22 Feb, 2014

1 commit

  • do_bootm_standanlone() calls ntohl(images->ep) which is wrong because
    endianess conversion has already been done:

    do_bootm()
    \-do_bootm_states()
    +-bootm_find_os()
    | \-images.ep = image_get_ep();
    | \-uimage_to_cpu(hdr->ih_ep);
    \-boot_selected_os()
    \-do_bootm_standanlone()

    Without this conversion the code works correctly at least on AT91SAM9G45.
    On big endian systems there should be no difference after applying this
    patch because uimage_to_cpu(x) and ntohl(x) both expand to 'x'.

    Signed-off-by: Christian Eggers

    Christian Eggers
     

14 Jan, 2014

1 commit

  • For standalone images, bootm had a special case where the OS boot function
    was NULL but did actually exist. It was just called manually.

    This was removed by commit 35fc84fa which checks for the non-existence of
    this function before the special case is examined.

    There is no obvious reason why standalone is handled with a special case.
    Adjust the code so that standalone has a normal OS boot function. We still
    need a special case for when the function returns, but at least we can
    avoid the main problem.

    This is intended to fix the reported:

    ERROR: booting os 'U-Boot' (17) is not supported

    but needs testing.

    Signed-off-by: Simon Glass

    Simon Glass
     

16 Dec, 2013

1 commit

  • The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
    description mechanism. For PowerPC, the boot interface conforms to
    the ePAPR standard, which is:

    void (*kernel_entry)(ulong fdt_addr,
    ulong r4 /* 0 */,
    ulong r5 /* 0 */,
    ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
    ulong r8 /* 0 */, ulong r9 /* 0 */)

    For ARM, the boot interface is:

    void (*kernel_entry)(void *fdt_addr)

    Signed-off-by: Miao Yan
    [trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
    missing extern ft_fixup_num_cores]
    Signed-off-by: Tom Rini

    Miao Yan
     

13 Dec, 2013

2 commits


08 Nov, 2013

1 commit

  • In commit "5c427e4: use BOOTM_STATE_OS_CMDLINE flag for plain bootm"
    and "3d187b3: Only pass BOOTM_STATE_OS_CMDLINE on PowerPC/MIPS",
    BOOTM_STATE_OS_CMDLINE was added to do_bootm for PowerPC and MIPS. This
    breaks other OSes (vxworks, netbsd, plan9,...) that don't support
    subcommand processing, e.g. they all contain the following code in their
    do_bootm_xxx():

    if (flag & BOOTM_STATE_OS_PREP)
    return 0;
    if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
    return 1;

    which will result a "subcommand not supported" error.
    This patch changes the above logic to:

    /* if not go command, pretend everything to be OK */
    if (flag != BOOTM_STATE_OS_GO)
    return 0;

    Signed-off-by: Miao Yan

    Miao Yan
     

24 Sep, 2013

1 commit

  • In 5c427e4 we pass BOOTM_STATE_OS_CMDLINE as part of the bootm states to
    run, on all arches. However, this is only valid / useful on PowerPC and
    MIPS, and causes a problem on ARM where we specifically do not use it.
    Rather than make this state fake pass like we do for GO on some arches
    (which need updating to use the GO state), we should just not pass
    CMDLINE except when it may be used, like before.

    Tested-by: Dan Murphy
    Signed-off-by: Tom Rini

    Tom Rini
     

20 Sep, 2013

2 commits

  • Netconsole calls eth_halt() before giving control to another operating
    system.
    But the state machine of netconsole don't take it into account.
    Thus, netconsole calls network functions of an halted network device,
    making the whole system freeze.
    Rather than modifying the state machine of netconsole, we just unregister
    the current network device before booting. It does work because
    nc_send_packet() verifies that the current network device is not null.

    Signed-off-by: Frédéric Leroy

    Frederic Leroy
     
  • A plain bootm used to call the architecture specific boot function with
    no flags, but was modified by commit 35fc84fa "Refactor the bootm
    command to reduce code duplication" to call the architecture specific
    boot function multiple times with various flags in sequence. The
    BOOTM_STATE_OS_CMDLINE flag was not used, indeed it seems that at least
    ARM prepares the command line on BOOTM_STATE_OS_PREP. However on MIPS
    since commit 59e8cbdb "MIPS: bootm: refactor initialisation of kernel
    cmdline" the command line is not prepared in response to a
    BOOTM_STATE_OS_PREP flag, only on BOOTM_STATE_OS_CMDLINE or a call with
    no flags. The end result is that a combination of those 2 commits leads
    to MIPS boards booting kernels with no command line arguments.

    An extra invocation of the architecture specific boot function with
    BOOTM_STATE_OS_CMDLINE fixes this.

    Signed-off-by: Paul Burton

    Paul Burton
     

