* [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-21 16:14 [RFC PATCH v2 0/4] Add device tree build information Alexandre Torgue
@ 2020-02-21 16:14 ` Alexandre Torgue
2020-02-21 17:52 ` Frank Rowand
2020-02-21 16:14 ` [RFC PATCH v2 2/4] of: fdt: print " Alexandre Torgue
` (3 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Alexandre Torgue @ 2020-02-21 16:14 UTC (permalink / raw)
To: robh+dt, Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg
Cc: devicetree, Alexandre Torgue, linux-kernel, linux-kbuild,
devicetree-compiler, Ian Lepore
This commit adds a new script to create a file (in dts file directory) with
some information (date, Linux version, user). This file could then be used
to populate "build-info" property in every dts file that would use this
build information:
Example:
/ {
...
build-info = /incbin/("dtb-build.txt");
...
};
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index bae62549e3d2..a5af84ef4ffc 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
# DTC
# ---------------------------------------------------------------------------
DTC ?= $(objtree)/scripts/dtc/dtc
+DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
# Disable noisy checks by default
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
@@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
quiet_cmd_dtc = DTC $@
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
+ $(DTB_GEN_INFO) $(src) ; \
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
$(DTC) -O $(2) -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
new file mode 100755
index 000000000000..0cd8bd98e410
--- /dev/null
+++ b/scripts/gen_dtb_build_info.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+set -o nounset
+
+DTB_DIR=$1
+DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
+DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
+
+printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-21 16:14 ` [RFC PATCH v2 1/4] scripts: Add script to generate dtb " Alexandre Torgue
@ 2020-02-21 17:52 ` Frank Rowand
2020-02-21 19:38 ` Rob Herring
2020-02-23 21:59 ` David Gibson
0 siblings, 2 replies; 18+ messages in thread
From: Frank Rowand @ 2020-02-21 17:52 UTC (permalink / raw)
To: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, david,
sjg
Cc: devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On 2/21/20 10:14 AM, Alexandre Torgue wrote:
> This commit adds a new script to create a file (in dts file directory) with
> some information (date, Linux version, user). This file could then be used
> to populate "build-info" property in every dts file that would use this
> build information:
>
> Example:
>
> / {
> ...
> build-info = /incbin/("dtb-build.txt");
s/.txt/.dtsi/
and same wherever the file name is used.
> ...
> };
>
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index bae62549e3d2..a5af84ef4ffc 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
> # DTC
> # ---------------------------------------------------------------------------
> DTC ?= $(objtree)/scripts/dtc/dtc
> +DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
>
> # Disable noisy checks by default
> ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
> @@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
>
> quiet_cmd_dtc = DTC $@
> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> + $(DTB_GEN_INFO) $(src) ; \
> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> $(DTC) -O $(2) -o $@ -b 0 \
> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
> new file mode 100755
> index 000000000000..0cd8bd98e410
> --- /dev/null
> +++ b/scripts/gen_dtb_build_info.sh
> @@ -0,0 +1,10 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +set -o nounset
> +
> +DTB_DIR=$1
> +DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
> +DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
I would remove the filler words "From", "by", "the", and the trailing
period ('.').
<bikeshed>
You might consider using a format more like the Linux
kernel version line, which puts parenthesis around the
compiled by info.
</bikeshed>
-Frank
> +
> +printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-21 17:52 ` Frank Rowand
@ 2020-02-21 19:38 ` Rob Herring
2020-03-02 12:40 ` Alexandre Torgue
2020-02-23 21:59 ` David Gibson
1 sibling, 1 reply; 18+ messages in thread
From: Rob Herring @ 2020-02-21 19:38 UTC (permalink / raw)
To: Frank Rowand
Cc: Alexandre Torgue, Masahiro Yamada, Michal Marek, David Gibson,
Simon Glass, devicetree, linux-kernel@vger.kernel.org,
Linux Kbuild mailing list, Devicetree Compiler, Ian Lepore
On Fri, Feb 21, 2020 at 11:52 AM Frank Rowand <frowand.list@gmail.com> wrote:
>
> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
> > This commit adds a new script to create a file (in dts file directory) with
> > some information (date, Linux version, user). This file could then be used
> > to populate "build-info" property in every dts file that would use this
> > build information:
> >
> > Example:
> >
> > / {
> > ...
> > build-info = /incbin/("dtb-build.txt");
>
> s/.txt/.dtsi/
>
> and same wherever the file name is used.
>
>
> > ...
> > };
> >
> > Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index bae62549e3d2..a5af84ef4ffc 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
> > # DTC
> > # ---------------------------------------------------------------------------
> > DTC ?= $(objtree)/scripts/dtc/dtc
> > +DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
> >
> > # Disable noisy checks by default
> > ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
> > @@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
> >
> > quiet_cmd_dtc = DTC $@
> > cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> > + $(DTB_GEN_INFO) $(src) ; \
> > $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> > $(DTC) -O $(2) -o $@ -b 0 \
> > $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> > diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
> > new file mode 100755
> > index 000000000000..0cd8bd98e410
> > --- /dev/null
> > +++ b/scripts/gen_dtb_build_info.sh
> > @@ -0,0 +1,10 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +set -o nounset
> > +
> > +DTB_DIR=$1
> > +DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
> > +DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
>
> I would remove the filler words "From", "by", "the", and the trailing
> period ('.').
>
> <bikeshed>
> You might consider using a format more like the Linux
> kernel version line, which puts parenthesis around the
> compiled by info.
IMO, we should use exactly the Linux kernel version line. Or exactly
the u-boot version line when built in u-boot.
Rob
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-21 19:38 ` Rob Herring
@ 2020-03-02 12:40 ` Alexandre Torgue
0 siblings, 0 replies; 18+ messages in thread
From: Alexandre Torgue @ 2020-03-02 12:40 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Masahiro Yamada, Michal Marek, David Gibson, Simon Glass,
devicetree, linux-kernel@vger.kernel.org,
Linux Kbuild mailing list, Devicetree Compiler, Ian Lepore
On 2/21/20 8:38 PM, Rob Herring wrote:
> On Fri, Feb 21, 2020 at 11:52 AM Frank Rowand <frowand.list@gmail.com> wrote:
>>
>> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
>>> This commit adds a new script to create a file (in dts file directory) with
>>> some information (date, Linux version, user). This file could then be used
>>> to populate "build-info" property in every dts file that would use this
>>> build information:
>>>
>>> Example:
>>>
>>> / {
>>> ...
>>> build-info = /incbin/("dtb-build.txt");
>>
>> s/.txt/.dtsi/
>>
>> and same wherever the file name is used.
>>
>>
>>> ...
>>> };
>>>
>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>>
>>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>>> index bae62549e3d2..a5af84ef4ffc 100644
>>> --- a/scripts/Makefile.lib
>>> +++ b/scripts/Makefile.lib
>>> @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
>>> # DTC
>>> # ---------------------------------------------------------------------------
>>> DTC ?= $(objtree)/scripts/dtc/dtc
>>> +DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
>>>
>>> # Disable noisy checks by default
>>> ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
>>> @@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
>>>
>>> quiet_cmd_dtc = DTC $@
>>> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
>>> + $(DTB_GEN_INFO) $(src) ; \
>>> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
>>> $(DTC) -O $(2) -o $@ -b 0 \
>>> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
>>> diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
>>> new file mode 100755
>>> index 000000000000..0cd8bd98e410
>>> --- /dev/null
>>> +++ b/scripts/gen_dtb_build_info.sh
>>> @@ -0,0 +1,10 @@
>>> +#!/bin/bash
>>> +# SPDX-License-Identifier: GPL-2.0
>>> +
>>> +set -o nounset
>>> +
>>> +DTB_DIR=$1
>>> +DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
>>> +DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
>>
>> I would remove the filler words "From", "by", "the", and the trailing
>> period ('.').
>>
>> <bikeshed>
>> You might consider using a format more like the Linux
>> kernel version line, which puts parenthesis around the
>> compiled by info.
>
> IMO, we should use exactly the Linux kernel version line. Or exactly
> the u-boot version line when built in u-boot.
I agree to keep the same format than Linux banner. But does it make
sense to keep uts version, config flags ?
regards
Alex
>
> Rob
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-21 17:52 ` Frank Rowand
2020-02-21 19:38 ` Rob Herring
@ 2020-02-23 21:59 ` David Gibson
2020-02-24 0:57 ` Frank Rowand
1 sibling, 1 reply; 18+ messages in thread
From: David Gibson @ 2020-02-23 21:59 UTC (permalink / raw)
To: Frank Rowand
Cc: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
[-- Attachment #1: Type: text/plain, Size: 2640 bytes --]
On Fri, Feb 21, 2020 at 11:52:34AM -0600, Frank Rowand wrote:
> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
> > This commit adds a new script to create a file (in dts file directory) with
> > some information (date, Linux version, user). This file could then be used
> > to populate "build-info" property in every dts file that would use this
> > build information:
> >
> > Example:
> >
> > / {
> > ...
> > build-info = /incbin/("dtb-build.txt");
>
> s/.txt/.dtsi/
I don't think that makes sense. This is an /incbin/ not an /include/
so the text file is *not* dts information.
> and same wherever the file name is used.
>
>
> > ...
> > };
> >
> > Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index bae62549e3d2..a5af84ef4ffc 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
> > # DTC
> > # ---------------------------------------------------------------------------
> > DTC ?= $(objtree)/scripts/dtc/dtc
> > +DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
> >
> > # Disable noisy checks by default
> > ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
> > @@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
> >
> > quiet_cmd_dtc = DTC $@
> > cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> > + $(DTB_GEN_INFO) $(src) ; \
> > $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> > $(DTC) -O $(2) -o $@ -b 0 \
> > $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> > diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
> > new file mode 100755
> > index 000000000000..0cd8bd98e410
> > --- /dev/null
> > +++ b/scripts/gen_dtb_build_info.sh
> > @@ -0,0 +1,10 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +set -o nounset
> > +
> > +DTB_DIR=$1
> > +DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
> > +DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
>
> I would remove the filler words "From", "by", "the", and the trailing
> period ('.').
>
> <bikeshed>
> You might consider using a format more like the Linux
> kernel version line, which puts parenthesis around the
> compiled by info.
> </bikeshed>
>
> -Frank
>
> > +
> > +printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 1/4] scripts: Add script to generate dtb build information
2020-02-23 21:59 ` David Gibson
@ 2020-02-24 0:57 ` Frank Rowand
0 siblings, 0 replies; 18+ messages in thread
From: Frank Rowand @ 2020-02-24 0:57 UTC (permalink / raw)
To: David Gibson
Cc: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On 2/23/20 3:59 PM, David Gibson wrote:
> On Fri, Feb 21, 2020 at 11:52:34AM -0600, Frank Rowand wrote:
>> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
>>> This commit adds a new script to create a file (in dts file directory) with
>>> some information (date, Linux version, user). This file could then be used
>>> to populate "build-info" property in every dts file that would use this
>>> build information:
>>>
>>> Example:
>>>
>>> / {
>>> ...
>>> build-info = /incbin/("dtb-build.txt");
>>
>> s/.txt/.dtsi/
>
> I don't think that makes sense. This is an /incbin/ not an /include/
> so the text file is *not* dts information.
You are right, thanks for catching that.
-Frank
>
>> and same wherever the file name is used.
>>
>>
>>> ...
>>> };
>>>
>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>>
>>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>>> index bae62549e3d2..a5af84ef4ffc 100644
>>> --- a/scripts/Makefile.lib
>>> +++ b/scripts/Makefile.lib
>>> @@ -246,6 +246,7 @@ quiet_cmd_gzip = GZIP $@
>>> # DTC
>>> # ---------------------------------------------------------------------------
>>> DTC ?= $(objtree)/scripts/dtc/dtc
>>> +DTB_GEN_INFO ?= $(objtree)/scripts/gen_dtb_build_info.sh
>>>
>>> # Disable noisy checks by default
>>> ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
>>> @@ -286,6 +287,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
>>>
>>> quiet_cmd_dtc = DTC $@
>>> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
>>> + $(DTB_GEN_INFO) $(src) ; \
>>> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
>>> $(DTC) -O $(2) -o $@ -b 0 \
>>> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
>>> diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
>>> new file mode 100755
>>> index 000000000000..0cd8bd98e410
>>> --- /dev/null
>>> +++ b/scripts/gen_dtb_build_info.sh
>>> @@ -0,0 +1,10 @@
>>> +#!/bin/bash
>>> +# SPDX-License-Identifier: GPL-2.0
>>> +
>>> +set -o nounset
>>> +
>>> +DTB_DIR=$1
>>> +DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
>>> +DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
>>
>> I would remove the filler words "From", "by", "the", and the trailing
>> period ('.').
>>
>> <bikeshed>
>> You might consider using a format more like the Linux
>> kernel version line, which puts parenthesis around the
>> compiled by info.
>> </bikeshed>
>>
>> -Frank
>>
>>> +
>>> +printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
>>>
>>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [RFC PATCH v2 2/4] of: fdt: print dtb build information
2020-02-21 16:14 [RFC PATCH v2 0/4] Add device tree build information Alexandre Torgue
2020-02-21 16:14 ` [RFC PATCH v2 1/4] scripts: Add script to generate dtb " Alexandre Torgue
@ 2020-02-21 16:14 ` Alexandre Torgue
2020-02-26 21:36 ` Rob Herring
2020-02-21 16:14 ` [RFC PATCH v2 3/4] ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2 Alexandre Torgue
` (2 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Alexandre Torgue @ 2020-02-21 16:14 UTC (permalink / raw)
To: robh+dt, Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg
Cc: devicetree, Alexandre Torgue, linux-kernel, linux-kbuild,
devicetree-compiler, Ian Lepore
This commit prints out DTB build information (build time, dts source
version used, ...) if "Build-info" property exists in DTB root node.
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 2cdf64d2456f..aa5989039746 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1224,9 +1224,18 @@ bool __init early_init_dt_scan(void *params)
*/
void __init unflatten_device_tree(void)
{
+ const char *build_info;
+ unsigned long dt_root;
+
__unflatten_device_tree(initial_boot_params, NULL, &of_root,
early_init_dt_alloc_memory_arch, false);
+ /* If available, provide dtb build information */
+ dt_root = of_get_flat_dt_root();
+ build_info = of_get_flat_dt_prop(dt_root, "build-info", NULL);
+ if (build_info)
+ pr_info("%s\n", build_info);
+
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 2/4] of: fdt: print dtb build information
2020-02-21 16:14 ` [RFC PATCH v2 2/4] of: fdt: print " Alexandre Torgue
@ 2020-02-26 21:36 ` Rob Herring
0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2020-02-26 21:36 UTC (permalink / raw)
To: Alexandre Torgue
Cc: Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On Fri, Feb 21, 2020 at 05:14:16PM +0100, Alexandre Torgue wrote:
> This commit prints out DTB build information (build time, dts source
> version used, ...) if "Build-info" property exists in DTB root node.
/Build/build/
>
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 2cdf64d2456f..aa5989039746 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1224,9 +1224,18 @@ bool __init early_init_dt_scan(void *params)
> */
> void __init unflatten_device_tree(void)
> {
> + const char *build_info;
> + unsigned long dt_root;
> +
> __unflatten_device_tree(initial_boot_params, NULL, &of_root,
> early_init_dt_alloc_memory_arch, false);
>
> + /* If available, provide dtb build information */
> + dt_root = of_get_flat_dt_root();
> + build_info = of_get_flat_dt_prop(dt_root, "build-info", NULL);
We just unflattened the tree, why are we using the flat dt functions?
> + if (build_info)
> + pr_info("%s\n", build_info);
> +
> /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
> of_alias_scan(early_init_dt_alloc_memory_arch);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [RFC PATCH v2 3/4] ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2
2020-02-21 16:14 [RFC PATCH v2 0/4] Add device tree build information Alexandre Torgue
2020-02-21 16:14 ` [RFC PATCH v2 1/4] scripts: Add script to generate dtb " Alexandre Torgue
2020-02-21 16:14 ` [RFC PATCH v2 2/4] of: fdt: print " Alexandre Torgue
@ 2020-02-21 16:14 ` Alexandre Torgue
2020-02-21 16:14 ` [RFC PATCH v2 4/4] script: make automatic dtb build info generation Alexandre Torgue
2020-02-21 17:47 ` [RFC PATCH v2 0/4] Add device tree build information Frank Rowand
4 siblings, 0 replies; 18+ messages in thread
From: Alexandre Torgue @ 2020-02-21 16:14 UTC (permalink / raw)
To: robh+dt, Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg
Cc: devicetree, Alexandre Torgue, linux-kernel, linux-kbuild,
devicetree-compiler, Ian Lepore
dtb-build.txt is a file containing device tree build information (date,
source version ...). This file is used to fill "build-info" entry which
will be displayed during kernel boot.
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
diff --git a/arch/arm/boot/dts/stm32mp157c-dk2.dts b/arch/arm/boot/dts/stm32mp157c-dk2.dts
index 7985b80967ca..387d3bcf5fa3 100644
--- a/arch/arm/boot/dts/stm32mp157c-dk2.dts
+++ b/arch/arm/boot/dts/stm32mp157c-dk2.dts
@@ -15,6 +15,7 @@
/ {
model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
+ build-info = /incbin/("dtb-build.txt");
aliases {
ethernet0 = ðernet0;
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [RFC PATCH v2 4/4] script: make automatic dtb build info generation
2020-02-21 16:14 [RFC PATCH v2 0/4] Add device tree build information Alexandre Torgue
` (2 preceding siblings ...)
2020-02-21 16:14 ` [RFC PATCH v2 3/4] ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2 Alexandre Torgue
@ 2020-02-21 16:14 ` Alexandre Torgue
2020-02-21 17:59 ` Frank Rowand
2020-02-26 20:56 ` Rob Herring
2020-02-21 17:47 ` [RFC PATCH v2 0/4] Add device tree build information Frank Rowand
4 siblings, 2 replies; 18+ messages in thread
From: Alexandre Torgue @ 2020-02-21 16:14 UTC (permalink / raw)
To: robh+dt, Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg
Cc: devicetree, Alexandre Torgue, linux-kernel, linux-kbuild,
devicetree-compiler, Ian Lepore
Append each "xxx.dtb.dts.tmp" file with "build-info" entry during dtb
build. It allows to get build information (date, source version, ...)
for each device tree without modify them manually.
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a5af84ef4ffc..f084e78267b2 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -289,6 +289,7 @@ quiet_cmd_dtc = DTC $@
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
$(DTB_GEN_INFO) $(src) ; \
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+ $(DTB_GEN_INFO) $(src) $(dtc-tmp) ; \
$(DTC) -O $(2) -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
index 0cd8bd98e410..72f31e386787 100755
--- a/scripts/gen_dtb_build_info.sh
+++ b/scripts/gen_dtb_build_info.sh
@@ -6,5 +6,7 @@ set -o nounset
DTB_DIR=$1
DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
+DTS_FILE=$2
-printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
+printf "$DTB_INFO" > "arch/arm/boot/dts/dtb-build.txt"
+echo "&{/} {build-info = /incbin/(\"dtb-build.txt\");};" >> $DTS_FILE
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 4/4] script: make automatic dtb build info generation
2020-02-21 16:14 ` [RFC PATCH v2 4/4] script: make automatic dtb build info generation Alexandre Torgue
@ 2020-02-21 17:59 ` Frank Rowand
2020-02-26 20:56 ` Rob Herring
1 sibling, 0 replies; 18+ messages in thread
From: Frank Rowand @ 2020-02-21 17:59 UTC (permalink / raw)
To: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, david,
sjg
Cc: devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On 2/21/20 10:14 AM, Alexandre Torgue wrote:
> Append each "xxx.dtb.dts.tmp" file with "build-info" entry during dtb
> build. It allows to get build information (date, source version, ...)
> for each device tree without modify them manually.
>
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index a5af84ef4ffc..f084e78267b2 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -289,6 +289,7 @@ quiet_cmd_dtc = DTC $@
> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> $(DTB_GEN_INFO) $(src) ; \
> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> + $(DTB_GEN_INFO) $(src) $(dtc-tmp) ; \
> $(DTC) -O $(2) -o $@ -b 0 \
> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
> index 0cd8bd98e410..72f31e386787 100755
> --- a/scripts/gen_dtb_build_info.sh
> +++ b/scripts/gen_dtb_build_info.sh
> @@ -6,5 +6,7 @@ set -o nounset
> DTB_DIR=$1
> DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
> DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
> +DTS_FILE=$2
>
> -printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
> +printf "$DTB_INFO" > "arch/arm/boot/dts/dtb-build.txt"
> +echo "&{/} {build-info = /incbin/(\"dtb-build.txt\");};" >> $DTS_FILE
>
Whatever the correct version of this ends up being, it should be
implemented as a single patch instead of patch 1/4 being modified
by patch 4/4.
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 4/4] script: make automatic dtb build info generation
2020-02-21 16:14 ` [RFC PATCH v2 4/4] script: make automatic dtb build info generation Alexandre Torgue
2020-02-21 17:59 ` Frank Rowand
@ 2020-02-26 20:56 ` Rob Herring
1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2020-02-26 20:56 UTC (permalink / raw)
To: Alexandre Torgue
Cc: Frank Rowand, Masahiro Yamada, Michal Marek, david, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On Fri, Feb 21, 2020 at 05:14:18PM +0100, Alexandre Torgue wrote:
> Append each "xxx.dtb.dts.tmp" file with "build-info" entry during dtb
> build. It allows to get build information (date, source version, ...)
> for each device tree without modify them manually.
>
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index a5af84ef4ffc..f084e78267b2 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -289,6 +289,7 @@ quiet_cmd_dtc = DTC $@
> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> $(DTB_GEN_INFO) $(src) ; \
We regenerate this for every dtb?
> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> + $(DTB_GEN_INFO) $(src) $(dtc-tmp) ; \
> $(DTC) -O $(2) -o $@ -b 0 \
> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> diff --git a/scripts/gen_dtb_build_info.sh b/scripts/gen_dtb_build_info.sh
> index 0cd8bd98e410..72f31e386787 100755
> --- a/scripts/gen_dtb_build_info.sh
> +++ b/scripts/gen_dtb_build_info.sh
> @@ -6,5 +6,7 @@ set -o nounset
> DTB_DIR=$1
> DTB_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
Use LINUX_COMPILE_BY #define
> DTB_INFO="From Linux $KERNELRELEASE by $DTB_COMPILE_BY the $(date).\0"
I'd use UTS_RELEASE and UTS_VERSION defines here.
> +DTS_FILE=$2
>
> -printf "$DTB_INFO" > "$DTB_DIR/dtb-build.txt"
> +printf "$DTB_INFO" > "arch/arm/boot/dts/dtb-build.txt"
Obviously, hardcoding this is not right. You probably need to prepend
with $(obj) so this works for out of tree builds too.
> +echo "&{/} {build-info = /incbin/(\"dtb-build.txt\");};" >> $DTS_FILE
You could commit the .dtsi file using the above defines and then just
add a #include of it here. Then we'd get dependency tracking for free.
Rob
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2 0/4] Add device tree build information
2020-02-21 16:14 [RFC PATCH v2 0/4] Add device tree build information Alexandre Torgue
` (3 preceding siblings ...)
2020-02-21 16:14 ` [RFC PATCH v2 4/4] script: make automatic dtb build info generation Alexandre Torgue
@ 2020-02-21 17:47 ` Frank Rowand
2020-02-28 17:47 ` Frank Rowand
4 siblings, 1 reply; 18+ messages in thread
From: Frank Rowand @ 2020-02-21 17:47 UTC (permalink / raw)
To: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, david,
sjg
Cc: devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
On 2/21/20 10:14 AM, Alexandre Torgue wrote:
> (with title it's better ;)
>
> Hi,
>
> The goal of this series is to add device tree build information in dtb.
> This information can be dtb build date, where devicetree files come from,
> who built the dtb ... Actually, same kind of information that you can find
> in the Linux banner which is printout during kernel boot. Having the same
> kind of information for device tree is useful for debugging and maintenance.
>
> A file (dtb-build.txt) containing a string with build information (e.g.,
>>From Linux 5.5.0-rc1 by alex the Mon Jan 13 18:25:38 CET 2020) is generated by
> "gen_dtb_build_info.sh" script.
>
> This file has to be included manually in each dts file that would like to use
> this build information.
In the RFC series, you said:
"I gonna prepare a V2 with David proposition (to use overlay format) by
keeping in mind not to modify existing dts(i) files."
https://lore.kernel.org/linux-devicetree/9d83a36c-78c5-3452-bb48-209d68c46038@st.com/
But here in v2 instead requires including dtb-build.txt.
This would require modifying every single main .dts file to get the build info.
I would prefer the method that Ian and David came up with (sorry, no lore link,
it did not go to lkml). Extract from David's email:
Date: Tue, 21 Jan 2020 13:05:25 +1100
From: David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [RFC PATCH 1/3] dtc: Add dtb build information option
> Given that dts files are run through the C preprocessor before being
> fed to dtc, the build script could use the '-include' flag to force-
> include a fragment containing generated build info without any need to
> modify existing dts files.
Uh... maybe. -include will essentially prepend the forced file, which
is a bit awkward for our purposes. It means that the prepended file
would need the /dts-v1/ tag, and we couldn't have it in the main files
which would be a bit confusing. I think it would also cause problems
with any /memreserve/ tags and means that the main tree could in
theory overwrite the build information which we don't necessarily
want.
I guess we could build things the other way around: have the main .dts
file specified with -include and have the dts on the dtc commandline
be a fixed one with the build information. It'd be a little weird,
though.
-Frank
>
> of/fdt.c is modified to printout "build-info" property during Kernel boot and
> scripts/Makefile.lib is modified to call "gen_dtb_build_info.sh" script.
>
> Patch 1 & 2 script and of/fdt.c updates
> Patch 3 is an example of use in stm32mp157c-dk2.dts file.
> Patch 4 is a tentative to make it automatic (not yet 100% functional).
>
> regards
> Alex
>
> Changes since v1;
> - Remove modification in dtc (no more -B option)
> - Generate a file containing build info which is directly included in dts
> file.
>
>
> Regards
> Alex
>
> Alexandre Torgue (4):
> scripts: Add script to generate dtb build information
> of: fdt: print dtb build information
> ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2
> script: make automatic dtb build info generation
>
> arch/arm/boot/dts/stm32mp157c-dk2.dts | 1 +
> drivers/of/fdt.c | 9 +++++++++
> scripts/Makefile.lib | 3 +++
> scripts/gen_dtb_build_info.sh | 12 ++++++++++++
> 4 files changed, 25 insertions(+)
> create mode 100755 scripts/gen_dtb_build_info.sh
>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [RFC PATCH v2 0/4] Add device tree build information
2020-02-21 17:47 ` [RFC PATCH v2 0/4] Add device tree build information Frank Rowand
@ 2020-02-28 17:47 ` Frank Rowand
2020-03-02 12:55 ` Alexandre Torgue
0 siblings, 1 reply; 18+ messages in thread
From: Frank Rowand @ 2020-02-28 17:47 UTC (permalink / raw)
To: Alexandre Torgue, robh+dt, Masahiro Yamada, Michal Marek, david,
sjg
Cc: devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
Hi Alexandred,
Ping.
-Frank
On 2/21/20 11:47 AM, Frank Rowand wrote:
> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
>> (with title it's better ;)
>>
>> Hi,
>>
>> The goal of this series is to add device tree build information in dtb.
>> This information can be dtb build date, where devicetree files come from,
>> who built the dtb ... Actually, same kind of information that you can find
>> in the Linux banner which is printout during kernel boot. Having the same
>> kind of information for device tree is useful for debugging and maintenance.
>>
>> A file (dtb-build.txt) containing a string with build information (e.g.,
>> >From Linux 5.5.0-rc1 by alex the Mon Jan 13 18:25:38 CET 2020) is generated by
>> "gen_dtb_build_info.sh" script.
>>
>> This file has to be included manually in each dts file that would like to use
>> this build information.
>
> In the RFC series, you said:
>
> "I gonna prepare a V2 with David proposition (to use overlay format) by
> keeping in mind not to modify existing dts(i) files."
>
> https://lore.kernel.org/linux-devicetree/9d83a36c-78c5-3452-bb48-209d68c46038@st.com/
>
> But here in v2 instead requires including dtb-build.txt.
>
> This would require modifying every single main .dts file to get the build info.
> I would prefer the method that Ian and David came up with (sorry, no lore link,
> it did not go to lkml). Extract from David's email:
>
> Date: Tue, 21 Jan 2020 13:05:25 +1100
> From: David Gibson <david@gibson.dropbear.id.au>
> Subject: Re: [RFC PATCH 1/3] dtc: Add dtb build information option
>
> > Given that dts files are run through the C preprocessor before being
> > fed to dtc, the build script could use the '-include' flag to force-
> > include a fragment containing generated build info without any need to
> > modify existing dts files.
>
> Uh... maybe. -include will essentially prepend the forced file, which
> is a bit awkward for our purposes. It means that the prepended file
> would need the /dts-v1/ tag, and we couldn't have it in the main files
> which would be a bit confusing. I think it would also cause problems
> with any /memreserve/ tags and means that the main tree could in
> theory overwrite the build information which we don't necessarily
> want.
>
> I guess we could build things the other way around: have the main .dts
> file specified with -include and have the dts on the dtc commandline
> be a fixed one with the build information. It'd be a little weird,
> though.
>
> -Frank
>
>>
>> of/fdt.c is modified to printout "build-info" property during Kernel boot and
>> scripts/Makefile.lib is modified to call "gen_dtb_build_info.sh" script.
>>
>> Patch 1 & 2 script and of/fdt.c updates
>> Patch 3 is an example of use in stm32mp157c-dk2.dts file.
>> Patch 4 is a tentative to make it automatic (not yet 100% functional).
>>
>> regards
>> Alex
>>
>> Changes since v1;
>> - Remove modification in dtc (no more -B option)
>> - Generate a file containing build info which is directly included in dts
>> file.
>>
>>
>> Regards
>> Alex
>>
>> Alexandre Torgue (4):
>> scripts: Add script to generate dtb build information
>> of: fdt: print dtb build information
>> ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2
>> script: make automatic dtb build info generation
>>
>> arch/arm/boot/dts/stm32mp157c-dk2.dts | 1 +
>> drivers/of/fdt.c | 9 +++++++++
>> scripts/Makefile.lib | 3 +++
>> scripts/gen_dtb_build_info.sh | 12 ++++++++++++
>> 4 files changed, 25 insertions(+)
>> create mode 100755 scripts/gen_dtb_build_info.sh
>>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2 0/4] Add device tree build information
2020-02-28 17:47 ` Frank Rowand
@ 2020-03-02 12:55 ` Alexandre Torgue
2020-03-31 1:03 ` Steve McIntyre
0 siblings, 1 reply; 18+ messages in thread
From: Alexandre Torgue @ 2020-03-02 12:55 UTC (permalink / raw)
To: Frank Rowand, robh+dt, Masahiro Yamada, Michal Marek, david, sjg
Cc: devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
Hi Franck
On 2/28/20 6:47 PM, Frank Rowand wrote:
> Hi Alexandred,
>
> Ping.
>
Sorry I was off last week.
> -Frank
>
>
> On 2/21/20 11:47 AM, Frank Rowand wrote:
>> On 2/21/20 10:14 AM, Alexandre Torgue wrote:
>>> (with title it's better ;)
>>>
>>> Hi,
>>>
>>> The goal of this series is to add device tree build information in dtb.
>>> This information can be dtb build date, where devicetree files come from,
>>> who built the dtb ... Actually, same kind of information that you can find
>>> in the Linux banner which is printout during kernel boot. Having the same
>>> kind of information for device tree is useful for debugging and maintenance.
>>>
>>> A file (dtb-build.txt) containing a string with build information (e.g.,
>>> >From Linux 5.5.0-rc1 by alex the Mon Jan 13 18:25:38 CET 2020) is generated by
>>> "gen_dtb_build_info.sh" script.
>>>
>>> This file has to be included manually in each dts file that would like to use
>>> this build information.
>>
>> In the RFC series, you said:
>>
>> "I gonna prepare a V2 with David proposition (to use overlay format) by
>> keeping in mind not to modify existing dts(i) files."
>>
>> https://lore.kernel.org/linux-devicetree/9d83a36c-78c5-3452-bb48-209d68c46038@st.com/
>>
>> But here in v2 instead requires including dtb-build.txt.
>>
>> This would require modifying every single main .dts file to get the build info
>> I would prefer the method that Ian and David came up with (sorry, no lore link,
>> it did not go to lkml). Extract from David's email:
>>
>> Date: Tue, 21 Jan 2020 13:05:25 +1100
>> From: David Gibson <david@gibson.dropbear.id.au>
>> Subject: Re: [RFC PATCH 1/3] dtc: Add dtb build information option
>>
>> > Given that dts files are run through the C preprocessor before being
>> > fed to dtc, the build script could use the '-include' flag to force-
>> > include a fragment containing generated build info without any need to
>> > modify existing dts files.
>>
>> Uh... maybe. -include will essentially prepend the forced file, which
>> is a bit awkward for our purposes. It means that the prepended file
>> would need the /dts-v1/ tag, and we couldn't have it in the main files
>> which would be a bit confusing. I think it would also cause problems
>> with any /memreserve/ tags and means that the main tree could in
>> theory overwrite the build information which we don't necessarily
>> want.
>>
>> I guess we could build things the other way around: have the main .dts
>> file specified with -include and have the dts on the dtc commandline
>> be a fixed one with the build information. It'd be a little weird,
>> though.
>>
>> -Frank
Yes. I try briefly this idea but I got issues with dts-v1 tag. I agree,
it is cleaner to not modify input dts file. I can rework int this way.
regards
Alex
>>
>>>
>>> of/fdt.c is modified to printout "build-info" property during Kernel boot and
>>> scripts/Makefile.lib is modified to call "gen_dtb_build_info.sh" script.
>>>
>>> Patch 1 & 2 script and of/fdt.c updates
>>> Patch 3 is an example of use in stm32mp157c-dk2.dts file.
>>> Patch 4 is a tentative to make it automatic (not yet 100% functional).
>>>
>>> regards
>>> Alex
>>>
>>> Changes since v1;
>>> - Remove modification in dtc (no more -B option)
>>> - Generate a file containing build info which is directly included in dts
>>> file.
>>>
>>>
>>> Regards
>>> Alex
>>>
>>> Alexandre Torgue (4):
>>> scripts: Add script to generate dtb build information
>>> of: fdt: print dtb build information
>>> ARM: dts: stm32: Add dtb build information entry for stm32mp157c-dk2
>>> script: make automatic dtb build info generation
>>>
>>> arch/arm/boot/dts/stm32mp157c-dk2.dts | 1 +
>>> drivers/of/fdt.c | 9 +++++++++
>>> scripts/Makefile.lib | 3 +++
>>> scripts/gen_dtb_build_info.sh | 12 ++++++++++++
>>> 4 files changed, 25 insertions(+)
>>> create mode 100755 scripts/gen_dtb_build_info.sh
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2 0/4] Add device tree build information
2020-03-02 12:55 ` Alexandre Torgue
@ 2020-03-31 1:03 ` Steve McIntyre
2020-03-31 15:00 ` Alexandre Torgue
0 siblings, 1 reply; 18+ messages in thread
From: Steve McIntyre @ 2020-03-31 1:03 UTC (permalink / raw)
To: Alexandre Torgue
Cc: Frank Rowand, robh+dt, Masahiro Yamada, Michal Marek, david, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
Hi Alexandre,
On Mon, Mar 02, 2020 at 01:55:55PM +0100, Alexandre Torgue wrote:
>On 2/28/20 6:47 PM, Frank Rowand wrote:
>> > This would require modifying every single main .dts file to get the build info
>> > I would prefer the method that Ian and David came up with (sorry, no lore link,
>> > it did not go to lkml). Extract from David's email:
>> >
>> > Date: Tue, 21 Jan 2020 13:05:25 +1100
>> > From: David Gibson <david@gibson.dropbear.id.au>
>> > Subject: Re: [RFC PATCH 1/3] dtc: Add dtb build information option
>> >
>> > > Given that dts files are run through the C preprocessor before being
>> > > fed to dtc, the build script could use the '-include' flag to force-
>> > > include a fragment containing generated build info without any need to
>> > > modify existing dts files.
>> >
>> > Uh... maybe. -include will essentially prepend the forced file, which
>> > is a bit awkward for our purposes. It means that the prepended file
>> > would need the /dts-v1/ tag, and we couldn't have it in the main files
>> > which would be a bit confusing. I think it would also cause problems
>> > with any /memreserve/ tags and means that the main tree could in
>> > theory overwrite the build information which we don't necessarily
>> > want.
>> >
>> > I guess we could build things the other way around: have the main .dts
>> > file specified with -include and have the dts on the dtc commandline
>> > be a fixed one with the build information. It'd be a little weird,
>> > though.
>> >
>> > -Frank
>
>Yes. I try briefly this idea but I got issues with dts-v1 tag. I agree, it is
>cleaner to not modify input dts file. I can rework int this way.
Have you made any progress on this please?
Cheers,
--
Steve McIntyre steve.mcintyre@linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2 0/4] Add device tree build information
2020-03-31 1:03 ` Steve McIntyre
@ 2020-03-31 15:00 ` Alexandre Torgue
0 siblings, 0 replies; 18+ messages in thread
From: Alexandre Torgue @ 2020-03-31 15:00 UTC (permalink / raw)
To: Steve McIntyre
Cc: Frank Rowand, robh+dt, Masahiro Yamada, Michal Marek, david, sjg,
devicetree, linux-kernel, linux-kbuild, devicetree-compiler,
Ian Lepore
Hi Steeve
On 3/31/20 3:03 AM, Steve McIntyre wrote:
> Hi Alexandre,
>
> On Mon, Mar 02, 2020 at 01:55:55PM +0100, Alexandre Torgue wrote:
>> On 2/28/20 6:47 PM, Frank Rowand wrote:
>>>> This would require modifying every single main .dts file to get the build info
>>>> I would prefer the method that Ian and David came up with (sorry, no lore link,
>>>> it did not go to lkml). Extract from David's email:
>>>>
>>>> Date: Tue, 21 Jan 2020 13:05:25 +1100
>>>> From: David Gibson <david@gibson.dropbear.id.au>
>>>> Subject: Re: [RFC PATCH 1/3] dtc: Add dtb build information option
>>>>
>>>> > Given that dts files are run through the C preprocessor before being
>>>> > fed to dtc, the build script could use the '-include' flag to force-
>>>> > include a fragment containing generated build info without any need to
>>>> > modify existing dts files.
>>>>
>>>> Uh... maybe. -include will essentially prepend the forced file, which
>>>> is a bit awkward for our purposes. It means that the prepended file
>>>> would need the /dts-v1/ tag, and we couldn't have it in the main files
>>>> which would be a bit confusing. I think it would also cause problems
>>>> with any /memreserve/ tags and means that the main tree could in
>>>> theory overwrite the build information which we don't necessarily
>>>> want.
>>>>
>>>> I guess we could build things the other way around: have the main .dts
>>>> file specified with -include and have the dts on the dtc commandline
>>>> be a fixed one with the build information. It'd be a little weird,
>>>> though.
>>>>
>>>> -Frank
>>
>> Yes. I try briefly this idea but I got issues with dts-v1 tag. I agree, it is
>> cleaner to not modify input dts file. I can rework int this way.
>
> Have you made any progress on this please?
Unfortunately no. I cook something locally but not yet upstream-able.
Due to project issue I didn't find time to work on it. I think (I hope)
to be less busy next week and so I'll restart it.
regards
alex
>
> Cheers,
>
^ permalink raw reply [flat|nested] 18+ messages in thread