Compare commits

...

5 Commits

Author SHA1 Message Date
Jóhann B. Guðmundsson 294eeed144 Update to Fedora31 2019-10-31 16:13:08 +01:00
Zbigniew Jędrzejewski-Szmek 673d873a42
Merge pull request #13510 from medhefgo/boot
sd-boot: Be silent on regular boots
2019-10-31 09:21:13 +01:00
Jan Janssen d9690d8fe9 sd-boot: Silence compiler warning when building with -O2 2019-10-30 17:47:55 +01:00
Jan Janssen 391719682b sd-boot: Don't loudly complain if RNG protocol isn't available
Fixes #13503
2019-10-30 17:47:50 +01:00
Jan Janssen 9ea4d81c12 sd-boot: Only disable optimization on debug builds 2019-10-30 17:34:12 +01:00
4 changed files with 19 additions and 32 deletions

View File

@ -5,7 +5,7 @@
[Distribution]
Distribution=fedora
Release=30
Release=31
[Output]
Format=raw_btrfs

View File

@ -515,7 +515,6 @@ static BOOLEAN menu_run(
BOOLEAN exit = FALSE;
BOOLEAN run = TRUE;
BOOLEAN wait = FALSE;
BOOLEAN cleared_screen = FALSE;
graphics_mode(FALSE);
uefi_call_wrapper(ST->ConIn->Reset, 2, ST->ConIn, FALSE);
@ -527,16 +526,13 @@ static BOOLEAN menu_run(
if (config->console_mode_change != CONSOLE_MODE_KEEP) {
err = console_set_mode(&config->console_mode, config->console_mode_change);
if (!EFI_ERROR(err))
cleared_screen = TRUE;
}
if (!cleared_screen)
if (EFI_ERROR(err)) {
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
Print(L"Error switching console mode to %ld: %r.\r", (UINT64)config->console_mode, err);
}
} else
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
if (config->console_mode_change != CONSOLE_MODE_KEEP && EFI_ERROR(err))
Print(L"Error switching console mode to %ld: %r.\r", (UINT64)config->console_mode, err);
err = uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut, ST->ConOut->Mode->Mode, &x_max, &y_max);
if (EFI_ERROR(err)) {
x_max = 80;

View File

@ -113,7 +113,6 @@ if have_gnu_efi
'-Wextra',
'-std=gnu90',
'-nostdinc',
'-ggdb', '-O0',
'-fpic',
'-fshort-wchar',
'-ffreestanding',
@ -138,6 +137,13 @@ if have_gnu_efi
if get_option('werror') == true
compile_args += ['-Werror']
endif
if get_option('buildtype') == 'debug'
compile_args += ['-ggdb', '-O0']
elif get_option('buildtype') == 'debugoptimized'
compile_args += ['-ggdb', '-Og']
else
compile_args += ['-O2']
endif
efi_ldflags = ['-T',
join_paths(efi_ldsdir, arch_lds),

View File

@ -23,14 +23,10 @@ static EFI_STATUS acquire_rng(UINTN size, VOID **ret) {
/* Try to acquire the specified number of bytes from the UEFI RNG */
err = LibLocateProtocol((EFI_GUID*) &rng_protocol_guid, (VOID**) &rng);
if (EFI_ERROR(err)) {
Print(L"Failed to acquire RNG protocol: %r\n", err);
if (EFI_ERROR(err))
return err;
}
if (!rng) {
/* Print(L"RNG protocol not available.\n"); */
if (!rng)
return EFI_UNSUPPORTED;
}
data = AllocatePool(size);
if (!data)
@ -233,36 +229,25 @@ EFI_STATUS process_random_seed(EFI_FILE *root_dir, RandomSeedMode mode) {
validate_sha256();
if (mode == RANDOM_SEED_OFF) {
/* Print(L"Random seed handling turned off.\n"); */
if (mode == RANDOM_SEED_OFF)
return EFI_NOT_FOUND;
}
/* Let's better be safe than sorry, and for now disable this logic in SecureBoot mode, so that we
* don't credit a random seed that is not authenticated. */
if (secure_boot_enabled()) {
/* Print(L"Not loading random seed, because we are in SecureBoot mode.\n"); */
if (secure_boot_enabled())
return EFI_NOT_FOUND;
}
/* Get some system specific seed that the installer might have placed in an EFI variable. We include
* it in our hash. This is protection against golden master image sloppiness, and it remains on the
* system, even when disk images are duplicated or swapped out. */
err = acquire_system_token(&system_token, &system_token_size);
if (mode != RANDOM_SEED_ALWAYS) {
/* if (err == EFI_NOT_FOUND) */
/* Print(L"Not loading random seed, because no system token is set.\n"); */
if (EFI_ERROR(err))
return err; /* in all other error cases we already logged */
}
if (mode != RANDOM_SEED_ALWAYS && EFI_ERROR(err))
return err;
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &handle, L"\\loader\\random-seed", EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0ULL);
if (EFI_ERROR(err)) {
if (err != EFI_NOT_FOUND)
Print(L"Failed to open random seed file: %r\n", err);
/* else */
/* Print(L"Not loading random seed, because there is none.\n"); */
return err;
}