[PATCH 1/3] efi: Correct logic for OF_EMBED and OF_SEPARATE co-existing

Simon Glass sjg at chromium.org
Wed Dec 11 01:45:01 CET 2024


While we do plan to switch to OF_SEPARATE now it is supported, it seems
worth at least showing how OF_EMBED could be used instead, just for the
record.

So make the Makefile rule conditional on OF_SEPARATE and adjust fdtdec
to avoid a build error when OF_EMBED is used.

Finally. the dtb symbol has a double underscore, so update it to avoid a
build warning.

With future patches, OF_EMBED will no-longer be used with the EFI app,
so it is expected that it will eventually stop working.

Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: 2e7bf25f6bf ("Support separate DTB files with the UEFI app")
---

 Makefile                       | 2 +-
 include/asm-generic/sections.h | 2 +-
 lib/fdtdec.c                   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index d46ff166a00..cbc0feff279 100644
--- a/Makefile
+++ b/Makefile
@@ -1678,7 +1678,7 @@ endif # CONFIG_X86
 
 OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)
 u-boot-app.efi: u-boot dts/dt.dtb FORCE
-	$(call if_changed,embeddtb)
+	$(if $(CONFIG_OF_SEPARATE),$(call if_changed,embeddtb))
 	$(call if_changed,zobjcopy)
 
 u-boot.bin.o: u-boot.bin FORCE
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 4113ea2a866..5b040d0acd0 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -70,7 +70,7 @@ extern char __image_copy_start[], __image_copy_end[];
 extern char __bss_end[];
 extern char __rel_dyn_start[], __rel_dyn_end[];
 extern char _image_binary_end[];
-extern char _dtb[];
+extern char __dtb[];
 
 /*
  * This is the U-Boot entry point - prior to relocation it should be same
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index c1eb1c9f825..a5f55cc6223 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1236,7 +1236,7 @@ static void *fdt_find_separate(void)
 		fdt_blob = (ulong *)_image_binary_end;
 	else
 		fdt_blob = (ulong *)__bss_end;
-#elif defined CONFIG_EFI_APP
+#elif defined CONFIG_EFI_APP && defined CONFIG_OF_SEPARATE
 	/* FDT is in a separate section */
 	fdt_blob = (ulong *)__dtb;
 #else
-- 
2.34.1



More information about the U-Boot mailing list