boot: efi - remove default boot splash handling

This commit is contained in:
Kay Sievers 2015-02-25 15:56:54 +01:00
parent 036a4773ff
commit a19b0678be
4 changed files with 44 additions and 114 deletions

View file

@ -65,7 +65,6 @@ typedef struct {
UINTN timeout_sec_config;
INTN timeout_sec_efivar;
CHAR16 *entry_default_pattern;
CHAR16 *splash;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background;
CHAR16 *entry_oneshot;
CHAR16 *options_edit;
@ -371,40 +370,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK);
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
/* show splash and wait for key */
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 = EFI_NOT_FOUND;
if (config->splash)
err = graphics_splash(root_dir, config->splash, pixel);
if (EFI_ERROR(err))
err = graphics_splash(root_dir, L"\\EFI\\systemd\\splash.bmp", pixel);
if (EFI_ERROR(err))
break;
/* 'b' rotates through background colors */
console_key_read(&key, TRUE);
if (key == KEYPRESS(0, 0, 'b')) {
pixel = &colors[color++];
if (color == ELEMENTSOF(colors))
color = 0;
continue;
}
graphics_mode(FALSE);
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
break;
}
Print(L"systemd-boot version: " VERSION "\n");
Print(L"architecture: " EFI_MACHINE_TYPE_NAME "\n");
Print(L"loaded image: %s\n", loaded_image_path);
@ -437,13 +402,9 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag
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->splash)
Print(L"splash '%s'\n", config->splash);
if (config->background)
Print(L"background '#%02x%02x%02x'\n",
config->background->Red,
config->background->Green,
config->background->Blue);
config->background->Red, config->background->Green, config->background->Blue);
Print(L"\n");
Print(L"config entry count: %d\n", config->entry_count);
@ -481,11 +442,38 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag
entry = config->entries[i];
if (entry->splash) {
err = graphics_splash(root_dir, entry->splash, config->background);
if (!EFI_ERROR(err)) {
console_key_read(&key, TRUE);
graphics_mode(FALSE);
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);
@ -1064,41 +1052,6 @@ static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
StrLwr(config->entry_default_pattern);
continue;
}
if (strcmpa((CHAR8 *)"splash", key) == 0) {
FreePool(config->splash);
config->splash = stra_to_path(value);
continue;
}
if (strcmpa((CHAR8 *)"background", key) == 0) {
CHAR16 c[3];
/* accept #RRGGBB hex notation */
if (value[0] != '#')
continue;
if (value[7] != '\0')
continue;
FreePool(config->background);
config->background = AllocateZeroPool(sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if (!config->background)
continue;
c[0] = value[1];
c[1] = value[2];
c[2] = '\0';
config->background->Red = xtoi(c);
c[0] = value[3];
c[1] = value[4];
config->background->Green = xtoi(c);
c[0] = value[5];
c[1] = value[6];
config->background->Blue = xtoi(c);
continue;
}
}
}
@ -1596,9 +1549,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;
/* do not show a splash; they do not need one, or they draw their own */
entry->splash = StrDuplicate(L"");
/* export identifiers of automatically added entries */
if (config->entries_auto) {
CHAR16 *s;
@ -1811,7 +1761,6 @@ static VOID config_free(Config *config) {
FreePool(config->options_edit);
FreePool(config->entry_oneshot);
FreePool(config->entries_auto);
FreePool(config->splash);
FreePool(config->background);
}
@ -1972,25 +1921,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
entry->call();
continue;
}
} else {
err = EFI_NOT_FOUND;
} else if (entry->splash) {
UINT8 *content = NULL;
INTN len;
/* splash from entry file */
if (entry->splash) {
/* some entries disable the splash because they draw their own */
if (entry->splash[0] == '\0')
err = EFI_SUCCESS;
else
err = graphics_splash(root_dir, entry->splash, config.background);
}
len = file_read(root_dir, entry->splash, 0, 0, &content);
if (len > 0)
graphics_splash(content, len, config.background);
/* splash from config file */
if (EFI_ERROR(err) && config.splash)
err = graphics_splash(root_dir, config.splash, config.background);
/* default splash */
if (EFI_ERROR(err))
graphics_splash(root_dir, L"\\EFI\\systemd\\splash.bmp", config.background);
FreePool(content);
}
/* export the selected boot entry to the system */

View file

@ -321,12 +321,9 @@ EFI_STATUS bmp_to_blt(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *buf,
return EFI_SUCCESS;
}
EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path,
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background) {
EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background) {
EFI_GUID GraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput = NULL;
UINT8 *content;
INTN len;
struct bmp_dib *dib;
struct bmp_map *map;
UINT8 *pixmap;
@ -340,10 +337,6 @@ EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path,
if (EFI_ERROR(err))
return err;
len = file_read(root_dir, path, 0, 0, &content);
if (len < 0)
return EFI_LOAD_ERROR;
err = bmp_parse_header(content, len, &dib, &map, &pixmap);
if (EFI_ERROR(err))
goto err;
@ -384,6 +377,5 @@ EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path,
dib->x, dib->y, 0);
err:
FreePool(blt);
FreePool(content);
return err;
}

View file

@ -21,6 +21,5 @@
#define __SDBOOT_GRAPHICS_H
EFI_STATUS graphics_mode(BOOLEAN on);
EFI_STATUS graphics_splash(EFI_FILE *root_dir, CHAR16 *path,
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background);
EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background);
#endif

View file

@ -13,7 +13,7 @@ mount ${LOOP}p1 mnt
mkdir -p mnt/EFI/{Boot,systemd}
cp systemd-bootx64.efi mnt/EFI/Boot/bootx64.efi
cp test/splash.bmp mnt/EFI/systemd/
cp test/splash.bmp mnt/
[ -e /boot/shellx64.efi ] && cp /boot/shellx64.efi mnt/
@ -28,8 +28,8 @@ objcopy \
# install entries
mkdir -p mnt/loader/entries
echo -e "timeout 3\nsplash /EFI/systemd/splash.bmp\n" > mnt/loader/loader.conf
echo -e "title Test\nefi /test\n" > mnt/loader/entries/test.conf
echo -e "timeout 3\n" > mnt/loader/loader.conf
echo -e "title Test\nefi /test\nsplash /splash.bmp\n" > mnt/loader/entries/test.conf
echo -e "title Test2\nlinux /test2\noptions option=yes word number=1000 more\n" > mnt/loader/entries/test2.conf
echo -e "title Test3\nlinux /test3\n" > mnt/loader/entries/test3.conf
echo -e "title Test4\nlinux /test4\n" > mnt/loader/entries/test4.conf