[Buildroot] [PATCH v6 2/3] boot/ti-k3-image-gen: add new package

Anand Gadiyar gadiyar at ti.com
Thu Nov 17 00:15:10 UTC 2022


From: Xuanhao Shi <x-shi at ti.com>

This is the image generator that builds the full boot binary,
tiboot3.bin, for the R5 core on TI's k3 devices.
This requires the R5 spl output from the ti-k3-r5-loader package.

https://git.ti.com/cgit/k3-image-gen/k3-image-gen

Signed-off-by: Xuanhao Shi <x-shi at ti.com>
Signed-off-by: Anand Gadiyar <gadiyar at ti.com>
Reviewed-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
Acked-by: Andrew Davis <afd at ti.com>
Cc: Romain Naour <romain.naour at gmail.com>
Cc: Bryan Brattlof <bb at ti.com>
---
 DEVELOPERS                                |  2 ++
 boot/Config.in                            |  1 +
 boot/ti-k3-image-gen/Config.in            | 30 ++++++++++++++++
 boot/ti-k3-image-gen/ti-k3-image-gen.hash |  2 ++
 boot/ti-k3-image-gen/ti-k3-image-gen.mk   | 42 +++++++++++++++++++++++
 5 files changed, 77 insertions(+)
 create mode 100644 boot/ti-k3-image-gen/Config.in
 create mode 100644 boot/ti-k3-image-gen/ti-k3-image-gen.hash
 create mode 100644 boot/ti-k3-image-gen/ti-k3-image-gen.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index cf1cb8808b..e699b6ec81 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -129,6 +129,7 @@ F:	package/libxmlrpc/
 F:	package/python-docopt/
 
 N:	Anand Gadiyar <gadiyar at ti.com>
+F:	boot/ti-k3-image-gen/
 F:	boot/ti-k3-r5-loader/
 
 N:	André Zwing <nerv at dawncrow.de>
@@ -3049,6 +3050,7 @@ N:	Wojciech Niziński <niziak at spox.org>
 F:	package/fwup/
 
 N:	Xuanhao Shi <X15000177 at gmail.com>
+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 ce17b2df6b..1b25bacfee 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -22,6 +22,7 @@ source "boot/s500-bootloader/Config.in"
 source "boot/shim/Config.in"
 source "boot/sun20i-d1-spl/Config.in"
 source "boot/syslinux/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..02018f2f78
--- /dev/null
+++ b/boot/ti-k3-image-gen/Config.in
@@ -0,0 +1,30 @@
+config BR2_TARGET_TI_K3_IMAGE_GEN
+	bool "ti-k3-image-gen"
+	select BR2_TARGET_TI_K3_R5_LOADER
+	help
+	  Use TI's k3-image-gen to build a separate bare metal
+	  boot binary from a separate spl. Currently supports
+	  version 08.05.00.004 as default.
+
+	  https://git.ti.com/cgit/k3-image-gen/k3-image-gen/
+
+if BR2_TARGET_TI_K3_IMAGE_GEN
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC
+	string "SOC type for image gen"
+	help
+	  The target SoC option for image gen.
+	  For example, "am64x" for AM64X boards.
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_SOC_TYPE
+	string "SOC security type for image gen"
+	help
+	  The security type option for image gen.
+	  Options are "gp", "hs-fs", or "hs-se".
+
+config BR2_TARGET_TI_K3_IMAGE_GEN_CONFIG
+	string "CONFIG type for image gen"
+	help
+	  The board config option for image gen.
+	  Usually "sk" or "evm".
+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..82c5b17060
--- /dev/null
+++ b/boot/ti-k3-image-gen/ti-k3-image-gen.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  d13e9556bfba32d14071e172589683e48f6fea705a0b05ddd7fe984002089888  k3-image-gen-08.05.00.004.tar.gz
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..7239b94425
--- /dev/null
+++ b/boot/ti-k3-image-gen/ti-k3-image-gen.mk
@@ -0,0 +1,42 @@
+################################################################################
+#
+# ti-k3-image-gen
+#
+################################################################################
+
+TI_K3_IMAGE_GEN_VERSION = 08.05.00.004
+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.
+TI_K3_IMAGE_GEN_DEPENDENCIES = host-arm-gnu-toolchain ti-k3-r5-loader
+
+# The ti-k3-image-gen makefiles seem to need some feature from Make v4.0,
+# similar to u-boot. Explicitly use $(BR2_MAKE) here, as the build
+# otherwise fails with some misleading error message.
+TI_K3_IMAGE_GEN_MAKE = $(BR2_MAKE)
+TI_K3_IMAGE_GEN_SOC = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_SOC))
+TI_K3_IMAGE_GEN_SOC_TYPE = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_SOC_TYPE))
+TI_K3_IMAGE_GEN_CONFIG = $(call qstrip,$(BR2_TARGET_TI_K3_IMAGE_GEN_CONFIG))
+TI_K3_IMAGE_GEN_MAKE_OPTS = \
+	SOC=$(TI_K3_IMAGE_GEN_SOC) \
+	SOC_TYPE=$(TI_K3_IMAGE_GEN_SOC_TYPE) \
+	CONFIG=$(TI_K3_IMAGE_GEN_CONFIG) \
+	CROSS_COMPILE=$(HOST_DIR)/bin/arm-none-eabi- \
+	SBL=$(BINARIES_DIR)/r5-u-boot-spl.bin \
+	O=$(BINARIES_DIR) \
+	BIN_DIR=$(BINARIES_DIR)
+
+define TI_K3_IMAGE_GEN_BUILD_CMDS
+	$(TI_K3_IMAGE_GEN_MAKE) -C $(@D) $(TI_K3_IMAGE_GEN_MAKE_OPTS)
+endef
+
+define TI_K3_IMAGE_GEN_INSTALL_IMAGES_CMDS
+	cp $(@D)/tiboot3.bin $(BINARIES_DIR)
+endef
+
+$(eval $(generic-package))
-- 
2.34.1




More information about the buildroot mailing list