diff mbox series

[10/21] boot/ti-k3-r5-loader: add BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option

Message ID 20240213172817.2872849-11-romain.naour@smile.fr
State Superseded
Headers show
Series Add ti_j721e_sk_defconfig | expand

Commit Message

Romain Naour Feb. 13, 2024, 5:28 p.m. UTC
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.

As for U-boot package, 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.

The binman requirement is directly included in buildman dependency
(tools/buildman/requirements.txt) since within U-Boot, binman is
invoked by the build system, here buildman [1].

Make sure that all binman requirements are build before
ti-k3-r5-loader.

[1] https://docs.u-boot.org/en/v2024.01/develop/package/binman.html#invoking-binman-within-u-boot

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
Note:
  binman is bundled in U-Boot source code. Use "USE_BINMAN" instead of
  "NEEDS_BINMAN" since it's not an external U-Boot dependency.
---
 boot/ti-k3-r5-loader/Config.in          |  8 ++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

Comments

Alexander Sverdlin Feb. 14, 2024, 10:58 a.m. UTC | #1
Hi Romain,

On Tue, 2024-02-13 at 18:28 +0100, Romain Naour wrote:
> 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.
> 
> As for U-boot package, 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.
> 
> The binman requirement is directly included in buildman dependency
> (tools/buildman/requirements.txt) since within U-Boot, binman is
> invoked by the build system, here buildman [1].
> 
> Make sure that all binman requirements are build before
> ti-k3-r5-loader.
> 
> [1] https://docs.u-boot.org/en/v2024.01/develop/package/binman.html#invoking-binman-within-u-boot
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
> Note:
>   binman is bundled in U-Boot source code. Use "USE_BINMAN" instead of
>   "NEEDS_BINMAN" since it's not an external U-Boot dependency.
> ---
>  boot/ti-k3-r5-loader/Config.in          |  8 ++++++++
>  boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 14 ++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
> index 8c8368a1a5..d678bd17c2 100644
> --- a/boot/ti-k3-r5-loader/Config.in
> +++ b/boot/ti-k3-r5-loader/Config.in
> @@ -93,4 +93,12 @@ 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
> +	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..8f86e0fb07 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,20 @@ 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
> +# Make sure that all binman requirements are build before ti-k3-r5-loader.
> +TI_K3_R5_LOADER_DEPENDENCIES += \
> +	host-python3 \
> +	host-python-setuptools \
> +	host-python-pylibfdt \
> +	host-python-pyelftools
> +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 8c8368a1a5..d678bd17c2 100644
--- a/boot/ti-k3-r5-loader/Config.in
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -93,4 +93,12 @@  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
+	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..8f86e0fb07 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,20 @@  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
+# Make sure that all binman requirements are build before ti-k3-r5-loader.
+TI_K3_R5_LOADER_DEPENDENCIES += \
+	host-python3 \
+	host-python-setuptools \
+	host-python-pylibfdt \
+	host-python-pyelftools
+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