summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-15 21:02:50 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-20 10:09:34 +0300
commitff2f532fadd8f5238cc1ac2ae4ab075703bcc313 (patch)
treea711e39d420d3251d05520211206d1069b037d2c
parent2363effb7a689de66634ba325e57c2d6fc12f4e9 (diff)
downloadu-boot-ff2f532fadd8f5238cc1ac2ae4ab075703bcc313.tar.xz
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>
-rw-r--r--cmd/bootefi.c13
-rw-r--r--cmd/efidebug.c8
-rw-r--r--include/config_distro_bootcmd.h12
-rw-r--r--lib/efi_loader/Kconfig8
-rw-r--r--lib/efi_loader/Makefile2
5 files changed, 33 insertions, 10 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index fe70eec625..c8eb5c32b0 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -631,10 +631,12 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
else if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- if (!strcmp(argv[1], "bootmgr"))
- return do_efibootmgr();
+ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
+ if (!strcmp(argv[1], "bootmgr"))
+ return do_efibootmgr();
+ }
#ifdef CONFIG_CMD_BOOTEFI_SELFTEST
- else if (!strcmp(argv[1], "selftest"))
+ if (!strcmp(argv[1], "selftest"))
return do_efi_selftest();
#endif
@@ -657,11 +659,14 @@ static char bootefi_help_text[] =
" Use environment variable efi_selftest to select a single test.\n"
" Use 'setenv efi_selftest list' to enumerate all tests.\n"
#endif
+#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
"bootefi bootmgr [fdt address]\n"
" - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
"\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
U_BOOT_CMD(
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 6de81cab00..9a2d4ddd5e 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1367,8 +1367,8 @@ static int do_efi_boot_opt(struct cmd_tbl *cmdtp, int flag,
*
* efidebug test bootmgr
*/
-static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
- int argc, char * const argv[])
+static __maybe_unused int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
+ int argc, char * const argv[])
{
efi_handle_t image;
efi_uintn_t exit_data_size = 0;
@@ -1392,8 +1392,10 @@ static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
}
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,
"", ""),
+#endif
};
/**
@@ -1581,8 +1583,10 @@ static char efidebug_help_text[] =
" - show UEFI memory map\n"
"efidebug tables\n"
" - show UEFI configuration tables\n"
+#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
"efidebug test bootmgr\n"
" - run simple bootmgr for test\n"
+#endif
"efidebug query [-nv][-bs][-rt][-at]\n"
" - show size of UEFI variables store\n";
#endif
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index c9862260a3..2627c2a6a5 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -123,14 +123,20 @@
#endif
#endif
-
-#define BOOTENV_SHARED_EFI \
+#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
+#define BOOTENV_EFI_BOOTMGR \
"boot_efi_bootmgr=" \
"if fdt addr ${fdt_addr_r}; then " \
"bootefi bootmgr ${fdt_addr_r};" \
"else " \
"bootefi bootmgr;" \
- "fi\0" \
+ "fi\0"
+#else
+#define BOOTENV_EFI_BOOTMGR
+#endif
+
+#define BOOTENV_SHARED_EFI \
+ BOOTENV_EFI_BOOTMGR \
\
"boot_efi_binary=" \
"load ${devtype} ${devnum}:${distro_bootpart} " \
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index fdf245dea3..106f789b4d 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -27,6 +27,14 @@ config 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
bool
default n
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 0216eb83dc..a6355d240a 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -21,7 +21,7 @@ targets += helloworld.o
endif
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-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
obj-$(CONFIG_EFI_CAPSULE_FIRMWARE) += efi_firmware.o