diff mbox series

[v5,1/3] boot/ti-k3-r5-loader: add new package

Message ID 20220923205543.1518798-2-gadiyar@ti.com
State Superseded
Headers show
Series add support for TI's AM64x boards | expand

Commit Message

Anand Gadiyar Sept. 23, 2022, 8:55 p.m. UTC
From: Xuanhao Shi <x-shi@ti.com>

This is a separate U-Boot package that would build
the intermediate spl binary for the R5 core on TI's k3 boards.
Usually, the resulting spl will be used for k3-image-gen
to build the full R5 boot binary tiboot3.bin.

Signed-off-by: Xuanhao Shi <x-shi@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 DEVELOPERS                                |  6 +++
 boot/Config.in                            |  1 +
 boot/ti-k3-r5-loader/Config.in            | 13 +++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.hash |  2 +
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk   | 45 +++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 boot/ti-k3-r5-loader/Config.in
 create mode 100644 boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
 create mode 100644 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk

Comments

Romain Naour Oct. 1, 2022, 5:13 p.m. UTC | #1
Hello Anand,

Le 23/09/2022 à 22:55, Anand Gadiyar via buildroot a écrit :
> From: Xuanhao Shi <x-shi@ti.com>
> 
> This is a separate U-Boot package that would build
> the intermediate spl binary for the R5 core on TI's k3 boards.
> Usually, the resulting spl will be used for k3-image-gen
> to build the full R5 boot binary tiboot3.bin.
> 
> Signed-off-by: Xuanhao Shi <x-shi@ti.com>
> Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  DEVELOPERS                                |  6 +++
>  boot/Config.in                            |  1 +
>  boot/ti-k3-r5-loader/Config.in            | 13 +++++++
>  boot/ti-k3-r5-loader/ti-k3-r5-loader.hash |  2 +
>  boot/ti-k3-r5-loader/ti-k3-r5-loader.mk   | 45 +++++++++++++++++++++++
>  5 files changed, 67 insertions(+)
>  create mode 100644 boot/ti-k3-r5-loader/Config.in
>  create mode 100644 boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
>  create mode 100644 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 3de63ea72f..5f36cbf535 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -128,6 +128,9 @@ F:	package/dcron/
>  F:	package/libxmlrpc/
>  F:	package/python-docopt/
>  
> +N:	Anand Gadiyar <gadiyar@ti.com>
> +F:	boot/ti-k3-r5-loader/
> +
>  N:	André Zwing <nerv@dawncrow.de>
>  F:	package/libkrb5/
>  F:	package/openal/
> @@ -3063,6 +3066,9 @@ F:	package/python-pyusb/
>  N:	Wojciech Niziński <niziak@spox.org>
>  F:	package/fwup/
>  
> +N:	Xuanhao Shi <X15000177@gmail.com>
> +F:	boot/ti-k3-r5-loader/
> +
>  N:	Yair Ben Avraham <yairba@protonmail.com>
>  F:	package/casync/
>  F:	package/gloox/
> diff --git a/boot/Config.in b/boot/Config.in
> index 40472ae07d..ce17b2df6b 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-r5-loader/Config.in"
>  source "boot/uboot/Config.in"
>  source "boot/vexpress-firmware/Config.in"
>  
> diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
> new file mode 100644
> index 0000000000..7f5fa0b4c8
> --- /dev/null
> +++ b/boot/ti-k3-r5-loader/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_TARGET_TI_K3_R5_LOADER
> +	bool "ti-k3-r5-loader"
> +	help
> +	  Separate U-Boot build for R5 cores on TI's k3 boards.
> +	  Usually used to build tiboot3.bin with k3-image-gen.

Usually we add a "if BR2_TARGET_TI_K3_R5_LOADER" instead of "depends on
BR2_TARGET_TI_K3_R5_LOADER" for each sub-options.

