aboutsummaryrefslogtreecommitdiff
path: root/boot/bootmeth-uclass.c
Commit message (Collapse)AuthorAgeFilesLines
* bootstd: Add a command to read all files for a bootflowSimon Glass2023-08-111-0/+12
| | | | | | | | | | Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until it is needed to boot. This saves time when scanning and avoids needing to allocate memory for something that may never be used. To permit reading of these files, add a new 'bootflow read' command. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootflow: Export setup_fs()Simon Glass2023-08-031-17/+6
| | | | | | This function is used in some bootmeth implementations. Export it. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Correct baudrate typoSimon Glass2023-07-161-1/+1
| | | | | | | This is a copy error. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* fs: Create functions to load and allocate a fileSimon Glass2023-07-141-28/+2
| | | | | | | | | | | This functionality current sits in bootstd, but it is more generally useful. Add a function to load a file into memory, allocating it as needed. Adjust bootstd to use this version. Note: Tests are added in the subsequent patch which converts the 'cat' command to use this function. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Tidy up reporting of errorsSimon Glass2023-05-131-1/+1
| | | | | | | | | | | | In a few cases the error handling is not quite right. Make sure we return the actual error in distro_efi_read_bootflow_file() rather than -EINVAL. Return -IO when a file cannot be read. Also show the error name if available. This does not change operation, but does make it easier to diagnose problems. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add a new bootmeth method to set the bootflowSimon Glass2023-01-231-0/+11
| | | | | | | | | | | | | 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>
* bootstd: Allow reading a logo for the OSSimon Glass2023-01-161-9/+60
| | | | | | | 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: Add a way to set up a bootflowSimon Glass2022-10-311-4/+1
| | | | | | Add a function to init a bootflow, to reduce code duplication. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Allow scanning for global bootmeths separatelySimon Glass2022-08-121-22/+57
| | | | | | | | | | | | | | | | | | Typically we want to find and use global bootmeths first, since they have the best idea of how the system should boot. We then use normal bootmeths as a fallback. Add the logic for this, putting global bootmeths at the end of the ordering. We can then easily scan the global bootmeths first, then drop them from the list for subsequent bootdev-centric scans. This changes the ordering of global bootmeths, so update the bootflow_system() accordingly. Drop the comment from bootmeth_setup_iter_order() since this is an exported function and it should be in the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Allow bootmeths to be marked as globalSimon Glass2022-08-121-0/+14
| | | | | | | | | | | | The current way of handling things like EFI bootmgr is a bit odd, since that bootmeth handles selection of the bootdev itself. VBE needs to work the same way, so we should support it properly. Add a flag that indicates that the bootmeth is global, rather than being invoked on each bootdev. Provide a helper to read a bootflow from the bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Provide a bootmeth method to obtain state infoSimon Glass2022-08-121-0/+10
| | | | | | | | | Some bootmeths can provide information about what is available to boot. For example, VBE simple provides access to the firmware state. Add a new method for this, along with a sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Detect empty bootmeth orderingSimon Glass2022-08-121-0/+2
| | | | | | | | | | If the ordering produces no entries, this is an error. Report it, so that the caller doesn't try to continue with a NULL bootmeth. This fixes a crash in the bootflow_iter test when running with the sandbox 'default' device tree, instead of the required 'test' one. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add the bootmeth uclass and helpersSimon Glass2022-04-251-0/+333
A bootmeth is a method of locating an operating system. For now, just add the uclass itself. Drivers for particular bootmeths are added later. If no bootmeths devices are included in the devicetree, create them automatically. This avoids the need for boilerplate in the devicetree files. Signed-off-by: Simon Glass <sjg@chromium.org>