[U-Boot] [PATCH 2/5] efi_loader: bootmgr: allow for running a given load option
AKASHI Takahiro
takahiro.akashi at linaro.org
Tue Dec 18 05:02:54 UTC 2018
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 at linaro.org>
---
cmd/bootefi.c | 2 +-
include/efi_loader.h | 3 ++-
lib/efi_loader/efi_bootmgr.c | 9 ++++++++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 7012d72ab50d..3ebae1cdad08 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -452,7 +452,7 @@ 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(-1, &device_path, &file_path);
if (!addr)
return 1;
diff --git a/include/efi_loader.h b/include/efi_loader.h
index dd68cfce5c65..5a6321122c9c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -551,7 +551,8 @@ struct efi_load_option {
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) */
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index a54ae28343ce..db391147fb2d 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -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;
@@ -195,6 +196,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;
+ }
+
/* BootNext */
size = sizeof(bootnext);
ret = rs->get_variable(L"BootNext",
--
2.19.1
More information about the U-Boot
mailing list