diff mbox series

[RFC,1/4] scripts/Makefile.lib: Collate all dtsi files for inclusion

Message ID 20230814090309.1548310-2-sughosh.ganu@linaro.org
State Superseded
Headers show
Series capsule: Embed the public key ESL as part of build | expand

Commit Message

Sughosh Ganu Aug. 14, 2023, 9:03 a.m. UTC
At the time of building a device-tree file, all the *u-boot.dtsi files
are looked for, in a particular order, and the first file found is
included. Then, the list of files specified in the
CONFIG_DEVICE_TREE_INCLUDES symbol are included.

Combine these files that are to be included into a variable, and then
include all these files in one go.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
 scripts/Makefile.lib | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Tom Rini Aug. 14, 2023, 3:04 p.m. UTC | #1
On Mon, Aug 14, 2023 at 02:33:06PM +0530, Sughosh Ganu wrote:

> At the time of building a device-tree file, all the *u-boot.dtsi files
> are looked for, in a particular order, and the first file found is
> included. Then, the list of files specified in the
> CONFIG_DEVICE_TREE_INCLUDES symbol are included.
> 
> Combine these files that are to be included into a variable, and then
> include all these files in one go.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>  scripts/Makefile.lib | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index f5ab7af0f4..f41b16781d 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -179,10 +179,13 @@ ifdef DEVICE_TREE_DEBUG
>  u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
>  endif
>  
> -# We use the first match
> -u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
> +# We use the first match to be included
> +include_files = $(strip $(u_boot_dtsi_options_debug) \
>  	$(notdir $(firstword $(u_boot_dtsi_options))))
>  
> +# The CONFIG_DEVICE_TREE_INCLUDES also need to be included
> +include_files += $(CONFIG_DEVICE_TREE_INCLUDES)

This is what I wanted, logic-wise, but I think include_files is too
vague.
Sughosh Ganu Aug. 14, 2023, 6:42 p.m. UTC | #2
hi Tom,

On Mon, 14 Aug 2023 at 20:34, Tom Rini <trini@konsulko.com> wrote:
>
> On Mon, Aug 14, 2023 at 02:33:06PM +0530, Sughosh Ganu wrote:
>
> > At the time of building a device-tree file, all the *u-boot.dtsi files
> > are looked for, in a particular order, and the first file found is
> > included. Then, the list of files specified in the
> > CONFIG_DEVICE_TREE_INCLUDES symbol are included.
> >
> > Combine these files that are to be included into a variable, and then
> > include all these files in one go.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >  scripts/Makefile.lib | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index f5ab7af0f4..f41b16781d 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -179,10 +179,13 @@ ifdef DEVICE_TREE_DEBUG
> >  u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
> >  endif
> >
> > -# We use the first match
> > -u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
> > +# We use the first match to be included
> > +include_files = $(strip $(u_boot_dtsi_options_debug) \
> >       $(notdir $(firstword $(u_boot_dtsi_options))))
> >
> > +# The CONFIG_DEVICE_TREE_INCLUDES also need to be included
> > +include_files += $(CONFIG_DEVICE_TREE_INCLUDES)
>
> This is what I wanted, logic-wise, but I think include_files is too
> vague.

Okay. How about dtsi_include_list, or dtsi_list? If not, can you
suggest a name which you think would be apt. Thanks.

-sughosh
Tom Rini Aug. 14, 2023, 7:13 p.m. UTC | #3
On Tue, Aug 15, 2023 at 12:12:57AM +0530, Sughosh Ganu wrote:
> hi Tom,
> 
> On Mon, 14 Aug 2023 at 20:34, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Mon, Aug 14, 2023 at 02:33:06PM +0530, Sughosh Ganu wrote:
> >
> > > At the time of building a device-tree file, all the *u-boot.dtsi files
> > > are looked for, in a particular order, and the first file found is
> > > included. Then, the list of files specified in the
> > > CONFIG_DEVICE_TREE_INCLUDES symbol are included.
> > >
> > > Combine these files that are to be included into a variable, and then
> > > include all these files in one go.
> > >
> > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > > ---
> > >  scripts/Makefile.lib | 11 +++++++----
> > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > > index f5ab7af0f4..f41b16781d 100644
> > > --- a/scripts/Makefile.lib
> > > +++ b/scripts/Makefile.lib
> > > @@ -179,10 +179,13 @@ ifdef DEVICE_TREE_DEBUG
> > >  u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
> > >  endif
> > >
> > > -# We use the first match
> > > -u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
> > > +# We use the first match to be included
> > > +include_files = $(strip $(u_boot_dtsi_options_debug) \
> > >       $(notdir $(firstword $(u_boot_dtsi_options))))
> > >
> > > +# The CONFIG_DEVICE_TREE_INCLUDES also need to be included
> > > +include_files += $(CONFIG_DEVICE_TREE_INCLUDES)
> >
> > This is what I wanted, logic-wise, but I think include_files is too
> > vague.
> 
> Okay. How about dtsi_include_list, or dtsi_list? If not, can you
> suggest a name which you think would be apt. Thanks.

dtsi_include_list sounds good.
diff mbox series

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f5ab7af0f4..f41b16781d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -179,10 +179,13 @@  ifdef DEVICE_TREE_DEBUG
 u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
 endif
 
-# We use the first match
-u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
+# We use the first match to be included
+include_files = $(strip $(u_boot_dtsi_options_debug) \
 	$(notdir $(firstword $(u_boot_dtsi_options))))
 
+# The CONFIG_DEVICE_TREE_INCLUDES also need to be included
+include_files += $(CONFIG_DEVICE_TREE_INCLUDES)
+
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 $(UBOOTINCLUDE)                                         \
@@ -320,8 +323,8 @@  quiet_cmd_dtc = DTC     $@
 # Bring in any U-Boot-specific include at the end of the file
 # And finally any custom .dtsi fragments specified with CONFIG_DEVICE_TREE_INCLUDES
 cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
-	(cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \
-	$(foreach f,$(subst $(quote),,$(CONFIG_DEVICE_TREE_INCLUDES)), \
+	(cat $< > $(pre-tmp)); \
+	$(foreach f,$(subst $(quote),,$(include_files)), \
 	  echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
 	$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
 	$(DTC) -O dtb -o $@ -b 0 \