summaryrefslogtreecommitdiff
path: root/common/cmd_bootm.c
Commit message (Collapse)AuthorAgeLines
* common: Remove invalid endianess conversionChristian Eggers2014-02-21-2/+2
| | | | | | | | | | | | | | | | | | | 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 <ceggers@gmx.de>
* bootm: Reinstate special case for standalone imagesSimon Glass2014-01-14-9/+12
| | | | | | | | | | | | | | | | | | | | | 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 <sjg@chromium.org>
* common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot ↵Miao Yan2013-12-16-12/+69
| | | | | | | | | | | | | | | | | | | | | | | interface. 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 <miao.yan@windriver.com> [trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC, missing extern ft_fixup_num_cores] Signed-off-by: Tom Rini <trini@ti.com>
* common/cmd_bootm.c: seperate do_bootm_vxworks related code from CONFIG_CMD_ELF.Miao Yan2013-12-13-3/+12
| | | | | | | | | do_bootm_vxworks now is available under the configuration option CONFIG_BOOTM_VXWORKS, thus aligned with other operating systems that supported by bootm command. The bootvx command still depneds on CONFIG_CMD_ELF. Signed-off-by: Miao Yan <miao.yan@windriver.com>
* netbsd:fix documentation typo.Kees Jongenburger2013-12-13-4/+4
| | | | | | | The documentation suggested the arguments where passed over r3-r6 while the code below simply does that over r0-r3. Cc: Kumar Gala <galak@kernel.crashing.org>
* common/cmd_bootm.c: fix subcommand processing in OS specific do_bootm_xxx() ↵Miao Yan2013-11-08-24/+8
| | | | | | | | | | | | | | | | | | | | | | | | | functions 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@windriver.com>
* cmd_bootm.c: Only pass BOOTM_STATE_OS_CMDLINE on PowerPC/MIPSTom Rini2013-09-23-1/+4
| | | | | | | | | | | | 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 <dmurphy@ti.com> Signed-off-by: Tom Rini <trini@ti.com>
* Fix loading freeze when netconsole is activeFrederic Leroy2013-09-20-0/+1
| | | | | | | | | | | | | 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 <fredo@starox.org>
* bootm: use BOOTM_STATE_OS_CMDLINE flag for plain bootmPaul Burton2013-09-20-2/+3
| | | | | | | | | | | | | | | | | | | 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@imgtec.com>
* bootm: allow correct bounds-check of destinationKees Cook2013-09-03-1/+1
| | | | | | | | | 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 <keescook@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* sandbox: Correct compiler warnings in cmd_bootm/cmd_ximgSimon Glass2013-09-03-4/+6
| | | | | | | | | | | | | | | 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 <sjg@chromium.org> Acked-by: Kees Cook <keescook@chromium.org>
* bootm: fix conditional controlling call to fixup_silent_linuxPaul B. Henson2013-08-16-1/+1
| | | | | | | | | This function is only defined if CONFIG_SILENT_CONSOLE is set and CONFIG_SILENT_U_BOOT_ONLY is not set, the call to it should be based on the same conditions. Signed-off-by: Paul B. Henson <henson@acm.org> Acked-by: Simon Glass <sjg@chromium.org>
* RFC: bootm: Add silent_linux environment variableSimon Glass2013-08-16-2/+12
| | | | | | | | | | At present the console for linux is silent if the U-Boot console is silent, unless CONFIG_SILENT_U_BOOT_ONLY is set. I wonder if a better way would be to have an environment variable to control this? Then we can control the verbosity from scripts, and set the variable to 'no' for those boards that want Linux to boot with console output. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* bootm: Move fixup_silent_linux() earlier in the bootm stagesSimon Glass2013-07-17-4/+4
| | | | | | | | | | | | 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 <sjg@chromium.org>
* bootm: Handle errors consistentlySimon Glass2013-07-12-13/+8
| | | | | | | | | | | | 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 <sjg@chromium.org> [trini: Update slightly based on Simon's changes to also cover CONFIG_TRACE/BOOTM_STATE_FAKE_OS_GO] Signed-off-by: Tom Rini <trini@ti.com>
* bootm: Use selected configuration for ramdisk and fdtSimon Glass2013-07-12-1/+2
| | | | | | | | | | | | | | | 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 <sjg@chromium.org>
* blackfin: x86: bootm: Handle PREP stage of bootmSimon Glass2013-07-12-0/+16
| | | | | | | 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 <sjg@chromium.org>
* bootm: Remove extra OK messageSimon Glass2013-07-12-1/+0
| | | | | | This is not needed as we already print 'OK' later in all cases. Signed-off-by: Simon Glass <sjg@chromium.org>
* cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2Tom Rini2013-07-12-3/+2
| | | | | | | | | | | 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 <trini@ti.com>
* cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itselfTom Rini2013-07-10-16/+40
| | | | | | | | | As a zImage does not have a U-Boot header, we cannot really do what BOOTM_STATE_FINDOTHER does, exactly. Break the ramdisk/fdt portions of bootm_find_other into bootm_find_ramdisk/fdt which can be called in both cases. Signed-off-by: Tom Rini <trini@ti.com>
* cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argcTom Rini2013-07-10-5/+13
| | | | | | | Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the state functions will work. Signed-off-by: Tom Rini <trini@ti.com>
* bootm: Add the missing PREP stage to bootz and correct image handlingSimon Glass2013-07-10-2/+3
| | | | | | | | | | | | | In the recent bootm refactor, the PREP stage was missing in the bootz command. This causes unpredictable behaviour. The use of a local variable means that the reset of cmd_bootm.c does not in fact use the same image structure, so remove this. Also manually set the OS type to Linux, since this is the only possibility at present, and we need to select the right boot function. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Clean up bootz_setup() functionSimon Glass2013-07-10-5/+3
| | | | | | | | | This function has no prototype in the headers and passes void * around, thus requiring several casts. Tidy this up. - Add new patch to clean up bootz_setup() function Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Require boot function only if it is about to be usedSimon Glass2013-07-10-2/+5
| | | | | | | | | | | The original bootm code (before commit 35fc84f) did not check for a valid boot function in the subcommand case, which was incorrect. This check was introduced in all cases, but in fact we should only check for the function when we need it. Otherwise in some cases the check fires before the OS type is known. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Disable interrupts only when loadingSimon Glass2013-07-10-24/+43
| | | | | | | | | | | With the move of the interrupt code to earlier in the sequence, we exposed a problem where the interrupts are disabled at each bootm stage. This is not correct - it should be done only once. Let's disable interrupts in the LOAD stage. Put the code in a function for clarity. Also, bootz lost its interrupt code altogether, so reinstate it. Signed-off-by: Simon Glass <sjg@chromium.org>
* cmd_bootm.c: Correct check/return for unsupported sub-commandTom Rini2013-07-04-2/+7
| | | | | | | | | | | 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 <trini@ti.com> Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
* bootm: Disable interrupts before loading OSSimon Glass2013-06-28-26/+27
| | | | | | | | | | 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 <sr@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* cmd_bootm.c: Correct BOOTM_ERR_OVERLAP handlingTom Rini2013-06-28-27/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <trini@ti.com> --- 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'.
* cmd_bootm: Add command line arguments to Plan 9Steven Stallion2013-06-26-7/+29
| | | | | | | | | | | | | 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 <sstallion@gmail.com> [trini: Adapt for Simon's changes about correcting argc, no need to bump by 2 now] Signed-off-by: Tom Rini <trini@ti.com>
* Add a 'fake' go command to the bootm commandSimon Glass2013-06-26-2/+17
| | | | | | | | | | | | | | 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 <sjg@chromium.org>
* Refactor the bootm command to reduce code duplicationSimon Glass2013-06-26-241/+216
| | | | | | | | | | | | | | | | 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 <sub_command>' 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 <sjg@chromium.org>
* Clarify bootm OS argumentsSimon Glass2013-06-26-18/+26
| | | | | | | | | | | | | | 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 <sjg@chromium.org>
* bootz: un-staticize do_bootzRob Herring2013-06-24-1/+1
| | | | | | Make do_bootz available for other functions like do_bootm is. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* image: Use fit_image_load() to load kernelSimon Glass2013-06-04-133/+8
| | | | | | | Use the new common code to load a kernel. The functionality should not change. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Adjust bootm command to work with sandboxSimon Glass2013-06-04-13/+12
| | | | | | | Use map_sysmem() when converting from addresses to pointers, so that bootm can be used with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* image: Use fit_image_load() to load FDTSimon Glass2013-06-04-2/+2
| | | | | | | | Use the new common code to load a flat device tree. Also fix up a few casts so that this code works with sandbox. Other than that the functionality should not change. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootm: Avoid 256-byte overflow in fixup_silent_linux()Doug Anderson2013-05-17-12/+29
| | | | | | | | | | | | | | 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 <dianders@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* arm: Refactor bootm to reduce #ifdefsSimon Glass2013-05-14-1/+1
| | | | | | | | 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 <sjg@chromium.org>
* sandbox: image: Add support for booting images in sandboxSimon Glass2013-05-14-9/+12
| | | | | | | | | | | | | | | | | 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 <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> (v1)
* image: Rename fit_image_check_hashes() to fit_image_verify()Simon Glass2013-05-14-2/+2
| | | | | | | | | This is the main entry point to the FIT image verification code. We will be using it to handle image verification with signatures, so rename the function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* image: Add support for Plan 9Steven Stallion2013-03-27-0/+39
| | | | | | Signed-off-by: Steven Stallion <sstallion@gmail.com> Cc: Tom Rini <trini@ti.com> Reviewed-by: Tom Rini <trini@ti.com>
* Allow u-boot to be silent without forcing Linux to beJoe Hershberger2013-03-11-4/+4
| | | | | | That's a bit presumptuous of you, u-boot! Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* bootm: fix conditional compilation for bootm ramdisk subcommandDaniel Schwierzeck2013-03-04-1/+1
| | | | | | | | | All code related to the bootm ramdisk subcommand is conditionally enabled by CONFIG_SYS_BOOT_RAMDISK_HIGH except for the help message. Replace the CONFIG_ARCH defines by CONFIG_SYS_BOOT_RAMDISK_HIGH to fix this. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* common: Use new numeric setenv functionsSimon Glass2013-02-28-8/+3
| | | | | | Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ Signed-off-by: Simon Glass <sjg@chromium.org>
* imls: Add support to list images in NAND deviceVipin Kumar2013-02-22-3/+164
| | | | | | This patch adds support to list images in NAND flash through imls Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
* treewide: include libfdt_env.h before fdt.hKim Phillips2013-02-07-1/+0
| | | | | | | | | | | and, if including libfdt.h which includes libfdt_env.h in the correct order, don't include fdt.h before libfdt.h. this is needed to get the fdt type definitions set from the project environment before fdt.h uses them. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Cc: Jerry Van Baren <gvb.uboot@gmail.com>
* common/cmd_bootm.c: prevent running of subcommands before 'bootm start'Gabor Juhos2013-02-04-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The execution order of the bootm subcommands is fixed. Although here is a sanity check in the state machine which should prevent running the subcommands in wrong order but it does not catch all possible errors. It is possible to run any subcommand without running 'bootm start' first which leads to unexpected behaviour. For example, running 'bootm loados' without 'bootm start' causes a hang: U-Boot> bootm loados XIP Invalid Image ... OK OK Add a sanity check to 'do_bootm_subcommand' in order to ensure that no subcommands can be executed before 'bootm start'. After the patch running of any subcommand without running 'bootm start' will cause an error like this: U-Boot> bootm loados Trying to execute a command out of order bootm - boot application image from memory Usage: bootm [addr [arg ...]] - boot application image stored in memory ... Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
* bootm: relocate names of sub-command table for archs with ↵Daniel Schwierzeck2013-01-10-1/+7
| | | | | | | | | CONFIG_NEEDS_MANUAL_RELOC To make bootm sub-command feature working on archs with CONFIG_NEEDS_MANUAL_RELOC, the name pointers in the sub-command table need to be relocated. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* Fix use of conditional LMBSimon Glass2012-12-11-1/+1
| | | | | | This code was not guarded with CONFIG_LMB so failed to build on x86. Signed-off-by: Simon Glass <sjg@chromium.org>