[Concept,10/17] ulib: x86: Add demo-app.efi target for EFI app builds

Message ID 20260216013511.4079770-11-sjg@u-boot.org
State New
Headers
Series ulib: Add multi-arch demo and EFI app support |

Commit Message

Simon Glass Feb. 16, 2026, 1:34 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The x86 example targets currently only produce raw binaries
(demo-nodtb.bin), which do not work for EFI app builds that need PE
format output.

Add an EFI-specific path that embeds the DTB and converts the demo
ELF to a PE binary (demo-app.efi), following the same flow as
u-boot-app.efi. Non-EFI builds continue to produce demo-nodtb.bin as
before.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 scripts/Makefile.ulib-example | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example
index fd7c60e4483..575dedcfbf2 100644
--- a/scripts/Makefile.ulib-example
+++ b/scripts/Makefile.ulib-example
@@ -31,6 +31,17 @@  examples/ulib/demo: $(example-demo-objs) u-boot FORCE
 	$(call if_changed,u-boot-example)
 	$(EXAMPLE_POST_LINK)
 
+ifeq ($(CONFIG_EFI_APP),y)
+# EFI: embed DTB and convert to PE binary
+OBJCOPYFLAGS_demo-app.efi := $(OBJCOPYFLAGS_EFI)
+examples/ulib/demo-app.efi: examples/ulib/demo dts/dt.dtb FORCE
+	$(if $(CONFIG_OF_SEPARATE),$(call if_changed,embeddtb))
+	$(call if_changed,zobjcopy)
+
+examples_$(EXAMPLE_ARCH): \
+		$(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e)-app.efi) FORCE
+	@:
+else
 # Binary target (without DTB)
 OBJCOPYFLAGS_demo-nodtb.bin = $(OBJCOPYFLAGS_u-boot-nodtb.bin)
 examples/ulib/demo-nodtb.bin: examples/ulib/demo FORCE
@@ -49,3 +60,4 @@  examples_$(EXAMPLE_ARCH): \
 		$(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e)-nodtb.bin) FORCE
 	@:
 endif
+endif # CONFIG_EFI_APP