04 Sep, 2013

2 commits

  • While nothing presently examines the destination size, it should at
    least be correct so that future users of sys_mapmem() will not be
    surprised. Without this, it might be possible to overflow memory.

    Signed-off-by: Kees Cook
    Acked-by: Simon Glass

    Kees Cook
     
  • Correct the following warnings found with sandbox when compression
    is enabled.

    cmd_bootm.c: In function 'bootm_load_os':
    cmd_bootm.c:443:11: warning: passing argument 4 of 'lzop_decompress' from incompatible pointer type [enabled by default]
    /usr/local/google/c/cosarm/src/third_party/u-boot/files/include/linux/lzo.h:31:5: note: expected 'size_t *' but argument is of type 'uint *'
    cmd_ximg.c: In function 'do_imgextract':
    cmd_ximg.c:225:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    cmd_ximg.c:225:14: warning: 'hdr' may be used uninitialized in this function [-Wuninitialized]

    Signed-off-by: Simon Glass
    Acked-by: Kees Cook

    Simon Glass
     

17 Aug, 2013

2 commits


24 Jul, 2013

1 commit


17 Jul, 2013

1 commit

  • Before the bootm refactor, fixup_silent_linux() was done only in the
    monolithic bootm case, not in the subcommand case. With the refactor, it
    is done always, which is good. Unfortunately it is done too late, since it
    is the PREP or CMDLINE stages that set up the command line for Linux.

    Move fixup_silent_linux() into the LOADOS stage, which is where we find
    out the OS being used, and can thus decide whether to perform this step.

    Signed-off-by: Simon Glass

    Simon Glass
     

13 Jul, 2013

1 commit

  • A recent bootm fix left the error path incomplete. If CONFIG_TRACE is
    set it may still not be a supported command, so cover that with the
    unsupported subcommand print. Once we handle BOOTM_STATE_OS_GO, we can
    just move into the error handler itself, no need for a goto there.

    Signed-off-by: Simon Glass
    [trini: Update slightly based on Simon's changes to also cover
    CONFIG_TRACE/BOOTM_STATE_FAKE_OS_GO]
    Signed-off-by: Tom Rini

    Simon Glass
     

12 Jul, 2013

4 commits

  • If a specific configuraion is selected by the bootm command, e.g. with
    'bootm 84000000#recoveryconf' we must honour this for not just the kernel,
    but also the ramdisk and FDT.

    In the conversion to using a common fit_image_load() function for loading
    images from FITs (commits a51ec63 and 53f375f) this feature was lost.
    Reinstate it by passing the selected configuration back from
    fit_image_load() to boot_get_kernel(), then use this configuration
    (which is stored in images->fit_uname_cfg) in both boot_get_ramdisk()
    and boot_get_fdt().

    Signed-off-by: Simon Glass

    Simon Glass
     
  • The OS function is now always called with the PREP stage. Adjust the
    remaining bootm OS functions to deal with this correctly.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This is not needed as we already print 'OK' later in all cases.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • With ELDK4.2 we were getting a warning that load_end may be used
    uninitialized in calling lmb_reserve. This could not be the case,
    however. If we re-order the checks (and make them slightly clearer as
    well) the warning goes away. bootm_load_os may only return 0 on
    success, BOOTM_ERR_OVERLAP in a non-fatal overlap (already covered in
    comments) or a fatal BOOTM_ERR that is covered in the error handler.

    Signed-off-by: Tom Rini

    Tom Rini
     

10 Jul, 2013

6 commits


04 Jul, 2013

1 commit

  • With the do_bootm_states re-organization, we have the call to any
    potential sub-commands in a single spot. If one fails, we can then stop
    right there and return to the caller. Prior to these calls we have
    already ensured that ret is zero so we will not be returning this error
    for some other case.

    Signed-off-by: Tom Rini
    Tested-by: Andreas Bießmann

    Tom Rini
     

29 Jun, 2013

