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

Simon Glass sjg at chromium.org
Wed Mar 25 18:12:00 CET 2026


Hi Tom,

On Wed, 25 Mar 2026 at 10:54, Tom Rini <trini at konsulko.com> wrote:
>
> On Wed, Mar 25, 2026 at 07:08:09AM -0600, Simon Glass wrote:
> > 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(-)
>
> This is generic kbuild infrastructure now. Is there a fix we're missing
> from upstream, a change we haven't pulled in yet (as we need to keep
> syncing upwards) or a problem upstream too? Thanks!

Linux does this with DTB files in quiet_cmd_wrap_S_dtb:

echo '.incbin "$<" ';

But Linux only uses generated files in the build directory, never
actual source files. The font/splash/EFI .incbin rules are U-Boot
additions that aren't in the upstream kbuild. So Linux doesn't have
this problem.

Regards,
Simon


More information about the U-Boot mailing list