CHAR16 *entry_default_pattern;
CHAR16 *entry_oneshot;
CHAR16 *options_edit;
- CHAR16 *entries_auto;
+ BOOLEAN no_editor;
} Config;
static VOID cursor_left(UINTN *cursor, UINTN *first)
Print(L"console size: %d x %d\n", x, y);
if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) {
- Print(L"SecureBoot: %s\n", *b > 0 ? L"enabled" : L"disabled");
+ Print(L"SecureBoot: %s\n", yes_no(*b > 0));
FreePool(b);
}
Print(L"timeout (config): %d\n", config->timeout_sec_config);
if (config->entry_default_pattern)
Print(L"default pattern: '%s'\n", config->entry_default_pattern);
+ Print(L"editor: %s\n", yes_no(!config->no_editor));
Print(L"\n");
Print(L"config entry count: %d\n", config->entry_count);
Print(L"LoaderConfigTimeout: %d\n", i);
if (config->entry_oneshot)
Print(L"LoaderEntryOneShot: %s\n", config->entry_oneshot);
- if (efivar_get(L"LoaderDeviceIdentifier", &s) == EFI_SUCCESS) {
- Print(L"LoaderDeviceIdentifier: %s\n", s);
- FreePool(s);
- }
if (efivar_get(L"LoaderDevicePartUUID", &s) == EFI_SUCCESS) {
Print(L"LoaderDevicePartUUID: %s\n", s);
FreePool(s);
Print(L"loader '%s'\n", entry->loader);
if (entry->options)
Print(L"options '%s'\n", entry->options);
- Print(L"auto-select %s\n", entry->no_autoselect ? L"no" : L"yes");
+ Print(L"auto-select %s\n", yes_no(!entry->no_autoselect));
if (entry->call)
Print(L"internal call yes\n");
case KEYPRESS(0, 0, 'e'):
/* only the options of configured entries can be edited */
- if (config->entries[idx_highlight]->type == LOADER_UNDEFINED)
+ if (config->no_editor || config->entries[idx_highlight]->type == LOADER_UNDEFINED)
break;
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK);
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, y_max-1);
idx_last = idx_highlight;
idx_first = 1 + idx_highlight - visible_max;
refresh = TRUE;
- }
- if (idx_highlight < idx_first) {
+ } else if (idx_highlight < idx_first) {
idx_first = idx_highlight;
idx_last = idx_highlight + visible_max-1;
refresh = TRUE;
}
- idx_last = idx_first + visible_max-1;
-
if (!refresh && idx_highlight != idx_highlight_prev)
highlight = TRUE;
}
StrLwr(config->entry_default_pattern);
continue;
}
+
+ if (strcmpa((CHAR8 *)"editor", key) == 0) {
+ BOOLEAN on;
+
+ if (EFI_ERROR(parse_boolean(value, &on)))
+ continue;
+ config->no_editor = !on;
+ }
}
}
}
FreePool(initrd);
- if (entry->machine_id) {
- CHAR16 *var;
-
- /* append additional options from EFI variables for this machine-id */
- var = PoolPrint(L"LoaderEntryOptions-%s", entry->machine_id);
- if (var) {
- CHAR16 *s;
-
- if (efivar_get(var, &s) == EFI_SUCCESS) {
- if (entry->options) {
- CHAR16 *s2;
-
- s2 = PoolPrint(L"%s %s", entry->options, s);
- FreePool(entry->options);
- entry->options = s2;
- } else
- entry->options = s;
- }
- FreePool(var);
- }
-
- var = PoolPrint(L"LoaderEntryOptionsOneShot-%s", entry->machine_id);
- if (var) {
- CHAR16 *s;
-
- if (efivar_get(var, &s) == EFI_SUCCESS) {
- if (entry->options) {
- CHAR16 *s2;
-
- s2 = PoolPrint(L"%s %s", entry->options, s);
- FreePool(entry->options);
- entry->options = s2;
- } else
- entry->options = s;
- efivar_set(var, NULL, TRUE);
- }
- FreePool(var);
- }
- }
-
entry->device = device;
entry->file = StrDuplicate(file);
len = StrLen(entry->file);
continue;
if (f->Attribute & EFI_FILE_DIRECTORY)
continue;
+
len = StrLen(f->FileName);
if (len < 6)
continue;
if (StriCmp(f->FileName + len - 5, L".conf") != 0)
continue;
+ if (StrnCmp(f->FileName, L"auto-", 5) == 0)
+ continue;
len = file_read(entries_dir, f->FileName, 0, 0, &content);
if (len > 0)
/* do not boot right away into auto-detected entries */
entry->no_autoselect = TRUE;
- /* export identifiers of automatically added entries */
- if (config->entries_auto) {
- CHAR16 *s;
-
- s = PoolPrint(L"%s %s", config->entries_auto, file);
- FreePool(config->entries_auto);
- config->entries_auto = s;
- } else
- config->entries_auto = StrDuplicate(file);
-
return TRUE;
}
FreePool(config->entry_default_pattern);
FreePool(config->options_edit);
FreePool(config->entry_oneshot);
- FreePool(config->entries_auto);
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
/* export the device path this image is started from */
device_path = DevicePathFromHandle(loaded_image->DeviceHandle);
if (device_path) {
- CHAR16 *str;
EFI_DEVICE_PATH *path, *paths;
- str = DevicePathToStr(device_path);
- efivar_set(L"LoaderDeviceIdentifier", str, FALSE);
- FreePool(str);
-
paths = UnpackDevicePath(device_path);
for (path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
HARDDRIVE_DEVICE_PATH *drive;
config_entry_add_loader_auto(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path,
L"auto-efi-default", '\0', L"EFI Default Loader", L"\\EFI\\Boot\\boot" EFI_MACHINE_TYPE_NAME ".efi");
config_entry_add_osx(&config);
- efivar_set(L"LoaderEntriesAuto", config.entries_auto, FALSE);
if (efivar_get_raw(&global_guid, L"OsIndicationsSupported", &b, &size) == EFI_SUCCESS) {
UINT64 osind = (UINT64)*b;