summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-31 09:21:13 +0100
committerGitHub <noreply@github.com>2019-10-31 09:21:13 +0100
commit673d873a42fd6e7821e310cfb81bc37d092c4a22 (patch)
tree5c5e4372775885533db8fa8aef1ddc52c6487623
parent20bae8b94d34d75fe2572738e466abc37563bf88 (diff)
parentd9690d8fe9016783ef164c9a006e30987c359c6f (diff)
downloadsystemd-673d873a42fd6e7821e310cfb81bc37d092c4a22.tar.gz
systemd-673d873a42fd6e7821e310cfb81bc37d092c4a22.tar.bz2
systemd-673d873a42fd6e7821e310cfb81bc37d092c4a22.zip
Merge pull request #13510 from medhefgo/boot
sd-boot: Be silent on regular boots
-rw-r--r--src/boot/efi/boot.c14
-rw-r--r--src/boot/efi/meson.build8
-rw-r--r--src/boot/efi/random-seed.c27
3 files changed, 18 insertions, 31 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index fd0c972951..fb7abd1f38 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -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;
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index b8fd5105d0..3edabfedd5 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -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),
diff --git a/src/boot/efi/random-seed.c b/src/boot/efi/random-seed.c
index 4141ee01b2..cc747993b8 100644
--- a/src/boot/efi/random-seed.c
+++ b/src/boot/efi/random-seed.c
@@ -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;
}