diff mbox series

[v12,04/16] boot/ti-k3-r5-loader: add BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option

Message ID 20240407103512.1112712-5-romain.naour@smile.fr
State Accepted
Headers show
Series Add support for AM62x-SK HS-FS devices | expand

Commit Message

Romain Naour April 7, 2024, 10:34 a.m. UTC
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>

Recent version of U-Boot use binman to provide a mechanism for building
images, from simple SPL + U-Boot combinations, to more complex
arrangements with many parts.

This tool uses additional host python modules that must be provided by
Buildroot. So introduce a new option
BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN to add additional host packages
in U-Boot build dependency to use binman.

When BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN is set, BINMAN_INDIRS
environment variable to provide the directory to search for binary
blobs and select the packages required by binman. Make sure that
ti-k3-boot-firmware package has been installed before building
ti-k3-r5-loader in order to provide such firmwares.

The BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option is currently needed
since we are in the middle of the process to switch TI AM62 and AM64
board defconfig to binman. Keep BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN
disabled for them until the u-boot/ti-k3-r5-loader version bump to
2024.01.

The dependency of binman is not really easy to follow. First we have
the packages list from binman.rst [1] then we have to install
additional python modules [2]. Maybe in the future it will be
necessary to add host-lzma and host-lz4 in the dependencies list.

[1] https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/binman/binman.rst?plain=1#L377
[2] https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt

Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
Changes in v11:
- Use BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option while AM62 and AM64
  still use ti-k3-image-gen
- Add missing ti-k3-boot-firmware dependency

Changes in v6:
- Update the commit message adding the links of requirements.

Changes in v5:
- Add dependecy on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
- Drop runtime dependecies
- Add host-python-pylibfdt dependency without requiring
  BR2_TARGET_UBOOT_NEEDS_PYLIBFDT configuration
- Add host-python3 and host-python-setuptools dependencies
- Add SOB and COB tags of Romain Naour

Changes in v4:
- Drop the BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option

Changes in v2:
- Change commit message
- Add BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option
- Select packages required by binman if
  BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN is enabled
---
 boot/ti-k3-r5-loader/Config.in          |  9 +++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 15 +++++++++++++++
 2 files changed, 24 insertions(+)

Comments

Arnout Vandecappelle April 7, 2024, 8:07 p.m. UTC | #1
On 07/04/2024 12:34, Romain Naour wrote:
> From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> Recent version of U-Boot use binman to provide a mechanism for building
> images, from simple SPL + U-Boot combinations, to more complex
> arrangements with many parts.
> 
> This tool uses additional host python modules that must be provided by
> Buildroot. So introduce a new option
> BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN to add additional host packages
> in U-Boot build dependency to use binman.
> 
> When BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN is set, BINMAN_INDIRS
> environment variable to provide the directory to search for binary
> blobs and select the packages required by binman. Make sure that
> ti-k3-boot-firmware package has been installed before building
> ti-k3-r5-loader in order to provide such firmwares.
> 
> The BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option is currently needed
> since we are in the middle of the process to switch TI AM62 and AM64
> board defconfig to binman. Keep BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN
> disabled for them until the u-boot/ti-k3-r5-loader version bump to
> 2024.01.
> 
> The dependency of binman is not really easy to follow. First we have
> the packages list from binman.rst [1] then we have to install
> additional python modules [2]. Maybe in the future it will be
> necessary to add host-lzma and host-lz4 in the dependencies list.
> 
> [1] https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/binman/binman.rst?plain=1#L377
> [2] https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt

  Excellent that you added this paragraph!

  Regards,
  Arnout

