summaryrefslogtreecommitdiff
path: root/boot
AgeCommit message (Collapse)Author
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>
2023-01-23bootstd: Add the concept of a bootdev hunterSimon Glass
Some bootdevs must be enumerated before they appear. For example, USB bootdevs are not visible until USB is enumerated. With standard boot this needs to happen automatically, since we only want to enumerate a bus if it is needed. Add a way to define bootdev 'hunters' which can be used to hunt for bootdevs of a given type. Track which ones have been used and add a command to list them. Include a clang work-around which seems to be needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a default method to get bootflowsSimon Glass
The code in these functions turns out to often be the same. Add a default get_bootflow() function and allow the drivers to select it by setting the method to NULL. This saves a little code space. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: mmc: Use bootdev_setup_sibling_blk()Simon Glass
At present MMC uses the bootdev_setup_for_dev() function to set up the bootdev. This is because MMC only has one block-device child, so does not need to worry about naming of the bootdev. However this inconsistency with other bootdevs that use block devices is a bit annoying. The only real reason for it is to have a name like 'mmc0.bootdev' instead of 'mmc0.blk.bootdev'. Update bootdev_setup_sibling_blk() to drop '.blk' from the name where it appears, thus removing the only reason to use the bootdev_setup_for_dev(). Switch MMC over to the subling function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Simplify locating existing bootdevsSimon Glass
There is no point in trying to match the alias order for bootdevs, since build_order() either sorts them by priority, uses the boot_targets environment variable or the bootdev-order property. Just use the iterator instead, to simplify the code. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Remove special-case code for boot_targetsSimon Glass
Rather than implement this as its own case in build_order(), process the boot_targets environment variable in the bootstd_get_bootdev_order() function. This allows build_order() to be simplified. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-19Merge tag 'dm-pull-18jan23' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dm convert rockchip to use binman patman fix for checkpatch binman optional entries, improved support for ELF symbols trace improvements minor fdt refactoring
2023-01-18vbe: Allow probing the VBE bootmeth to fail in OS fixupSimon Glass
This device is created when there are no bootmeths defined in the device tree. But it cannot be probed without a device tree node. For now, ignore a probe failure. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Karsten Merker <merker@debian.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Fixes: a56f663f0707 ("vbe: Add info about the VBE device to the fwupd node") Tested-by: Vagrant Cascadian <vagrant@debian.org> Tested-by: Karsten Merker <merker@debian.org>
2023-01-18rockchip: Drop the FIT generator scriptSimon Glass
This is not used anymore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18rockchip: Convert all boards to use binmanSimon Glass
Instead of the bash script, use binman to generate the FIT for arm64. For 32-bit boards, use binman for all images, dropping the intermediate files. With this change, only Zynq is now using SPL_FIT_GENERATOR so update the Kconfig rule accordingly. Clean up the Makefile to the extent possible. Unfortunately, two boards do not use SPL_FRAMEWORK so don't enable the u-boot.img rule: evb-rk3036 kylin-rk3036 So a small remnant remains. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18event: Correct dependencies on the EVENT frameworkTom Rini
The event framework is just that, a framework. Enabling it by itself does nothing, so we shouldn't ask the user about it. Reword (and correct typos) around this the option and help text. This also applies to DM_EVENT and EVENT_DYNAMIC. Only EVENT_DEBUG and CMD_EVENT should be visible to the user to select, when EVENT is selected. With this, it's time to address the larger problems. When functionality uses events, typically via EVENT_SPY, the appropriate framework then must be select'd and NOT imply'd. As the functionality will cease to work (and so, platforms will fail to boot) this is non-optional and where select is appropriate. Audit the current users of EVENT_SPY to have a more fine-grained approach to select'ing the framework where used. Also ensure the current users of event_register and also select EVENT_DYNAMIC. Cc: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reported-by: Oliver Graute <Oliver.Graute@kococonnector.com> Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com> Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") Fixes: 42fdcebf859f ("event: Convert misc_init_f() to use events") Fixes: c5ef2025579e ("dm: fix DM_EVENT dependencies") Signed-off-by: Tom Rini <trini@konsulko.com> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-01-16bootstd: Support setting a theme for the menuSimon Glass
Allow a theme to be set. For now this is very simple, just a default font size to use for all elements. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Support creating a boot menuSimon Glass
Create an expo to handle the boot menu. For now this is quite simple, with just a header, some menu items and a pointer to show the current one. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16expo: Add support for scene menusSimon Glass
A menu is a key part of the expo design. It consists of a number of items which the user can select from. Add the initial implementation of this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16expo: Add support for scenesSimon Glass
A scene is a single screen within an expo. It is possible to move between scenes but only one can be displayed at once. Add a basic implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16expo: Add basic implementationSimon Glass
An expo is a way of presenting and collecting information from the user. It consists of a collection of 'scenes' of which only one is presented at a time. An expo is typically used to show a boot menu and allow settings to be changed. One created, the same expo can be automatically presented in graphical form using a vidconsole, or in text form on a serial console. Add an initial implementation of the expo itself. Supports for scenes and objects is provided later. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Allow reading a logo for the OSSimon Glass
Some operating systems provide a logo in bmp format. Read this in if present so it can be displayed in the menu. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Read the Operating System name for distro/scriptsSimon Glass
Add the concept of an OS name to the bootflow. This typically includes the OS name, version and kernel version. Implement this for the distro and script bootmeths so that it works with Armbian and older version of Fedora. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16image: Move common image code to image_board and commandSimon Glass
We should use the cmd/ directory for commands rather than for common code used elsewhere in U-Boot. Move the common 'source' code into image-board.c to achieve this. The image_source_script() function needs to call run_command_list() so seems to belong better in the command library. Move and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-09Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-06cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImageMarek Vasut
Commit d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT. Fixes: d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot") Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Peter Hoyes <peter.hoyes@arm.com> Tested-by: Peter Hoyes <peter.hoyes@arm.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-01-06Revert "Revert "cmd: pxe_utils: Check fdtcontroladdr in label_boot""Marek Vasut
This reverts commit ed6251187afabf811a5fd49a44ebd61c53c7b378. Superseded by "cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage" which is less heavy-handed approach and retains part of the original behavior for non-fitImage. Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
2022-12-31cmd: source: Support specifying config nameSean Anderson
As discussed previously [1,2], the source command is not safe to use with verified boot unless there is a key with required = "images" (which has its own problems). This is because if such a key is absent, signatures are verified but not required. It is assumed that configuration nodes will provide the signature. Because the source command does not use configurations to determine the image to source, effectively no verification takes place. To address this, allow specifying configuration nodes. We use the same syntax as the bootm command (helpfully provided for us by fit_parse_conf). By default, we first try the default config and then the default image. To force using a config, # must be present in the command (e.g. `source $loadaddr#my-conf`). For convenience, the config may be omitted, just like the address may be (e.g. `source \#`). This also works for images (`source :` behaves exactly like `source` currently does). [1] https://lore.kernel.org/u-boot/7d711133-d513-5bcb-52f2-a9dbaa9eeded@prevas.dk/ [2] https://lore.kernel.org/u-boot/042dcb34-f85f-351e-1b0e-513f89005fdd@gmail.com/ Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-29PowerPC: Rework PBL location choiceTom Rini
When converting CONFIG_SDCARD and CONFIG_SPIFLASH to Kconfig, one set of uses wasn't converted correctly. Allow for the case where platforms don't rely on "PBL" to boot but instead use other mechanisms. See the link below for more details. Link: https://lore.kernel.org/all/20220802091338.f4g45ldhc7qbg6hm@pali/ Fixes: d433c74eecdc ("Convert CONFIG_SDCARD et al to Kconfig") Tested-by: Pali Rohár <pali@kernel.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23common/spl/spl_ram: Remove unused defaultTom Rini
We ask for CONFIG_SPL_LOAD_FIT_ADDRESS in Kconfig, so we cannot define it in C as a fall-back. However, this option previously was buried under "if ... endif" Kconfig logic. Rework a number of config options to now have more robust dependency lines so that we can ask this address when needed. With that done, we can remove the fallback in spl_ram.c. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-21Merge tag 'v2023.01-rc4' into nextTom Rini
Prepare v2023.01-rc4 Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-13Revert "cmd: pxe_utils: Check fdtcontroladdr in label_boot"Tom Rini
With the change here, all extlinux.conf files with only "KERNEL /fitImage" don't work anymore. One common example of this would be those files generated by thee Poky/OE WIC bootimg-partition bootloader partition generator. This reverts commit d5ba6188dfbf6bb68354bec86e483623f1f6dae2. Reported-by: Neil Armstrong <neil.armstrong@linaro.org> Reported-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-12distro/pxeboot: Handle prompt variableManuel Traut
Regarding the documentation found here: https://github.com/u-boot/u-boot/blob/master/common/menu.c#L347 If both timeout and prompt is set to 0 the default entry shall be booted immediately. However the current behaviour is that the prompt is shown (tested with distroboot) until the user selects an entry (no timeout). This change implements a behaviour as documented. It was tested with distroboot. Signed-off-by: Manuel Traut <manuel.traut@mt.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-12cmd: pxe: use strdup to copy configPatrick Delaunay
Replace malloc and strcpy by strdup in function parse_label_kernel. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>