]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
kbuild: Use if_changed for font and splash .incbin rules
authorSimon Glass <sjg@chromium.org>
Mon, 13 Apr 2026 13:15:38 +0000 (07:15 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 21 Apr 2026 21:56:54 +0000 (15:56 -0600)
The generated .S files for fonts and splash screens 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.

Follow the existing DTB convention: rename the object targets to use
compound suffixes (.ttf.o, .bmp.o), switch the pattern rules from
direct $(call cmd,...) to FORCE + $(call if_changed,...), and register
the new suffixes with intermediate_targets so that kbuild loads their
.cmd files. This lets if_changed detect when the recorded command
(including source paths) has changed and regenerate the .S file
automatically.

The EFI rule is left unchanged since its prerequisite is a generated
file in the build directory, like the DTB and DTBO rules.

The intermediate_targets entries stay in scripts/Makefile.build rather
than moving to scripts/Makefile.lib-u-boot, because that file is
included before intermediate_targets is defined and 'targets' is ':=',
so a '$(call intermediate_targets, ...)' inside it would expand to
empty and silently drop the entries. To keep the upstream block
untouched, the U-Boot additions go in a separate 'targets +=' block
immediately below.

Suggested-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rasmus Villemoes <ravi@prevas.dk>
drivers/video/Makefile
drivers/video/fonts/Makefile
scripts/Makefile.build
scripts/Makefile.lib-u-boot

index 984768ea156d23f5c1f778a0a65229f80432146b..dbc3018d71688277d257489be137cef41a171ffb 100644 (file)
@@ -24,7 +24,7 @@ obj-$(CONFIG_$(PHASE_)PANEL) += panel-uclass.o
 obj-$(CONFIG_PANEL_HX8238D) += hx8238d.o
 obj-$(CONFIG_$(PHASE_)SIMPLE_PANEL) += simple_panel.o
 
-obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o
+obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.bmp.o
 obj-$(CONFIG_$(PHASE_)BMP) += bmp.o
 
 endif
index 1111f92a2c6d18848a37cc259a1f26a4fda32a62..4d32fa4399496e07f6bc5f479992f19385a8df84 100644 (file)
@@ -3,8 +3,8 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
-obj-$(CONFIG_CONSOLE_TRUETYPE_NIMBUS) += nimbus_sans_l_regular.o
-obj-$(CONFIG_CONSOLE_TRUETYPE_ANKACODER) += ankacoder_c75_r.o
-obj-$(CONFIG_CONSOLE_TRUETYPE_RUFSCRIPT) += rufscript010.o
-obj-$(CONFIG_CONSOLE_TRUETYPE_CANTORAONE) += cantoraone_regular.o
-obj-$(CONFIG_CONSOLE_TRUETYPE_DEJAVU) += dejavu_mono.o
+obj-$(CONFIG_CONSOLE_TRUETYPE_NIMBUS) += nimbus_sans_l_regular.ttf.o
+obj-$(CONFIG_CONSOLE_TRUETYPE_ANKACODER) += ankacoder_c75_r.ttf.o
+obj-$(CONFIG_CONSOLE_TRUETYPE_RUFSCRIPT) += rufscript010.ttf.o
+obj-$(CONFIG_CONSOLE_TRUETYPE_CANTORAONE) += cantoraone_regular.ttf.o
+obj-$(CONFIG_CONSOLE_TRUETYPE_DEJAVU) += dejavu_mono.ttf.o
index e625f99986ecabd97bd9a40174681b80883aeaca..73b6769ab905c65f06a59bcda5fc8df126500b36 100644 (file)
@@ -440,6 +440,10 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
           $(call intermediate_targets, .lex.o, .lex.c) \
           $(call intermediate_targets, .tab.o, .tab.c .tab.h)
 
+# Added for U-Boot
+targets += $(call intermediate_targets, .ttf.o, .ttf.S) \
+          $(call intermediate_targets, .bmp.o, .bmp.S)
+
 # Build
 # ---------------------------------------------------------------------------
 
index c55f8d8e0c375558d380951c5995a723edf7b97c..4d60a8eee49b79e14ca0da94cb12f5257bcff205 100644 (file)
@@ -20,8 +20,8 @@ cmd_S_ttf=                                            \
        echo '.balign 16';                              \
 ) > $@
 
-$(obj)/%.S: $(src)/%.ttf
-       $(call cmd,S_ttf)
+$(obj)/%.ttf.S: $(src)/%.ttf FORCE
+       $(call if_changed,S_ttf)
 
 # Splash logos
 # ---------------------------------------------------------------------------
@@ -40,8 +40,8 @@ cmd_S_splash=                                         \
        echo '.balign 16';                              \
 ) > $@
 
-$(obj)/%.S: $(src)/%.bmp
-       $(call cmd,S_splash)
+$(obj)/%.bmp.S: $(src)/%.bmp FORCE
+       $(call if_changed,S_splash)
 
 # EFI applications
 # A Makefile target *.efi is built as EFI application.