efi_loader: make the UEFI boot manager configurable
v2 cover 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.
v2:
Some stuff belonging into the first patch were in the second patch Correct copyright notice in lib/efi_loader/efi_load_options.c
Heinrich Schuchardt (2):
efi_loader: move load options to new module
efi_loader: make the UEFI boot manager configurable
cmd/bootefi.c | 13 ++- cmd/efidebug.c | 8 +- lib/efi_loader/Kconfig | 8 ++ lib/efi_loader/Makefile | 3 +- lib/efi_loader/efi_bootmgr.c | 135 --------------------------- lib/efi_loader/efi_load_options.c | 149 ++++++++++++++++++++++++++++++ 6 files changed, 174 insertions(+), 142 deletions(-) create mode 100644 lib/efi_loader/efi_load_options.c
--
2.29.2
PATCH v2 1/2 efi_loader: move load options to new module
Move all load options related functions to a new module. So that they can be compiled independently.
---
v2:
move stuff from patch 2 to patch 1
correct copyright notice
--- lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_bootmgr.c | 135 --------------------------- lib/efi_loader/efi_load_options.c | 149 ++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 135 deletions(-) create mode 100644 lib/efi_loader/efi_load_options.c
lib/efi_loader/Makefile +1 -0
@@ -35,6 +35,7 @@ endif obj-y += efi_file.o obj-$(CONFIG_EFI_LOADER_HII) += efi_hii.o obj-y += efi_image_loader.o +obj-y += efi_load_options.o obj-y += efi_memory.o obj-y += efi_root_node.o obj-y += efi_runtime.o
lib/efi_loader/efi_bootmgr.c +0 -135
141 lines not on this page · raw message
lib/efi_loader/efi_load_options.c new file +149 -0
149 lines not on this page · raw message
--
2.29.2
PATCH v2 2/2 efi_loader: make the UEFI boot manager configurable
In reply to Heinrich SchuchardtSome 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.
---
v2:
move stuff from patch 2 to patch 1
--- cmd/bootefi.c | 13 +++++++++---- cmd/efidebug.c | 8 ++++++-- lib/efi_loader/Kconfig | 8 ++++++++ lib/efi_loader/Makefile | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-)
cmd/bootefi.c +9 -4
@@ -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(
cmd/efidebug.c +6 -2
@@ -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
lib/efi_loader/Kconfig +8 -0
@@ -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
lib/efi_loader/Makefile +1 -1
@@ -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
--
2.29.2
PATCH v2 2/2 efi_loader: make the UEFI boot manager configurable
Hi,
Am 2021-01-19 18:09, schrieb Heinrich Schuchardt:
Quoted 5 lines
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.
include/config_distro_bootcmd.h needs to be updated too, no? "bootefi bootmgr"
is called unconditionally there.
-michael
PATCH v2 2/2 efi_loader: make the UEFI boot manager configurable
Am 19. Januar 2021 23:51:46 MEZ schrieb Michael Walle <[email protected]>:
Quoted 7 lines
Hi,
Am 2021-01-19 18:09, schrieb Heinrich Schuchardt:
Quoted 4 lines
Some boards are very tight on the binary size. Booting via UEFI is possible
without using the boot manager.
Quoted 5 lines
Quoted 1 line
Provide a configuration option to make the boot manager available.
include/config_distro_bootcmd.hneeds to be updated too, no? "bootefi bootmgr"
is called unconditionally there.
Yes, we can avoid unnecessary output by not calling the unimplemented command.
Quoted 2 lines
-michael