> +
> +config BR2_TARGET_TI_K3_R5_LOADER_BOARD
> +	string "Board to configure for"
> +	depends on BR2_TARGET_TI_K3_R5_LOADER
> +	help
> +	  Specify the board to configure the bootloader for.
> +	  This should be the name of a board under board/ti
> +	  For example, "am64x_evm".
> diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash b/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
> new file mode 100644
> index 0000000000..fb6ce7c2a6
> --- /dev/null
> +++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
> @@ -0,0 +1,2 @@
> +# Locally computed:
> +sha256  6d69d5e4635cb3fa7852bf15f88ca342ef7740196e71961d3572deb58ba44bea  u-boot-2022.10-rc1.tar.bz2
> diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> new file mode 100644
> index 0000000000..1e09fad9f5
> --- /dev/null
> +++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> @@ -0,0 +1,45 @@
> +################################################################################
> +#
> +# ti-k3-r5-loader.mk
> +#
> +################################################################################
> +
> +TI_K3_R5_LOADER_VERSION = 2022.10-rc1

We prefer using a release version not an -rc pre-release.

Is 2022.07 is good enough?

> +TI_K3_R5_LOADER_SITE = https://ftp.denx.de/pub/u-boot
> +TI_K3_R5_LOADER_SOURCE = u-boot-$(TI_K3_R5_LOADER_VERSION).tar.bz2
> +TI_K3_R5_LOADER_LICENSE = GPL-2.0+
> +TI_K3_R5_LOADER_LICENSE_FILES = Licenses/gpl-2.0.txt
> +TI_K3_R5_LOADER_CPE_ID_VENDOR = denx
> +TI_K3_R5_LOADER_CPE_ID_PRODUCT = u-boot
> +TI_K3_R5_LOADER_INSTALL_IMAGES = YES
> +TI_K3_R5_LOADER_DEPENDENCIES = \
> +	host-pkgconf \
> +	$(BR2_MAKE_HOST_DEPENDENCY) \
> +	host-arm-gnu-toolchain \
> +	host-openssl
> +
> +TI_K3_R5_LOADER_MAKE = $(BR2_MAKE)
> +TI_K3_R5_LOADER_MAKE_ENV = $(TARGET_MAKE_ENV)
> +TI_K3_R5_LOADER_KCONFIG_DEPENDENCIES = \
> +	host-arm-gnu-toolchain \
> +	$(BR2_MAKE_HOST_DEPENDENCY) \
> +	$(BR2_BISON_HOST_DEPENDENCY) \
> +	$(BR2_FLEX_HOST_DEPENDENCY)
> +
> +TI_K3_R5_LOADER_BOARD = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_BOARD))

We have to check if BR2_TARGET_TI_K3_R5_LOADER_BOARD is not empty.

> +TI_K3_R5_LOADER_KCONFIG_DEFCONFIG = $(TI_K3_R5_LOADER_BOARD)_r5_defconfig

I think we should handle the ti-k3-r5-loader defconfig as for other packages
using a defconfig. We should use a Kconfig option to provide the ti-k3-r5-loader
(uboot) defconfig name from Buildroot defconfig and not hardcoding a suffix _r5_
from the package makefile (.mk).

> +TI_K3_R5_LOADER_MAKE_OPTS += \
> +	CROSS_COMPILE=$(HOST_ARM_GNU_TOOLCHAIN_INSTALL_DIR)/bin/arm-none-eabi- \

Use the $(HOST_DIR) instead.

