diff options
author | Simon Glass <sjg@chromium.org> | 2024-11-07 14:31:43 -0700 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-11-09 10:00:38 +0100 |
commit | 9fd623afede63a7049b498bbc285f3555eb2bf26 (patch) | |
tree | d4e2dcdd0604cc60223fc0a314806cea5d60e4ca /lib/efi_loader/efi_helper.c | |
parent | efe9bd4a088c958eefaaf39bb83320871669662e (diff) |
efi: Move default filename to a function
Use a function to obtain the device EFI filename, so that we can control
how sandbox behaves.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/efi_loader/efi_helper.c')
-rw-r--r-- | lib/efi_loader/efi_helper.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 00167bd2a10..51e0c4852c5 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -12,18 +12,63 @@ #include <mapmem.h> #include <dm.h> #include <fs.h> +#include <efi.h> #include <efi_api.h> #include <efi_load_initrd.h> #include <efi_loader.h> #include <efi_variable.h> +#include <host_arch.h> #include <linux/libfdt.h> #include <linux/list.h> +#ifdef CONFIG_SANDBOX + +#if HOST_ARCH == HOST_ARCH_X86_64 +#define BOOTEFI_NAME "BOOTX64.EFI" +#elif HOST_ARCH == HOST_ARCH_X86 +#define BOOTEFI_NAME "BOOTIA32.EFI" +#elif HOST_ARCH == HOST_ARCH_AARCH64 +#define BOOTEFI_NAME "BOOTAA64.EFI" +#elif HOST_ARCH == HOST_ARCH_ARM +#define BOOTEFI_NAME "BOOTARM.EFI" +#elif HOST_ARCH == HOST_ARCH_RISCV32 +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#elif HOST_ARCH == HOST_ARCH_RISCV64 +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#else +#error Unsupported UEFI architecture +#endif + +#else + +#if defined(CONFIG_ARM64) +#define BOOTEFI_NAME "BOOTAA64.EFI" +#elif defined(CONFIG_ARM) +#define BOOTEFI_NAME "BOOTARM.EFI" +#elif defined(CONFIG_X86_64) +#define BOOTEFI_NAME "BOOTX64.EFI" +#elif defined(CONFIG_X86) +#define BOOTEFI_NAME "BOOTIA32.EFI" +#elif defined(CONFIG_ARCH_RV32I) +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#elif defined(CONFIG_ARCH_RV64I) +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#else +#error Unsupported UEFI architecture +#endif + +#endif + #if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD) /* GUID used by Linux to identify the LoadFile2 protocol with the initrd */ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; #endif +const char *efi_get_basename(void) +{ + return BOOTEFI_NAME; +} + /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent |