diff mbox series

[v11,07/17] boot/ti-k3-r5-loader: install tiboot3.bin and sysfw.itb to BINARIES_DIR

Message ID 20240403195403.1359007-8-romain.naour@smile.fr
State Superseded
Headers show
Series Add support for AM62x-SK HS-FS devices | expand

Commit Message

Romain Naour April 3, 2024, 7:53 p.m. UTC
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>

U-boot for k3 r5 core (ti-k3-r5-loader) can install different target
image (tiboot3*.bin) depending on the k3 SoC variant using different
boot flow [1]:

- Split binary with a combined firmware: (eg: AM65)
- Combined binary with a combined firmware: (eg: AM64)
- Split binary with a split firmware: (eg: J721E)
- Combined binary with a split firmware: (eg: AM62)

K3 SoC using Split Binary Boot Flow also requires sysfw-*.itb file
to boot (eg: am65, j721e). Only tiboot3*.bin is needed for other
boot flow.

From [1]:
"It's important to rename the generated tiboot3.bin and sysfw.itb
to match exactly tiboot3.bin and sysfw.itb as ROM and the wakeup
UBoot SPL will only look for and load the files with these names."

See the list of all tiboot3*.bin and sysfw*.itb file variant found in meta-ti:

  meta-ti-bsp/conf/machine/beaglebone-ai64-k3r5.conf:UBOOT_IMAGE = "tiboot3-${MAINMACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
  meta-ti-bsp/conf/machine/beaglebone-ai64-k3r5.conf:UBOOT_SYMLINK = "tiboot3-${MAINMACHINE}.${UBOOT_SUFFIX}"
  meta-ti-bsp/conf/machine/include/am62axx.inc:IMAGE_BOOT_FILES += "tiboot3-am62ax-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/am62axx.inc:IMAGE_BOOT_FILES += "tiboot3-am62ax-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/am62axx.inc:IMAGE_BOOT_FILES += "tiboot3-am62ax-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/am62pxx.inc:IMAGE_BOOT_FILES += "tiboot3-am62px-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/am62xx.inc:IMAGE_BOOT_FILES += "tiboot3-am62x-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/am62xx.inc:IMAGE_BOOT_FILES += "tiboot3-am62x-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/am62xx.inc:IMAGE_BOOT_FILES += "tiboot3-am62x-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/am64xx.inc:IMAGE_BOOT_FILES += "tiboot3-am64x_sr2-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/am64xx.inc:IMAGE_BOOT_FILES += "tiboot3-am64x-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/am64xx.inc:IMAGE_BOOT_FILES += "tiboot3-am64x_sr2-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/am65xx.inc:IMAGE_BOOT_FILES += "tiboot3-am65x_sr2-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/am65xx.inc:IMAGE_BOOT_FILES += "tiboot3-am65x_sr2-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/j7200.inc:IMAGE_BOOT_FILES += "tiboot3-j7200-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/j7200.inc:IMAGE_BOOT_FILES += "tiboot3-j7200_sr2-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/j7200.inc:IMAGE_BOOT_FILES += "tiboot3-j7200_sr2-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "tiboot3-j721e-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "tiboot3-j721e_sr2-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "tiboot3-j721e_sr1_1-hs-evm.bin"
  meta-ti-bsp/conf/machine/include/j721s2.inc:IMAGE_BOOT_FILES += "tiboot3-j721s2-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/j721s2.inc:IMAGE_BOOT_FILES += "tiboot3-j721s2-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/j722s.inc:IMAGE_BOOT_FILES += "tiboot3-j722s-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/j784s4.inc:IMAGE_BOOT_FILES += "tiboot3-j784s4-gp-evm.bin"
  meta-ti-bsp/conf/machine/include/j784s4.inc:IMAGE_BOOT_FILES += "tiboot3-j784s4-hs-fs-evm.bin"
  meta-ti-bsp/conf/machine/include/k3r5.inc:SPL_BINARY = "tiboot3-${SYSFW_SOC}-${SYSFW_SUFFIX}-${SYSFW_CONFIG}.${SPL_SUFFIX}"

  meta-ti-bsp/conf/machine/include/am65xx.inc:IMAGE_BOOT_FILES += "sysfw.itb"
  meta-ti-bsp/conf/machine/include/am65xx.inc:IMAGE_BOOT_FILES += "sysfw-am65x_sr2-gp-evm.itb"
  meta-ti-bsp/conf/machine/include/am65xx.inc:IMAGE_BOOT_FILES += "sysfw-am65x_sr2-hs-evm.itb"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "sysfw.itb"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "sysfw-j721e-gp-evm.itb"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "sysfw-j721e_sr2-hs-fs-evm.itb"
  meta-ti-bsp/conf/machine/include/j721e.inc:IMAGE_BOOT_FILES += "sysfw-j721e_sr1_1-hs-evm.itb"

