[PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Nov 29 23:03:19 PST 2023


We currently conflate flags for *.dtb and *.dtbo targets:

  - -@ doesn't make sense for overlays, but is used there anyway when
    CONFIG_OF_OVERLAY_LIVE

  - DTC_CPP_FLAGS_basetarget.dtbo and DTC_CPP_FLAGS_basetarget.dtb are
    interchangeable

Fix this by allowing flags to be specific to either *.dtb or *.dtbo
generation.

Fixes: 3610ec11f72b ("kbuild: Add target to build dtb overlay files")
Fixes: 5b3d7e66aac0 ("kbuild: support DTC_CPP_FLAGS_file.dtbo")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 scripts/Makefile.lib | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 18b4fc1b9dd2..8aa49b1ee1b0 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -220,8 +220,7 @@ dtc_cpp_flags  = -Wp,-MD,$(depfile).pre -nostdinc                        \
 		 -I$(srctree)/include                                    \
 		 -I$(srctree)/dts/include                                \
 		 -I$(srctree)/dts/src/                                   \
-		 $(DTC_CPP_FLAGS_$(basetarget).dtb)                      \
-		 $(DTC_CPP_FLAGS_$(basetarget).dtbo)                     \
+		 $(DTC_CPP_FLAGS_$(basetarget)$(suffix $@))              \
 		 -undef -D__DTS__
 
 ifdef CONFIG_BOOTM_FITIMAGE_PUBKEY
@@ -369,7 +368,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \
 	 -Wno-interrupt_provider
 
 ifeq ($(CONFIG_OF_OVERLAY_LIVE), y)
-DTC_FLAGS += -@
+DTC_FLAGS.dtb += -@
 endif
 
 # Generate an assembly file to wrap the output of the device tree compiler
@@ -391,7 +390,7 @@ quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) \
 	-D'$(subst -,_,$(*F))_dts=1' $(foreach f,$< $(2),-include '$(f)') /dev/null ; \
 	$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
-		-i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) \
+		-i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) $(DTC_FLAGS$(suffix $@)) \
 		-i $(srctree)/dts/src/$(SRCARCH) \
 		-i $(srctree)/dts/src/arm/ti/omap \
 		-d $(depfile).dtc $(dtc-tmp) ; \
-- 
2.39.2




More information about the barebox mailing list