From f2bfa0cb17948aa4a0fa20fdf9014296b9c4d9c7 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 3 Sep 2023 22:40:00 +0200 Subject: [PATCH] bootstd: Make efi_mgr bootmeth work for non-sandbox setups Enable the bootflow based on this bootmeth if the BootOrder EFI variable is set. Signed-off-by: Mark Kettenis Reviewed-by: Simon Glass --- boot/bootmeth_efi_mgr.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c index e9d973429f..e6c42d41fb 100644 --- a/boot/bootmeth_efi_mgr.c +++ b/boot/bootmeth_efi_mgr.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include /** * struct efi_mgr_priv - private info for the efi-mgr driver @@ -46,13 +48,26 @@ static int efi_mgr_check(struct udevice *dev, struct bootflow_iter *iter) static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow) { struct efi_mgr_priv *priv = dev_get_priv(dev); + efi_status_t ret; + efi_uintn_t size; + u16 *bootorder; if (priv->fake_dev) { bflow->state = BOOTFLOWST_READY; return 0; } - /* To be implemented */ + ret = efi_init_obj_list(); + if (ret) + return log_msg_ret("init", ret); + + /* Enable this method if the "BootOrder" UEFI exists. */ + bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid, + &size); + if (bootorder) { + bflow->state = BOOTFLOWST_READY; + return 0; + } return -EINVAL; } -- 2.39.5