From: Lennart Poettering Date: Mon, 25 Jul 2022 15:40:32 +0000 (+0200) Subject: stub: override StubInfo EFI variable unconditionally, since *we* own it X-Git-Tag: v252-rc1~568 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24120e40383e8aeb4e743501210211f6b1775237;p=thirdparty%2Fsystemd.git stub: override StubInfo EFI variable unconditionally, since *we* own it The other variables are owned by the boot menu (i.e. sd-boot), we only fill those in if it didn't do so for us (to support cases where our stub kernel is directly invoked by UEFI). But StubInfo is genuinely about the stub, hence let's simplify things and unconditionally set it from the stub. --- diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index 2acd5e57385..83badd96cda 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -142,9 +142,9 @@ static void export_variables(EFI_LOADED_IMAGE_PROTOCOL *loaded_image) { efivar_set(LOADER_GUID, L"LoaderFirmwareType", s, 0); } - /* add StubInfo */ - if (efivar_get_raw(LOADER_GUID, L"StubInfo", NULL, NULL) != EFI_SUCCESS) - efivar_set(LOADER_GUID, L"StubInfo", L"systemd-stub " GIT_VERSION, 0); + /* add StubInfo (this is one is owned by the stub, hence we unconditionally override this with our + * own data) */ + (void) efivar_set(LOADER_GUID, L"StubInfo", L"systemd-stub " GIT_VERSION, 0); } EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {