[U-Boot,v5,10/15] Makefile: Query the SPL Fit Generator for its dependencies
diff mbox series

Message ID 20190920152824.18958-11-jjhiblot@ti.com
State Superseded
Delegated to: Tom Rini
Headers show
Series
  • Add support for applications of overlays in SPL
Related show

Commit Message

Jean-Jacques Hiblot Sept. 20, 2019, 3:28 p.m. UTC
To reduce the complexity of the Makefile, let the generator tell what its
dependencies are. For this purpose use the "--deps" option.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile                                           | 9 ++-------
 arch/arm/mach-imx/mkimage_fit_atf.sh               | 5 +++++
 arch/arm/mach-rockchip/make_fit_atf.py             | 7 +++++++
 board/sunxi/mksunxi_fit_atf.sh                     | 4 ++++
 board/theobroma-systems/puma_rk3399/fit_spl_atf.sh | 6 ++++++
 5 files changed, 24 insertions(+), 7 deletions(-)

Comments

Auer, Lukas Oct. 6, 2019, 4:57 p.m. UTC | #1
Hi Jean-Jacques,

On Fri, 2019-09-20 at 17:28 +0200, Jean-Jacques Hiblot wrote:
> To reduce the complexity of the Makefile, let the generator tell what its
> dependencies are. For this purpose use the "--deps" option.
> 

We recently added a generic FIT generator script for RISC-V, located at
arch/riscv/lib/mkimage_fit_opensbi.sh . Can you add the --deps option
to that script as well? It does not have any dependencies, so it can be
handled the same way as in the i.MX and sunxi FIT generator scripts.

Thanks,
Lukas

> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  Makefile                                           | 9 ++-------
>  arch/arm/mach-imx/mkimage_fit_atf.sh               | 5 +++++
>  arch/arm/mach-rockchip/make_fit_atf.py             | 7 +++++++
>  board/sunxi/mksunxi_fit_atf.sh                     | 4 ++++
>  board/theobroma-systems/puma_rk3399/fit_spl_atf.sh | 6 ++++++
>  5 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 8a28740b22..1fa63d2a6b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1235,13 +1235,8 @@ U_BOOT_ITS = $(src)/$(SPL_FIT_SOURCE)
>  else
>  ifneq ($(SPL_FIT_GENERATOR),)
>  U_BOOT_ITS := u-boot.its
> -ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh")
> -U_BOOT_ITS_DEPS += u-boot-nodtb.bin
> -endif
> -ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py")
> -U_BOOT_ITS_DEPS += u-boot
> -endif
> -$(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
> +U_BOOT_ITS_DEPS += $(shell $(srctree)/$(SPL_FIT_GENERATOR) --deps $(BOARD))
> +$(U_BOOT_ITS): u-boot-nodtb.bin $(U_BOOT_ITS_DEPS) FORCE
>  	$(srctree)/$(SPL_FIT_GENERATOR) \
>  	$(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
>  endif
> diff --git a/arch/arm/mach-imx/mkimage_fit_atf.sh b/arch/arm/mach-imx/mkimage_fit_atf.sh
> index 38c9858e84..4da7531954 100755
> --- a/arch/arm/mach-imx/mkimage_fit_atf.sh
> +++ b/arch/arm/mach-imx/mkimage_fit_atf.sh
> @@ -11,6 +11,11 @@
>  [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0x00910000"
>  [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
>  
> +
> +if [ x"$1" = x"--deps" ]; then
> +	exit 0
> +fi
> +
>  if [ ! -f $BL31 ]; then
>  	echo "ERROR: BL31 file $BL31 NOT found" >&2
>  	exit 0
> diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
> index b9a1988298..56fab4e330 100755
> --- a/arch/arm/mach-rockchip/make_fit_atf.py
> +++ b/arch/arm/mach-rockchip/make_fit_atf.py
> @@ -163,6 +163,10 @@ def unpack_elf(filename):
>              segments.append((index, e_entry, p_paddr, p_data))
>      return segments
>  
> +def show_deps_and_exit():
> +	print("u-boot")
> +	sys.exit(0)
> +
>  def main():
>      uboot_elf = "./u-boot"
>      fit_its = sys.stdout
> @@ -178,6 +182,9 @@ def main():
>          logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
>          logging.warning(' Please read Building section in doc/README.rockchip')
>  
> +    if sys.argv[1] == "--deps":
> +	    show_deps_and_exit()
> +
>      opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
>      for opt, val in opts:
>          if opt == "-o":
> diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh
> index 88ad719747..c0ce4394e2 100755
> --- a/board/sunxi/mksunxi_fit_atf.sh
> +++ b/board/sunxi/mksunxi_fit_atf.sh
> @@ -5,6 +5,10 @@
>  #
>  # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
>  
> +if [ x"$1" = x"--deps" ]; then
> +	exit 0
> +fi
> +
>  [ -z "$BL31" ] && BL31="bl31.bin"
>  
>  if [ ! -f $BL31 ]; then
> diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> index 420e7daf4c..a7bada193a 100755
> --- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> +++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
> @@ -11,6 +11,12 @@
>  #
>  # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
>  
> +
> +if [ x"$1" = x"--deps" ]; then
> +	echo "u-boot.dtb"
> +	exit 0
> +fi
> +
>  [ -z "$BL31" ] && BL31="bl31.bin"
>  
>  if [ ! -f $BL31 ]; then
Tom Rini Oct. 6, 2019, 5:12 p.m. UTC | #2
On Sun, Oct 06, 2019 at 04:57:29PM +0000, Auer, Lukas wrote:
> Hi Jean-Jacques,
> 
> On Fri, 2019-09-20 at 17:28 +0200, Jean-Jacques Hiblot wrote:
> > To reduce the complexity of the Makefile, let the generator tell what its
> > dependencies are. For this purpose use the "--deps" option.
> > 
> 
> We recently added a generic FIT generator script for RISC-V, located at
> arch/riscv/lib/mkimage_fit_opensbi.sh . Can you add the --deps option
> to that script as well? It does not have any dependencies, so it can be
> handled the same way as in the i.MX and sunxi FIT generator scripts.

Can we please work on generalizing these scripts and either using
binman, updating binman as needed or coming up with a POSIX SH tool that
can do what needs doing?  Thanks!
Jean-Jacques Hiblot Oct. 7, 2019, 9:43 a.m. UTC | #3
On 06/10/2019 19:12, Tom Rini wrote:
> On Sun, Oct 06, 2019 at 04:57:29PM +0000, Auer, Lukas wrote:
>> Hi Jean-Jacques,
>>
>> On Fri, 2019-09-20 at 17:28 +0200, Jean-Jacques Hiblot wrote:
>>> To reduce the complexity of the Makefile, let the generator tell what its
>>> dependencies are. For this purpose use the "--deps" option.
>>>
>> We recently added a generic FIT generator script for RISC-V, located at
>> arch/riscv/lib/mkimage_fit_opensbi.sh . Can you add the --deps option
>> to that script as well? It does not have any dependencies, so it can be
>> handled the same way as in the i.MX and sunxi FIT generator scripts.
> Can we please work on generalizing these scripts and either using
> binman, updating binman as needed or coming up with a POSIX SH tool that
> can do what needs doing?  Thanks!

Maybe it can be done. But we would need to know first what the needs are.

In may case, all I need is to bundle at build time a set of DTB overlays 
with u-boot.bin and some DTBs.

For this binman is overkill, using dtc is enough, though I guess binman 
can be used instead.

JJ

>
Tom Rini Oct. 7, 2019, 4:02 p.m. UTC | #4
On Mon, Oct 07, 2019 at 11:43:07AM +0200, Jean-Jacques Hiblot wrote:
> 
> On 06/10/2019 19:12, Tom Rini wrote:
> > On Sun, Oct 06, 2019 at 04:57:29PM +0000, Auer, Lukas wrote:
> > > Hi Jean-Jacques,
> > > 
> > > On Fri, 2019-09-20 at 17:28 +0200, Jean-Jacques Hiblot wrote:
> > > > To reduce the complexity of the Makefile, let the generator tell what its
> > > > dependencies are. For this purpose use the "--deps" option.
> > > > 
> > > We recently added a generic FIT generator script for RISC-V, located at
> > > arch/riscv/lib/mkimage_fit_opensbi.sh . Can you add the --deps option
> > > to that script as well? It does not have any dependencies, so it can be
> > > handled the same way as in the i.MX and sunxi FIT generator scripts.
> > Can we please work on generalizing these scripts and either using
> > binman, updating binman as needed or coming up with a POSIX SH tool that
> > can do what needs doing?  Thanks!
> 
> Maybe it can be done. But we would need to know first what the needs are.
> 
> In may case, all I need is to bundle at build time a set of DTB overlays
> with u-boot.bin and some DTBs.
> 
> For this binman is overkill, using dtc is enough, though I guess binman can
> be used instead.

OK, and in this case we're talking about tools/k3_fit_atf.sh which is
based on board/sunxi/mksunxi_fit_atf.sh ?  That's two similar but not
quite just mergable POSIX SH tools.  If we end up with an intermediate
state of having tools/generators/ with a number of $(soc)_fit_atf.sh
scripts that'll start to make it clearer what is/isn't the same.  Maybe
we won't have a single tool, but if it's at least make it clearer where
things belong and we can get consistency.  Thanks!
Jean-Jacques Hiblot Oct. 9, 2019, 10:10 a.m. UTC | #5
On 07/10/2019 18:02, Tom Rini wrote:
> On Mon, Oct 07, 2019 at 11:43:07AM +0200, Jean-Jacques Hiblot wrote:
>> On 06/10/2019 19:12, Tom Rini wrote:
>>> On Sun, Oct 06, 2019 at 04:57:29PM +0000, Auer, Lukas wrote:
>>>> Hi Jean-Jacques,
>>>>
>>>> On Fri, 2019-09-20 at 17:28 +0200, Jean-Jacques Hiblot wrote:
>>>>> To reduce the complexity of the Makefile, let the generator tell what its
>>>>> dependencies are. For this purpose use the "--deps" option.
>>>>>
>>>> We recently added a generic FIT generator script for RISC-V, located at
>>>> arch/riscv/lib/mkimage_fit_opensbi.sh . Can you add the --deps option
>>>> to that script as well? It does not have any dependencies, so it can be
>>>> handled the same way as in the i.MX and sunxi FIT generator scripts.
>>> Can we please work on generalizing these scripts and either using
>>> binman, updating binman as needed or coming up with a POSIX SH tool that
>>> can do what needs doing?  Thanks!
>> Maybe it can be done. But we would need to know first what the needs are.
>>
>> In may case, all I need is to bundle at build time a set of DTB overlays
>> with u-boot.bin and some DTBs.
>>
>> For this binman is overkill, using dtc is enough, though I guess binman can
>> be used instead.
> OK, and in this case we're talking about tools/k3_fit_atf.sh which is
> based on board/sunxi/mksunxi_fit_atf.sh ?  That's two similar but not
> quite just mergable POSIX SH tools.  If we end up with an intermediate
> state of having tools/generators/ with a number of $(soc)_fit_atf.sh
> scripts that'll start to make it clearer what is/isn't the same.  Maybe
> we won't have a single tool, but if it's at least make it clearer where
> things belong and we can get consistency.  Thanks!

I see your point. This patch is not essential for this series, so I'll 
drop this for the time being and try to come up with a better solution 
when adding SPL overlay support for AM6/J7.

JJ


>

Patch
diff mbox series

diff --git a/Makefile b/Makefile
index 8a28740b22..1fa63d2a6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1235,13 +1235,8 @@  U_BOOT_ITS = $(src)/$(SPL_FIT_SOURCE)
 else
 ifneq ($(SPL_FIT_GENERATOR),)
 U_BOOT_ITS := u-boot.its
-ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh")
-U_BOOT_ITS_DEPS += u-boot-nodtb.bin
-endif
-ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py")
-U_BOOT_ITS_DEPS += u-boot
-endif
-$(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
+U_BOOT_ITS_DEPS += $(shell $(srctree)/$(SPL_FIT_GENERATOR) --deps $(BOARD))
+$(U_BOOT_ITS): u-boot-nodtb.bin $(U_BOOT_ITS_DEPS) FORCE
 	$(srctree)/$(SPL_FIT_GENERATOR) \
 	$(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
 endif
diff --git a/arch/arm/mach-imx/mkimage_fit_atf.sh b/arch/arm/mach-imx/mkimage_fit_atf.sh
index 38c9858e84..4da7531954 100755
--- a/arch/arm/mach-imx/mkimage_fit_atf.sh
+++ b/arch/arm/mach-imx/mkimage_fit_atf.sh
@@ -11,6 +11,11 @@ 
 [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0x00910000"
 [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
 
+
+if [ x"$1" = x"--deps" ]; then
+	exit 0
+fi
+
 if [ ! -f $BL31 ]; then
 	echo "ERROR: BL31 file $BL31 NOT found" >&2
 	exit 0
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
index b9a1988298..56fab4e330 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -163,6 +163,10 @@  def unpack_elf(filename):
             segments.append((index, e_entry, p_paddr, p_data))
     return segments
 
+def show_deps_and_exit():
+	print("u-boot")
+	sys.exit(0)
+
 def main():
     uboot_elf = "./u-boot"
     fit_its = sys.stdout
@@ -178,6 +182,9 @@  def main():
         logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
         logging.warning(' Please read Building section in doc/README.rockchip')
 
+    if sys.argv[1] == "--deps":
+	    show_deps_and_exit()
+
     opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
     for opt, val in opts:
         if opt == "-o":
diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh
index 88ad719747..c0ce4394e2 100755
--- a/board/sunxi/mksunxi_fit_atf.sh
+++ b/board/sunxi/mksunxi_fit_atf.sh
@@ -5,6 +5,10 @@ 
 #
 # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
 
+if [ x"$1" = x"--deps" ]; then
+	exit 0
+fi
+
 [ -z "$BL31" ] && BL31="bl31.bin"
 
 if [ ! -f $BL31 ]; then
diff --git a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
index 420e7daf4c..a7bada193a 100755
--- a/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
+++ b/board/theobroma-systems/puma_rk3399/fit_spl_atf.sh
@@ -11,6 +11,12 @@ 
 #
 # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
 
+
+if [ x"$1" = x"--deps" ]; then
+	echo "u-boot.dtb"
+	exit 0
+fi
+
 [ -z "$BL31" ] && BL31="bl31.bin"
 
 if [ ! -f $BL31 ]; then