diff options
author | Kay Sievers <kay@vrfy.org> | 2012-09-05 03:08:49 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-09-05 03:08:49 +0200 |
commit | d717149d9b86cfda37e6b7022be41e6ae47249c0 (patch) | |
tree | f842be5a44abecadf9bc902828b2833d1e32c5a3 | |
parent | 11a12f8a0c5046eca4bd3287347c66f2574164ff (diff) |
do not auto-select automatically added entries
-rw-r--r-- | gummiboot.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gummiboot.c b/gummiboot.c index 681b8c5..cdd4670 100644 --- a/gummiboot.c +++ b/gummiboot.c @@ -1244,8 +1244,6 @@ static VOID config_default_entry_select(Config *config) { UINTN i; for (i = 0; i < config->entry_count; i++) { - if (!config->entries[i]->file) - continue; if (StrCmp(config->entries[i]->file, var) == 0) { config->idx_default = i; found = TRUE; @@ -1270,8 +1268,6 @@ static VOID config_default_entry_select(Config *config) { UINTN i; for (i = 0; i < config->entry_count; i++) { - if (!config->entries[i]->file) - continue; if (StrCmp(config->entries[i]->file, var) == 0) { config->idx_default = i; config->idx_default_efivar = i; @@ -1293,8 +1289,6 @@ static VOID config_default_entry_select(Config *config) { UINTN i; for (i = config->entry_count-1; i >= 0; i--) { - if (!config->entries[i]->file) - continue; if (config->entries[i]->no_autoselect) continue; if (MetaiMatch(config->entries[i]->file, config->entry_default_pattern)) { @@ -1305,8 +1299,18 @@ static VOID config_default_entry_select(Config *config) { } /* select the last entry */ - if (config->entry_count) + if (config->entry_count) { + UINTN i; + + for (i = config->entry_count-1; i >= 0; i--) { + if (config->entries[i]->no_autoselect) + continue; + config->idx_default = i; + return; + } + config->idx_default = config->entry_count-1; + } } /* generate a unique title, avoiding non-distinguishable menu entries */ @@ -1435,8 +1439,7 @@ static VOID config_entry_add_loader(Config *config, EFI_FILE *root_dir, CHAR16 * entry = AllocateZeroPool(sizeof(ConfigEntry)); entry->title = StrDuplicate(title); entry->loader = StrDuplicate(loader); - if (file) - entry->file = StrDuplicate(file); + entry->file = StrDuplicate(file); entry->no_autoselect = TRUE; config_add_entry(config, entry); } @@ -1582,7 +1585,7 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { } /* export the selected boot entry to the system */ - efivar_set(L"LoaderEntrySelected", entry->file, FALSE); + efivar_set(L"LoaderEntrySelected", entry->file, FALSE); image_start(image, loaded_image, &config, entry); |