X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fboot%2Fefi%2Fboot.c;h=3f8140ebff0d30477258d2a997a68e33346a515d;hb=9d3dec15ae8ac6153038c9b994e6c4fc22045180;hp=0990fb80f9ee8eb0317c7e811697c2ad7c1f9f36;hpb=2f8d336478536af789d654599f9523d02e0ca693;p=elogind.git diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 0990fb80f..3f8140ebf 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -21,7 +21,6 @@ #include "util.h" #include "console.h" #include "graphics.h" -#include "splash.h" #include "pefile.h" #include "linux.h" @@ -50,7 +49,6 @@ typedef struct { enum loader_type type; CHAR16 *loader; CHAR16 *options; - CHAR16 *splash; CHAR16 key; EFI_STATUS (*call)(VOID); BOOLEAN no_autoselect; @@ -68,7 +66,6 @@ typedef struct { CHAR16 *entry_default_pattern; CHAR16 *entry_oneshot; CHAR16 *options_edit; - CHAR16 *entries_auto; } Config; static VOID cursor_left(UINTN *cursor, UINTN *first) @@ -355,7 +352,7 @@ static UINTN entry_lookup_key(Config *config, UINTN start, CHAR16 key) { 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; @@ -363,9 +360,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag UINTN x; UINTN y; UINTN size; - EFI_STATUS err; - UINTN color = 0; - const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *pixel = NULL; uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK); uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut); @@ -414,10 +408,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag 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); @@ -437,42 +427,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag 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); @@ -498,8 +452,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag 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"); @@ -511,7 +463,7 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag 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; @@ -835,7 +787,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, EFI_FILE *ro break; case KEYPRESS(0, 0, 'P'): - print_status(config, root_dir, loaded_image_path); + print_status(config, loaded_image_path); refresh = TRUE; break; @@ -1145,12 +1097,6 @@ static VOID config_entry_add_from_file(Config *config, EFI_HANDLE *device, CHAR1 FreePool(new); continue; } - - if (strcmpa((CHAR8 *)"splash", key) == 0) { - FreePool(entry->splash); - entry->splash = stra_to_path(value); - continue; - } } if (entry->type == LOADER_UNDEFINED) { @@ -1175,46 +1121,6 @@ static VOID config_entry_add_from_file(Config *config, EFI_HANDLE *device, CHAR1 } 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); @@ -1265,11 +1171,14 @@ static VOID config_load(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir, 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) @@ -1546,16 +1455,6 @@ static BOOLEAN config_entry_add_loader_auto(Config *config, EFI_HANDLE *device, /* 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; } @@ -1757,7 +1656,6 @@ static VOID config_free(Config *config) { 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) { @@ -1795,13 +1693,8 @@ 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; @@ -1847,7 +1740,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { 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; @@ -1900,7 +1792,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { 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" */ @@ -1908,15 +1800,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { 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, NULL); - - FreePool(content); } /* export the selected boot entry to the system */