summaryrefslogtreecommitdiffstats
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2021-03-17 21:55:00 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-03-25 20:14:26 +0100
commit53f6a5aa86267a59ea9d45c89405e42002410e37 (patch)
tree3fa57d6625a5e8ef4d3944b7acaaf78376752dce /cmd/bootefi.c
parent37c3ca5c0b1a449356279efdcaca346b3eae84fd (diff)
downloadu-boot-53f6a5aa86267a59ea9d45c89405e42002410e37.tar.gz
u-boot-53f6a5aa86267a59ea9d45c89405e42002410e37.tar.xz
u-boot-53f6a5aa86267a59ea9d45c89405e42002410e37.zip
efi_loader: Replace config option for initrd loading
Up to now we install EFI_LOAD_FILE2_PROTOCOL to load an initrd unconditionally. Although we correctly return various EFI exit codes depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the kernel loader, only falls back to the cmdline interpreted initrd if the protocol is not installed. This creates a problem for EFI installers, since they won't be able to load their own initrd and continue the installation. It also makes the feature hard to use, since we can either have a single initrd or we have to recompile u-boot if the filename changes. So let's introduce a different logic that will decouple the initrd path from the config option we currently have. When defining a UEFI BootXXXX we can use the filepathlist and store a file path pointing to our initrd. Specifically the EFI spec describes: "The first element of the array is a device path that describes the device and location of the Image for this load option. Other device paths may optionally exist in the FilePathList, but their usage is OSV specific" When the EFI application is launched through the bootmgr, we'll try to interpret the extra device path. If that points to a file that exists on our disk, we'll now install the load_file2 and the efi-stub will be able to use it. This opens up another path using U-Boot and defines a new boot flow. A user will be able to control the kernel/initrd pairs without explicit cmdline args or GRUB. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 271b385ede..cba81ffe75 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -358,6 +358,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
free(load_options);
+ if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD))
+ efi_initrd_deregister();
+
return ret;
}