2021-01-26 05:40:42

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH] cmd_dtc: Enable generation of device tree symbols

Adding the -@ switch to dtc results in the binary devicetrees containing
a list of symbolic references and their paths. This is necessary to
apply device tree overlays e.g. on Raspberry Pi as described on
https://www.raspberrypi.org/documentation/configuration/device-tree.md.

Obviously the downside of this change is an increas of the size of the
generated dtbs, for an arm out-of-tree build (multi_v7_defconfig):

$ du -s arch/arm/boot/dts*
101380 arch/arm/boot/dts-pre
114308 arch/arm/boot/dts-post

so this is in average an increase of 12.8% in size.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
scripts/Makefile.lib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 213677a5ed33..0683a5808f7f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -319,7 +319,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE

quiet_cmd_dtc = DTC $@
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
+ $(DTC) -@ -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
--
2.29.2


2021-01-26 19:02:07

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] cmd_dtc: Enable generation of device tree symbols

On Tue, Jan 26, 2021 at 1:27 AM Uwe Kleine-König <[email protected]> wrote:
>
> Hello Masahiro,
>
> On 1/25/21 10:53 PM, Masahiro Yamada wrote:
> > On Mon, Jan 25, 2021 at 8:07 PM Uwe Kleine-König <[email protected]> wrote:
> >>
> >> Adding the -@ switch to dtc results in the binary devicetrees containing
> >> a list of symbolic references and their paths. This is necessary to
> >> apply device tree overlays e.g. on Raspberry Pi as described on
> >> https://www.raspberrypi.org/documentation/configuration/device-tree.md.
> >>
> >> Obviously the downside of this change is an increas of the size of the
> >> generated dtbs, for an arm out-of-tree build (multi_v7_defconfig):
> >>
> >> $ du -s arch/arm/boot/dts*
> >> 101380 arch/arm/boot/dts-pre
> >> 114308 arch/arm/boot/dts-post
> >>
> >> so this is in average an increase of 12.8% in size.
> >>
> >> Signed-off-by: Uwe Kleine-König <[email protected]>
> >
> >
> > (CCing DT ML.)
>
> makes sense, thanks.
>
> > https://www.spinics.net/lists/linux-kbuild/msg27904.html
> >
> > See Rob's comment:
> >
> > "We've already rejected doing that. Turning on '-@' can grow the dtb
> > size by a significant amount which could be problematic for some
> > boards."
>
> The patch was created after some conversation on irc which continued
> after I sent the patch. I added the participating parties to Cc:.
>
> The (relevant) followups were:
>
> Geert suggested to always generate the symbols and provide a way to
> strip the symbols for installation if and when they are not needed.
>
> Rob said: "I'm less concerned with the size increases, but rather that
> labels go from purely source syntax to an ABI. I'd rather see some
> decision as to which labels are enabled or not."

I've also said move the arm32 dts files to family subdirectories and
enable '-@' per directory. I've posted a script to do the whole thing,
but I think the preference is one-by-one. This is needed anyways if
we're going to start adding overlays which Viresh is working on.

Rob

2021-01-27 19:48:14

by Frank Rowand

[permalink] [raw]
Subject: Re: [PATCH] cmd_dtc: Enable generation of device tree symbols

+frank

On 1/25/21 4:57 AM, Uwe Kleine-König wrote:
> Adding the -@ switch to dtc results in the binary devicetrees containing
> a list of symbolic references and their paths. This is necessary to
> apply device tree overlays e.g. on Raspberry Pi as described on
> https://www.raspberrypi.org/documentation/configuration/device-tree.md.
>
> Obviously the downside of this change is an increas of the size of the
> generated dtbs, for an arm out-of-tree build (multi_v7_defconfig):
>
> $ du -s arch/arm/boot/dts*
> 101380 arch/arm/boot/dts-pre
> 114308 arch/arm/boot/dts-post
>
> so this is in average an increase of 12.8% in size.
>
> Signed-off-by: Uwe Kleine-König <[email protected]>
> ---
> scripts/Makefile.lib | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 213677a5ed33..0683a5808f7f 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -319,7 +319,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
>
> quiet_cmd_dtc = DTC $@
> cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> - $(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
> + $(DTC) -@ -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
>