> +	ARCH=arm \
> +	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
> +	HOSTLDFLAGS="$(HOST_LDFLAGS)"
> +
> +define TI_K3_R5_LOADER_BUILD_CMDS
> +	$(TARGET_CONFIGURE_OPTS) $(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
> +endef
> +
> +define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
> +	cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
> +endef
Best regards,
Romain

> +
> +$(eval $(kconfig-package))
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 3de63ea72f..5f36cbf535 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -128,6 +128,9 @@  F:	package/dcron/
 F:	package/libxmlrpc/
 F:	package/python-docopt/
 
+N:	Anand Gadiyar <gadiyar@ti.com>
+F:	boot/ti-k3-r5-loader/
+
 N:	André Zwing <nerv@dawncrow.de>
 F:	package/libkrb5/
 F:	package/openal/
@@ -3063,6 +3066,9 @@  F:	package/python-pyusb/
 N:	Wojciech Niziński <niziak@spox.org>
 F:	package/fwup/
 
+N:	Xuanhao Shi <X15000177@gmail.com>
+F:	boot/ti-k3-r5-loader/
+
 N:	Yair Ben Avraham <yairba@protonmail.com>
 F:	package/casync/
 F:	package/gloox/
diff --git a/boot/Config.in b/boot/Config.in
index 40472ae07d..ce17b2df6b 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-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
 
diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
new file mode 100644
index 0000000000..7f5fa0b4c8
--- /dev/null
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -0,0 +1,13 @@ 
+config BR2_TARGET_TI_K3_R5_LOADER
+	bool "ti-k3-r5-loader"
+	help
+	  Separate U-Boot build for R5 cores on TI's k3 boards.
+	  Usually used to build tiboot3.bin with k3-image-gen.
+
+config BR2_TARGET_TI_K3_R5_LOADER_BOARD
+	string "Board to configure for"
+	depends on BR2_TARGET_TI_K3_R5_LOADER
+	help
+	  Specify the board to configure the bootloader for.
+	  This should be the name of a board under board/ti
+	  For example, "am64x_evm".
diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash b/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
new file mode 100644
index 0000000000..fb6ce7c2a6
--- /dev/null
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.hash
@@ -0,0 +1,2 @@ 
+# Locally computed:
+sha256  6d69d5e4635cb3fa7852bf15f88ca342ef7740196e71961d3572deb58ba44bea  u-boot-2022.10-rc1.tar.bz2
diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
new file mode 100644
index 0000000000..1e09fad9f5
--- /dev/null
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
@@ -0,0 +1,45 @@ 
+################################################################################
+#
+# ti-k3-r5-loader.mk
+#
+################################################################################
+
+TI_K3_R5_LOADER_VERSION = 2022.10-rc1
+TI_K3_R5_LOADER_SITE = https://ftp.denx.de/pub/u-boot
+TI_K3_R5_LOADER_SOURCE = u-boot-$(TI_K3_R5_LOADER_VERSION).tar.bz2
+TI_K3_R5_LOADER_LICENSE = GPL-2.0+
+TI_K3_R5_LOADER_LICENSE_FILES = Licenses/gpl-2.0.txt
+TI_K3_R5_LOADER_CPE_ID_VENDOR = denx
+TI_K3_R5_LOADER_CPE_ID_PRODUCT = u-boot
+TI_K3_R5_LOADER_INSTALL_IMAGES = YES
+TI_K3_R5_LOADER_DEPENDENCIES = \
+	host-pkgconf \
+	$(BR2_MAKE_HOST_DEPENDENCY) \
+	host-arm-gnu-toolchain \
+	host-openssl
+
+TI_K3_R5_LOADER_MAKE = $(BR2_MAKE)
+TI_K3_R5_LOADER_MAKE_ENV = $(TARGET_MAKE_ENV)
+TI_K3_R5_LOADER_KCONFIG_DEPENDENCIES = \
+	host-arm-gnu-toolchain \
+	$(BR2_MAKE_HOST_DEPENDENCY) \
+	$(BR2_BISON_HOST_DEPENDENCY) \
+	$(BR2_FLEX_HOST_DEPENDENCY)
+
+TI_K3_R5_LOADER_BOARD = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_BOARD))
+TI_K3_R5_LOADER_KCONFIG_DEFCONFIG = $(TI_K3_R5_LOADER_BOARD)_r5_defconfig
+TI_K3_R5_LOADER_MAKE_OPTS += \
+	CROSS_COMPILE=$(HOST_ARM_GNU_TOOLCHAIN_INSTALL_DIR)/bin/arm-none-eabi- \
+	ARCH=arm \
+	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
+	HOSTLDFLAGS="$(HOST_LDFLAGS)"
+
+define TI_K3_R5_LOADER_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
+endef
+
+define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
+	cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
+endef
+
+$(eval $(kconfig-package))