Skip to contentSkip to conversation

arm64: zynqmp: Add support for u-boot.itb generation with ATF

PATCH Superseded Michal Simek 2 participants 6 messages Dec 5, 2019 – Dec 10, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++
 include/configs/xilinx_zynqmp.h         |  6 +-
 3 files changed, 106 insertions(+), 2 deletions(-)
 create mode 100755 arch/arm/mach-zynqmp/mkimage_fit_atf.sh
Kconfig +2 -1
index e22417ec4471..7efafffec0a4 100644
@@ -253,7 +253,7 @@ config BUILD_TARGET
 	default "u-boot-spl.kwb" if ARCH_MVEBU && SPL
 	default "u-boot-elf.srec" if RCAR_GEN3
 	default "u-boot.itb" if SPL_LOAD_FIT && (ARCH_ROCKCHIP || \
-				ARCH_SUNXI || RISCV)
+				ARCH_SUNXI || RISCV || ARCH_ZYNQMP)
 	default "u-boot.kwb" if KIRKWOOD
 	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
 	default "u-boot-with-spl.imx" if ARCH_MX6 && SPL
@@ -481,6 +481,7 @@ config SPL_FIT_GENERATOR
 	depends on SPL_FIT
 	default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI
 	default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP
+	default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP
 	default "arch/riscv/lib/mkimage_fit_opensbi.sh" if SPL_LOAD_FIT && RISCV
 	help
 	  Specifies a (platform specific) script file to generate the FIT
arch/arm/mach-zynqmp/mkimage_fit_atf.sh new file +99 -0

99 lines not on this page · raw message

include/configs/xilinx_zynqmp.h +5 -1
index ee1ceebf1291..e7eb8dbfcb45 100644
@@ -243,7 +243,11 @@
 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0 /* unused */
 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	0 /* unused */
 # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0 /* unused */
-# define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
+# if defined(CONFIG_SPL_LOAD_FIT)
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.itb"
+# else
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
+# endif
 #endif
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU)
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Quoted 13 lines · Michal Simek

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Quoted 7 lines

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++

My only complaint here is adding and N'th version of mkimage_fit_atf.sh that varies seemingly only in addresses. Can we not abstract this enough to make it for everyone to use and pass in the needed values?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191205/29e06d9c/attachment.sig>
#2 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Quoted 19 lines · Tom Rini
Quoted 18 lines · Michal Simek

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

Quoted 6 lines
Quoted 2 lines
 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++

My only complaint here is adding and N'th version of mkimage_fit_atf.sh that varies seemingly only in addresses. Can we not abstract this enough to make it for everyone to use and pass in the needed values?

First of all I will be sending v3 because of other things I found.

Adding more folks to this.

I have went through all versions and here is sort of stat:

board/sunxi/mksunxi_fit_atf.sh - firmware is uboot, atf loadables (not standard)

board/theobroma-systems/puma_rk3399/fit_spl_atf.sh - license present atf, uboot, pmufw (only present here)

arch/arm/mach-rockchip/make_fit_atf.py - python (only one) and read addresses from elfs

arch/arm/mach-rockchip/fit_spl_optee.sh - firmware is tee(no ATF)

arch/riscv/lib/mkimage_fit_opensbi.sh - reads stuff from .config and also handles non DT case

arch/arm/mach-imx/mkimage_fit_atf.sh - optee, atf, incorrect dt nodes names

And of course this one.

-------------------------------

I think the key point here is to start talk about how this should be done. Language? One is python others are shell scripts.

Should it stop when ATF/TEE is not found?

What file to read to get information from u-boot? .config or include/generated/autoconf.h?

Read information about locations from ELFs?

Should we handle non DT case? Yes?

Move just DT generation to common location and keep VARs, file checking in board/arch scripts?

Thanks,
Michal

#3 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Quoted 42 lines · Michal Simek
Quoted 19 lines · Tom Rini
Quoted 18 lines · Michal Simek

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

Quoted 6 lines
Quoted 2 lines
 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++

My only complaint here is adding and N'th version of mkimage_fit_atf.sh that varies seemingly only in addresses. Can we not abstract this enough to make it for everyone to use and pass in the needed values?

First of all I will be sending v3 because of other things I found.

Adding more folks to this.

I have went through all versions and here is sort of stat:

board/sunxi/mksunxi_fit_atf.sh - firmware is uboot, atf loadables (not standard)

