From: Jan Janssen Date: Tue, 4 Jan 2022 12:12:21 +0000 (+0100) Subject: boot: Do more config handling in config_load_all_entries X-Git-Tag: v251-rc1~568^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=163d1ea5dd69c75d889ba4c2d1b51432ed14127f;p=thirdparty%2Fsystemd.git boot: Do more config handling in config_load_all_entries --- diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 608b3196c20..fac31abc44b 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1700,8 +1700,10 @@ static void config_default_entry_select(Config *config) { return; } - /* no entry found */ - config->idx_default = IDX_INVALID; + /* If no configured entry to select from was found, enable the menu. */ + config->idx_default = 0; + if (config->timeout_sec == 0) + config->timeout_sec = 10; } static BOOLEAN find_nonunique(ConfigEntry **entries, UINTN entry_count) { @@ -2358,6 +2360,16 @@ static void config_load_all_entries( L"auto-reboot-to-firmware-setup", L"Reboot Into Firmware Interface", reboot_into_firmware); + + if (config->entry_count == 0) + return + + config_write_entries_to_variable(config); + + config_title_generate(config); + + /* select entry by configured pattern or EFI LoaderDefaultEntry= variable */ + config_default_entry_select(config); } EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { @@ -2409,20 +2421,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { goto out; } - config_write_entries_to_variable(&config); - - config_title_generate(&config); - - /* select entry by configured pattern or EFI LoaderDefaultEntry= variable */ - config_default_entry_select(&config); - - /* if no configured entry to select from was found, enable the menu */ - if (config.idx_default == IDX_INVALID) { - config.idx_default = 0; - if (config.timeout_sec == 0) - config.timeout_sec = 10; - } - /* select entry or show menu when key is pressed or timeout is set */ if (config.force_menu || config.timeout_sec > 0) menu = TRUE;