* [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file
@ 2026-08-24 4:47 Suraj Kakade
2026-08-24 15:09 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: Suraj Kakade @ 2026-08-24 4:47 UTC (permalink / raw)
To: u-boot, michal.simek
Cc: git, padmarao.begari, Suraj Kakade, Tom Rini, Rasmus Villemoes,
Simon Glass, Jonathan Humphreys
cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I
path) in the HOSTCC command. With a long $(srctree) that command is
too large for /bin/sh -c and Make fails with "Argument list too
long" while building a .dtb.
Write the flags to a per-target .dtc.flags.tmp file and pass @file to
HOSTCC/CPP so the shell command stays short.
This change requires GNU Make >= 4.0, since $(file ...) is not
supported by Make 3.x.
Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM")
Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules")
Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com>
---
scripts/Makefile.lib | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 24b1a581790..6066abed199 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -448,7 +448,8 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
(cat $< > $(pre-tmp)); \
$(foreach f,$(subst $(quote),,$(dtsi_include_list) $(CONFIG_DEVICE_TREE_INCLUDES)), \
echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
- $(HOSTCC) -E $(dtc_cpp_flags) -I$(obj) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
+ $(file >$(dtc-flags-tmp),$(dtc_cpp_flags) -I$(obj)) \
+ $(HOSTCC) -E @$(dtc-flags-tmp) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
$(DTC) -O dtb -o $@ -b 0 \
-i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) || \
@@ -477,6 +478,7 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FOR
pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
+dtc-flags-tmp = $(subst $(comma),_,$(dot-target).dtc.flags.tmp)
# DTCO
# ---------------------------------------------------------------------------
@@ -486,7 +488,8 @@ quiet_cmd_dtco = DTCO $@
# No generation of assembly file either
# Modified for U-Boot
cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
- $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+ $(file >$(dtc-flags-tmp),$(dtc_cpp_flags)) \
+ $(CPP) @$(dtc-flags-tmp) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
$(DTC) -@ -O dtb -o $@ -b 0 \
-i $(dir $<) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
--
2.43.7
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 2026-08-24 4:47 [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file Suraj Kakade @ 2026-08-24 15:09 ` Tom Rini 2026-08-24 15:29 ` Michal Simek 0 siblings, 1 reply; 6+ messages in thread From: Tom Rini @ 2026-08-24 15:09 UTC (permalink / raw) To: Suraj Kakade Cc: u-boot, michal.simek, git, padmarao.begari, Rasmus Villemoes, Simon Glass, Jonathan Humphreys [-- Attachment #1: Type: text/plain, Size: 943 bytes --] On Mon, Aug 24, 2026 at 10:17:18AM +0530, Suraj Kakade wrote: > cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I > path) in the HOSTCC command. With a long $(srctree) that command is > too large for /bin/sh -c and Make fails with "Argument list too > long" while building a .dtb. > > Write the flags to a per-target .dtc.flags.tmp file and pass @file to > HOSTCC/CPP so the shell command stays short. > > This change requires GNU Make >= 4.0, since $(file ...) is not > supported by Make 3.x. > > Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM") > Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules") > Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com> The linux kernel, and so Kbuild, says that 4.0 is the minimum version of GNU make required, so that is true for us as well, so this is fine. Reviewed-by: Tom Rini <trini@konsulko.com> -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 2026-08-24 15:09 ` Tom Rini @ 2026-08-24 15:29 ` Michal Simek 2026-08-24 16:51 ` Tom Rini 0 siblings, 1 reply; 6+ messages in thread From: Michal Simek @ 2026-08-24 15:29 UTC (permalink / raw) To: Tom Rini, Suraj Kakade Cc: u-boot, git, padmarao.begari, Rasmus Villemoes, Simon Glass, Jonathan Humphreys On 8/24/26 17:09, Tom Rini wrote: > On Mon, Aug 24, 2026 at 10:17:18AM +0530, Suraj Kakade wrote: > >> cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I >> path) in the HOSTCC command. With a long $(srctree) that command is >> too large for /bin/sh -c and Make fails with "Argument list too >> long" while building a .dtb. >> >> Write the flags to a per-target .dtc.flags.tmp file and pass @file to >> HOSTCC/CPP so the shell command stays short. >> >> This change requires GNU Make >= 4.0, since $(file ...) is not >> supported by Make 3.x. >> >> Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM") >> Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules") >> Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com> > > The linux kernel, and so Kbuild, says that 4.0 is the minimum version of > GNU make required, so that is true for us as well, so this is fine. > > Reviewed-by: Tom Rini <trini@konsulko.com> > We should likely fix this too. 94 # If the user is running make -s (silent mode), suppress echoing of 95 # commands 96 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 97 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) 98 quiet=silent_ 99 endif 100 else # make-3.8x 101 ifneq ($(filter s% -s%,$(MAKEFLAGS)),) 102 quiet=silent_ 103 endif 104 endif Thanks, Michal ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 2026-08-24 15:29 ` Michal Simek @ 2026-08-24 16:51 ` Tom Rini 2026-08-25 5:53 ` Michal Simek 0 siblings, 1 reply; 6+ messages in thread From: Tom Rini @ 2026-08-24 16:51 UTC (permalink / raw) To: Michal Simek Cc: Suraj Kakade, u-boot, git, padmarao.begari, Rasmus Villemoes, Simon Glass, Jonathan Humphreys [-- Attachment #1: Type: text/plain, Size: 1732 bytes --] On Mon, Aug 24, 2026 at 05:29:37PM +0200, Michal Simek wrote: > > > On 8/24/26 17:09, Tom Rini wrote: > > On Mon, Aug 24, 2026 at 10:17:18AM +0530, Suraj Kakade wrote: > > > > > cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I > > > path) in the HOSTCC command. With a long $(srctree) that command is > > > too large for /bin/sh -c and Make fails with "Argument list too > > > long" while building a .dtb. > > > > > > Write the flags to a per-target .dtc.flags.tmp file and pass @file to > > > HOSTCC/CPP so the shell command stays short. > > > > > > This change requires GNU Make >= 4.0, since $(file ...) is not > > > supported by Make 3.x. > > > > > > Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM") > > > Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules") > > > Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com> > > > > The linux kernel, and so Kbuild, says that 4.0 is the minimum version of > > GNU make required, so that is true for us as well, so this is fine. > > > > Reviewed-by: Tom Rini <trini@konsulko.com> > > > > We should likely fix this too. > > 94 # If the user is running make -s (silent mode), suppress echoing of > 95 # commands > 96 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 > 97 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) > 98 quiet=silent_ > 99 endif > 100 else # make-3.8x > 101 ifneq ($(filter s% -s%,$(MAKEFLAGS)),) > 102 quiet=silent_ > 103 endif > 104 endif I think this means we should pull commit 5f99665ee8f4335f334a5292b6d5b41a577fc2c0 from the kernel in, to fully switch to 4.0 as minimum. -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 2026-08-24 16:51 ` Tom Rini @ 2026-08-25 5:53 ` Michal Simek 2026-08-25 13:48 ` Tom Rini 0 siblings, 1 reply; 6+ messages in thread From: Michal Simek @ 2026-08-25 5:53 UTC (permalink / raw) To: Tom Rini Cc: Suraj Kakade, u-boot, git, padmarao.begari, Rasmus Villemoes, Simon Glass, Jonathan Humphreys On 8/24/26 18:51, Tom Rini wrote: > On Mon, Aug 24, 2026 at 05:29:37PM +0200, Michal Simek wrote: >> >> >> On 8/24/26 17:09, Tom Rini wrote: >>> On Mon, Aug 24, 2026 at 10:17:18AM +0530, Suraj Kakade wrote: >>> >>>> cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I >>>> path) in the HOSTCC command. With a long $(srctree) that command is >>>> too large for /bin/sh -c and Make fails with "Argument list too >>>> long" while building a .dtb. >>>> >>>> Write the flags to a per-target .dtc.flags.tmp file and pass @file to >>>> HOSTCC/CPP so the shell command stays short. >>>> >>>> This change requires GNU Make >= 4.0, since $(file ...) is not >>>> supported by Make 3.x. >>>> >>>> Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM") >>>> Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules") >>>> Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com> >>> >>> The linux kernel, and so Kbuild, says that 4.0 is the minimum version of >>> GNU make required, so that is true for us as well, so this is fine. >>> >>> Reviewed-by: Tom Rini <trini@konsulko.com> >>> >> >> We should likely fix this too. >> >> 94 # If the user is running make -s (silent mode), suppress echoing of >> 95 # commands >> 96 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 >> 97 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) >> 98 quiet=silent_ >> 99 endif >> 100 else # make-3.8x >> 101 ifneq ($(filter s% -s%,$(MAKEFLAGS)),) >> 102 quiet=silent_ >> 103 endif >> 104 endif > > I think this means we should pull commit > 5f99665ee8f4335f334a5292b6d5b41a577fc2c0 from the kernel in, to fully > switch to 4.0 as minimum. > something like this? M diff --git a/Makefile b/Makefile index 16e3e4dfe5e4..e0ab39200c1b 100644 --- a/Makefile +++ b/Makefile @@ -93,15 +93,9 @@ endif # If the user is running make -s (silent mode), suppress echoing of # commands -ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 -ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) +ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),) quiet=silent_ endif -else # make-3.8x -ifneq ($(filter s% -s%,$(MAKEFLAGS)),) - quiet=silent_ -endif -endif export quiet Q KBUILD_VERBOSE @@ -166,14 +160,6 @@ ifneq ($(abs_srctree),$(abs_objtree)) MAKEFLAGS += --include-dir=$(abs_srctree) endif -ifneq ($(filter 3.%,$(MAKE_VERSION)),) -# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x -# We need to invoke sub-make to avoid implicit rules in the top Makefile. -need-sub-make := 1 -# Cancel implicit rules for this Makefile. -$(this-makefile): ; -endif - export abs_srctree abs_objtree export sub_make_done := 1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 2026-08-25 5:53 ` Michal Simek @ 2026-08-25 13:48 ` Tom Rini 0 siblings, 0 replies; 6+ messages in thread From: Tom Rini @ 2026-08-25 13:48 UTC (permalink / raw) To: Michal Simek Cc: Suraj Kakade, u-boot, git, padmarao.begari, Rasmus Villemoes, Simon Glass, Jonathan Humphreys [-- Attachment #1: Type: text/plain, Size: 3297 bytes --] On Tue, Aug 25, 2026 at 07:53:10AM +0200, Michal Simek wrote: > > > On 8/24/26 18:51, Tom Rini wrote: > > On Mon, Aug 24, 2026 at 05:29:37PM +0200, Michal Simek wrote: > > > > > > > > > On 8/24/26 17:09, Tom Rini wrote: > > > > On Mon, Aug 24, 2026 at 10:17:18AM +0530, Suraj Kakade wrote: > > > > > > > > > cmd_dtc inlines dtc_cpp_flags (including every upstream dtsi -I > > > > > path) in the HOSTCC command. With a long $(srctree) that command is > > > > > too large for /bin/sh -c and Make fails with "Argument list too > > > > > long" while building a .dtb. > > > > > > > > > > Write the flags to a per-target .dtc.flags.tmp file and pass @file to > > > > > HOSTCC/CPP so the shell command stays short. > > > > > > > > > > This change requires GNU Make >= 4.0, since $(file ...) is not > > > > > supported by Make 3.x. > > > > > > > > > > Fixes: d31ff219a833 ("Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM") > > > > > Fixes: 1e7883f6325a ("dtbo: Fix dtbo generation rules") > > > > > Signed-off-by: Suraj Kakade <suraj.hanumantkakade@amd.com> > > > > > > > > The linux kernel, and so Kbuild, says that 4.0 is the minimum version of > > > > GNU make required, so that is true for us as well, so this is fine. > > > > > > > > Reviewed-by: Tom Rini <trini@konsulko.com> > > > > > > > > > > We should likely fix this too. > > > > > > 94 # If the user is running make -s (silent mode), suppress echoing of > > > 95 # commands > > > 96 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 > > > 97 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) > > > 98 quiet=silent_ > > > 99 endif > > > 100 else # make-3.8x > > > 101 ifneq ($(filter s% -s%,$(MAKEFLAGS)),) > > > 102 quiet=silent_ > > > 103 endif > > > 104 endif > > > > I think this means we should pull commit > > 5f99665ee8f4335f334a5292b6d5b41a577fc2c0 from the kernel in, to fully > > switch to 4.0 as minimum. > > > > something like this? > > M > > diff --git a/Makefile b/Makefile > index 16e3e4dfe5e4..e0ab39200c1b 100644 > --- a/Makefile > +++ b/Makefile > @@ -93,15 +93,9 @@ endif > > # If the user is running make -s (silent mode), suppress echoing of > # commands > -ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 > -ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) > +ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),) > quiet=silent_ > endif > -else # make-3.8x > -ifneq ($(filter s% -s%,$(MAKEFLAGS)),) > - quiet=silent_ > -endif > -endif > > export quiet Q KBUILD_VERBOSE > > @@ -166,14 +160,6 @@ ifneq ($(abs_srctree),$(abs_objtree)) > MAKEFLAGS += --include-dir=$(abs_srctree) > endif > > -ifneq ($(filter 3.%,$(MAKE_VERSION)),) > -# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x > -# We need to invoke sub-make to avoid implicit rules in the top Makefile. > -need-sub-make := 1 > -# Cancel implicit rules for this Makefile. > -$(this-makefile): ; > -endif > - > export abs_srctree abs_objtree > export sub_make_done := 1 And also the version check part (which we didn't add the initial part of yet either, which checks for 3.8). Thanks! -- Tom [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-25 13:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-24 4:47 [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file Suraj Kakade 2026-08-24 15:09 ` Tom Rini 2026-08-24 15:29 ` Michal Simek 2026-08-24 16:51 ` Tom Rini 2026-08-25 5:53 ` Michal Simek 2026-08-25 13:48 ` Tom Rini
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.