board/theobroma-systems/puma_rk3399/fit_spl_atf.sh - license present atf, uboot, pmufw (only present here)

arch/arm/mach-rockchip/make_fit_atf.py - python (only one) and read addresses from elfs

Quoted 8 lines

arch/arm/mach-rockchip/fit_spl_optee.sh - firmware is tee(no ATF)

arch/riscv/lib/mkimage_fit_opensbi.sh - reads stuff from .config and also handles non DT case

arch/arm/mach-imx/mkimage_fit_atf.sh - optee, atf, incorrect dt nodes names

And of course this one.

Thanks for looking more here.

Quoted 4 lines

-------------------------------

I think the key point here is to start talk about how this should be done. Language? One is python others are shell scripts.

I don't have a hard preference here. I think the reason we have one in Python is for ease of working with ELF. Restrictions / issues like that probably mean it would be best to make sure we pick a language that allows for peeking at ELFs but I have not confirmed if we could easily re-do the rockchip python tool in shell by using a standard tool (objdump or similar from binutils, so we'll certainly have it).

Quoted 1 line

Should it stop when ATF/TEE is not found?

For CI it must non-fatally complete, but should also be verbose in that the resulting binary is non-functional.

Quoted 2 lines

What file to read to get information from u-boot? .config or include/generated/autoconf.h?

Honestly? I'd like to start looking at something better if we can here as these are not really user-configurable values, but system values. Some property under a -u-boot.dtsi file?

Quoted 3 lines

Read information about locations from ELFs?

Should we handle non DT case? Yes?

Sorry, non-DT case in this instance meaning what? We're talking about FIT and FIT uses a DT.

Quoted 2 lines

Move just DT generation to common location and keep VARs, file checking in board/arch scripts?

High level, this sounds right. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191209/ae9a5508/attachment.sig>
#4 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Quoted 59 lines · Tom Rini
Quoted 42 lines · Michal Simek
Quoted 19 lines · Tom Rini
Quoted 18 lines · Michal Simek

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

Quoted 6 lines
Quoted 2 lines
 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++

My only complaint here is adding and N'th version of mkimage_fit_atf.sh that varies seemingly only in addresses. Can we not abstract this enough to make it for everyone to use and pass in the needed values?

First of all I will be sending v3 because of other things I found.

Adding more folks to this.

I have went through all versions and here is sort of stat:

board/sunxi/mksunxi_fit_atf.sh - firmware is uboot, atf loadables (not standard)

board/theobroma-systems/puma_rk3399/fit_spl_atf.sh - license present atf, uboot, pmufw (only present here)

arch/arm/mach-rockchip/make_fit_atf.py - python (only one) and read addresses from elfs

Quoted 8 lines

arch/arm/mach-rockchip/fit_spl_optee.sh - firmware is tee(no ATF)

arch/riscv/lib/mkimage_fit_opensbi.sh - reads stuff from .config and also handles non DT case

arch/arm/mach-imx/mkimage_fit_atf.sh - optee, atf, incorrect dt nodes names

And of course this one.

Thanks for looking more here.

Quoted 4 lines

-------------------------------

I think the key point here is to start talk about how this should be done. Language? One is python others are shell scripts.

Quoted 6 lines

I don't have a hard preference here. I think the reason we have one in Python is for ease of working with ELF. Restrictions / issues like that probably mean it would be best to make sure we pick a language that allows for peeking at ELFs but I have not confirmed if we could easily re-do the rockchip python tool in shell by using a standard tool (objdump or similar from binutils, so we'll certainly have it).

I expect that all addresses are just entry points of these elfs It means something like this should be enough. readelf -l bl31.elf | awk '/Entry point/ { print $3 }'

Quoted 5 lines
Quoted 2 lines

Should it stop when ATF/TEE is not found?

For CI it must non-fatally complete, but should also be verbose in that the resulting binary is non-functional.

ok.

Quoted 7 lines
Quoted 3 lines

What file to read to get information from u-boot? .config or include/generated/autoconf.h?

Honestly? I'd like to start looking at something better if we can here as these are not really user-configurable values, but system values. Some property under a -u-boot.dtsi file?

I still have one ancient branch to get rid of all u-boot,dm* variables from nodes and move them to chosen node where they should be. Can you please elaborate on this more?

Quoted 6 lines
Quoted 3 lines

Read information about locations from ELFs?

Should we handle non DT case? Yes?