2 commits

  • This restores the ordering of interrupt disable to what it what before
    commit 35fc84fa. It seems that on some archiectures (e.g. PowerPC) the
    OS is loaded into an interrupt region, which can cause problems if
    interrupts are still running.

    Tested-by: Stefan Roese
    Signed-off-by: Simon Glass

    Simon Glass
     
  • With 35fc84fa1 [Refactor the bootm command to reduce code duplication]
    we stopped checking the return value of bootm_load_os (unintentionally!)
    and simply returned if we had a non-zero return value from the function.
    This broke the valid case of a legacy image file of a single kernel
    loaded into an overlapping memory area (the default way of booting
    nearly all TI platforms).

    The best way to fix this problem in the new code is to make
    bootm_load_os be the one to see if we have a problem with this, and if
    it's fatal return BOOTM_ERR_RESET and if it's not BOOTM_ERR_OVERLAP, so
    that we can avoid calling lmb_reserve() but continue with booting. We
    however still need to handle the other BOOTM_ERR values so re-work
    do_bootm_states so that we have an error handler at the bottom we can
    goto for problems from bootm_load_os, or problems from the other callers
    (as the code was before). Add a comment to do_bootm_states noting the
    existing restriction on negative return values.

    Signed-off-by: Tom Rini

    ---
    Changes in v2:
    - Rework so that only bootm_load_os and boot_selected_os head down into
    the err case code, and other errors simply return back to the caller.
    Fixes 'spl export'.

    Tom Rini
     

26 Jun, 2013

4 commits

  • This patch introduces support for command line arguments to Plan 9.
    Plan 9 generally dedicates a small region of kernel memory (known
    as CONFADDR) for runtime configuration. A new environment variable
    named confaddr was introduced to indicate this location when copying
    arguments.

    Signed-off-by: Steven Stallion
    [trini: Adapt for Simon's changes about correcting argc, no need to bump
    by 2 now]
    Signed-off-by: Tom Rini

    Steven Stallion
     
  • For tracing it is useful to run as much of U-Boot as possible so as to get
    a complete picture. Quite a bit of work happens in bootm, and we don't want
    to have to stop tracing before bootm starts.

    Add a way of doing a 'fake' boot of the OS - which does everything up to
    the point where U-Boot is about to jump to the OS image. This allows
    tracing to record right until the end.

    This requires arch support to work.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present the bootm code is mostly duplicated for the plain 'bootm'
    command and its sub-command variant. This makes the code harder to
    maintain and means that changes must be made to several places.

    Introduce do_bootm_states() which performs selected portions of the bootm
    work, so that both plain 'bootm' and 'bootm ' can use the
    same code.

    Additional duplication exists in bootz, so tidy that up as well. This
    is not intended to change behaviour, apart from minor fixes where the
    previously-duplicated code missed some chunks of code.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present the arguments to bootm are processed in a somewhat confusing
    way. Sub-functions must know how many arguments their calling functions
    have processed, and the OS boot function must also have this information.
    Also it isn't obvious that 'bootm' and 'bootm start' provide arguments in
    the same way.

    Adjust the code so that arguments are removed from the list before calling
    a sub-function. This means that all functions can know that argv[0] is the
    first argument of which they need to take notice.

    Signed-off-by: Simon Glass

    Simon Glass
     

25 Jun, 2013

1 commit


05 Jun, 2013

3 commits


18 May, 2013

1 commit

  • This makes fixup_silent_linux() use malloc() to allocate its
    working space, meaning that our maximum kernel command line
    should only be limited by malloc(). Previously it was silently
    overflowing the stack.

    Note that nothing about this change increases the kernel's maximum
    command line length. If you have a command line that is >256
    bytes it's up to you to make sure that kernel can handle it.

    Signed-off-by: Doug Anderson
    Acked-by: Mike Frysinger

    Doug Anderson
     

15 May, 2013

2 commits

  • With fewer #ifdefs the code is more readable and more of the code is
    compiled for all boards. Add defines in the header file to control
    what features are enabled, and then use if() instead of #ifdef.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Much of the image code uses addresses as ulongs and pointers interchangeably,
    casting between the two forms as needed.

    This doesn't work with sandbox, which has a U-Boot RAM buffer which is
    separate from the host machine's memory.

    Adjust the cost so that translating from a U-Boot address to a pointer uses
    map_sysmem(). This allows bootm to work correctly on sandbox.

    Note that there are no exhaustive tests for this code on sandbox, so it is
    possible that some dark corners remain.

    Signed-off-by: Simon Glass
    Reviewed-by: Marek Vasut (v1)

    Simon Glass