Define BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN and
BR2_TARGET_TI_K3_R5_LOADER_SWSFW_ITB strings set with the binary file
to use according to the SoC family choice and the Security type.

[1] https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/doc/board/ti/k3.rst

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
Changes in v11:
- Introduce BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN and BR2_TARGET_TI_K3_R5_LOADER_SWSFW_ITB
  strings to provide firmware name to copy at the end of ti-k3-r5-loader build.
  This replace the "find . -regex" from provious patch version.
- Add sysfw.itb handling needed to TI K3 SoC using Split Binary Boot Flow.

Changes in v8:
- Use the `find' command in pipe with the `cp' command.

Changes in v6:
- Replace `find' command with `cp' one.

Changes in v5:
- Replace tiboot3-*-$(TI_K3_R5_LOADER_SECTYPE)-*.bin with
  tiboot3-$(TI_K3_R5_LOADER_SOC)-$(TI_K3_R5_LOADER_SECTYPE)-*.bin

Added in v4
---
 boot/ti-k3-r5-loader/Config.in          | 19 +++++++++++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 13 +++++++++++++
 2 files changed, 32 insertions(+)
diff mbox series

Patch

diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
index cfae45ac98..a580b6ca61 100644
--- a/boot/ti-k3-r5-loader/Config.in
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -101,4 +101,23 @@  config BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN
 
 	  https://docs.u-boot.org/en/v2024.01/develop/package/binman.html
 
+config BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN
+	string
+	default "tiboot3-am62ax-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "tiboot3-am62ax-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX && BR2_PACKAGE_TI_K3_SECTYPE_HS
+	default "tiboot3-am62ax-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX && BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
+	default "tiboot3-am62x-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62X && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "tiboot3-am62x-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62X && BR2_PACKAGE_TI_K3_SECTYPE_HS
+	default "tiboot3-am62x-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62X && BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
+	default "tiboot3-am64x-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "tiboot3-am64x_sr2-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_HS
+	default "tiboot3-am64x_sr2-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
+	default "tiboot3-am65x_sr2-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM65X && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "tiboot3-am65x_sr2-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM65X && BR2_PACKAGE_TI_K3_SECTYPE_HS
+
+config BR2_TARGET_TI_K3_R5_LOADER_SWSFW_ITB
+	string
+	default "sysfw-am65x_sr2-gp-evm.itb" if BR2_PACKAGE_TI_K3_SOC_AM65X && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "sysfw-am65x_sr2-hs-evm.itb" if BR2_PACKAGE_TI_K3_SOC_AM65X && BR2_PACKAGE_TI_K3_SECTYPE_HS
+
 endif
diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
index cf18b43871..ef7f8df6f7 100644
--- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
@@ -73,14 +73,27 @@  TI_K3_R5_LOADER_DEPENDENCIES += \
 	host-python-pylibfdt \
 	host-python-setuptools
 TI_K3_R5_LOADER_MAKE_OPTS += BINMAN_INDIRS=$(BINARIES_DIR)
+define TI_K3_R5_LOADER_INSTALL_TIBOOT3_BIN
+	cp $(@D)/$(TI_K3_R5_LOADER_TIBOOT3_BIN) $(BINARIES_DIR)/tiboot3.bin
+endef
+# sysfw*.itb are only generated for Split binary based Boot Flow (eg: am65, j721e)
+ifneq ($(BR2_TARGET_TI_K3_R5_LOADER_SWSFW_ITB),)
+define TI_K3_R5_LOADER_INSTALL_SWSFW_ITB
+	cp $(@D)/$(BR2_TARGET_TI_K3_R5_LOADER_SWSFW_ITB) $(BINARIES_DIR)/sysfw.itb
+endef
+endif
 endif
 
 define TI_K3_R5_LOADER_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) $(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
 endef
 
+TI_K3_R5_LOADER_TIBOOT3_BIN = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN))
+
 define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
 	cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
+	$(TI_K3_R5_LOADER_INSTALL_TIBOOT3_BIN)
+	$(TI_K3_R5_LOADER_INSTALL_SWSFW_ITB)
 endef
 
 $(eval $(kconfig-package))