> 
> Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Co-developed-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
> Changes in v11:
> - Use BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option while AM62 and AM64
>    still use ti-k3-image-gen
> - Add missing ti-k3-boot-firmware dependency
> 
> Changes in v6:
> - Update the commit message adding the links of requirements.
> 
> Changes in v5:
> - Add dependecy on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> - Drop runtime dependecies
> - Add host-python-pylibfdt dependency without requiring
>    BR2_TARGET_UBOOT_NEEDS_PYLIBFDT configuration
> - Add host-python3 and host-python-setuptools dependencies
> - Add SOB and COB tags of Romain Naour
> 
> Changes in v4:
> - Drop the BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option
> 
> Changes in v2:
> - Change commit message
> - Add BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option
> - Select packages required by binman if
>    BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN is enabled
> ---
>   boot/ti-k3-r5-loader/Config.in          |  9 +++++++++
>   boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 15 +++++++++++++++
>   2 files changed, 24 insertions(+)
> 
> diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
> index 5f86c045c9..5f4f33b220 100644
> --- a/boot/ti-k3-r5-loader/Config.in
> +++ b/boot/ti-k3-r5-loader/Config.in
> @@ -93,4 +93,13 @@ config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_CONFIG_FILE
>   	help
>   	  Path to the TI K3 R5 Loader configuration file.
>   
> +config BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN
> +	bool "ti-k3-r5-loader use binman"
> +	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS # python-rpds-py -> python-jsonschema
> +	select BR2_TARGET_TI_K3_BOOT_FIRMWARE
> +	help
> +	  Use binman tool for generation and signing of boot images.
> +
> +	  https://docs.u-boot.org/en/v2024.01/develop/package/binman.html
> +
>   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 0ffcb8235f..cf18b43871 100644
> --- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> +++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> @@ -60,6 +60,21 @@ TI_K3_R5_LOADER_MAKE_OPTS = \
>   	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
>   	HOSTLDFLAGS="$(HOST_LDFLAGS)"
>   
> +ifeq ($(BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN),y)
> +# https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt
> +TI_K3_R5_LOADER_DEPENDENCIES += \
> +	host-python-jsonschema \
> +	host-python-pyyaml \
> +	ti-k3-boot-firmware
> +# Make sure that all binman requirements are build before ti-k3-r5-loader.
> +TI_K3_R5_LOADER_DEPENDENCIES += \
> +	host-python3 \
> +	host-python-pyelftools \
> +	host-python-pylibfdt \
> +	host-python-setuptools
> +TI_K3_R5_LOADER_MAKE_OPTS += BINMAN_INDIRS=$(BINARIES_DIR)
> +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
diff mbox series

Patch

diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
index 5f86c045c9..5f4f33b220 100644
--- a/boot/ti-k3-r5-loader/Config.in
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -93,4 +93,13 @@  config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_CONFIG_FILE
 	help
 	  Path to the TI K3 R5 Loader configuration file.
 
+config BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN
+	bool "ti-k3-r5-loader use binman"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS # python-rpds-py -> python-jsonschema
+	select BR2_TARGET_TI_K3_BOOT_FIRMWARE
+	help
+	  Use binman tool for generation and signing of boot images.
+
+	  https://docs.u-boot.org/en/v2024.01/develop/package/binman.html
+
 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 0ffcb8235f..cf18b43871 100644
--- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
@@ -60,6 +60,21 @@  TI_K3_R5_LOADER_MAKE_OPTS = \
 	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
 	HOSTLDFLAGS="$(HOST_LDFLAGS)"
 
+ifeq ($(BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN),y)
+# https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt
+TI_K3_R5_LOADER_DEPENDENCIES += \
+	host-python-jsonschema \
+	host-python-pyyaml \
+	ti-k3-boot-firmware
+# Make sure that all binman requirements are build before ti-k3-r5-loader.
+TI_K3_R5_LOADER_DEPENDENCIES += \
+	host-python3 \
+	host-python-pyelftools \
+	host-python-pylibfdt \
+	host-python-setuptools
+TI_K3_R5_LOADER_MAKE_OPTS += BINMAN_INDIRS=$(BINARIES_DIR)
+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