enum loader_type type;
CHAR16 *loader;
CHAR16 *options;
- CHAR16 *splash;
CHAR16 key;
EFI_STATUS (*call)(VOID);
BOOLEAN no_autoselect;
UINTN timeout_sec_config;
INTN timeout_sec_efivar;
CHAR16 *entry_default_pattern;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background;
CHAR16 *entry_oneshot;
CHAR16 *options_edit;
CHAR16 *entries_auto;
return -1;
}
-static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_image_path) {
+static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
UINT64 key;
UINTN i;
CHAR16 *s;
UINTN x;
UINTN y;
UINTN size;
- EFI_STATUS err;
- UINTN color = 0;
- const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *pixel = config->background;
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK);
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
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);
- if (config->background)
- Print(L"background '#%02x%02x%02x'\n",
- config->background->Red, config->background->Green, config->background->Blue);
Print(L"\n");
Print(L"config entry count: %d\n", config->entry_count);
break;
entry = config->entries[i];
-
- if (entry->splash) {
- UINT8 *content = NULL;
- INTN len;
-
- len = file_read(root_dir, entry->splash, 0, 0, &content);
- if (len > 0) {
- for (;;) {
- static const EFI_GRAPHICS_OUTPUT_BLT_PIXEL colors[] = {
- { .Red = 0xff, .Green = 0xff, .Blue = 0xff },
- { .Red = 0xc0, .Green = 0xc0, .Blue = 0xc0 },
- { .Red = 0xff, .Green = 0, .Blue = 0 },
- { .Red = 0, .Green = 0xff, .Blue = 0 },
- { .Red = 0, .Green = 0, .Blue = 0xff },
- { .Red = 0, .Green = 0, .Blue = 0 },
- };
-
- err = graphics_splash(content, len, pixel);
- if (EFI_ERROR(err))
- break;
-
- /* 'b' rotates through background colors */
- console_key_read(&key, TRUE);
- if (key != KEYPRESS(0, 0, 'b'))
- break;
- pixel = &colors[color++];
- if (color == ELEMENTSOF(colors))
- color = 0;
- }
- }
-
- FreePool(content);
- graphics_mode(FALSE);
- uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
- }
-
Print(L"config entry: %d/%d\n", i+1, config->entry_count);
if (entry->file)
Print(L"file '%s'\n", entry->file);
Print(L"loader '%s'\n", entry->loader);
if (entry->options)
Print(L"options '%s'\n", entry->options);
- if (entry->splash)
- Print(L"splash '%s'\n", entry->splash);
Print(L"auto-select %s\n", entry->no_autoselect ? L"no" : L"yes");
if (entry->call)
Print(L"internal call yes\n");
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
}
-static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, EFI_FILE *root_dir, CHAR16 *loaded_image_path) {
+static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, CHAR16 *loaded_image_path) {
EFI_STATUS err;
UINTN visible_max;
UINTN idx_highlight;
break;
case KEYPRESS(0, 0, 'P'):
- print_status(config, root_dir, loaded_image_path);
+ print_status(config, loaded_image_path);
refresh = TRUE;
break;
FreePool(new);
continue;
}
-
- if (strcmpa((CHAR8 *)"splash", key) == 0) {
- FreePool(entry->splash);
- entry->splash = stra_to_path(value);
- continue;
- }
}
if (entry->type == LOADER_UNDEFINED) {
FreePool(config->options_edit);
FreePool(config->entry_oneshot);
FreePool(config->entries_auto);
- FreePool(config->background);
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
ZeroMem(&config, sizeof(Config));
config_load(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path);
- if (!config.background) {
- config.background = AllocateZeroPool(sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- if (StriCmp(L"Apple", ST->FirmwareVendor) == 0) {
- config.background->Red = 0xc0;
- config.background->Green = 0xc0;
- config.background->Blue = 0xc0;
- }
- }
-
/* if we find some well-known loaders, add them to the end of the list */
config_entry_add_linux(&config, loaded_image, root_dir);
config_entry_add_loader_auto(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path,
if (menu) {
efivar_set_time_usec(L"LoaderTimeMenuUSec", 0);
uefi_call_wrapper(BS->SetWatchdogTimer, 4, 0, 0x10000, 0, NULL);
- if (!menu_run(&config, &entry, root_dir, loaded_image_path))
+ if (!menu_run(&config, &entry, loaded_image_path))
break;
/* run special entry like "reboot" */
entry->call();
continue;
}
- } else if (entry->splash) {
- UINT8 *content = NULL;
- INTN len;
-
- len = file_read(root_dir, entry->splash, 0, 0, &content);
- if (len > 0)
- graphics_splash(content, len, config.background);
-
- FreePool(content);
}
/* export the selected boot entry to the system */
uefi_call_wrapper(BS->SetWatchdogTimer, 4, 5 * 60, 0x10000, 0, NULL);
err = image_start(image, &config, entry);
-
- if (err == EFI_ACCESS_DENIED || err == EFI_SECURITY_VIOLATION) {
- /* Platform is secure boot and requested image isn't
- * trusted. Need to go back to prior boot system and
- * install more keys or hashes. Signal failure by
- * returning the error */
- Print(L"\nImage %s gives a security error\n", entry->title);
- Print(L"Please enrol the hash or signature of %s\n", entry->loader);
+ if (EFI_ERROR(err)) {
+ graphics_mode(FALSE);
+ Print(L"\nFailed to execute %s (%s): %r\n", entry->title, entry->loader, err);
uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);
goto out;
}