[PATCH] kbuild: Use relative paths in generated .incbin directives
Simon Glass
sjg at chromium.org
Thu Mar 26 12:52:36 CET 2026
Hi Tom,
On Wed, 25 Mar 2026 at 13:53, Tom Rini <trini at konsulko.com> wrote:
>
> On Wed, Mar 25, 2026 at 01:21:54PM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Wed, 25 Mar 2026 at 12:26, Tom Rini <trini at konsulko.com> wrote:
> > >
> > > On Wed, Mar 25, 2026 at 11:57:17AM -0600, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Wed, 25 Mar 2026 at 11:15, Tom Rini <trini at konsulko.com> wrote:
> > > > >
> > > > > On Wed, Mar 25, 2026 at 11:12:00AM -0600, Simon Glass wrote:
> > > > > > 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.
> > > > >
> > > > > Shouldn't we be generating these files in to the build directory too?
> > > >
> > > > These are actually source files, e.g.
> > > > drivers/video/fonts/nimbus_sans_l_regular.ttf
> > >
> > > So, the first thing then is that S_ttf is a local U-Boot rule. Lets
> > > start by moving this out of scripts/Makefile.lib to
> > > scripts/Makefile.lib-u-boot as that will make future re-sync work easier
> > > (and is something we've talked about in the re-sync threads, splitting
> > > U-Boot specific stuff out to new files). Then 2/2 of that series can be
> > > this change, thanks.
> >
> > Almost, but I still need the a_flags change.
>
> Think a bit on how to solve that without touching the files that we
> really want to have no delta with upstream on please. It's 5 files,
> adding AFLAGS_foo.o += ... to the fonts Makefile and a note doesn't seem
> bad and reduces the chances of the a_flags part being lost in a future
> resync to zero.
I don't like it very much, but I'll send a v2 along these lines.
Regards,
Simon
More information about the U-Boot
mailing list