From beb095f41d458b7d684c0cd6cac1749e2fc3f29b Mon Sep 17 00:00:00 2001 From: California Sullivan Date: Wed, 21 Mar 2018 13:01:26 -0700 Subject: [PATCH 1/5] partially revert "sd-boot: stub: Obtain PE section offsets from RAM, not disk (#6250)" Only revert the section for finding the root_dir, as RMC needs this to find its database file. Upstream-Status: Inappropriate [upstream doesn't need the root_dir]. Signed-off-by: California Sullivan --- src/boot/efi/stub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index ff45cebd4..540ca5985 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -30,6 +30,8 @@ static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE; EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { EFI_LOADED_IMAGE *loaded_image; + EFI_FILE *root_dir; + CHAR16 *loaded_image_path; CHAR8 *b; UINTN size; BOOLEAN secure = FALSE; @@ -58,6 +60,13 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { return err; } + root_dir = LibOpenRoot(loaded_image->DeviceHandle); + if (!root_dir) { + Print(L"Unable to open root directory: %r ", err); + uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); + return EFI_LOAD_ERROR; + } + if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) { if (*b > 0) secure = TRUE; -- 2.14.3