mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags
@ 2023-11-30  7:03 Ahmad Fatoum
  2023-11-30  7:03 ` [PATCH 2/2] kbuild: don't warn about reg formatting Ahmad Fatoum
  2023-12-05  8:01 ` [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-11-30  7:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kbuild: don't warn about reg formatting
  2023-11-30  7:03 [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Ahmad Fatoum
@ 2023-11-30  7:03 ` Ahmad Fatoum
  2023-12-05  8:01 ` [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-11-30  7:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Overlays, especially new style ones, are prone to trigger the reg
formatting warnings if fragments add node with reg properties without
also patching the parent:

  &phy0 {
	reg = <7>;
  };

In order to add #address-cells and #size-cells, the parent would need to
be overlaid, which is a bad tradeoff as it's either redundant or it
overrides the existing cell count with the wrong ones, possibly
invalidating reg parsing for existing nodes.

Improve the situation and avoid false positives by silencing the warnings
when building device tree overlays.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/Makefile.lib | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 8aa49b1ee1b0..0b236babb275 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -371,6 +371,8 @@ ifeq ($(CONFIG_OF_OVERLAY_LIVE), y)
 DTC_FLAGS.dtb += -@
 endif
 
+DTC_FLAGS.dtbo += -Wno-avoid_default_addr_size -Wno-reg_format
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb = DTB     $@
 cmd_dt_S_dtb = $(srctree)/scripts/gen-dtb-s $(subst -,_,$(*F)) $< $(CONFIG_IMD) > $@
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags
  2023-11-30  7:03 [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Ahmad Fatoum
  2023-11-30  7:03 ` [PATCH 2/2] kbuild: don't warn about reg formatting Ahmad Fatoum
@ 2023-12-05  8:01 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-12-05  8:01 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Nov 30, 2023 at 08:03:19AM +0100, Ahmad Fatoum wrote:
> 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@pengutronix.de>
> ---
>  scripts/Makefile.lib | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-05  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30  7:03 [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Ahmad Fatoum
2023-11-30  7:03 ` [PATCH 2/2] kbuild: don't warn about reg formatting Ahmad Fatoum
2023-12-05  8:01 ` [PATCH 1/2] kbuild: don't mix overlay and normal DTC and CPP flags Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox