summaryrefslogtreecommitdiff
path: root/include/bootflow.h
Commit message (Collapse)AuthorAgeFilesLines
* bootstd: Replicate the dtb-filename quirks of distrobootSimon Glass2023-03-081-0/+14
| | | | | | | | | | | | | | For EFI, the distro boot scripts search in three different directories for the .dtb file. The SOC-based filename fallback is supported only for 32-bit ARM. Adjust the code to mirror this behaviour. Also some boards can use a prior-stage FDT if one is not found in the normal way. Support this and show a message in that case. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Mark Kettenis <kettenis@openbsd.org>
* bootflow: Rename bootflow_flags_tSimon Glass2023-03-081-25/+26
| | | | | | | These flags actually relate to the iterator, not the bootflow struct itself. Rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Record the bootdevs used during scanningSimon Glass2023-01-231-1/+9
| | | | | | | | | | | | | | | 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>
* bootstd: Drop the old bootflow_scan_first()Simon Glass2023-01-231-20/+3
| | | | | | | 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>
* bootstd: Allow scanning a single bootdev labelSimon Glass2023-01-231-3/+7
| | | | | | | | | | | | | 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>
* bootstd: Switch bootdev scanning to use labelsSimon Glass2023-01-231-6/+2
| | | | | | | | | | | | | | | | | | | 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>
* bootstd: Allow iterating to the next bootdev priortiySimon Glass2023-01-231-0/+3
| | | | | | | | | 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>
* bootstd: Allow iterating to the next label in a listSimon Glass2023-01-231-0/+4
| | | | | | | | | | 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>
* bootstd: Allow hunting for a bootdev by labelSimon Glass2023-01-231-1/+13
| | | | | | | | | | 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>
* bootstd: Use hunters when scanning for bootflowsSimon Glass2023-01-231-5/+16
| | | | | | | | | Add a flag to control whether hunters are used when scanning for bootflows. Enable it by default and tidy up the flag comments a little. Fow now this has no effect, until a future patch enables this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Treat DHCP and PXE as bootdev labelsSimon Glass2023-01-231-0/+15
| | | | | | | | | | | | | | | | 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>
* bootstd: Add a SPI flash bootdevSimon Glass2023-01-231-0/+9
| | | | | | | | | | | | 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>
* bootstd: Update docs on bootmeth_try_file() for sandboxSimon Glass2023-01-231-1/+1
| | | | | | | | | Mention that this function is also used with a NULL block devices to access files on the host, when using sandbox. Update the comment on struct bootflow also. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Set the distro_bootpart env var with scriptsSimon Glass2023-01-231-0/+3
| | | | | | | 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>
* bootstd: Include the device tree in the bootflowSimon Glass2023-01-231-0/+6
| | | | | | | | | | | | | 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>
* bootstd: Rename bootdev checkersSimon Glass2023-01-231-6/+6
| | | | | | | These functions return 0 if the check passes, so the names are somewhat confusing. Rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Only scan bootable partitionsSimon Glass2023-01-231-0/+2
| | | | | | | | 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>
* bootstd: Support setting a theme for the menuSimon Glass2023-01-161-0/+10
| | | | | | | 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>
* bootstd: Support creating a boot menuSimon Glass2023-01-161-0/+23
| | | | | | | 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>
* bootstd: Allow reading a logo for the OSSimon Glass2023-01-161-0/+4
| | | | | | | 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>
* bootstd: Read the Operating System name for distro/scriptsSimon Glass2023-01-161-0/+3
| | | | | | | | | | 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>
* bootstd: Add a way to set up a bootflowSimon Glass2022-10-311-0/+12
| | | | | | Add a function to init a bootflow, to reduce code duplication. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Support bootflows with global bootmethsSimon Glass2022-08-121-3/+13
| | | | | | | | Add support for handling this concept in bootflows. Update the 'bootflow' command to allow only the normal bootmeths to be used. This alllows skipping EFI bootmgr and VBE, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Tidy comments in bootflow_scan_bootdev()Simon Glass2022-08-121-2/+2
| | | | | | Fix a few nits in this function comment. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add support for bootflowsSimon Glass2022-04-251-0/+50
| | | | | | | Add support for bootflows, including maintaining a list of them and iterating to find them. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add the concept of a bootflowSimon Glass2022-04-251-0/+260
A bootflow encapsulates the process used to boot an operating system. It typically has a control file (such as extlinux.conf) and information about which 'bootdev' it came from. Add the header file for this first, since it is needed by all other files. Signed-off-by: Simon Glass <sjg@chromium.org>