summaryrefslogtreecommitdiffstats
path: root/common/bootm.c
Commit message (Collapse)AuthorAgeFilesLines
* bootm: fix magicvar name for global_bootm_verboseEnrico Jorns2017-01-161-1/+1
| | | | | Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_unflatten_dtb(): Check return value with IS_ERRAndrey Smirnov2016-09-051-1/+5
| | | | | | | | Of_unflatten_dtb returns a ERR_PTR value so checking it against NULL is incorrect. Fix it in all of the places where this was happening. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-261-1/+2
| | | | | | | | 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: make verbosity controllable via global variableSascha Hauer2016-05-111-0/+5
| | | | | | | | When the bootm code is not called directly by the bootm command it is useful to control the verbosity with a globalvar. This introduces global.bootm.verbose for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Move magicvar descriptions to common/bootm.cSascha Hauer2016-05-111-0/+10
| | | | | | | | 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: Add verify mode "available"Sascha Hauer2016-05-101-0/+1
| | | | | | | | | The verify "available" mode checks whatever is available in the booted image, so when an image has a signature, it is checked and must be correct and when an image is hashed, it is also checked for correctness. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: set bootm_verify_mode to correct valueSascha Hauer2016-05-101-0/+4
| | | | | | | | When CONFIG_BOOTM_FORCE_SIGNED_IMAGES is enabled bootm_verify_mode shall be forced to "signature", so set bootm_verify_mode to this value during startup. Otherwise it shows up as "<NULL>" in devinfo. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Move bootm options to common/KconfigSascha Hauer2016-05-101-4/+4
| | | | | | | | | | | | 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/+17
| | | | | | | | | 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: Fix booting uImagesSascha Hauer2016-02-251-6/+12
| | | | | | | | | | | | | | This fixes: 0a37e22d (bootm: use names instead of numbers for image parts) This commit switches to strings for the image numbers for better FIT image support (which uses names instead of numbers). These strings may be NULL when no image number is given. They are used uninitialzed in several places. Introduce a wrapper function to convert the string into a number. Check for NULL here in which case we return 0 which is the correct value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Free allocated fdt buffer in error pathHarald Welte2016-02-181-0/+1
| | | | | | | | | It seems like there is a memory leak in an error path of bootm_open_oftree_uimage() where the memory allocated for the fdt is not released again. Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: parse initrd and oftree into correct struct membersLucas Stach2016-02-151-2/+2
| | | | | | | | The code parsing the oftree and initrd file names is clearly wrong, leading to bootm not loading oftree or initrd files any more. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: restore load DT message for plain oftree filesLucas Stach2016-02-151-0/+1
| | | | | | | | This message was dropped when reorganizing the DT loading code, and it's really confusing to miss this. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Fix resource_size_t format specifierSascha Hauer2016-02-111-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-02-081-4/+4
|\
| * Convert users of PRINTF_CONVERSION_RESOURCE to %paSascha Hauer2016-01-151-6/+6
| | | | | | | | | | | | | | | | printf now supports printing resource_size_t directly, convert all users of the previously used PRINTF_CONVERSION_RESOURCE over to %pa. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Add option to force booting signed imagesSascha Hauer2016-01-261-0/+19
| | | | | | | | | | | | | | | | | | | | | | With CONFIG_BOOTM_FORCE_SIGNED_IMAGES the bootm code will refuse to boot unsigned images. Since currently FIT is the only image type which supports signing, this means with this option we enforce using FIT images. All additionally passed in device trees and initrds will be ignored, so that only the ones from the FIT image can be used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
* | bootm: add initial FIT supportJan Luebbe2016-01-261-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implementation is inspired by U-Boot's FIT support. Instead of using libfdt (which does not exist in barebox), configuration signatures are verified by using a simplified DT parser based on barebox's own code. Currently, only signed configurations with hashed images are supported, as the other variants are less useful for verified boot. Compatible FIT images can be created using U-Boot's mkimage tool. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: make verifying/hashing configurableSascha Hauer2016-01-261-2/+18
| | | | | | | | | | | | | | | | | | 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-0/+11
| | | | | | | | | | | | | | | | 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: move oftree code togetherSascha Hauer2016-01-261-107/+86
| | | | | | | | | | | | | | The device tree code is distributed in several places in the bootm code. Move it all together in bootm_load_devicetree(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: move initrd code togetherSascha Hauer2016-01-261-76/+75
| | | | | | | | | | | | | | The initrd code is distributed in several places in the bootm code. Move it all together in bootm_load_initrd(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Push dryrun to handlersSascha Hauer2016-01-261-3/+3
| | | | | | | | | | | | | | 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: use names instead of numbers for image partsSascha Hauer2016-01-221-16/+27
| | | | | | | | | | | | | | | | | | The uImage format uses numbers for to identify the different parts of a image, but the FIT image format uses names. To better integrate the FIT image format into bootm always use names and convert them to numbers when necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: introduce bootm_get_os_sizeSascha Hauer2016-01-221-0/+19
| | | | | | | | | | | | | | | | ARM do_bootm_linux is not only called with uImages but also with raw images, so we can't use uimage_get_size() here. Introduce bootm_get_os_size() which handles the different image types. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Do not call uimage_close twiceSascha Hauer2016-01-221-1/+0
|/ | | | | | | uimage_close() is called on bootm cleanup, so do not close it in the failure path in bootm_open_os_uimage(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: get file type before bootm_open_os_uimageJan Remmet2015-11-201-17/+22
| | | | | | | | | | Using a multi uimage stored in nand didn't work. Only one open for the bb file is allowed. The file type detection after bootm_open_os_uimage will fail. bootm_open_initrd_uimage and bootm_open_oftree_uimage already check if they can reuse data->os. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: cleanup bootm_open_oftreeJan Remmet2015-11-201-28/+54
| | | | | | | | Separate oftree file and uimage oftree handling. Make fie_type checks in bootm_boot Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* move file helper functions to separate fileSascha Hauer2014-08-071-0/+1
| | | | | | | | | | We have our file helper functions in several places. Move them all to lib/libfile.c. With this we no longer have file helpers in fs/fs.c which contains the core fs functions and no functions in lib/libbb.c which are not from busybox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix format specifiersSascha Hauer2014-06-051-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: beautify outputHolger Schurig2014-06-021-2/+2
| | | | | | | | | * 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>
* misc: upper-case some abbreviationsHolger Schurig2014-06-021-2/+2
| | | | | Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Drop devicetree merge supportSascha Hauer2014-05-221-1/+1
| | | | | | | | | | | | I assume I am the only person knowing that barebox is able to merge devicetrees. This feature seems broken for a while now since trying to merge devicetress results in: unflatten: too many end nodes Remove this feature to save the complexity. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Return error when devicetree file is not a dtbSascha Hauer2014-02-131-0/+1
| | | | | | | We check whether the file passed as devicetree actually is a devicetree, but we missed to return an error if it's not. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: introduce bootm_load_devicetree helperSascha Hauer2014-01-141-0/+63
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: introduce bootm_load_initrd helperSascha Hauer2014-01-141-0/+38
| | | | | | | Make the bootm handlers simpler by factoring out an initrd load function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: introduce bootm_load_os helperSascha Hauer2014-01-101-9/+40
| | | | | | | | | | The common bootm code used to load uImage contents to SDRAM before calling into the handlers if possible. This makes the handlers complicated since they have to handle many cases. Instead, introduce a helper to load the os after the handlers have figured out a good load address. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Replace getenv_loadaddr with getenv_ulSascha Hauer2013-10-071-13/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Add dryrun supportSascha Hauer2013-09-241-1/+5
| | | | | | 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-2/+44
| | | | | | | | | | | | 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-0/+16
| | | | | | | 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-0/+13
| | | | | | | 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: check for os image fileSascha Hauer2013-09-241-0/+5
| | | | | | Check if an os image file has been given. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: fix memory leakSascha Hauer2013-09-241-0/+2
| | | | | | | data->of_root_node may be allocated from of of_unflatten_dtb. Free it in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: fix possible memory leakSascha Hauer2013-09-241-0/+1
| | | | | | fdt is allocated, free it in error case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: factor out code to make it usable from CSascha Hauer2013-06-191-0/+303
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>