From: Jan Kiszka <[email protected]>

EDK2 does not support this yet. We can live without it if the user
provides DTBs with the required carve-outs hard-coded. Therefore, issue
a warning and install the embedded DTB directly.

Signed-off-by: Jan Kiszka <[email protected]>
---
 kernel-stub/fdt.c         | 12 ++++++++++--
 kernel-stub/kernel-stub.h |  1 +
 kernel-stub/main.c        |  2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/kernel-stub/fdt.c b/kernel-stub/fdt.c
index ab5c1e6..8858773 100644
--- a/kernel-stub/fdt.c
+++ b/kernel-stub/fdt.c
@@ -162,12 +162,20 @@ VOID replace_fdt(const VOID *fdt)
 
        status = LibLocateProtocol(&EfiDtFixupProtocol, (VOID **)&protocol);
        if (EFI_ERROR(status)) {
-               error_exit(L"Did not find device tree fixup protocol", status);
+               info(L"Firmware does not provide device tree fixup protocol");
+
+               status = BS->InstallConfigurationTable(&EfiDtbTableGuid,
+                                                      (VOID *) fdt);
+               if (EFI_ERROR(status)) {
+                       error_exit(L"Failed to install alternative device tree",
+                                  status);
+               }
+               return;
        }
 
        /* Find out which size we need */
        size = 0;
-       status = protocol->Fixup(protocol, (VOID *)fdt, &size,
+       status = protocol->Fixup(protocol, (VOID *) fdt, &size,
                                 EFI_DT_APPLY_FIXUPS);
        if (status != EFI_BUFFER_TOO_SMALL) {
                error_exit(L"Device tree fixup: unexpected error", status);
diff --git a/kernel-stub/kernel-stub.h b/kernel-stub/kernel-stub.h
index 4944355..2b31464 100644
--- a/kernel-stub/kernel-stub.h
+++ b/kernel-stub/kernel-stub.h
@@ -15,6 +15,7 @@
 #include <efi.h>
 
 VOID __attribute__((noreturn)) error_exit(CHAR16 *message, EFI_STATUS status);
+VOID info(CHAR16 *message);
 
 const VOID *get_fdt_compatible(VOID);
 BOOLEAN match_fdt(const VOID *fdt, const CHAR8 *compatible);
diff --git a/kernel-stub/main.c b/kernel-stub/main.c
index c9517a5..9dc14ed 100644
--- a/kernel-stub/main.c
+++ b/kernel-stub/main.c
@@ -71,7 +71,7 @@ VOID __attribute__((noreturn)) error_exit(CHAR16 *message, 
EFI_STATUS status)
        __builtin_unreachable();
 }
 
-static VOID info(CHAR16 *message)
+VOID info(CHAR16 *message)
 {
        Print(L"Unified kernel stub: %s\n", message);
 }
-- 
2.35.3

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/7e9d5fe867f7ba6817fd39cfc4c20fa5b0e7a289.1656320533.git.jan.kiszka%40siemens.com.

Reply via email to