@@ -452,7 +452,8 @@ static int do_bootefi_bootmgr_exec(void)
void *addr;
efi_status_t r;
- addr = efi_bootmgr_load(&device_path, &file_path);
+ addr = efi_bootmgr_load(EFI_BOOTMGR_DEFAULT_ORDER,
+ &device_path, &file_path);
if (!addr)
return 1;
@@ -549,9 +549,12 @@ struct efi_load_option {
u8 *optional_data;
};
+#define EFI_BOOTMGR_DEFAULT_ORDER (-1)
+
void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data);
unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data);
-void *efi_bootmgr_load(struct efi_device_path **device_path,
+void *efi_bootmgr_load(int boot_id,
+ struct efi_device_path **device_path,
struct efi_device_path **file_path);
#else /* CONFIG_IS_ENABLED(EFI_LOADER) */
@@ -180,7 +180,8 @@ error:
* available load-options, finding and returning the first one that can
* be loaded successfully.
*/
-void *efi_bootmgr_load(struct efi_device_path **device_path,
+void *efi_bootmgr_load(int boot_id,
+ struct efi_device_path **device_path,
struct efi_device_path **file_path)
{
u16 bootnext, *bootorder;
@@ -194,6 +195,12 @@ void *efi_bootmgr_load(struct efi_device_path **device_path,
bs = systab.boottime;
rs = systab.runtime;
+ /* specified boot option */
+ if (boot_id != -1) {
+ image = try_load_entry(boot_id, device_path, file_path);
+ goto error;
+ }
+
/* get BootNext */
size = sizeof(bootnext);
ret = rs->get_variable(L"BootNext",
With an extra argument, efi_bootmgr_load() can now load an efi binary based on a "BootXXXX" variable specified. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> --- cmd/bootefi.c | 3 ++- include/efi_loader.h | 5 ++++- lib/efi_loader/efi_bootmgr.c | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-)