From 8a4c3c91e7af89397438bcf329954b1503b03a5e Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 7 Apr 2024 12:34:57 +0200 Subject: [PATCH] boot/ti-k3-r5-loader: add BR2_TARGET_TI_K3_R5_LOADER_USE_BINMAN option 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 Signed-off-by: Michael Trimarchi Co-developed-by: Romain Naour Signed-off-by: Romain Naour Signed-off-by: Dario Binacchi Signed-off-by: Romain Naour Signed-off-by: Arnout Vandecappelle --- 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