[PATCH] kbuild: Use relative paths in generated .incbin directives

Simon Glass sjg at chromium.org
Wed Mar 25 14:08:09 CET 2026


The generated .S files for fonts, splash screens and EFI apps use
.incbin with the full prerequisite path. When building with O= this
bakes an absolute path into the .S file. If the build directory is
later used on a different machine (e.g. in a container), the assembler
cannot find the source file.

Use $(src)/$(notdir $<) instead of $< so the .incbin directive contains
a source-relative path like drivers/video/fonts/nimbus_sans_l_regular.ttf
rather than an absolute one. Add -Wa,-I$(srctree) to the assembler
flags so the assembler can resolve these paths.

The DTB and DTBO rules are left unchanged since their prerequisites are
generated files in the build directory.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 scripts/Makefile.lib | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7386353e0cc..e44120ea0c0 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -219,6 +219,7 @@ c_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)    \
 		 $(basename_flags) $(modname_flags)
 
 a_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
+		 -Wa,-I$(srctree)                                   \
 		 $(_a_flags) $(modkern_aflags)
 
 cpp_flags      = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
@@ -520,7 +521,7 @@ cmd_S_ttf=						\
 	echo '.balign 16';				\
 	echo '.global __ttf_$(*F)_begin';		\
 	echo '__ttf_$(*F)_begin:';			\
-	echo '.incbin "$<" ';				\
+	echo '.incbin "$(src)/$(notdir $<)" ';				\
 	echo '__ttf_$(*F)_end:';			\
 	echo '.global __ttf_$(*F)_end';			\
 	echo '.balign 16';				\
@@ -541,7 +542,7 @@ cmd_S_splash=						\
 	echo '.balign 16';				\
 	echo '.global __splash_$(*F)_begin';		\
 	echo '__splash_$(*F)_begin:';			\
-	echo '.incbin "$<" ';				\
+	echo '.incbin "$(src)/$(notdir $<)" ';				\
 	echo '__splash_$(*F)_end:';			\
 	echo '.global __splash_$(*F)_end';			\
 	echo '.balign 16';				\
@@ -562,7 +563,7 @@ cmd_S_efi=					\
 	echo '.balign 16';			\
 	echo '.global __efi_$*_begin';		\
 	echo '__efi_$*_begin:';			\
-	echo '.incbin "$<" ';			\
+	echo '.incbin "$(src)/$(notdir $<)" ';			\
 	echo '__efi_$*_end:';			\
 	echo '.global __efi_$*_end';		\
 	echo '.balign 16';			\
-- 
2.43.0

base-commit: 1ffc541eafc96d5eebcf837ab892dccec3b93568
branch: font-us


More information about the U-Boot mailing list