Sorry, non-DT case in this instance meaning what? We're talking about FIT and FIT uses a DT.

With OF_BOARD configurations where DT can be stored somewhere else there could be use cases that you want to have FIT without DT.

Quoted 4 lines
Quoted 2 lines

Move just DT generation to common location and keep VARs, file checking in board/arch scripts?

High level, this sounds right. Thanks!

I would like to get more feedback from others to agreed how this should be done before anybody invest time for doing it.

Thanks,
Michal

#5 lore raw

PATCH v2 1/1 arm64: zynqmp: Add support for u-boot.itb generation with ATF

Quoted 68 lines · Michal Simek
Quoted 59 lines · Tom Rini
Quoted 42 lines · Michal Simek
Quoted 19 lines · Tom Rini
Quoted 18 lines · Michal Simek

Follow i.MX, Sunxi, RISC-V and Rockchip to generate u-boot.itb which includes U-Boot proper, ATF and DTBs in FIT format. ZynqMP supports FIT for quite a long time but with using out of tree solution. The patch is filling this gap.

Tested on zcu102, zcu104 and zcu100/Ultra96.

zcu100/Ultra96 v2.2 ATF build by:
make DEBUG=0 ZYNQMP_CONSOLE=cadence1 RESET_TO_BL31=1 PLAT=zynqmp bl31

---

Changes in v2:
- Exchange u-boot/atf in config section
- Use default ATF baseaddr from mainline
- Update commit message

Quoted 6 lines
Quoted 2 lines
 Kconfig                                 |  3 +-
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 99 +++++++++++++++++++++++++

My only complaint here is adding and N'th version of mkimage_fit_atf.sh that varies seemingly only in addresses. Can we not abstract this enough to make it for everyone to use and pass in the needed values?

First of all I will be sending v3 because of other things I found.

Adding more folks to this.

I have went through all versions and here is sort of stat:

board/sunxi/mksunxi_fit_atf.sh - firmware is uboot, atf loadables (not standard)

board/theobroma-systems/puma_rk3399/fit_spl_atf.sh - license present atf, uboot, pmufw (only present here)

arch/arm/mach-rockchip/make_fit_atf.py - python (only one) and read addresses from elfs

Quoted 8 lines

arch/arm/mach-rockchip/fit_spl_optee.sh - firmware is tee(no ATF)

arch/riscv/lib/mkimage_fit_opensbi.sh - reads stuff from .config and also handles non DT case

arch/arm/mach-imx/mkimage_fit_atf.sh - optee, atf, incorrect dt nodes names

And of course this one.

Thanks for looking more here.

Quoted 4 lines

-------------------------------

I think the key point here is to start talk about how this should be done. Language? One is python others are shell scripts.

Quoted 6 lines

I don't have a hard preference here. I think the reason we have one in Python is for ease of working with ELF. Restrictions / issues like that probably mean it would be best to make sure we pick a language that allows for peeking at ELFs but I have not confirmed if we could easily re-do the rockchip python tool in shell by using a standard tool (objdump or similar from binutils, so we'll certainly have it).

Quoted 3 lines

I expect that all addresses are just entry points of these elfs It means something like this should be enough. readelf -l bl31.elf | awk '/Entry point/ { print $3 }'

OK. Then we should probably stick to shell.

Quoted 11 lines
Quoted 4 lines
Quoted 1 line

Should it stop when ATF/TEE is not found?

For CI it must non-fatally complete, but should also be verbose in that the resulting binary is non-functional.

ok.

Quoted 4 lines
Quoted 3 lines

What file to read to get information from u-boot? .config or include/generated/autoconf.h?

Quoted 7 lines
Quoted 3 lines

Honestly? I'd like to start looking at something better if we can here as these are not really user-configurable values, but system values. Some property under a -u-boot.dtsi file?

I still have one ancient branch to get rid of all u-boot,dm* variables from nodes and move them to chosen node where they should be. Can you please elaborate on this more?

Well, it's been pointed out before, and I agree, that a lot of things we have had historically in CONFIG_xxx symbols are things that just aren't appropriate for Kconfig (users shouldn't change them, putting N default values in Kconfig is ugly, etc). While devicetree-the-in-kernel-file is to describe the hardware, devicetree-the-syntax is something we use for other things (FIT images) and other projects take even farther. So I've been thinking that devicetree-the-syntax seems like a good way to handle this particular problem. Where it all goes, I don't know.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191210/1a185424/attachment.sig>