[PATCH v3 2/2] kbuild: Use if_changed for font and splash .incbin rules

Simon Glass sjg at chromium.org
Mon Apr 13 15:16:21 CEST 2026


Hi Rasmus,

On Thu, 9 Apr 2026 at 01:01, Rasmus Villemoes <ravi at prevas.dk> wrote:
>
> On Sun, Apr 05 2026, Simon Glass <sjg at chromium.org> wrote:
>
> > 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.
> >
> > Suggested-by: Rasmus Villemoes <ravi at prevas.dk>
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v3:
> > - Use if_changed with compound suffixes (.ttf.o, .bmp.o)
> >
> > Changes in v2:
> > - Move U-Boot .incbin rules to Makefile.lib-u-boot first (previous patch)
> > - Drop the EFI .incbin change since .efi files are generated, not source
> > - Use per-file AFLAGS instead of modifying a_flags in Makefile.lib
> >
>
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index e625f99986e..067c38c4cdd 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -438,7 +438,9 @@ intermediate_targets = $(foreach sfx, $(2), \
> >  targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
> >          $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
> >          $(call intermediate_targets, .lex.o, .lex.c) \
> > -        $(call intermediate_targets, .tab.o, .tab.c .tab.h)
> > +        $(call intermediate_targets, .tab.o, .tab.c .tab.h) \
> > +        $(call intermediate_targets, .ttf.o, .ttf.S) \
> > +        $(call intermediate_targets, .bmp.o, .bmp.S)
>
> Do these extra lines need to go here, causing a conflict with the next
> kbuild sync, or could one instead add
>
>   targets += $(call intermediate_targets, .ttf.o, .ttf.S) \
>              $(call intermediate_targets, .bmp.o, .bmp.S)
>
> in the new Makefile.lib-u-boot? I think that would make more sense. But
> there may be some ordering of makefile includes that makes that not
> posssible.
>
> At the very least, I think the additions to targets should go in a new
> 'targets +=', just to separate them a little better from upstream and
> making it pure code addition instead of having to modify that last line
> to add a continuation marker.

OK I did the latter and updated the commit msg with why the former can't work.

Regards,
Simon

>
> Rasmus


More information about the U-Boot mailing list