[1/1] package/uboot-tools: add support for mkfwumdata

Message ID 20251228152221.26838-1-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [1/1] package/uboot-tools: add support for mkfwumdata
Related show

Commit Message

Dario Binacchi Dec. 28, 2025, 3:22 p.m. UTC
The mkfwumdata U-Boot tool can be used to generate FWU metadata images
for the meta-data partition to be used in A/B Update imeplementation.
Add an option to cross-build it and install it to the target filesystem.
Also, build it and install it unconditionally to the host dir.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/uboot-tools/Config.in      | 11 +++++++++++
 package/uboot-tools/uboot-tools.mk | 18 ++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

Patch

diff --git a/package/uboot-tools/Config.in b/package/uboot-tools/Config.in
index da6cd652521d..fadb9b2eb76e 100644
--- a/package/uboot-tools/Config.in
+++ b/package/uboot-tools/Config.in
@@ -107,4 +107,15 @@  config BR2_PACKAGE_UBOOT_TOOLS_DUMPIMAGE
 	  The dumpimage tool from Das U-Boot bootloader, which allows
 	  extraction of data from U-Boot images.
 
+config BR2_PACKAGE_UBOOT_TOOLS_MKFWUMDATA
+	bool "mkfwumdata"
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	help
+	  Install the mkfwumdata tool on the target system
+
+	  The mkfwumdata tool from Das U-Boot bootloader, which allows
+	  to create a raw image of the FWU metadata for initial
+	  installation of the FWU multi bank update on the board.
+
 endif
diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
index 1135fb9c03b1..60b9e2ae78a7 100644
--- a/package/uboot-tools/uboot-tools.mk
+++ b/package/uboot-tools/uboot-tools.mk
@@ -15,7 +15,7 @@  UBOOT_TOOLS_INSTALL_STAGING = YES
 
 # u-boot 2020.01+ needs make 4.0+
 UBOOT_TOOLS_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY)
-HOST_UBOOT_TOOLS_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY) host-gnutls
+HOST_UBOOT_TOOLS_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY) host-gnutls host-util-linux
 
 # the available hash algorithms and the way to enable them are the
 # same for host and target
@@ -59,6 +59,11 @@  UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_MKEFICAPSULE=y
 UBOOT_TOOLS_DEPENDENCIES += gnutls
 endif
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKFWUMDATA),y)
+UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_MKFWUMDATA=y
+UBOOT_TOOLS_DEPENDENCIES += util-linux
+endif
+
 ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN),y)
 define UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN
 	$(INSTALL) -m 0755 -D $(@D)/tools/fit_check_sign $(TARGET_DIR)/usr/bin/fit_check_sign
@@ -103,6 +108,12 @@  define UBOOT_TOOLS_INSTALL_DUMPIMAGE
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKFWUMDATA),y)
+define UBOOT_TOOLS_INSTALL_MKFWUMDATA
+	$(INSTALL) -m 0755 -D $(@D)/tools/mkfwumdata $(TARGET_DIR)/usr/bin/mkfwumdata
+endef
+endif
+
 define UBOOT_TOOLS_INSTALL_STAGING_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/tools/env/lib.a $(STAGING_DIR)/usr/lib/libubootenv.a
 	$(INSTALL) -D -m 0644 $(@D)/tools/env/fw_env.h $(STAGING_DIR)/usr/include/fw_env.h
@@ -115,6 +126,7 @@  define UBOOT_TOOLS_INSTALL_TARGET_CMDS
 	$(UBOOT_TOOLS_INSTALL_FWPRINTENV)
 	$(UBOOT_TOOLS_INSTALL_DUMPIMAGE)
 	$(UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN)
+	$(UBOOT_TOOLS_INSTALL_MKFWUMDATA)
 endef
 
 # host-uboot-tools
@@ -134,7 +146,8 @@  endef
 HOST_UBOOT_TOOLS_MAKE_OPTS = HOSTCC="$(HOSTCC)" \
 	HOSTCFLAGS="$(HOST_CFLAGS)" \
 	HOSTLDFLAGS="$(HOST_LDFLAGS)" \
-	CONFIG_TOOLS_MKEFICAPSULE=y
+	CONFIG_TOOLS_MKEFICAPSULE=y \
+	CONFIG_TOOLS_MKFWUMDATA=y
 
 ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT),y)
 HOST_UBOOT_TOOLS_MAKE_OPTS += CONFIG_FIT=y CONFIG_MKIMAGE_DTC_PATH=dtc
@@ -237,6 +250,7 @@  define HOST_UBOOT_TOOLS_INSTALL_CMDS
 	ln -sf fw_printenv $(HOST_DIR)/bin/fw_setenv
 	$(HOST_UBOOT_TOOLS_INSTALL_ENVIMAGE)
 	$(HOST_UBOOT_TOOLS_INSTALL_BOOT_SCRIPT)
+	$(INSTALL) -m 0755 -D $(@D)/tools/mkfwumdata $(HOST_DIR)/bin/mkfwumdata
 endef
 
 $(eval $(generic-package))