diff mbox series

[09/21] boot/uboot: add BR2_TARGET_UBOOT_USE_BINMAN option

Message ID 20240213172817.2872849-10-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.

This tool uses additional host python modules that must be provided by
Buildroot. So introduce a new option BR2_TARGET_UBOOT_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].

[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/uboot/Config.in | 11 +++++++++++
 boot/uboot/uboot.mk  |  8 ++++++++
 2 files changed, 19 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.
> 
> This tool uses additional host python modules that must be provided by
> Buildroot. So introduce a new option BR2_TARGET_UBOOT_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].
> 
> [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/uboot/Config.in | 11 +++++++++++
>  boot/uboot/uboot.mk  |  8 ++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index beafb38930..e6e7956adc 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -290,6 +290,17 @@ config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN
>  	  This option makes sure that the needed binary blobs are copied
>  	  into the U-Boot source directory.
>  
> +config BR2_TARGET_UBOOT_USE_BINMAN
> +	bool "U-Boot use binman"
> +	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS # python-rpds-py -> python-jsonschema
> +	select BR2_TARGET_UBOOT_NEEDS_PYTHON3
> +	select BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS
> +	select BR2_TARGET_UBOOT_NEEDS_PYLIBFDT
> +	help
> +	  Use binman tool for generation and signing of boot images.
> +
> +	  https://docs.u-boot.org/en/v2024.01/develop/package/binman.html
> +
>  menu "U-Boot binary format"
>  
>  config BR2_TARGET_UBOOT_FORMAT_AIS
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index dda606a880..0714522550 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -269,6 +269,14 @@ ifeq ($(BR2_TARGET_UBOOT_NEEDS_XXD),y)
>  UBOOT_DEPENDENCIES += host-vim
>  endif
>  
> +ifeq ($(BR2_TARGET_UBOOT_USE_BINMAN),y)
> +# https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt
> +UBOOT_DEPENDENCIES += \
> +	host-python-jsonschema \
> +	host-python-pyyaml
> +UBOOT_MAKE_OPTS += BINMAN_INDIRS=$(BINARIES_DIR)
> +endif
> +
>  # prior to u-boot 2013.10 the license info was in COPYING. Copy it so
>  # legal-info finds it
>  define UBOOT_COPY_OLD_LICENSE_FILE
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index beafb38930..e6e7956adc 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -290,6 +290,17 @@  config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN
 	  This option makes sure that the needed binary blobs are copied
 	  into the U-Boot source directory.
 
+config BR2_TARGET_UBOOT_USE_BINMAN
+	bool "U-Boot use binman"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS # python-rpds-py -> python-jsonschema
+	select BR2_TARGET_UBOOT_NEEDS_PYTHON3
+	select BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS
+	select BR2_TARGET_UBOOT_NEEDS_PYLIBFDT
+	help
+	  Use binman tool for generation and signing of boot images.
+
+	  https://docs.u-boot.org/en/v2024.01/develop/package/binman.html
+
 menu "U-Boot binary format"
 
 config BR2_TARGET_UBOOT_FORMAT_AIS
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index dda606a880..0714522550 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -269,6 +269,14 @@  ifeq ($(BR2_TARGET_UBOOT_NEEDS_XXD),y)
 UBOOT_DEPENDENCIES += host-vim
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_USE_BINMAN),y)
+# https://source.denx.de/u-boot/u-boot/-/blob/v2024.01/tools/buildman/requirements.txt
+UBOOT_DEPENDENCIES += \
+	host-python-jsonschema \
+	host-python-pyyaml
+UBOOT_MAKE_OPTS += BINMAN_INDIRS=$(BINARIES_DIR)
+endif
+
 # prior to u-boot 2013.10 the license info was in COPYING. Copy it so
 # legal-info finds it
 define UBOOT_COPY_OLD_LICENSE_FILE