[Buildroot] [git commit branch/next] boot/ti-k3-image-gen: new package

Thomas Petazzoni thomas.petazzoni at bootlin.com
Tue Aug 22 10:01:08 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=6134872d2878f46f8f2800c81baf917281bc79b0
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

This is the image generator that builds the initial boot binary,
tiboot3.bin, for the R5 core on TI's K3 family of devices.

This requires the R5 SPL output from the ti-k3-r5-loader package as
well as some boot firmware from ti-k3-boot-firmware.

Signed-off-by: Xuanhao Shi <x-shi at ti.com>
Signed-off-by: Anand Gadiyar <gadiyar at ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg at ti.com>
Reviewed-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
Acked-by: Andrew Davis <afd at ti.com>
Tested-by: Bryan Brattlof <bb at ti.com>
Cc: Romain Naour <romain.naour at gmail.com>
Reviewed-by: Francois Perrad <francois.perrad at gadz.org>
Reviewed-by: Julien Olivain <ju.o at free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 DEVELOPERS                                |  2 +
 boot/Config.in                            |  1 +
 boot/ti-k3-image-gen/Config.in            | 77 +++++++++++++++++++++++++++++++
 boot/ti-k3-image-gen/ti-k3-image-gen.hash |  3 ++
 boot/ti-k3-image-gen/ti-k3-image-gen.mk   | 54 ++++++++++++++++++++++
 5 files changed, 137 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 3b60189c77..2a10bb44cd 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -133,6 +133,7 @@ F:	package/python-docopt/
 
 N:	Anand Gadiyar <gadiyar at ti.com>
 F:	boot/ti-k3-boot-firmware/
+F:	boot/ti-k3-image-gen/
 F:	boot/ti-k3-r5-loader/
 
 N:	André Zwing <nerv at dawncrow.de>
@@ -3116,6 +3117,7 @@ F:	package/fwup/
 
 N:	Xuanhao Shi <X15000177 at gmail.com>
 F:	boot/ti-k3-boot-firmware/
+F:	boot/ti-k3-image-gen/
 F:	boot/ti-k3-r5-loader/
 
 N:	Yair Ben Avraham <yairba at protonmail.com>
diff --git a/boot/Config.in b/boot/Config.in
index 87e1b7c00e..e5fdf7ad43 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -20,6 +20,7 @@ source "boot/s500-bootloader/Config.in"
 source "boot/shim/Config.in"
 source "boot/syslinux/Config.in"
 source "boot/ti-k3-boot-firmware/Config.in"
+source "boot/ti-k3-image-gen/Config.in"
 source "boot/ti-k3-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
