summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/systemd-boot/systemd-boot/0001-partially-revert-sd-boot-stub-Obtain-PE-section-offs.patch
blob: 6d7b144da836f8b285b4845e109e45779ebb4f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From beb095f41d458b7d684c0cd6cac1749e2fc3f29b Mon Sep 17 00:00:00 2001
From: California Sullivan <california.l.sullivan@intel.com>
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 <california.l.sullivan@intel.com>
---
 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