mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 04:44:46 +00:00
efi_loader: make the UEFI boot manager configurable
Some boards are very tight on the binary size. Booting via UEFI is possible without using the boot manager. Provide a configuration option to make the boot manager available. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
2363effb7a
commit
ff2f532fad
5 changed files with 33 additions and 10 deletions
|
@ -631,10 +631,12 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
else if (ret != EFI_SUCCESS)
|
else if (ret != EFI_SUCCESS)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
|
||||||
if (!strcmp(argv[1], "bootmgr"))
|
if (!strcmp(argv[1], "bootmgr"))
|
||||||
return do_efibootmgr();
|
return do_efibootmgr();
|
||||||
|
}
|
||||||
#ifdef CONFIG_CMD_BOOTEFI_SELFTEST
|
#ifdef CONFIG_CMD_BOOTEFI_SELFTEST
|
||||||
else if (!strcmp(argv[1], "selftest"))
|
if (!strcmp(argv[1], "selftest"))
|
||||||
return do_efi_selftest();
|
return do_efi_selftest();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -657,11 +659,14 @@ static char bootefi_help_text[] =
|
||||||
" Use environment variable efi_selftest to select a single test.\n"
|
" Use environment variable efi_selftest to select a single test.\n"
|
||||||
" Use 'setenv efi_selftest list' to enumerate all tests.\n"
|
" Use 'setenv efi_selftest list' to enumerate all tests.\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
|
||||||
"bootefi bootmgr [fdt address]\n"
|
"bootefi bootmgr [fdt address]\n"
|
||||||
" - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
|
" - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" If specified, the device tree located at <fdt address> gets\n"
|
" If specified, the device tree located at <fdt address> gets\n"
|
||||||
" exposed as EFI configuration table.\n";
|
" exposed as EFI configuration table.\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ static int do_efi_boot_opt(struct cmd_tbl *cmdtp, int flag,
|
||||||
*
|
*
|
||||||
* efidebug test bootmgr
|
* efidebug test bootmgr
|
||||||
*/
|
*/
|
||||||
static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
|
static __maybe_unused int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
|
||||||
int argc, char * const argv[])
|
int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
efi_handle_t image;
|
efi_handle_t image;
|
||||||
|
@ -1392,8 +1392,10 @@ static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd_tbl cmd_efidebug_test_sub[] = {
|
static struct cmd_tbl cmd_efidebug_test_sub[] = {
|
||||||
|
#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
|
||||||
U_BOOT_CMD_MKENT(bootmgr, CONFIG_SYS_MAXARGS, 1, do_efi_test_bootmgr,
|
U_BOOT_CMD_MKENT(bootmgr, CONFIG_SYS_MAXARGS, 1, do_efi_test_bootmgr,
|
||||||
"", ""),
|
"", ""),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1581,8 +1583,10 @@ static char efidebug_help_text[] =
|
||||||
" - show UEFI memory map\n"
|
" - show UEFI memory map\n"
|
||||||
"efidebug tables\n"
|
"efidebug tables\n"
|
||||||
" - show UEFI configuration tables\n"
|
" - show UEFI configuration tables\n"
|
||||||
|
#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
|
||||||
"efidebug test bootmgr\n"
|
"efidebug test bootmgr\n"
|
||||||
" - run simple bootmgr for test\n"
|
" - run simple bootmgr for test\n"
|
||||||
|
#endif
|
||||||
"efidebug query [-nv][-bs][-rt][-at]\n"
|
"efidebug query [-nv][-bs][-rt][-at]\n"
|
||||||
" - show size of UEFI variables store\n";
|
" - show size of UEFI variables store\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -123,14 +123,20 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
|
||||||
#define BOOTENV_SHARED_EFI \
|
#define BOOTENV_EFI_BOOTMGR \
|
||||||
"boot_efi_bootmgr=" \
|
"boot_efi_bootmgr=" \
|
||||||
"if fdt addr ${fdt_addr_r}; then " \
|
"if fdt addr ${fdt_addr_r}; then " \
|
||||||
"bootefi bootmgr ${fdt_addr_r};" \
|
"bootefi bootmgr ${fdt_addr_r};" \
|
||||||
"else " \
|
"else " \
|
||||||
"bootefi bootmgr;" \
|
"bootefi bootmgr;" \
|
||||||
"fi\0" \
|
"fi\0"
|
||||||
|
#else
|
||||||
|
#define BOOTENV_EFI_BOOTMGR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOOTENV_SHARED_EFI \
|
||||||
|
BOOTENV_EFI_BOOTMGR \
|
||||||
\
|
\
|
||||||
"boot_efi_binary=" \
|
"boot_efi_binary=" \
|
||||||
"load ${devtype} ${devnum}:${distro_bootpart} " \
|
"load ${devtype} ${devnum}:${distro_bootpart} " \
|
||||||
|
|
|
@ -27,6 +27,14 @@ config EFI_LOADER
|
||||||
|
|
||||||
if EFI_LOADER
|
if EFI_LOADER
|
||||||
|
|
||||||
|
config CMD_BOOTEFI_BOOTMGR
|
||||||
|
bool "UEFI Boot Manager"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Select this option if you want to select the UEFI binary to be booted
|
||||||
|
via UEFI variables Boot####, BootOrder, and BootNext. This enables the
|
||||||
|
'bootefi bootmgr' command.
|
||||||
|
|
||||||
config EFI_SETUP_EARLY
|
config EFI_SETUP_EARLY
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -21,7 +21,7 @@ targets += helloworld.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
|
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
|
||||||
obj-y += efi_bootmgr.o
|
obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += efi_bootmgr.o
|
||||||
obj-y += efi_boottime.o
|
obj-y += efi_boottime.o
|
||||||
obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
|
obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
|
||||||
obj-$(CONFIG_EFI_CAPSULE_FIRMWARE) += efi_firmware.o
|
obj-$(CONFIG_EFI_CAPSULE_FIRMWARE) += efi_firmware.o
|
||||||
|
|
Loading…
Add table
Reference in a new issue