diff --git a/boot/ti-k3-image-gen/Config.in b/boot/ti-k3-image-gen/Config.in
new file mode 100644
index 0000000000..d76cef82e9
--- /dev/null
+++ b/boot/ti-k3-image-gen/Config.in
@@ -0,0 +1,77 @@
+config BR2_TARGET_TI_K3_IMAGE_GEN
+	bool "ti-k3-image-gen"
+	depends on BR2_TARGET_TI_K3_R5_LOADER
+	select BR2_TARGET_TI_K3_BOOT_FIRMWARE
+	# We need FIT support in uboot-tools, which is why we select a
+	# host package
+	select BR2_PACKAGE_HOST_UBOOT_TOOLS
+	select BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT
+	help
+	  Use TI's k3-image-gen to build a separate bare metal boot
+	  binary from a separate SPL that is running on the R5 core.
+
+	  https://git.ti.com/cgit/k3-image-gen/k3-image-gen/
+
+if BR2_TARGET_TI_K3_IMAGE_GEN
+choice
+	prompt "SoC family"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62AX
+	bool "am62ax"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62X
+	bool "am62x"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM64X
+	bool "am64x"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM65X
+	bool "am65x"
+
+endchoice
+
+choice
+	prompt "Security type"
+	help
+	  The target SoC security type option for image gen.  Valid
+	  options are "gp" for General Purpose devices, "hs-fs" for
+	  High Security - Field Securable devices, or "hs" for High
+	  Security - Security Enforcing devices.  Note for all High
+	  Security device variants the TI_SECURE_DEV_PKG environmental
+	  variable must be defined at build time pointing to a valid
+	  core-secdev-k3 folder location, otherwise the build will
+	  fail, see
+	  https://git.ti.com/cgit/security-development-tools/core-secdev-k3
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_GP
+	bool "gp"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_HS_FS
+	bool "hs-fs"
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_HS
+	bool "hs"
+
+endchoice
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC
+	string
+	default "am62ax" if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62AX
+	default "am62x"  if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62X
+	default "am64x"  if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM64X
+	default "am65x"  if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM65X
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_FW_TYPE
+	string
+	default "ti-fs"  if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62AX
+	default "ti-fs"  if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM62X
+	default "ti-sci" if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM64X
+	default "ti-sci" if BR2_TARGET_TI_K3_IMAGE_GEN_SOC_AM65X
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE
+	string
+	default "gp"    if BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_GP
+	default "hs-fs" if BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_HS_FS
+	default "hs"    if BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE_HS
+
+endif
diff --git a/boot/ti-k3-image-gen/ti-k3-image-gen.hash b/boot/ti-k3-image-gen/ti-k3-image-gen.hash
new file mode 100644
index 0000000000..c968c5648f
--- /dev/null
+++ b/boot/ti-k3-image-gen/ti-k3-image-gen.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  f89ea4b1f5c992455b1a682fde48359221b53f3294135df4bf20feea6aea90e4  k3-image-gen-08.06.00.007.tar.gz
+sha256  f012e8d000d711d0539e5b4c812fc1d3a59c10fc1e3d6ea155556f5b78286845  LICENSE
diff --git a/boot/ti-k3-image-gen/ti-k3-image-gen.mk b/boot/ti-k3-image-gen/ti-k3-image-gen.mk
new file mode 100644
index 0000000000..64be9a18f2
--- /dev/null
+++ b/boot/ti-k3-image-gen/ti-k3-image-gen.mk
@@ -0,0 +1,54 @@
+################################################################################
+#
+# ti-k3-image-gen
+#
+################################################################################
+
+TI_K3_IMAGE_GEN_VERSION = 08.06.00.007
+TI_K3_IMAGE_GEN_SITE = https://git.ti.com/cgit/k3-image-gen/k3-image-gen/snapshot
+TI_K3_IMAGE_GEN_SOURCE = k3-image-gen-$(TI_K3_IMAGE_GEN_VERSION).tar.gz
+TI_K3_IMAGE_GEN_LICENSE = BSD-3-Clause
+TI_K3_IMAGE_GEN_LICENSE_FILES = LICENSE
+TI_K3_IMAGE_GEN_INSTALL_IMAGES = YES
+
+# - ti-k3-image-gen is used to build tiboot3.bin, using the
+#   r5-u-boot-spl.bin file from the ti-k3-r5-loader package. Hence the
+#   dependency on ti-k3-r5-loader.
+# - the ti-k3-image-gen makefiles seem to need some feature from Make
+#   v4.0, similar to u-boot.
+TI_K3_IMAGE_GEN_DEPENDENCIES = \
+	host-arm-gnu-toolchain \
+	host-python3 \
+	host-openssl \
+	host-uboot-tools \
+	ti-k3-r5-loader \
+	ti-k3-boot-firmware \
+	$(BR2_MAKE_HOST_DEPENDENCY)
+
+TI_K3_IMAGE_GEN_FW_TYPE = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_FW_TYPE))
+TI_K3_IMAGE_GEN_SOC = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_SOC))
+TI_K3_IMAGE_GEN_SECTYPE = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_SECTYPE))
+
+TI_K3_IMAGE_GEN_SYSFW = $(TI_K3_IMAGE_GEN_FW_TYPE)-firmware-$(TI_K3_IMAGE_GEN_SOC)-$(TI_K3_IMAGE_GEN_SECTYPE).bin
+
+define TI_K3_IMAGE_GEN_CONFIGURE_CMDS
+	cp $(BINARIES_DIR)/ti-sysfw/$(TI_K3_IMAGE_GEN_SYSFW) $(@D)
+endef
+
+define TI_K3_IMAGE_GEN_BUILD_CMDS
+	$(TARGET_MAKE_ENV) \
+	$(BR2_MAKE) -C $(@D) \
+		SOC=$(TI_K3_IMAGE_GEN_SOC) \
+		SOC_TYPE=$(TI_K3_IMAGE_GEN_SECTYPE) \
+		CONFIG=evm \
+		CROSS_COMPILE=$(HOST_DIR)/bin/arm-none-eabi- \
+		SBL=$(BINARIES_DIR)/r5-u-boot-spl.bin \
+		O=$(@D)/tmp \
+		BIN_DIR=$(@D)
+endef
+
+define TI_K3_IMAGE_GEN_INSTALL_IMAGES_CMDS
+	cp $(@D)/tiboot3.bin $(BINARIES_DIR)
+endef
+
+$(eval $(generic-package))



More information about the buildroot mailing list