summaryrefslogtreecommitdiff
path: root/boot
AgeCommit message (Collapse)Author
2023-06-19Kconfig: Add support for fit image signature enforcingManorit Chawdhry
FIT_SIGNATURE doesn't enforce the U-boot setup to be correct for booting the FIT images, the DTB might not have all the proper nodes and it just boots up without any warning. This makes it difficult to get the correct setup working. Adds an enforcement flag that doesn't allow the setup to have problems and enforces the environment to only pick the signature node from DTB and don't rely on anything else. Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
2023-05-09Kconfig: change default for FIT_IMAGE_POST_PROCESSManorit Chawdhry
Now that the default flow is moving towards FIT_SIGNATURE, make the default of FIT_IMAGE_POST_PROCESS depend on it. Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
2023-04-05android: boot: support bootconfigSafae Ouajih
commit 57e405e1f4745cdca49a4a6b260afe68592b1d5c upstream. Support Bootconfig feature. - The bootconfig feature replaces the androidboot.* kernel cmdline options. This was adapted from downstream [1] commit : 7af0a0506d4d ("cuttlefish: support bootconfig parameters"). Link:[1] https://android.googlesource.com/platform/external/u-boot/ Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: support boot image header version 3 and 4Safae Ouajih
commit 636da2039aea4ea3a638b14da0a9ec258897a10c upstream. Enable the support for boot image header version 3 and 4 using abootimg command. In order to use version 3 or 4: 1- Vendor boot image address should be given to abootimg cmd. abootimg addr $1 $vendor_boot_load_addr 2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host the ramdisk : generic ramdisk + vendor ramdisk Replace "struct andr_boot_img_hdr_v0*" by "void *" in some functions since v3 and v4 are now supported as well. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: update android_image_get_dtb_img_addr to support v3, v4Safae Ouajih
commit 2d0da1972ded075ba783f3ea705662349e77fa61 upstream. Add support for boot image version 3 and 4 in android_image_get_dtb_img_addr(). Since the dtb is now included in vendor_boot image instead of boot image, extract the dtb address from vendor_boot image when a v3 or v4 is used. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: support extra command lineSafae Ouajih
commit b36b227b6a37695ab39306341c3a977cf9b081b6 upstream. In version 3 and 4 of boot image header, the vendor specific command line are located in vendor boot image. Thus, use extra command line to add those cmd to bootargs. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: ramdisk: support vendor ramdiskSafae Ouajih
commit c79a2e6823d5a3a2813f66d03023c0a192c27e7e upstream. Version 3 and 4 of boot image header introduced vendor boot ramdisk: Please check include/android_image.h for details. The ramdisk is now split into a generic ramdisk in boot image and a vendor ramdisk in vendor boot image. Support the new vendor ramdisk. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: update android_image_get_data to support v3, v4Safae Ouajih
commit 1115027d2f75ade805f0d4d44a6a2c21e74ea6b2 upstream. Since boot image header version 3 and 4 introduced vendor boot image, use the following functions to fill the generic android structure : andr_image_data: - android_boot_image_v3_v4_parse_hdr() - android_vendor_boot_image_v3_v4_parse_hdr() Update android_image_get_data() to support v3 and v4 Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: add vendor boot image to prepare for v3, v4 supportSafae Ouajih
commit e058176be32b09ca4f787442fd99d29e44079519 upstream. Introduce vendor boot image for version 3 and 4 of boot image header. The vendor boot image will hold extra information about kernel, dtb and ramdisk. This is done to prepare for boot image version 3 and 4 support. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: boot image header v3, v4 do not support recovery DTBOSafae Ouajih
commit 447240e27b892ab2ccc1ada03a260abbb562484e upstream. android_image_get_dtbo() is used to get recovery DTBO via abootimg cmd. This is not supported in boot image header v3 and v4. Thus, print an error message when v1,v2 header version are not used. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: content print is not supported for v3, v4 header versionSafae Ouajih
commit bb5d692732ca02511f2f491af1e680c87373fd35 upstream. Content print is not supported for version 3 and 4 of boot image header. Thus, only print that content when v2 is used. Update android_print_contents() to print an error message when trying to print boot image header version 3 or 4 content. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: move to andr_image_data structureSafae Ouajih
commit 607b07554e23ff58d245f16765d831253a4210de upstream. Move from andr_boot_img_hdr_v0 to andr_image_data structure to prepare for boot image header version 3 and 4. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: kcomp: support andr_image_dataSafae Ouajih
commit f48efa0edb6f65b2c382209871df7c9b61a905e2 upstream. andr_image_data structure is used as a global representation of boot image header structure. Introduce this new structure to support all boot header versions : v0,v1.v2.v3.v4 and to support v3 and v4 while maitaining support for v0,v1,v2. The need of using andr_image_data comes from the change of header structure in both version 3 and 4. Rework android_image_get_kcomp() to support this new struct. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: replace android_image_check_headerSafae Ouajih
commit 734cb47d6de16d2e3b52a03bce5daab40e5bb29d upstream. With the new vendor boot image introduced in versions 3 and 4 of boot image header, the header check must be done for both boot image and vendor boot image. Thus, replace android_image_check_header() by is_android_boot_image_header() to only refer to boot image header check. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-04-05android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0Safae Ouajih
commit d71a732af45e2d3acef92649f4f7986a83175cf4 upstream. Android introduced boot header version 3 or 4. The header structure change with version 3 and 4 to support the new updates such as: - Introducing Vendor boot image: with a vendor ramdisk - Bootconfig feature (v4) Change andr_img_hdr struct name to maintain support for version v0, v1 and v2 while introducing version 3 and 4. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-03-27boot: Create a common BOOT_DEFAULTS for distro and bootstdSimon Glass
These two features use a lot of common options. Move them into a common CONFIG to reduce duplication. Use 'select' for most options since these are things that boards aren't supposed to override. For now it is not possible to disable BOOT_DEFAULTS but we may take another look later. Note that five options use 'imply' to match existing behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Rework a bit so we don't grow so many platforms unintentionally] Signed-off-by: Tom Rini <trini@konsulko.com>
2023-03-27lmb: Enable LMB if SYS_BOOT_RAMDISK_HIGHSimon Glass
Ramdisk relocation requires LMB, so enable it automatically to avoid build errors. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-27Move DISTRO_DEFAULTS into boot/Simon Glass
This relates to booting so move it in to that Kconfig file, before changing it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10Correct SPL uses of CMD_BOOTEFI_BOOTMGRSimon Glass
This converts 3 usages of this option to the non-SPL form, since there is no SPL_CMD_BOOTEFI_BOOTMGR defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-10Correct SPL uses of LMBSimon Glass
This converts 9 usages of this option to the non-SPL form, since there is no SPL_LMB defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09Correct SPL use of CMD_PSTORESimon Glass
This converts 1 usage of this option to the non-SPL form, since there is no SPL_CMD_PSTORE defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09Correct SPL uses of CMD_FDTSimon Glass
This converts 2 usages of this option to the non-SPL form, since there is no SPL_CMD_FDT defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09Correct SPL uses of CMD_BOOTM_PRE_LOADSimon Glass
This converts 2 usages of this option to the non-SPL form, since there is no SPL_CMD_BOOTM_PRE_LOAD defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09Correct SPL use of CMD_BOOTISimon Glass
This converts 1 usage of this option to the non-SPL form, since there is no SPL_CMD_BOOTI defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06qemu: Add a bootmeth for qfwSimon Glass
This supports reading a kernel and ramdisk from qfw, then loading it with either the booti or bootz commands. For now this uses the existing booti and bootz commands, rather than trying to call that functionality directly (e.g. do_bootm_states()). It does not require the HUSH parser though, which helps a little with size. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06bootstd: Add some default filesystems and commandsSimon Glass
We need to support a basic set of filesystems for booting to work in most cases. Add these in via a new option, letting the board disable them individually (for space reasons) if desired. This enables the filesystem commands as well as the actual functionality, even though bootstd is quite happy to use ext4 without the ext4 command. Further work would be needed to disintangle this and reduce code size. Add several other options as well, providing sensible defaults. We cannot enable this by default, since it expands the size of many boards quite a lot. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06bootstd: Probe the block device before useSimon Glass
In some cases the block device is obtained but is not probed, since it is a sibling of the bootdev. Make sure it is probed, so it can be used without any trouble. This fixes a bug with virtio, where the device is accessed before it has been set up by the virtio uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 201417d700a ("bootstd: Add the bootdev uclass") Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-02-06bootstd: Allow enabling BOOTSTD_FULL without needing EXPOSimon Glass
It is sometimes useful to have one without the other, e.g. on a device without a display, since at present the expo feature requires CONFIG_VIDEO to be enabled. Update the Makefile and bootflow command to support this, as well as the EXPO dependency. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a little more logging of bootflowsSimon Glass
Add some logging to aid debugging of problems with bootflows. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Record the bootdevs used during scanningSimon Glass
Add a way to record the bootdevs used when scanning for bootflows. This is useful for testing. Enable this only with BOOTSTD_FULL and do the same for the progress reporting. Re-enable and update the affected tests now that we have this feature. For bootdev_test_order_default() there is no-longer any support for using the bootdev aliases to specify an ordering, so drop that part of the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Drop the old bootflow_scan_first()Simon Glass
This function is not used outside tests. Drop it and rename bootflow_scan_dev() since it is how we start a scan now. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow scanning a single bootdev labelSimon Glass
We want to support scanning a single label, like 'mmc' or 'usb0'. Add this feature by plumbing the label through to the iterator, setting a flag to indicate that only siblings of the initial device should be used. This means that scanning a bootdev by its name is not supported anymore. That feature doesn't seem very useful in practice, so it is no great loss. Add a test for bootdev_find_by_any() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Switch bootdev scanning to use labelsSimon Glass
At present we set up the bootdev order at the start, then scan the bootdevs one by one. However this approach cannot be used with hunters, since the bootdevs may not exist until the hunter is used. Nor can we just run all the hunters at the start, since that violate's U-Boot's 'lazy init' requirement. It also increases boot time. So we need to adjust the algorithm to scan by labels instead. As a first step, drop the dev_order[] array in favour of a list of labels. Update the name of bootdev_setup_iter_order() to better reflect what it does. Update some related comments and log messages. Also disable a few tests until a later commit where we can use them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow iterating to the next bootdev priortiySimon Glass
Add a function which moves to the next priority to be processed. This works by storing the current priority in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow iterating to the next label in a listSimon Glass
Add a function which moves to the next label in a list of labels. This allows processing the boot_targets environment variable. This works using a new label list in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow hunting for a bootdev by labelSimon Glass
Add a function to hunt for a bootdev label and find the bootdev produced by the hunter (or already present). Add a few extra flags so that we can distinguish between "mmc1", "mmc" and "1" which all need to be handled differently. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a new pre-scan priority for bootdevsSimon Glass
We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow hunting for bootdevs of a given prioritySimon Glass
Add a way to run the hunter function for a particular priority, so that new bootdevs can be found. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Treat DHCP and PXE as bootdev labelsSimon Glass
These are associated with the ethernet boot device but do not match its uclass name, so handle them as special cases. Provide a way to pass flags through with the bootdev so that we know how to process it. The flags are checked by the bootmeths, to ensure that only the selected bootmeth is used. While these both use the network device, they work quite differently. It is common to run only one of these, or to run PXE before DHCP. Provide bootflow flags to control which methods are used. Check these in the two bootmeths so that only the chosen one is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Support reading a script from network or SPI flashSimon Glass
At present this bootmeth only supports a block device and the sandbox host filesystem. Add support for obtaining the script from a network device. Also implement the set_bootflow() method so that it is easy for other bootdevs (such as enabling SPI flash to support scripts). Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a SPI flash bootdevSimon Glass
Add a bootdev for SPI flash so that these devices can be used with standard boot. It only supports loading a script. Add a special case for the label, since we want to use "spi", not "spi_flash". Enable the new bootdev on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a new bootmeth method to set the bootflowSimon Glass
Normally the bootmeth driver reads the bootflow from the bootdev, since it knows the correct way to do it. However it is easier for some bootdevs to handle this themselves. For example, reading from SPI flash is quite different from other devices. Add a way for the bootdev to pass a bootflow to the bootmeth, so that this can be supported. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Move label parsing into its own functionSimon Glass
This is complicated enough to merit its own function, particularly as we are about to add to it. Create a new label_to_uclass() function to decode a label. Also update the code to ignore an empty label or one consisting of just a number. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Set the distro_bootpart env var with scriptsSimon Glass
This environment variable is supposed to be set so that the script knows which partition holds the script. Set it before invoking the script. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Support reading the device tree with EFISimon Glass
With EFI booting the device tree is required but is not actually specified in any way. The normal method is to use a fdtfile environment variable to get the filename, then look for that file on the media. Implement this in the bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Include the device tree in the bootflowSimon Glass
Some bootmeths provide a way to load a device tree as well as the base OS image. Add a way to store this in the bootflow. Update the 'bootflow info' command to show this information. Note that the device tree is not allocated, but instead is stored at an address provided by an environment variable. This may need to be adjusted at some point, but for now it works well and fits in with the existing distro-boot scripts. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow reading an EFI file from the networkSimon Glass
At present this bootmeth only supports reading from a filesystem. Add support for reading from a network also, using DHCP with autoload. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Rename bootdev checkersSimon Glass
These functions return 0 if the check passes, so the names are somewhat confusing. Rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Only scan bootable partitionsSimon Glass
At present all partitions are scanned, whether marked bootable or not. Use only bootable partitions, defaulting to partition 1 if none is found. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Support running bootdev huntersSimon Glass
Add a way to run a bootdev hunter to find bootdevs of a certain type. Add this to the 'bootdev hunt' command. Test for this are added in a later patch, since a useful test needs some hunters to work with. Signed-off-by: Simon Glass <sjg@chromium.org>