All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Kakade <suraj.hanumantkakade@amd.com>
To: <u-boot@lists.u-boot-project.org>, <michal.simek@amd.com>
Cc: <git@amd.com>, <padmarao.begari@amd.com>,
	Suraj Kakade <suraj.hanumantkakade@amd.com>,
	Tom Rini <trini@konsulko.com>,
	"Rasmus Villemoes" <rv@rasmusvillemoes.dk>,
	Simon Glass <sjg@chromium.org>,
	"Jonathan Humphreys" <j-humphreys@ti.com>
Subject: [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file
Date: Mon, 24 Aug 2026 10:17:18 +0530	[thread overview]
Message-ID: <20260824044729.708287-1-suraj.hanumantkakade@amd.com> (raw)

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


             reply	other threads:[~2026-08-24  4:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  4:47 Suraj Kakade [this message]
2026-08-24 15:09 ` [PATCH RFC] scripts: pass dtc cpp flags via a GCC response file 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824044729.708287-1-suraj.hanumantkakade@amd.com \
    --to=suraj.hanumantkakade@amd.com \
    --cc=git@amd.com \
    --cc=j-humphreys@ti.com \
    --cc=michal.simek@amd.com \
    --cc=padmarao.begari@amd.com \
    --cc=rv@rasmusvillemoes.dk \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.