[2/6] package/uboot-tools: add fwumdata target tool

Message ID 20261022151358.2260712-3-dario.binacchi@amarulasolutions.com
State New
Headers
Series Add support for the STM32MP257F-EV1 board |

Commit Message

Dario Binacchi Oct. 22, 2026, 3:13 p.m. UTC
Add an option to build and install the fwumdata tool on the target.

fwumdata allows to read, display and modify the FWU (Firmware Update)
metadata from Linux userspace, similarly to what fw_printenv/fw_setenv
do for the U-Boot environment. It can be used to change the
active/previous bank indices, the bank states or the image acceptance
flags, e.g. by an update agent after writing a new firmware bank.

The location of the metadata is read from /etc/fwumdata.config, which
is platform specific and is therefore not installed by the package: it
has to be provided, for example, by a rootfs overlay.

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

Patch

diff --git a/package/uboot-tools/Config.in b/package/uboot-tools/Config.in
index b7fd6ff17da2..ac785261c523 100644
--- a/package/uboot-tools/Config.in
+++ b/package/uboot-tools/Config.in
@@ -104,6 +104,20 @@  config BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
 	  bootloader, which allows access to the U-Boot environment
 	  from Linux.
 
+config BR2_PACKAGE_UBOOT_TOOLS_FWUMDATA
+	bool "fwumdata"
+	help
+	  Install the fwumdata tool on the target system
+
+	  The fwumdata tool from Das U-Boot bootloader, which allows
+	  to read, display and modify the FWU (Firmware Update)
+	  metadata from Linux (e.g. change the active/previous bank
+	  indices, the bank states or the image acceptance flags).
+
+	  The location of the metadata is described by the
+	  /etc/fwumdata.config file, which must be provided (e.g. by a
+	  rootfs overlay).
+
 config BR2_PACKAGE_UBOOT_TOOLS_DUMPIMAGE
 	bool "dumpimage"
 	help
diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
index 7c6ee0f3c467..5849e07a990d 100644
--- a/package/uboot-tools/uboot-tools.mk
+++ b/package/uboot-tools/uboot-tools.mk
@@ -63,6 +63,10 @@  UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_MKEFICAPSULE=y
 UBOOT_TOOLS_DEPENDENCIES += gnutls
 endif
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWUMDATA),y)
+UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_FWUMDATA=y
+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
@@ -101,6 +105,12 @@  define UBOOT_TOOLS_INSTALL_FWPRINTENV
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWUMDATA),y)
+define UBOOT_TOOLS_INSTALL_FWUMDATA
+	$(INSTALL) -m 0755 -D $(@D)/tools/fwumdata $(TARGET_DIR)/usr/sbin/fwumdata
+endef
+endif
+
 ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_DUMPIMAGE),y)
 define UBOOT_TOOLS_INSTALL_DUMPIMAGE
 	$(INSTALL) -m 0755 -D $(@D)/tools/dumpimage $(TARGET_DIR)/usr/sbin/dumpimage
@@ -117,6 +127,7 @@  define UBOOT_TOOLS_INSTALL_TARGET_CMDS
 	$(UBOOT_TOOLS_INSTALL_MKEFICAPSULE)
 	$(UBOOT_TOOLS_INSTALL_MKENVIMAGE)
 	$(UBOOT_TOOLS_INSTALL_FWPRINTENV)
+	$(UBOOT_TOOLS_INSTALL_FWUMDATA)
 	$(UBOOT_TOOLS_INSTALL_DUMPIMAGE)
 	$(UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN)
 endef