summaryrefslogtreecommitdiffstats
path: root/commands/bootm.c
Commit message (Collapse)AuthorAgeFilesLines
* commands: exit on invalid optionEnrico Jorns2016-09-161-1/+1
| | | | | | | | | | Barebox commands should not perform any action and return 0 if an invalid parameter was given. This might cause undetected unintended behvaior when calling commands with wrong options, either manually or from a script. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-261-1/+1
| | | | | | | | The majority of the stuff currently in include/boot.h is about bootm code implemented common/bootm.c. To be more consistent move it to a new file include/bootm.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Move magicvar descriptions to common/bootm.cSascha Hauer2016-05-111-10/+0
| | | | | | | | Now that the bootm code can be used without the command, we have to move the magicvar descriptions from the command code to the common bootm code aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Move bootm options to common/KconfigSascha Hauer2016-05-101-6/+6
| | | | | | | | | | | | bootm has a C API, so the bootm options have to depend on the option providing the bootm code (CONFIG_BOOTM), not on the option providing the command (CONFIG_CMD_BOOTM). Fixing the dependencies makes it possible to fully use bootm from C without enabling the bootm command support. This also removes the CMD_ prefix from the options which means we have to update the defconfigs aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Optionally add a root= option to Kernel command lineSascha Hauer2016-05-041-0/+1
| | | | | | | | | It becomes a common case that the Kernel is loaded from the filesystem which later becomes the rootfs. This adds a possibility to let bootm automatically append the root= option to the kernel command line. This is done when global.bootm.appendroot is true. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: make verifying/hashing configurableSascha Hauer2016-01-261-3/+9
| | | | | | | | | So long struct bootm_data.verify is a bool which enables CRC checking (hashing). Extend this to a enum and add support for signature checking in the same option. This also adds the corresponding globalvar and a -s option to bootm. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Initialize bootm_data defaults in single placeSascha Hauer2016-01-261-26/+5
| | | | | | | | Both the bootm and the boot code initialize the struct bootm_data with defaults from the bootm global variables. Create a common function for doing this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Push dryrun to handlersSascha Hauer2016-01-261-3/+0
| | | | | | | We can make the dryrun option more useful by calling into the handlers. With this we can detect more cases that can go wrong during boot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: add magicvar description for global.bootm.oftreeMarc Kleine-Budde2015-05-261-0/+1
| | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm.c: "-o" option should refer to "DTB", not "DTS"Robert P. J. Day2014-07-071-3/+3
| | | | | | | Fix option explanation, and a couple grammar fixes. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Documentation: remove doxygen documentationSascha Hauer2014-06-261-17/+0
| | | | | | | The doxygen documentation is long outdated. Remove it. It will be replaced with sphinx based documentation later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: beautify outputHolger Schurig2014-06-021-7/+8
| | | | | | | | | * fix indentation of options in 'help bootm' * add missing help for -m * put some output into debug/verbose mode Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: harmonize in-barebox documentationHolger Schurig2014-05-141-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does probably too much, but it's hard (and very cumbersome/time consuming) to break it out. What is does is this: * each command has one short description, e.g. "list MUX configuration" * made sure the short descriptions start lowercase * each command has one usage. That string contains just the options, e.g. "[-npn]". It's not part of the long help text. * that is, it doesn't say "[OPTIONS]" anymore, every usable option is listed by character in this (short) option string (the long description is in the long help text, as before) * help texts have been reworked, to make them - sometimes smaller - sometimes describe the options better - more often present themselves in a nicer format * all long help texts are now created with BUSYBOX_CMD_HELP_ macros, no more 'static const __maybe_unused char cmd_foobar_help[]' * made sure the long help texts starts uppercase * because cmdtp->name and cmdtp->opts together provide the new usage, all "Usage: foobar" texts have been removed from the long help texts * BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this is nicer in the source code * BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself * made sure no line gets longer than 77 characters * delibertely renamed cmdtp->usage, so that we can get compile-time errors (e.g. in out-of-tree modules that use register_command() * the 'help' command can now always emit the usage, even without compiled long help texts * 'help -v' gives a list of commands with their short description, this is similar like the old "help" command before my patchset * 'help -a' gives out help of all commands Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: group 'help' outputHolger Schurig2014-05-141-0/+1
| | | | | | | | | | | | | | | | | | | The old output of "help" was just producing a long list, that usually scrolled of the screen (even on a X11 terminal). This list is more compact, and also sorted by groups. The old output format (plus grouping) is now available with 'help -v'. Example: Information commands: ?, devinfo, help, iomem, meminfo, version Boot commands: boot, bootm, go, loadb, loads, loadx, loady, saves, uimage ... Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Replace getenv_loadaddr with getenv_ulSascha Hauer2013-10-071-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Add dryrun supportSascha Hauer2013-09-241-3/+12
| | | | | | This adds support for checking the bootm command without actually booting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: separate bootm input data and internal dataSascha Hauer2013-09-241-30/+4
| | | | | | | | | | | | We used to use struct image_data as the central data structure for bootm and also as the input data structure. This makes it unclear which of the fields are actually input data. This patch creates a struct bootm_data which is exclusively used for input data to make usage clearer. Also it moves the dispatching of multifile uImage pathnames to the core bootm code so that the core code gets more flexible and the command code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: move globalvars from command to commonSascha Hauer2013-09-241-14/+0
| | | | | | | The globalvars should be available even if the bootm command is not directly present. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: move getenv_loadaddr from command to commonSascha Hauer2013-09-241-13/+0
| | | | | | | getenv_loadaddr may be used by other code, so move it from command/ to common/ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: remove unused defineSascha Hauer2013-09-241-5/+0
| | | | | | OFTREE_SIZE_INCREASE isn't used anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/boardinfo'Sascha Hauer2013-09-051-6/+5
|\ | | | | | | | | | | | | Conflicts: arch/mips/boards/qemu-malta/init.c commands/bootm.c drivers/of/base.c
| * globalvar: Allow to set initial valueSascha Hauer2013-08-161-3/+3
| | | | | | | | | | | | | | Calling globalvar_add_simple() and setting a value is more than common. Add a parameter for the initial value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: add global bootm.{image/initrd}.loadaddr supportJean-Christophe PLAGNIOL-VILLARD2013-09-021-1/+21
|/ | | | | | | To be able to pass the loadaddr of the image and the initrd. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: factor out code to make it usable from CSascha Hauer2013-06-191-276/+5
| | | | | | | Much of the bootm code is implemented in the command itself. Move it to a common place to be able to call it from C aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Print internal devicetree information without verboseSascha Hauer2013-05-311-1/+1
| | | | | | | | It's a precious information that barebox will boot the kernel with the internal devicetree, so print it even in non verbose mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: make sure to print fixed oftreeSascha Hauer2013-05-311-4/+0
| | | | | | | | when doing bootm -v -v we dumped the original tree to the console. Make sure to print the fixed tree instead so that the fixups can be examined. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Don't honor initrd load addressSascha Hauer2013-05-041-3/+0
| | | | | | | | | | U-Boot doesn't honor the load address specified in an initrd. Barebox shouldn't be more strict here. This unbreaks booting an uInitrd generated by Debian's flash-kernel that uses 0 as entry address where there is nothing on the i.MX53 that was used. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Simplify initrd address handlingUwe Kleine-König2013-05-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data.initrd_address = UIMAGE_SOME_ADDRESS; ... if (-L was given to bootm) data.initrd_address = address_provided_to_-L; ... if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_SOME_ADDRESS) data.initrd_address = load_address_from_uInitrd; ... if (data.initrd_address == UIMAGE_SOME_ADDRESS) data.initrd_address = UIMAGE_INVALID_ADDRESS; can be simplified to: data.initrd_address = UIMAGE_INVALID_ADDRESS; ... if (-L was given to bootm) data.initrd_address = address_provided_to_-L; ... if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_INVALID_ADDRESS) data.initrd_address = load_address_from_uInitrd; ... The only change introduced by this simplification is for cases where the user passes -L UIMAGE_SOME_ADDRESS or -L UIMAGE_INVALID_ADDRESS to bootm. (-L UIMAGE_SOME_ADDRESS is now used literally instead of ignored before. -L UIMAGE_INVALID_ADDRESS used to skip getting the initrd-address from the uInitrd, now the uInitrd address is honored.) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: remove unused libfdtSascha Hauer2013-03-061-1/+0
| | | | | | | Now that we are completely independent of libfdt remove the unused code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Pass unflattened devicetree to handlersSascha Hauer2013-03-061-15/+9
| | | | | | | | | This makes it possible to modify the tree in the handlers. This is necessary because the initrd addresses are only known inside the handlers, but not to the generic bootm code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Use of_print_nodes instead of fdt_printSascha Hauer2013-03-061-3/+3
| | | | | | | Now that we use the unflattened tree in bootm we can use of_print_nodes instead of printing the flattened tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Pass barebox internal format devicetree to of_get_fixed_treeSascha Hauer2013-03-061-1/+8
| | | | | | | With this every devicetree is first converted to the barebox internal format before it's converted back to dtb again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/oftree'Sascha Hauer2013-02-041-24/+8
|\ | | | | | | | | Conflicts: drivers/of/base.c
| * of: make of_get_fixed_tree more universally usableSascha Hauer2013-01-111-24/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the bootm code uses of_fix_tree to apply the fixups to the devicetree given on the command line. This function assumes that there is enough space for the fixups available. Also on ARM we have to make sure the tree does not cross 1Mib boundaries. This patch moves the space allocation and alignment ensurance to of_get_fixed_tree and uses it in bootm. This is the first step for making of_get_fixed_tree the single point of devicetree handling in barebox. of_get_fixed_tree now takes an argument of the input fdt. If it is given, this one is used, otherwise an internal oftree is used which will be created in subsequent patches. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: move printing of file locations outside verbose modeSascha Hauer2013-01-181-8/+8
|/ | | | | | | | The location of files that are booted is a precious information, so print it by default and not only in verbose mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Michael Olbrich <m.olbrich@pengutronix.de>
* filetype: Pass bufsizeSascha Hauer2012-12-031-1/+1
| | | | | | | | | | Pass the buffer size to the file detection code. This makes sure we do not read past the buffer. This is especially useful for ext filesystem detection as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE define which is set to the minimum bufsize the detection code needs to detect all known filetypes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Do not cross 1MiB sections for the devicetreeSascha Hauer2012-11-011-1/+9
| | | | | | | | ARM Linux only maps a single 1MiB section for the devicetree. This has a 1Mib alignment, so we are not allowed to cross such a boundary. Align the devicetree to the next power of two so that this never happens. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Add a define for the additional devicetree sizeSascha Hauer2012-11-011-2/+9
| | | | | | | | The fixed devicetree may need more space than the original one. We used to use 0x8000 here. Add a define for it to have the space defined at a single place. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: close open filesVicente2012-10-101-1/+5
| | | | | Signed-off-by: Vicente <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* trivial: bootm: correct grammar in error messageSteffen Trumtrar2012-08-311-1/+1
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: do not load the initrd in the common codeJean-Christophe PLAGNIOL-VILLARD2012-08-131-8/+0
| | | | | | | This need to be handled by the arch bootm as the address can be invalid and provided at arch level. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-011-4/+2
| | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Add default images variablesSascha Hauer2012-05-181-14/+52
| | | | | | | | | | It turns out useful to be able to configure bootm before its usage. This allows us to overwrite bootm settings on an individual base. This patch adds global variables to configure the kernel image, the initrd image and the devicetree image. These values will be used unless overwritten explicitely with command line switches. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: fix initrd handlingSascha Hauer2012-05-011-14/+10
| | | | | | | | bootm_initrd tests for data->initrd, but this never becomes true because the settingof data->initrd is inside a if(bootm_initrd()). Fix this. Also, do not support the initrd options when initrd is disabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'binfmt' of git://git.jcrosoft.org/barebox into nextSascha Hauer2012-04-181-0/+12
|\
| * bootm: add uimage binfmt supportJean-Christophe PLAGNIOL-VILLARD2012-04-181-0/+12
| | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | bootm: Align oftreeSteffen Trumtrar2012-04-181-6/+10
| | | | | | | | | | | | | | | | | | | | Arm needs 64-Bit alignment of the oftree as mentioned in the documentation Documentation/arm/Booting. Other architectures may need a bigger alignment so align to 4K. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Fix check for ret-valueSteffen Trumtrar2012-04-181-4/+3
|/ | | | | | | | The intention of this code was to check the return value of fdt_open_into. Fix this. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: be more informative with oftreesSascha Hauer2012-04-141-4/+6
| | | | | | | | - print error message when the specified oftree cannot be opened - move verbose info to top of function so that the information is printed before something else fails. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>