efi_loader: add bootmgr
Similar to a "real" UEFI implementation, the bootmgr looks at the
BootOrder and BootXXXX variables to try to find an EFI payload to load
and boot. This is added as a sub-command of bootefi.
The idea is that the distro bootcmd would first try loading a payload
via the bootmgr, and then if that fails (ie. first boot or corrupted
EFI variables) it would fallback to loading bootaa64.efi. (Which
would then load fallback.efi which would look for \EFI\*\boot.csv and
populate BootOrder and BootXXXX based on what it found.)
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 90f0051..f97b0ca 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -814,8 +814,8 @@
list_add_tail(&obj->link, &efi_obj_list);
}
-static efi_status_t load_image_from_path(struct efi_device_path *file_path,
- void **buffer)
+efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
+ void **buffer)
{
struct efi_file_info *info = NULL;
struct efi_file_handle *f;
@@ -875,7 +875,7 @@
struct efi_device_path *dp, *fp;
efi_status_t ret;
- ret = load_image_from_path(file_path, &source_buffer);
+ ret = efi_load_image_from_path(file_path, &source_buffer);
if (ret != EFI_SUCCESS) {
free(info);
free(obj);