Skip to contentSkip to conversation

kbuild: Use relative paths in generated .incbin directives

PATCH In review Simon Glass 2 participants 9 messages Mar 25 – Mar 26 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: Use relative paths in generated .incbin directives

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.

---

 scripts/Makefile.lib | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/Makefile.lib +4 -3
index 7386353e0cc..e44120ea0c0 100644
@@ -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';			\
Signature · 4 lines
2.43.0

base-commit: 1ffc541eafc96d5eebcf837ab892dccec3b93568
branch: font-us
#1 lore raw
Quoted 11 lines · Simon Glass

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.

Quoted 8 lines

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

---

 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!

Signature · 1 line
Tom
#2 lore raw

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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

#3 lore raw
Quoted 29 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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!

Quoted 8 lines

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?

Signature · 1 line
Tom
#4 lore raw

Hi Tom,

Quoted 33 lines · Tom Rini
Quoted 31 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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:

Quoted 8 lines
Quoted 6 lines

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

Regards,
Simon

#5 lore raw
Quoted 43 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 37 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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.

Quoted 4 lines
Quoted 1 line

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.

Signature · 1 line
Tom
#6 lore raw

Hi Tom,

Quoted 50 lines · Tom Rini
Quoted 43 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 37 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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.

Quoted 4 lines
Quoted 1 line

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

Quoted 6 lines

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.

Regards,
Simon

#7 lore raw
Quoted 53 lines · Simon Glass

Hi Tom,

Quoted 50 lines · Tom Rini
Quoted 47 lines · Simon Glass

Hi Tom,

Quoted 33 lines · Tom Rini
Quoted 31 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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:

Quoted 8 lines
Quoted 6 lines

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

Quoted 8 lines
Quoted 6 lines

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.

Signature · 1 line
Tom
#8 lore raw

Hi Tom,

Quoted 62 lines · Tom Rini
Quoted 60 lines · Simon Glass

Hi Tom,

Quoted 56 lines · Tom Rini
Quoted 43 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 37 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 17 lines · Simon Glass

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.

---

Quoted 6 lines
Quoted 2 lines
 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.

Quoted 4 lines
Quoted 1 line

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.

Quoted 7 lines
Quoted 1 line

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