[{"id":3684128,"web_url":"http://patchwork.ozlabs.org/comment/3684128/","msgid":"<10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>","list_archive_url":null,"date":"2026-04-29T15:12:23","subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","submitter":{"id":86869,"url":"http://patchwork.ozlabs.org/api/people/86869/","name":"Stefano Babic","email":"stefano.babic@swupdate.org"},"content":"Hi Dario,\n\nOn 4/29/26 16:01, Dario Binacchi wrote:\n> Add a handler to manage the boot selection process according to\n> the Firmware Update (FWU) metadata specification using the\n> libfwumdata library.\n\nThis seems that the specification is something generic, but this is \nreally just for STM32MP2, as described in the cover. Then an according \ndocumentation should be added.\n\nNevertheless, I will raise a basic issue about the concept. I cannot \nfind the patches sent to openembedded-core, too.\n\nAccording to the related patches merged into U-Boot, this is a ST \nreplacement for fw_setenv / fw_printenv. The configuration file, at \nleast the one pushed to U-Boot, has the same old format as U-Boot's \ntools. So I am just asking why we should have a separate tool (yes, I \nsaw in U-Boot, too) instead of integrating into the current ecosystem.\n\n From a concept view, the tool is used to select which is the active \nimage to be booted, and select also some parms (flags) for it. In \nSWUpdate, this is the \"bootloader\" interface, and not a \"script\" \nhandler. That can be implemented also as script, as here, is clear, but \nfrom the logical point of view, it does not belong to.\n\nAnd the second main aspect: if this is just to choose the active \nsoftware set, and the fwumdata.c is poushed as replacement for FWU \nmetadata of fw_setenv, and also taken into account that its code seems \nto me pretty simple, whhy shouldn't be integrated as storage into \nlibubootenv, instead ? Then SWUpdate hasn't another interface, there is \nstill the bootloader interface, and under the hood the FMU is written \ninstead of U-Boot env.\n\nBest regards,\nStefano\n\n> \n> The handler is a script handler that updates the active_index\n> and marks the selected bank as valid during the post-install phase.\n> \n> Example in sw-description:\n> \n>      scripts: (\n>          {\n>              type = \"fwumdata\";\n>              properties: {\n>                  active = \"1\";\n>              }\n>          }\n>      );\n> \n> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>\n> ---\n>   Kconfig                        |   4 ++\n>   Makefile.deps                  |   4 ++\n>   Makefile.flags                 |   3 +\n>   bootloader/Kconfig             |   7 ++\n>   configs/all_handlers_defconfig |   1 +\n>   doc/source/handlers.rst        |  37 ++++++++++\n>   handlers/Kconfig               |  17 +++++\n>   handlers/Makefile              |   1 +\n>   handlers/fwumdata_handler.c    | 125 +++++++++++++++++++++++++++++++++\n>   9 files changed, 199 insertions(+)\n>   create mode 100644 handlers/fwumdata_handler.c\n> \n> diff --git a/Kconfig b/Kconfig\n> index 2cf68eb890b0..fcb60f900b3f 100644\n> --- a/Kconfig\n> +++ b/Kconfig\n> @@ -129,6 +129,10 @@ config HAVE_ZCK\n>   \tbool\n>   \toption env=\"HAVE_ZCK\"\n>   \n> +config HAVE_LIBFWUMDATA\n> +\tbool\n> +\toption env=\"HAVE_LIBFWUMDATA\"\n> +\n>   menu \"SWUpdate Settings\"\n>   \n>   menu \"General Configuration\"\n> diff --git a/Makefile.deps b/Makefile.deps\n> index c759f6876dea..313d5af6230c 100644\n> --- a/Makefile.deps\n> +++ b/Makefile.deps\n> @@ -121,3 +121,7 @@ endif\n>   ifeq ($(HAVE_ZCK),)\n>   export HAVE_ZCK = y\n>   endif\n> +\n> +ifeq ($(HAVE_LIBFWUMDATA),)\n> +export HAVE_LIBFWUMDATA = y\n> +endif\n> diff --git a/Makefile.flags b/Makefile.flags\n> index 40dd3b66856e..76b87e67fe67 100644\n> --- a/Makefile.flags\n> +++ b/Makefile.flags\n> @@ -233,6 +233,9 @@ ifeq ($(CONFIG_UCFWHANDLER),y)\n>   LDLIBS += gpiod\n>   endif\n>   \n> +ifeq ($(CONFIG_FWUMDATA_HANDLER),y)\n> +LDLIBS += fwumdata\n> +endif\n>   \n>   ifeq ($(CONFIG_BOOTLOADER_STATIC_LINKED),y)\n>   ifeq ($(CONFIG_BOOTLOADER_EBG),y)\n> diff --git a/bootloader/Kconfig b/bootloader/Kconfig\n> index edc02d99b2d1..36f856507356 100644\n> --- a/bootloader/Kconfig\n> +++ b/bootloader/Kconfig\n> @@ -158,3 +158,10 @@ config UPDATE_STATE_BOOTLOADER\n>   \thelp\n>   \t  Store update information in Bootloader's environment.\n>   \n> +config FWUMDATA_CONFIG_FILE\n> +\tstring \"FWU Metadata Configuration file\"\n> +\tdepends on HAVE_LIBFWUMDATA\n> +\tdefault \"/etc/fwumdata.config\"\n> +\thelp\n> +\t  It tells where the FWU metadata are saved.\n> +\n> diff --git a/configs/all_handlers_defconfig b/configs/all_handlers_defconfig\n> index 16cd9b6b98f1..63299bd223ae 100644\n> --- a/configs/all_handlers_defconfig\n> +++ b/configs/all_handlers_defconfig\n> @@ -20,6 +20,7 @@ CONFIG_DISKPART=y\n>   CONFIG_DISKPART_FORMAT=y\n>   CONFIG_DISKFORMAT_HANDLER=y\n>   CONFIG_FAT_FILESYSTEM=y\n> +CONFIG_FWUMDATA_HANDLER=y\n>   CONFIG_EXT_FILESYSTEM=y\n>   CONFIG_LUASCRIPTHANDLER=y\n>   CONFIG_RAW=y\n> diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst\n> index 6742c10a58c3..cbfb146f099c 100644\n> --- a/doc/source/handlers.rst\n> +++ b/doc/source/handlers.rst\n> @@ -1710,3 +1710,40 @@ Examples:\n>   \t\t\tname = \"helloworld\";\n>   \t\t};\n>   \t});\n> +\n> +FWU Metadata Handler\n> +--------------------\n> +\n> +This is a script handler used to manage the boot selection process according to\n> +the Firmware Update (FWU) metadata specification.\n> +\n> +The handler implements a post-install script that updates the metadata to switch\n> +the active bank and marks it as valid, ensuring the system boots from the new\n> +bank at the next reset. The ``active`` property defines which bank must be\n> +selected.\n> +\n> +Example selecting boot bank 1 (bank A in A/B schema):\n> +\n> +::\n> +\n> +\tscripts: (\n> +\t\t{\n> +\t\t\ttype = \"fwumdata\";\n> +\t\t\tproperties: {\n> +\t\t\t\tactive = \"1\";\n> +\t\t\t}\n> +\t\t}\n> +\t);\n> +\n> +Example selecting boot bank 2 (bank B in A/B schema):\n> +\n> +::\n> +\n> +\tscripts: (\n> +\t\t{\n> +\t\t\ttype = \"fwumdata\";\n> +\t\t\tproperties: {\n> +\t\t\t\tactive = \"2\";\n> +\t\t\t}\n> +\t\t}\n> +\t);\n> diff --git a/handlers/Kconfig b/handlers/Kconfig\n> index 152bc08074a1..b7d9e51a20c9 100644\n> --- a/handlers/Kconfig\n> +++ b/handlers/Kconfig\n> @@ -151,6 +151,23 @@ config EMMC_HANDLER\n>   \t  with a dual-copy concept. This guarantees that the upgrade\n>   \t  is power-cut safe.\n>   \n> +config FWUMDATA_HANDLER\n> +\tbool \"FWU metadata update\"\n> +\tdepends on HAVE_LIBFWUMDATA\n> +\tdefault n\n> +\thelp\n> +\t  This handler allows to manage the boot selection process using\n> +\t  firmware update (FWU) metadata via libfwumdata.\n> +\n> +\t  Selecting the new boot bank automatically triggers the handler to\n> +\t  set the current bank for rollback and mark the selected boot-up\n> +\t  bank as 'valid'.\n> +\n> +\t  This ensures the system is ready to boot from the updated\n> +\t  partition while maintaining a safe path to revert to the previous\n> +\t  working state if the new firmware fails to reach the 'accepted'\n> +\t  state\n> +\n>   config RAW\n>   \tbool \"raw\"\n>   \tdefault n\n> diff --git a/handlers/Makefile b/handlers/Makefile\n> index 8490172a10a3..45fcb525e461 100644\n> --- a/handlers/Makefile\n> +++ b/handlers/Makefile\n> @@ -30,3 +30,4 @@ obj-$(CONFIG_SWUFORWARDER_HANDLER) += swuforward_handler.o swuforward-ws.o\n>   obj-$(CONFIG_UBIVOL)\t+= ubivol_handler.o\n>   obj-$(CONFIG_UCFWHANDLER)\t+= ucfw_handler.o\n>   obj-$(CONFIG_DOCKER)\t+= docker_handler.o\n> +obj-$(CONFIG_FWUMDATA_HANDLER)\t+= fwumdata_handler.o\n> diff --git a/handlers/fwumdata_handler.c b/handlers/fwumdata_handler.c\n> new file mode 100644\n> index 000000000000..1331fe64aa74\n> --- /dev/null\n> +++ b/handlers/fwumdata_handler.c\n> @@ -0,0 +1,125 @@\n> +#include <stdio.h>\n> +#include <unistd.h>\n> +#include <fcntl.h>\n> +#include <stdlib.h>\n> +#include <stdbool.h>\n> +#include <errno.h>\n> +#include <linux/version.h>\n> +#include <sys/ioctl.h>\n> +#include <stddef.h>\n> +\n> +#include \"swupdate_image.h\"\n> +#include \"handler.h\"\n> +#include \"util.h\"\n> +\n> +#include <libfwumdata.h>\n> +\n> +static int _fwumdata_set(uint32_t active_index, uint32_t previous_index,\n> +\t\t\t uint8_t bank_state)\n> +{\n> +\tint mdd;\n> +\tint ret;\n> +\n> +\tmdd = fwumdata_init();\n> +\tif (mdd < 0) {\n> +\t\tERROR(\"Cannot initialize libfwumdata\\n\");\n> +\t\treturn mdd;\n> +\t}\n> +\n> +\tret = fwumdata_read_config(mdd, CONFIG_FWUMDATA_CONFIG_FILE);\n> +\tif (ret) {\n> +\t\tERROR(\"Cannot read %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n> +\t\tgoto exit;\n> +\t}\n> +\n> +\tret = fwumdata_open(mdd, 0);\n> +\tif (ret) {\n> +\t\tERROR(\"Cannot open %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n> +\t\tgoto exit;\n> +\t}\n> +\n> +\tret = fwumdata_set_active_index(mdd, active_index);\n> +\tif (ret) {\n> +\t\tERROR(\"Cannot set active index\\n\");\n> +\t\tgoto close;\n> +\t}\n> +\n> +\tfwumdata_set_previous_index(mdd, previous_index);\n> +\tif (ret) {\n> +\t\tERROR(\"Cannot set previous index\\n\");\n> +\t\tgoto close;\n> +\t}\n> +\n> +\tret = fwumdata_set_bank_state(mdd, active_index, bank_state);\n> +\tif (ret) {\n> +\t\tERROR(\"Cannot set bank state\\n\");\n> +\t\tgoto close;\n> +\t}\n> +\n> +        ret = fwumdata_store(mdd);\n> +        if (ret) {\n> +\t\tERROR(\"Cannot store fwu metadata\\n\");\n> +\t\tgoto close;\n> +\t}\n> +\n> +\tDEBUG(\"fwumdata: active: %d, previous: %d, state: 0x%x\",\n> +\t      active_index, previous_index, bank_state);\n> +\n> +close:\n> +\tfwumdata_close(mdd);\n> +exit:\n> +\tfwumdata_exit(mdd);\n> +\treturn ret;\n> +}\n> +\n> +static int fwumdata_set(struct img_type *img, void *data)\n> +{\n> +\tstruct script_handler_data *script_data;\n> +\tchar *value;\n> +\tint active_index = -1;\n> +\tint previous_index;\n> +\n> +\n> +\tif (!data)\n> +\t\treturn -EINVAL;\n> +\n> +\tscript_data = data;\n> +\n> +\t/*\n> +\t * Call only in case of postinstall\n> +\t */\n> +\tif (script_data->scriptfn != POSTINSTALL)\n> +\t\treturn 0;\n> +\n> +\tvalue = dict_get_value(&img->properties, \"active\");\n> +\tif (!value) {\n> +\t\tERROR(\"active: cannot find in sw-description\");\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tactive_index = ustrtoull(value, NULL, 10);\n> +\tif (errno) {\n> +\t\tERROR(\"active %s: ustrotull failed\", value);\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tactive_index--;\n> +\tif (active_index == 0) {\n> +\t\tprevious_index = 1;\n> +\t} else if (active_index == 1) {\n> +\t\tprevious_index = 0;\n> +\t} else {\n> +\t\tERROR(\"active %s: invalid value\", value);\n> +\t\treturn -EINVAL;\n> +\n> +\t}\n> +\n> +\treturn _fwumdata_set(active_index, previous_index, FWUMDATA_BANK_VALID);\n> +}\n> +\n> +__attribute__((constructor))\n> +void fwumdata_handler(void)\n> +{\n> +\tregister_handler(\"fwumdata\", fwumdata_set,\n> +\t\t\t SCRIPT_HANDLER | NO_DATA_HANDLER, NULL);\n> +}","headers":{"Return-Path":"<swupdate+bncBD2ZDGN6SEKRBW57ZDHQMGQE6I7VQDQ@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=wsymy/kO;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2a00:1450:4864:20::23d; helo=mail-lj1-x23d.google.com;\n envelope-from=swupdate+bncbd2zdgn6sekrbw57zdhqmgqe6i7vqdq@googlegroups.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from mail-lj1-x23d.google.com (mail-lj1-x23d.google.com\n [IPv6:2a00:1450:4864:20::23d])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5LQG43z3z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 01:12:37 +1000 (AEST)","by mail-lj1-x23d.google.com with SMTP id\n 38308e7fff4ca-38e9589b7c7sf55437361fa.0\n        for <incoming@patchwork.ozlabs.org>;\n Wed, 29 Apr 2026 08:12:37 -0700 (PDT)","by 2002:a2e:9d87:0:b0:38c:c205:5ae3 with SMTP id\n 38308e7fff4ca-38eab9fb3fdls13448271fa.2.-pod-prod-02-eu;\n Wed, 29 Apr 2026 08:12:25 -0700 (PDT)","from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.24])\n        by gmr-mx.google.com with ESMTPS id\n 38308e7fff4ca-3924f9c7de1si498601fa.3.2026.04.29.08.12.24\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Wed, 29 Apr 2026 08:12:24 -0700 (PDT)","from client.hidden.invalid by mrelayeu.kundenserver.de (mreue108\n [212.227.17.181]) with ESMTPSA (Nemesis) id 1Mi2Fj-1vetwk3gvp-00ZyT9; Wed, 29\n Apr 2026 17:12:23 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1777475549; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=XJ+9vGaBtmunRtxSMaShym/dW/QquomS0CqHw4cwP8sx2wrMmuUXXxIEabBHyV1tca\n         C5md7Svdzn9g18j1K8O4ErBKFHgDkuHkZA7tkKfBXx42PoTvr31VFQChjE9ugY/siMtO\n         rfd1nRH5hyHnMG7RcmD4mUvzE+sie54Rl0m/x+J346hKZDaEZR++PUx1XBu6P0FF6RYQ\n         CB5CfromLxin2d6R6veAKtQ+U6sGVfGqvpbcNwfn9NYA6YB1AmEeCyjdOIZZnEUwEMj/\n         rxN49vdP6mm1pI4TrXfw2zg4iOkBXmjBCncweKUxsUlvw3vRI2V/qFMSJfl3OoWwGKm1\n         Sfpg==","i=1; a=rsa-sha256; t=1777475544; cv=none;\n        d=google.com; s=arc-20240605;\n        b=Zg7Ame2pA5IAdeQX7UKVnLEiUrrP1o6J3e2QHXgB36j8p3D2XPa/PXTHcxeWdryj5o\n         V79UaprmFMs2GL85rMjhogT8VKgIhX4YGn0xpVlBJNjQXZUQjxbzlOtyGeBpIUdaXrIm\n         1G2NrASorWTSBe52x44+tKZ1cYw+qe1cwDy3avvAlgju5SuFfMs+2haL8ZWYspW+T9zv\n         BdLdkLd/iN3a+GLcUyEw6/MMd24nuThJqjAyUfb97goAQlntrcdSKxKIs6QntCfWXYev\n         rQufrjmuSNZGdi/MTFYghAh5PZrrggIK7RHTjJzsn0g8v7Az4A20W8OJveM3uKA8RpSY\n         gqzg=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:ui-outboundreport\n         :content-transfer-encoding:in-reply-to:content-language:references\n         :cc:to:subject:from:user-agent:mime-version:date:message-id:sender\n         :dkim-signature;\n        bh=RHvjy8NlXmpFVKF/oFK0iawYASlKiOBDAYZP3vIeUfQ=;\n        fh=1PBM00lNfs9RzfQmicn5zNzQr8z4ZSoD61MO+GoOv8w=;\n        b=PljAN9XJsJ5FNFzyaoS9NBHJ2nzwp724m9f7jyxj58fpkiYvuQKPeGTDQZC1zwzI+d\n         hiDQpSRiE4EnBHmud58DKqKtKWJGlUdxy6WxkwbXIUpmkpmm1jpwe9MzH3rFZbXzC5Wn\n         HAaFUclIcZYEIkWZvGsfkvszW47xeLR9E99OsKbOe2UYH76iJOXDF+dG/JqB+0nmMDAx\n         DKw6ue2aKmWF/bCkrqmPMwlAWNCUY/5LmFNP4P8XjdmoSNMJTQymTjpJpaJd4QnY0ncZ\n         uCXNDl5h885YAZobIZzA0tJQ24IUYYD5W9eMVwb/QEt1933KSkXmJ1CynyDh5fpeRAOz\n         5O5w==;\n        darn=patchwork.ozlabs.org","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=ui-outboundreport:content-transfer-encoding:in-reply-to\n         :content-language:references:cc:to:subject:from:user-agent\n         :mime-version:date:message-id:dkim-signature;\n        bh=dGIi1tWpicL0kKPI1UGiDPLR5auNrn6ikD2qFKC1rFY=;\n        fh=s8NDUq/BdyucutxO5BZdGa+E7Wl3dPAo57KiaAOVX0E=;\n        b=eDG3VVqwXQH9gfMJUk/aY6UifY0U4GoBBvjfESkeEebbdfpFq6rKmx7xLuZj/wf8rM\n         NoBP3LVN6CTqze3JDjFHdKkPr2iCWCm2jyVvPhpbHOeaGrVgX2b0KC3gxc319VQMWtRx\n         ppQbUyvfN+atA75pTlK3RKJiK0z9Gj0PxstRqGZDa109JbbvMWDXSPHhLYiqMnXBzliS\n         D7dFXbEHFKbWfM9cCyCxANCtUzpPZyMN9dZ2Qsqj4pxZAA7hhidLqT8M8Kb6dt9g42/x\n         bCohbQcbuM+BQQ5ee6bSifsxAs+wGPdY2NCKoe7kEZp1Szo6jWKPUz5inNDVoCYShLEz\n         2G5Q==;\n        dara=google.com"],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=qMnrrx1j;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.17.24 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","i=1; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=qMnrrx1j;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.17.24 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1777475549; x=1778080349;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:ui-outboundreport:content-transfer-encoding\n         :in-reply-to:content-language:references:cc:to:subject:from\n         :user-agent:mime-version:date:message-id:sender:from:to:cc:subject\n         :date:message-id:reply-to;\n        bh=RHvjy8NlXmpFVKF/oFK0iawYASlKiOBDAYZP3vIeUfQ=;\n        b=wsymy/kOU9I1HM5bHRiSFnG/G42GQGLmOQfdHmmAqdZKWHvudb/dTgfcH4QStG3Gz+\n         b0V5r1OkYthCjyCK4+hfWOF6DgmS0kHl8aw18QlzmPL58pPpr3y2M+ZEeAOKLPyW3rfL\n         ze9ds9KkJavBvLU5vBYdgBFRXQXVePrlGXNu2yRgttT/y6TGlfYIwnOl43Q7UVowVKY/\n         qG/uWCOW3TUQnohs2NZ4gY3k78hjLF3hH1UhvLY5gTS+zCWdYH76/9AiwZ5rEoKhaaru\n         xudqrVbzSz6ZA+cS76iMMTMDrpkH0jSr9tng6K72F8H15Hfg78x77MrW9nb/pgrhNWko\n         Zmpg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777475549; x=1778080349;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :x-spam-checked-in-group:list-id:mailing-list:precedence\n         :x-original-authentication-results:x-original-sender\n         :ui-outboundreport:content-transfer-encoding:in-reply-to\n         :content-language:references:cc:to:subject:from:user-agent\n         :mime-version:date:message-id:x-beenthere:x-gm-message-state:sender\n         :from:to:cc:subject:date:message-id:reply-to;\n        bh=RHvjy8NlXmpFVKF/oFK0iawYASlKiOBDAYZP3vIeUfQ=;\n        b=Rf65p8zQc+9nFIIWMpXI1JBjagOL+ofFmTviZbdykaGY0rskWJw+ZyDYlwAAckkP73\n         nBcqG7P3S37HxkT0L6Rck6QovriQ97Hdpq/JfUKlscYSoIB0cLCQYf56hJ5FJ02LlrtD\n         8CGsAWLcaXhmc8WPh+FfbomWGDbcTbmy0J+rAcleQk9UqLeBbB7+FAbQi19+dHYXNmW0\n         ZjM2W44sQNSGHiGn4RQi+9hAuuBN/lsDlrG7FoeSV1FXQRrRM6B3mNLP9+/1btWVmeuH\n         fm1nMaAx3S+iiwSODvUVs+HJCbgOJ17gNpCFZhypzarAZTK0+A5M36WC8VbUKSGv3qD1\n         EamQ==","Sender":"swupdate@googlegroups.com","X-Forwarded-Encrypted":["i=2;\n AFNElJ+mCIEkq9ivLWHKvkL0H1DdAc1iswbAzegNcyaPzVxJCvTt/30sxRV5WRCN77Lo0cSCnX/KMqZwHg==@patchwork.ozlabs.org","i=2;\n AFNElJ+x3x/FmotgZmmEnpMCwkGtLSo11HcrRrJSapgd5LeEF5LNb8U7cqYlD4H6Nxnm4iuNr2ZE26Y0ug==@googlegroups.com"],"X-Gm-Message-State":"AOJu0Yx+nGKtERaXUIKyR7/x7tAyckZt+29MfVwvxNl0nHJxEnHzXKY8\n\tVm9rBLG5Ej28nXrcVSFDmUwsjBzUTNhf/AZhiBR7AHPsvB3dz6/nyS9C","X-Received":["by 2002:a2e:b891:0:b0:38e:15d9:d606 with SMTP id\n 38308e7fff4ca-39240cf7990mr30536411fa.10.1777475549636;\n        Wed, 29 Apr 2026 08:12:29 -0700 (PDT)","by 2002:a05:651c:b13:b0:38a:a77a:b0b2 with SMTP id\n 38308e7fff4ca-392411fa3e5mr30496211fa.30.1777475544916;\n        Wed, 29 Apr 2026 08:12:24 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com;\n h=\"AUV6zMOLrkQJS8i36SpqmIr7VxQsSkE4rkQjOlGK0X0RO5zvAg==\"","Received-SPF":"pass (google.com: domain of stefano.babic@swupdate.org\n designates 212.227.17.24 as permitted sender) client-ip=212.227.17.24;","X-UI-Sender-Class":"55c96926-9e95-11ee-ae09-1f7a4046a0f6","Message-ID":"<10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>","Date":"Wed, 29 Apr 2026 17:12:23 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","From":"Stefano Babic <stefano.babic@swupdate.org>","Subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","To":"Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n swupdate@googlegroups.com","Cc":"linux-amarula@amarulasolutions.com","References":"<20260429140130.615536-1-dario.binacchi@amarulasolutions.com>\n <20260429140130.615536-2-dario.binacchi@amarulasolutions.com>","Content-Language":"en-US","In-Reply-To":"<20260429140130.615536-2-dario.binacchi@amarulasolutions.com>","Content-Type":"text/plain; charset=\"UTF-8\"; format=flowed","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:CnzRt4m3ODmNqzrvFqcR8MJ7GvHoWremGi3dmzzF1d374RDq9nP\n jT+mrEvS7OD2X3ibIoNZeh5Xy4iuOPnL3RB77/A5PUtMXj/JY7yMH+yly15V/FFOz2aUSOs\n wACyeRg/1EF13clzZcTFbNX8r3hpXTUcar0XIg3FlmIoMhzWi9vVnug2OvTAsiz8LsfBgOW\n h1k32RH7Q8BWRw97liAdw==","X-Spam-Flag":"NO","UI-OutboundReport":"notjunk:1;M01:P0:nijo5DrNRQs=;nDDCAA9O/xb/pc+znk0E5Zg0mh0\n Q7rZKF/N89jmjNjRBcgdaa1AdDYYSiAiL3oUpcphnHJta0EwOfan9y9bX7DZ8tJ++P44kmx2B\n LEl20069Y0y/45qkijWNWZNDpPa/KHVHbwZTCV/fcJFU0z5XyfqoyeHbMO+deDHBik7WEVrEY\n nVjhgq2uLXZqqUR7MnmEi59sONXg0bXUQtfhtsMxQsS+BEEtzX5QANOZGaBKtcdbg/BLLNMi/\n VXYGGG/qwck2+4u5h9ZhDBdOHZIgdspu4bqU+YRt4nNa+DYdyb5MXzDCy+D3nVGH1wNm2NNey\n m7Ty35cnQ678BKaMCeDwzfGW1QKf8Yp7uydfhN/k8GMTFwHzNBtllRHEE7rTnjpj4jIwHZIGg\n 0UKZhW56A5/bT/34YliHOx/C1C4wyFB3ckpRZYISSNhPdx6gNyIX6A+CysnJlrV7LsWEqkRMA\n vKITRucel+AKcOaZjHvUK5sgWUP3M0qODj/14ImsNeEbyscqVlaon6mPMk0WB+mbLHzZjY7x2\n Z4enQw14KGgthT/Dl2DJ0TUQ9Tni3f5qQnMarU1EVZaHyvpJA3g7iRMNrCxLmdcCbef5HpPhA\n Qq+K9JuYe4q0cgVvRpZp2li9KdEWz0beTDmQLSYJeXFFIpd/dkzYNb9qcG60DGBKUQQfefKs7\n owOdwivT6+uEo9+RWE/ZGSu+u7KShpeXPugGWFv1u7FHmYuR8hPpbRt41tPFe75KC7HB/XCLI\n n3oy2mNfr/V3gQw2UBvPtR475ssMQmrbDwUohps9Q4NlckuJdR3D+8jO9T2aqFV8mjU5LdMLR\n aifSYj494a8/I6mbLVcMA5EGqEeMbmUsJm5qcf3wCSr9feacUTV4/z138NkTLIKTR0ID4q18P\n P2fCcxo3wMsXE19n1gHAMyi+XWe0eZA5Pgl0a3/jTR8rHliq7wwAOmRzLzh0z1sGm6k0BWLpZ\n BI9hW0l34M06z8JSwXhOCZY2sFVWYfZGfjocF7ATKwV7RmVGCbFljRx7fk0MUfcPWPUmw82r1\n qLPsWbXnP53RuSdZhM/IHRoHyRQ+rlEV8ylrhl2+UcoujAHzNUDT0Envl4OvHpTYjfuy58XQh\n pGE1U2DABHt3os/WqVdT/COhA5XcCSviooxZd5r7hyYQf6yviYZN7M0fb8IcanOUyFM3q+pGn\n BCljYnVQriJUAO24WDpKFe8JwFRj2neS7nfPB3lj7HqCnr7WPAHN51B0NPqYzCZNyIMyHXeVr\n bh+YNVoZioRhU5A6D6kOQ7AiyjRiCryoxhy+yccwpjHnCuEnw2Jv9xhGDIOK5jx+6YyNDQWic\n Fm5TlVyQtCQlPS5mvxIYW6WxBUaYZC6r07WFm6Y3m8XbGG0WIEO1bdW0vZRD0f6C20R+JD2sJ\n v4E3o+oXO0rN6aZFcICMjjl0gFZ+KiExz7DQXEqkzs/c8NtLRO6uudei/G0xNPmben8e+tHtB\n tki3qOACXgMKp8vU8pMog/zi4tLwpMngj+soluYl7qmFkpqNrlVU89lJZbESjOK5KzNmApP/h\n Bm7gulONb6JSHksDrKzRKEPZ0EaCdAaNRjKCyZq2D3RbwjUQKRCZtTVoPXWCv4X0l8f7hhAkk\n 4GzXvtOnNvh2Xbat8Pa6HifskoQhsLSCM2BESZGrA5kUK5yBrz3f5oUwIMk/pktkT30YnfThw\n Q0JlPJJRmAlOp+QRagNCdBN1RsW3Foz6oHJbtJeDC0ZD4Ph+TDy5DKHMRXArQnoUvO6oqfvPq\n f1Vvkb42Gy1WNBe5EXNDVi7XLXGQ3cTGEXxSfOcDjZlYAAcg0Sbq3R3OI/rrjUHd896RDcyTo\n lbIDByi+RaNgSl4PgCOvOzzk8bBaYRgqsAtv+/TZYxkJb4s3luZUlbsgROvIAG6s5ozMmcyq8\n KwxDI3Fz0UNMgr3oIL0zPddJdNZey12iX/+YJd34laPXfs9+jSdDN5mzd2ONsxQvQH6/tVaRK\n VElpiMR7fAXUzlT0MnrRAeKtkHwNHXrjdwA9amaxuz0dlf8JmjkUIHZzbnkK2xiToUFyaPo6D\n SNmRB5N8KD4U61FDAfXizntJHVFtrxMbfJl1ulwOrQ/ms1TvyBtVDtuJcCxayVhT8jeusCWXZ\n Wu0pQ+ITFSE=","X-Original-Sender":"stefano.babic@swupdate.org","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n header.i=@swupdate.org header.s=s1-ionos header.b=qMnrrx1j;       spf=pass\n (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.24 as\n permitted sender) smtp.mailfrom=stefano.babic@swupdate.org;       dmarc=pass\n (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"}},{"id":3684681,"web_url":"http://patchwork.ozlabs.org/comment/3684681/","msgid":"<CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>","list_archive_url":null,"date":"2026-04-30T12:52:48","subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","submitter":{"id":83038,"url":"http://patchwork.ozlabs.org/api/people/83038/","name":"Dario Binacchi","email":"dario.binacchi@amarulasolutions.com"},"content":"Hi Stefano,\n\nOn Wed, Apr 29, 2026 at 5:12 PM Stefano Babic <stefano.babic@swupdate.org>\nwrote:\n\n> Hi Dario,\n>\n> On 4/29/26 16:01, Dario Binacchi wrote:\n> > Add a handler to manage the boot selection process according to\n> > the Firmware Update (FWU) metadata specification using the\n> > libfwumdata library.\n>\n> This seems that the specification is something generic, but this is\n> really just for STM32MP2, as described in the cover. Then an according\n> documentation should be added.\n>\n\nAFAIK the FWU (Firmware Update) metadata is a fully generic specification\n(part of the Arm FWU specification). While the STM32MP2 is my use case and\nthe\nreason I wrote this patch, the standard and this implementation are not\nST-specific. Other platforms already implement and use FWU metadata in\nU-Boot,\nso the handler is meant to be completely platform-agnostic.\n\n\n>\n> Nevertheless, I will raise a basic issue about the concept. I cannot\n> find the patches sent to openembedded-core, too.\n>\n\nYou can find the patch submitted to oe-core here:\nhttps://patchwork.yoctoproject.org/project/oe-core/patch/20260429145136.618168-1-dario.binacchi@amarulasolutions.com/\n\n\n>\n> According to the related patches merged into U-Boot, this is a ST\n> replacement for fw_setenv / fw_printenv. The configuration file, at\n> least the one pushed to U-Boot, has the same old format as U-Boot's\n> tools. So I am just asking why we should have a separate tool (yes, I\n> saw in U-Boot, too) instead of integrating into the current ecosystem.\n>\n>  From a concept view, the tool is used to select which is the active\n> image to be booted, and select also some parms (flags) for it. In\n> SWUpdate, this is the \"bootloader\" interface, and not a \"script\"\n> handler. That can be implemented also as script, as here, is clear, but\n> from the logical point of view, it does not belong to.\n>\n\nImplementing it as a \"script\" handler was simply the easiest and fastest\npath for me to validate the concept, and I should have probably tagged\n the patch as an RFC for this reason. I agree that, from a logical point of\n view, this belongs in the \"bootloader\" interface.\n\n\n>\n> And the second main aspect: if this is just to choose the active\n> software set, and the fwumdata.c is poushed as replacement for FWU\n> metadata of fw_setenv, and also taken into account that its code seems\n> to me pretty simple, whhy shouldn't be integrated as storage into\n> libubootenv, instead ?\n\n\nI believe it should remain a separate library (libfwumdata) for a couple of\nreasons:\n\nConceptual separation: U-Boot itself keeps the standard environment and\nFWU metadata separated. They serve different purposes and have\nentirely different structures (a flexible key-value store vs. a rigidly\ndefined A/B state structure). Merging FWU metadata handling into\nlibubootenv could lead to conceptual misunderstandings.\n\nDedicated API: I think it's correct to have a dedicated, minimal C library\nspecifically designed to allow any userspace application - not just\nSWUpdate,\nbut also other OTA managers or proprietary system services - to easily\nswitch\nboot banks. It differs from U-Boot's mkfwumdata (which generates the\nmetadata\nimage from scratch at build time) and fwumdata (the CLI tool for targeted\nupdates).\nlibfwumdata provides a strictly limited, safe C API to update just the 3\nfields needed for a bank switch.\n\nSo, can we meet halfway? We could integrate the management of FWU variables\ninside bootloader/uboot.c. If a variable has the fwu- prefix (e.g.,\nfwu-active),\nit will be saved using libfwumdata; otherwise, it will be handled by\nlibubootenv as usual.\n\nKeeping libfwumdata separate avoids forcing FWU metadata management inside\nthe libubootenv library. This approach gives users a seamless bootenv:\ninterface\nwhile keeping the underlying architectures clean.\n\nWould this compromise be acceptable to you for v2?\n\nThanks and regards,\nDario\n\n\n> Then SWUpdate hasn't another interface, there is\n> still the bootloader interface, and under the hood the FMU is written\n> instead of U-Boot env.\n>\n> Best regards,\n> Stefano\n>\n> >\n> > The handler is a script handler that updates the active_index\n> > and marks the selected bank as valid during the post-install phase.\n> >\n> > Example in sw-description:\n> >\n> >      scripts: (\n> >          {\n> >              type = \"fwumdata\";\n> >              properties: {\n> >                  active = \"1\";\n> >              }\n> >          }\n> >      );\n> >\n> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>\n> > ---\n> >   Kconfig                        |   4 ++\n> >   Makefile.deps                  |   4 ++\n> >   Makefile.flags                 |   3 +\n> >   bootloader/Kconfig             |   7 ++\n> >   configs/all_handlers_defconfig |   1 +\n> >   doc/source/handlers.rst        |  37 ++++++++++\n> >   handlers/Kconfig               |  17 +++++\n> >   handlers/Makefile              |   1 +\n> >   handlers/fwumdata_handler.c    | 125 +++++++++++++++++++++++++++++++++\n> >   9 files changed, 199 insertions(+)\n> >   create mode 100644 handlers/fwumdata_handler.c\n> >\n> > diff --git a/Kconfig b/Kconfig\n> > index 2cf68eb890b0..fcb60f900b3f 100644\n> > --- a/Kconfig\n> > +++ b/Kconfig\n> > @@ -129,6 +129,10 @@ config HAVE_ZCK\n> >       bool\n> >       option env=\"HAVE_ZCK\"\n> >\n> > +config HAVE_LIBFWUMDATA\n> > +     bool\n> > +     option env=\"HAVE_LIBFWUMDATA\"\n> > +\n> >   menu \"SWUpdate Settings\"\n> >\n> >   menu \"General Configuration\"\n> > diff --git a/Makefile.deps b/Makefile.deps\n> > index c759f6876dea..313d5af6230c 100644\n> > --- a/Makefile.deps\n> > +++ b/Makefile.deps\n> > @@ -121,3 +121,7 @@ endif\n> >   ifeq ($(HAVE_ZCK),)\n> >   export HAVE_ZCK = y\n> >   endif\n> > +\n> > +ifeq ($(HAVE_LIBFWUMDATA),)\n> > +export HAVE_LIBFWUMDATA = y\n> > +endif\n> > diff --git a/Makefile.flags b/Makefile.flags\n> > index 40dd3b66856e..76b87e67fe67 100644\n> > --- a/Makefile.flags\n> > +++ b/Makefile.flags\n> > @@ -233,6 +233,9 @@ ifeq ($(CONFIG_UCFWHANDLER),y)\n> >   LDLIBS += gpiod\n> >   endif\n> >\n> > +ifeq ($(CONFIG_FWUMDATA_HANDLER),y)\n> > +LDLIBS += fwumdata\n> > +endif\n> >\n> >   ifeq ($(CONFIG_BOOTLOADER_STATIC_LINKED),y)\n> >   ifeq ($(CONFIG_BOOTLOADER_EBG),y)\n> > diff --git a/bootloader/Kconfig b/bootloader/Kconfig\n> > index edc02d99b2d1..36f856507356 100644\n> > --- a/bootloader/Kconfig\n> > +++ b/bootloader/Kconfig\n> > @@ -158,3 +158,10 @@ config UPDATE_STATE_BOOTLOADER\n> >       help\n> >         Store update information in Bootloader's environment.\n> >\n> > +config FWUMDATA_CONFIG_FILE\n> > +     string \"FWU Metadata Configuration file\"\n> > +     depends on HAVE_LIBFWUMDATA\n> > +     default \"/etc/fwumdata.config\"\n> > +     help\n> > +       It tells where the FWU metadata are saved.\n> > +\n> > diff --git a/configs/all_handlers_defconfig\n> b/configs/all_handlers_defconfig\n> > index 16cd9b6b98f1..63299bd223ae 100644\n> > --- a/configs/all_handlers_defconfig\n> > +++ b/configs/all_handlers_defconfig\n> > @@ -20,6 +20,7 @@ CONFIG_DISKPART=y\n> >   CONFIG_DISKPART_FORMAT=y\n> >   CONFIG_DISKFORMAT_HANDLER=y\n> >   CONFIG_FAT_FILESYSTEM=y\n> > +CONFIG_FWUMDATA_HANDLER=y\n> >   CONFIG_EXT_FILESYSTEM=y\n> >   CONFIG_LUASCRIPTHANDLER=y\n> >   CONFIG_RAW=y\n> > diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst\n> > index 6742c10a58c3..cbfb146f099c 100644\n> > --- a/doc/source/handlers.rst\n> > +++ b/doc/source/handlers.rst\n> > @@ -1710,3 +1710,40 @@ Examples:\n> >                       name = \"helloworld\";\n> >               };\n> >       });\n> > +\n> > +FWU Metadata Handler\n> > +--------------------\n> > +\n> > +This is a script handler used to manage the boot selection process\n> according to\n> > +the Firmware Update (FWU) metadata specification.\n> > +\n> > +The handler implements a post-install script that updates the metadata\n> to switch\n> > +the active bank and marks it as valid, ensuring the system boots from\n> the new\n> > +bank at the next reset. The ``active`` property defines which bank must\n> be\n> > +selected.\n> > +\n> > +Example selecting boot bank 1 (bank A in A/B schema):\n> > +\n> > +::\n> > +\n> > +     scripts: (\n> > +             {\n> > +                     type = \"fwumdata\";\n> > +                     properties: {\n> > +                             active = \"1\";\n> > +                     }\n> > +             }\n> > +     );\n> > +\n> > +Example selecting boot bank 2 (bank B in A/B schema):\n> > +\n> > +::\n> > +\n> > +     scripts: (\n> > +             {\n> > +                     type = \"fwumdata\";\n> > +                     properties: {\n> > +                             active = \"2\";\n> > +                     }\n> > +             }\n> > +     );\n> > diff --git a/handlers/Kconfig b/handlers/Kconfig\n> > index 152bc08074a1..b7d9e51a20c9 100644\n> > --- a/handlers/Kconfig\n> > +++ b/handlers/Kconfig\n> > @@ -151,6 +151,23 @@ config EMMC_HANDLER\n> >         with a dual-copy concept. This guarantees that the upgrade\n> >         is power-cut safe.\n> >\n> > +config FWUMDATA_HANDLER\n> > +     bool \"FWU metadata update\"\n> > +     depends on HAVE_LIBFWUMDATA\n> > +     default n\n> > +     help\n> > +       This handler allows to manage the boot selection process using\n> > +       firmware update (FWU) metadata via libfwumdata.\n> > +\n> > +       Selecting the new boot bank automatically triggers the handler to\n> > +       set the current bank for rollback and mark the selected boot-up\n> > +       bank as 'valid'.\n> > +\n> > +       This ensures the system is ready to boot from the updated\n> > +       partition while maintaining a safe path to revert to the previous\n> > +       working state if the new firmware fails to reach the 'accepted'\n> > +       state\n> > +\n> >   config RAW\n> >       bool \"raw\"\n> >       default n\n> > diff --git a/handlers/Makefile b/handlers/Makefile\n> > index 8490172a10a3..45fcb525e461 100644\n> > --- a/handlers/Makefile\n> > +++ b/handlers/Makefile\n> > @@ -30,3 +30,4 @@ obj-$(CONFIG_SWUFORWARDER_HANDLER) +=\n> swuforward_handler.o swuforward-ws.o\n> >   obj-$(CONFIG_UBIVOL)        += ubivol_handler.o\n> >   obj-$(CONFIG_UCFWHANDLER)   += ucfw_handler.o\n> >   obj-$(CONFIG_DOCKER)        += docker_handler.o\n> > +obj-$(CONFIG_FWUMDATA_HANDLER)       += fwumdata_handler.o\n> > diff --git a/handlers/fwumdata_handler.c b/handlers/fwumdata_handler.c\n> > new file mode 100644\n> > index 000000000000..1331fe64aa74\n> > --- /dev/null\n> > +++ b/handlers/fwumdata_handler.c\n> > @@ -0,0 +1,125 @@\n> > +#include <stdio.h>\n> > +#include <unistd.h>\n> > +#include <fcntl.h>\n> > +#include <stdlib.h>\n> > +#include <stdbool.h>\n> > +#include <errno.h>\n> > +#include <linux/version.h>\n> > +#include <sys/ioctl.h>\n> > +#include <stddef.h>\n> > +\n> > +#include \"swupdate_image.h\"\n> > +#include \"handler.h\"\n> > +#include \"util.h\"\n> > +\n> > +#include <libfwumdata.h>\n> > +\n> > +static int _fwumdata_set(uint32_t active_index, uint32_t previous_index,\n> > +                      uint8_t bank_state)\n> > +{\n> > +     int mdd;\n> > +     int ret;\n> > +\n> > +     mdd = fwumdata_init();\n> > +     if (mdd < 0) {\n> > +             ERROR(\"Cannot initialize libfwumdata\\n\");\n> > +             return mdd;\n> > +     }\n> > +\n> > +     ret = fwumdata_read_config(mdd, CONFIG_FWUMDATA_CONFIG_FILE);\n> > +     if (ret) {\n> > +             ERROR(\"Cannot read %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n> > +             goto exit;\n> > +     }\n> > +\n> > +     ret = fwumdata_open(mdd, 0);\n> > +     if (ret) {\n> > +             ERROR(\"Cannot open %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n> > +             goto exit;\n> > +     }\n> > +\n> > +     ret = fwumdata_set_active_index(mdd, active_index);\n> > +     if (ret) {\n> > +             ERROR(\"Cannot set active index\\n\");\n> > +             goto close;\n> > +     }\n> > +\n> > +     fwumdata_set_previous_index(mdd, previous_index);\n> > +     if (ret) {\n> > +             ERROR(\"Cannot set previous index\\n\");\n> > +             goto close;\n> > +     }\n> > +\n> > +     ret = fwumdata_set_bank_state(mdd, active_index, bank_state);\n> > +     if (ret) {\n> > +             ERROR(\"Cannot set bank state\\n\");\n> > +             goto close;\n> > +     }\n> > +\n> > +        ret = fwumdata_store(mdd);\n> > +        if (ret) {\n> > +             ERROR(\"Cannot store fwu metadata\\n\");\n> > +             goto close;\n> > +     }\n> > +\n> > +     DEBUG(\"fwumdata: active: %d, previous: %d, state: 0x%x\",\n> > +           active_index, previous_index, bank_state);\n> > +\n> > +close:\n> > +     fwumdata_close(mdd);\n> > +exit:\n> > +     fwumdata_exit(mdd);\n> > +     return ret;\n> > +}\n> > +\n> > +static int fwumdata_set(struct img_type *img, void *data)\n> > +{\n> > +     struct script_handler_data *script_data;\n> > +     char *value;\n> > +     int active_index = -1;\n> > +     int previous_index;\n> > +\n> > +\n> > +     if (!data)\n> > +             return -EINVAL;\n> > +\n> > +     script_data = data;\n> > +\n> > +     /*\n> > +      * Call only in case of postinstall\n> > +      */\n> > +     if (script_data->scriptfn != POSTINSTALL)\n> > +             return 0;\n> > +\n> > +     value = dict_get_value(&img->properties, \"active\");\n> > +     if (!value) {\n> > +             ERROR(\"active: cannot find in sw-description\");\n> > +             return -EINVAL;\n> > +     }\n> > +\n> > +     active_index = ustrtoull(value, NULL, 10);\n> > +     if (errno) {\n> > +             ERROR(\"active %s: ustrotull failed\", value);\n> > +             return -EINVAL;\n> > +     }\n> > +\n> > +     active_index--;\n> > +     if (active_index == 0) {\n> > +             previous_index = 1;\n> > +     } else if (active_index == 1) {\n> > +             previous_index = 0;\n> > +     } else {\n> > +             ERROR(\"active %s: invalid value\", value);\n> > +             return -EINVAL;\n> > +\n> > +     }\n> > +\n> > +     return _fwumdata_set(active_index, previous_index,\n> FWUMDATA_BANK_VALID);\n> > +}\n> > +\n> > +__attribute__((constructor))\n> > +void fwumdata_handler(void)\n> > +{\n> > +     register_handler(\"fwumdata\", fwumdata_set,\n> > +                      SCRIPT_HANDLER | NO_DATA_HANDLER, NULL);\n> > +}\n>\n> --\n> _______________________________________________________________________\n> Nabla Software Engineering GmbH\n> Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n> Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n> E-Mail: sbabic@nabladev.com\n>\n>\n> --\n> _______________________________________________________________________\n> Nabla Software Engineering GmbH\n> Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n> Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n> E-Mail: sbabic@nabladev.com\n>","headers":{"Return-Path":"<swupdate+bncBCQ4XFG47UFRBLNBZXHQMGQEVTRGADQ@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=FH/Bb7XY;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2607:f8b0:4864:20::83a; helo=mail-qt1-x83a.google.com;\n envelope-from=swupdate+bncbcq4xfg47ufrblnbzxhqmgqevtrgadq@googlegroups.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from mail-qt1-x83a.google.com (mail-qt1-x83a.google.com\n [IPv6:2607:f8b0:4864:20::83a])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5vGr0xNJz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 22:53:07 +1000 (AEST)","by mail-qt1-x83a.google.com with SMTP id\n d75a77b69052e-50fb0b93e90sf2328691cf.3\n        for <incoming@patchwork.ozlabs.org>;\n Thu, 30 Apr 2026 05:53:07 -0700 (PDT)","by 2002:a05:622a:2d6:b0:510:12f1:3f2 with SMTP id\n d75a77b69052e-5102947af29ls17825681cf.0.-pod-prod-08-us; Thu, 30 Apr 2026\n 05:52:59 -0700 (PDT)","from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com.\n [2607:f8b0:4864:20::1133])\n        by gmr-mx.google.com with ESMTPS id\n af79cd13be357-8f93f3895b2si19010085a.3.2026.04.30.05.52.59\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n        Thu, 30 Apr 2026 05:52:59 -0700 (PDT)","by mail-yw1-x1133.google.com with SMTP id\n 00721157ae682-7982c3b7da9so8467837b3.1\n        for <swupdate@googlegroups.com>; Thu, 30 Apr 2026 05:52:59 -0700 (PDT)"],"ARC-Seal":["i=3; a=rsa-sha256; t=1777553583; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=lBCCCjiERheAmZnguL5hjumLM189DnndtHVS46GIzykS+hI7r/Mdl41uG3cHTPhCes\n         2K78fJXcsCAW1I/2bhhvGxQO3rKxwgjOBT5xQ7pmUQqX+ihkA9DXTbEotaoJ/Wnj1Hoo\n         2oQRSGa9rT1B1RajQIbQT7vd/NT9g4PziDnFJYUmpNjOd7oB0CMA4Maup4qBb0wRF8JG\n         CvvhNgm2oyFr+7q+UQKkDmJ+PP0hit9EuI8f35Q4M6OP0ssV+R5Kmn3QiuSPZtKqJUlf\n         PMTIavs6Led6j1Sb1mrTC5Mt8neWP+6a3qF+f8CTkLVedvX2IrIj0gFGFv//ajmZod7/\n         v1bw==","i=2; a=rsa-sha256; t=1777553579; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=gaOtdA8ScBq0nka2nnvpGhnvcJD+ldq1VLVvGMulZ3GQqbWCVklCvYGKzuisoT0RKg\n         qVX8RGuo7itL+Qu8tdHixPUsaUHcJWEBP3jqnNFI7WmnVwOg5kxZHAPkCiXjY6kndsnb\n         aIArxpvsHWrvCWc3l2J4Avz3lNdG9JkJaO7c5h+0F9ZC2+lqIckCJa+ZZxAvR9dC0xgl\n         wDo35rq/2c1RqUFaQOF5F3LhTngQzgRN6G7KWdAHbabXuTO2yVkcDcQiQ3+28WvvMUnv\n         rqOpbLf/6Y4yWzlTQK4AwqqfHSszGUna6eXuNkIoUDq91sj7cGqOpIEZqjmPcVGy51pz\n         Mc6A==","i=1; a=rsa-sha256; t=1777553579; cv=none;\n        d=google.com; s=arc-20240605;\n        b=E5Ctyj7N9EWzKPOUAb0/u8YQVjjamSbkD/8+05qgzYBNtSIrxp5mfX5g82eqGXkd+X\n         pm0xur6Rf+ZEyWA8qaIpnImD46zJVqu/t8HbDYGma0vNLMCMS3jkRSHD85j5DYJQ9hbV\n         uTFYbt1quJzHVxUPCR7RnqhkycgViQge9WClvhxiHZmdQh8OUSYWyT6nEFj7c+mH4NJQ\n         ZoU6TH2+GSDjM5ha4UWOj2pRBoyB8DrRPGEkJOCSt6vgDKqUg2TIcRBmMteL9D+HD7+K\n         rBl5mY0yDkWKPxwf69Svvu6x+klOj8CkLwo2wXKsfLqKup77g/2iN+2i/hiLNS81lxPT\n         m1tQ=="],"ARC-Message-Signature":["i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:sender:dkim-signature;\n        bh=tvN6uSt7/R34XNDrL9AbS0JtuVtmBpMnhsXoXlhG/xM=;\n        fh=lq8VSFGCVo5MqiqnfGb8NkpmB+u4uNjgwY7wxoEziZI=;\n        b=Y7pSVEiUxvrj4fIqn1aPGBG1ZdgFRlYbw2FxzZoaYJU4L51J01EQ0j9Xw7p9SrQDii\n         VOe6haIzL+o271Zu1ERt+9+xIYkt/onDrt7fDIn0KPZagN+MJTdT2WLmtjwAwzOEUMpS\n         7bazHhnhkY2d4nTiJnj8+PQWVV8NfaiqZbDa1a1HlndmT0hY3cP3xbxAMZdOoiU9DZVo\n         /fs6I5Gnd4AatUivbeGtJHxVi9K3jNh1cY0c5qwjS7/Ey13lI1+31HaQpCB45BUwi4M9\n         u9nEoP6QlOld4PJJTtgo/huQdafZPaPehfsW2HaOFOnAv88PJKdhM6/BOXoxUOzL8xI3\n         C25Q==;\n        darn=patchwork.ozlabs.org","i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:dkim-signature;\n        bh=PaDWJ1odTbML3vMWt00GNSN5regVzG3Ktyvp1uYD2i8=;\n        fh=XlaocOg4+hEg9m6vkXgFAGy4bjo1d4y6YkK6a6dOTeU=;\n        b=Bik3O87Mgbac9muiFVnRK0V/RRXbeXkreELkv+ALJpMrGfOAtFZ1icthHmzVUYuyAG\n         WveAsR6+AQkPXSouh/IjKtw186fFVzzXLC7nKRGhGagb+phFVCT1GFdUori80YUsyRuQ\n         2U7p6o6pPUfUbZuaGTIASf2zAAwPYGGK1pjCmVphPDWrUZRUi3SmkWnQAKelS3R1RuBl\n         b51ef8GHszXvcahg2JIbClOrG8pNsfsfxgAT/RtaCIwLDGW/EYuLcwLrSudA8zkpAfBN\n         V2jXIj880dQBa0P41PVqgl8pT5OuB1hIKO0ePu29jFoK9ByNSSxgofNkXcksRJNKKZi4\n         uu9w==;\n        dara=google.com","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:dkim-signature;\n        bh=PaDWJ1odTbML3vMWt00GNSN5regVzG3Ktyvp1uYD2i8=;\n        fh=XlaocOg4+hEg9m6vkXgFAGy4bjo1d4y6YkK6a6dOTeU=;\n        b=e5eXbIaqTSk6O25PnpIkzvGszrQX7xqZMZT6wwTKImPm+PoCBguduBKSS9L7HQbYQp\n         BxxOqtRwPGzlA6zpYqmOQFVG4mZhCtnEoh0NwGUMhfmSgehoDQNFGy1WAk5fze0vaHyX\n         JyHRJfjUSnDaA/R0JIhG71gF5rU3vJeuo8PJjnZLQvnybJD/ZCE4tiwlacy92oY9INCu\n         tLnT8vagq+Tr36tsrJzhaIaNNWHD9wTIku8paTGbUMz6V9Flp2g8/G07HZvoTUvt/VQD\n         XML5cH1wrzmPTgsbLke/EWZrzvQlEFVKov/TVYw4XNMyuPwLYQSut2OQpbKQln2SSw/K\n         jCaA==;\n        dara=google.com"],"ARC-Authentication-Results":["i=3; gmr-mx.google.com;\n       dkim=pass header.i=@amarulasolutions.com header.s=google\n header.b=QxnYQkIF;\n       arc=pass (i=1);\n       spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1133 as permitted sender)\n smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","i=2; gmr-mx.google.com;\n       dkim=pass header.i=@amarulasolutions.com header.s=google\n header.b=QxnYQkIF;\n       arc=pass (i=1);\n       spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1133 as permitted sender)\n smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","i=1; mx.google.com; arc=none"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1777553583; x=1778158383;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:cc:to:subject:message-id:date:from:in-reply-to\n         :references:mime-version:sender:from:to:cc:subject:date:message-id\n         :reply-to;\n        bh=tvN6uSt7/R34XNDrL9AbS0JtuVtmBpMnhsXoXlhG/xM=;\n        b=FH/Bb7XYUAwGd+8YYkldWNiKT2evPn9VaDilx6t+1/TsZk+1cVb1EpLD17E3DPAF60\n         IHT9+zwR4ugRhvrKkHNgmNsK3I/81I4jzT4XuJt0IU8p3wI4DBGq/wTs3qOh3zAuX8kO\n         3e+SKJW/vCN/shgmatwIuGkroCiDfDjcVlqd4HoBrCtPjRNCTGz+zucHQ8zek0gYXMxA\n         CbE23eHI2BTKu0TynKZM950oERGPef4pE6qzr/u7UQRd7B6PKBRQngyVjbrflkzE2Qaa\n         ERMafTzHDcyGE0o0DvrSB/KZBefrwGZe5YDnNN3FbAeiURiJL3TK6wuU4d1ecuWNj8ir\n         lGiA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777553583; x=1778158383;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :x-spam-checked-in-group:list-id:mailing-list:precedence\n         :x-original-authentication-results:x-original-sender:cc:to:subject\n         :message-id:date:from:in-reply-to:references:mime-version:x-gm-gg\n         :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=tvN6uSt7/R34XNDrL9AbS0JtuVtmBpMnhsXoXlhG/xM=;\n        b=myfBHojeTZoS52YLUAv52I0VwXiW0q/FWh930NkxgpFA+JlQyTEBbsFV2hLedEjygj\n         zBQ/DZwF6c27upF9Fhldas9YgCfJ1J/aUZTiIW7Hn0zS9l8z+X8S5otn/2KM1Zc8olqo\n         SyTAmJdcVnq9XgxC6w5oJnZU1tw2pmiA0T2o/mCspgchV+UdnUgRGJyoYJxH6mAiVPFz\n         5kXSCzXnC/dqCrbfOsoYGgasxoR3CkjhsEC4/Tre7Mp2xD2FbPyXSJzcpkP2HIBoAziX\n         vmQHeiGb6DS6QE9Rj2XntLKu1H34E2fVsxLCE9nQKp3vH5LNT3okhxdy6voVlxqF6/vI\n         0sqA==","Sender":"swupdate@googlegroups.com","X-Forwarded-Encrypted":"i=3;\n AFNElJ9sWWU6/zNsvX0NJEDFbWGPz0h3ZLORCAw3dso3O+Co3vXEWnz0gk9UD7DqGYVtvrJzZN5e8fNHiw==@patchwork.ozlabs.org","X-Gm-Message-State":"AOJu0YxtnBCSiJLyKNBjk3YizMPiDKbi96IsOgQuCveEStUTm1/+5SSx\n\tbChXji0N7g7Zf/vcT3HY59XU+w1XM0djGoMlHmRKQbHGLli82YW1Kong","X-Received":["by 2002:a05:622a:648:b0:50e:487a:bfef with SMTP id\n d75a77b69052e-5102aad7c45mr25439581cf.2.1777553582818;\n        Thu, 30 Apr 2026 05:53:02 -0700 (PDT)","by 2002:a05:620a:17aa:b0:8de:b9dd:8528 with SMTP id\n af79cd13be357-8fa87599edfmr460702785a.24.1777553579732;\n        Thu, 30 Apr 2026 05:52:59 -0700 (PDT)","by 2002:a05:690c:6c13:b0:797:a27b:864c with SMTP id\n 00721157ae682-7bd52961d74mr27329727b3.38.1777553579017; Thu, 30 Apr 2026\n 05:52:59 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com;\n h=\"AUV6zMML+5auRCGR73CeXmjPeTsJYI+l+/emCq8nEttNIcJgzA==\"","Received-SPF":"pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1133 as permitted sender)\n client-ip=2607:f8b0:4864:20::1133;","X-Gm-Gg":"AeBDiesUgInf+PHxO0TACX4hWGWXKASGh4M+QMwRsL3NlAB+jZC6oSZwYJ4Hratll6n\n\tEfGxDqxpn6BpvVDG3bcAyDj1vTXSchaCLaYmE0JXHoKWgcHpau4BmuYr8D0og9gSBBY+4yFmiGw\n\tPc8oMzqGkOB5wOV5/HOVirY7b16dA7RQJFvmzbppHSMQgEBY02s4M07z0+zY8CVtOQNHPVO1Aww\n\tZNAPxaIfI+Ymfkc7d+lPUfU2BA9ZGrlPLXewta82IoFjEou+V/m45/GMrlHzdz4KPz6m/HM/K+S\n\tv7WrqpPTYs4AitFJmOo/90EfL2ZCQ96QGnoJCN6NHnrmCgxA","MIME-Version":"1.0","References":"<20260429140130.615536-1-dario.binacchi@amarulasolutions.com>\n <20260429140130.615536-2-dario.binacchi@amarulasolutions.com>\n <10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>","In-Reply-To":"<10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>","From":"Dario Binacchi <dario.binacchi@amarulasolutions.com>","Date":"Thu, 30 Apr 2026 14:52:48 +0200","X-Gm-Features":"AVHnY4IRTUOx1EeL1J3b-bAqyHJL5_2x_TRaF4diFKjv6KtkQfhf13LNPJt9ajA","Message-ID":"\n <CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>","Subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","To":"Stefano Babic <stefano.babic@swupdate.org>","Cc":"swupdate@googlegroups.com, linux-amarula@amarulasolutions.com","Content-Type":"multipart/alternative; boundary=\"000000000000a5977f0650acf126\"","X-Original-Sender":"dario.binacchi@amarulasolutions.com","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n header.i=@amarulasolutions.com header.s=google header.b=QxnYQkIF;\n       arc=pass (i=1);       spf=pass (google.com: domain of\n dario.binacchi@amarulasolutions.com designates 2607:f8b0:4864:20::1133 as\n permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"}},{"id":3684699,"web_url":"http://patchwork.ozlabs.org/comment/3684699/","msgid":"<a5d5d0da-0235-4571-a7b9-ca2bfe50972e@swupdate.org>","list_archive_url":null,"date":"2026-04-30T13:24:12","subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","submitter":{"id":86869,"url":"http://patchwork.ozlabs.org/api/people/86869/","name":"Stefano Babic","email":"stefano.babic@swupdate.org"},"content":"Hi Dario,\n\nOn 4/30/26 14:52, Dario Binacchi wrote:\n> Hi Stefano,\n> \n> On Wed, Apr 29, 2026 at 5:12 PM Stefano Babic \n> <stefano.babic@swupdate.org <mailto:stefano.babic@swupdate.org>> wrote:\n> \n>     Hi Dario,\n> \n>     On 4/29/26 16:01, Dario Binacchi wrote:\n>      > Add a handler to manage the boot selection process according to\n>      > the Firmware Update (FWU) metadata specification using the\n>      > libfwumdata library.\n> \n>     This seems that the specification is something generic, but this is\n>     really just for STM32MP2, as described in the cover. Then an according\n>     documentation should be added.\n> \n> \n> AFAIK the FWU (Firmware Update) metadata is a fully generic specification\n> (part of the Arm FWU specification). While the STM32MP2 is my use case \n> and the\n> reason I wrote this patch, the standard and this implementation are not\n> ST-specific. Other platforms already implement and use FWU metadata in \n> U-Boot,\n> so the handler is meant to be completely platform-agnostic.\n> \n> \n>     Nevertheless, I will raise a basic issue about the concept. I cannot\n>     find the patches sent to openembedded-core, too.\n> \n> \n> You can find the patch submitted to oe-core here:\n> https://patchwork.yoctoproject.org/project/oe-core/ \n> patch/20260429145136.618168-1-dario.binacchi@amarulasolutions.com/ \n> <https://patchwork.yoctoproject.org/project/oe-core/ \n> patch/20260429145136.618168-1-dario.binacchi@amarulasolutions.com/>\n\nThanks !\n\n> \n> \n>     According to the related patches merged into U-Boot, this is a ST\n>     replacement for fw_setenv / fw_printenv. The configuration file, at\n>     least the one pushed to U-Boot, has the same old format as U-Boot's\n>     tools. So I am just asking why we should have a separate tool (yes, I\n>     saw in U-Boot, too) instead of integrating into the current ecosystem.\n> \n>       From a concept view, the tool is used to select which is the active\n>     image to be booted, and select also some parms (flags) for it. In\n>     SWUpdate, this is the \"bootloader\" interface, and not a \"script\"\n>     handler. That can be implemented also as script, as here, is clear, but\n>     from the logical point of view, it does not belong to.\n> \n> \n> Implementing it as a \"script\" handler was simply the easiest and fastest\n> path for me to validate the concept, and I should have probably tagged\n>   the patch as an RFC for this reason. I agree that, from a logical point of\n>   view, this belongs in the \"bootloader\" interface.\n> \n\nOk\n\n> \n>     And the second main aspect: if this is just to choose the active\n>     software set, and the fwumdata.c is poushed as replacement for FWU\n>     metadata of fw_setenv, and also taken into account that its code seems\n>     to me pretty simple, whhy shouldn't be integrated as storage into\n>     libubootenv, instead ?\n> \n> \n> I believe it should remain a separate library (libfwumdata) for a couple \n> of reasons:\n> \n> Conceptual separation: U-Boot itself keeps the standard environment and\n> FWU metadata separated. They serve different purposes and have\n> entirely different structures (a flexible key-value store vs. a rigidly\n> defined A/B state structure). Merging FWU metadata handling into\n> libubootenv could lead to conceptual misunderstandings.\n\nBut libubootenv maintains the name, but it is already not only thought \nfor U-Boot. Currently, it is used to store persistently tuple that must \nsurvive an update. Namespaces allow to set vars into different domains \nthan U-Boot (bootloader vars vs application vars is the most typical use \ncase). A FWU will be just a different namespace, but interface remains \ncoherent.\n\n> \n> Dedicated API: I think it's correct to have a dedicated, minimal C library\n> specifically designed to allow any userspace application - not just \n> SWUpdate,\n > but also other OTA managers or proprietary system services - to \neasily > switch\n\nWell, this was one reason for the libubootenv, and it is used by other \nOTA updater, too. It is not bound to SWUpdate, SWUpdate is just an user \nof the library.\n\nSo checking inside your libfwumdata, and seeing the analogies with \nlibubootenv, and you have already stated in the header that there are \nparts taken from libubootenv, I am even less convinced that adding \nanother additional library is the best way to go. If I can agree about \nthe separation from U-B0oot environment (and this is already provided \nvia name3space), why is this not simply done by adding to libubootenv ? \nIt can be still used by any OTA, it is still separated by U-Boot's env \n(ok, not the name..), configuration is already in a more modern and \nflexible way as in old U-Boot and in libfwumdata, that takes over from \nU-Boot (YAML).\n\nThe most practical way seems to extend the current library instead of \ncreating a new one.\n\n> boot banks. It differs from U-Boot's mkfwumdata (which generates the \n> metadata\n> image from scratch at build time) and fwumdata (the CLI tool for \n> targeted updates).\n> libfwumdata provides a strictly limited, safe C API to update just the 3\n> fields needed for a bank switch.\n> \n> So, can we meet halfway? We could integrate the management of FWU variables\n> inside bootloader/uboot.c.\n\nNot at all. It is a bad solution for you, too. We agree that is \nseparated by U-Boot, then this mixes all up.\n\n> If a variable has the fwu- prefix (e.g., fwu- \n> active),\n> it will be saved using libfwumdata; otherwise, it will be handled by\n> libubootenv as usual.\n\nThis is just a hack - I fully disagree here.\n\nAnd be sure, there will be some user early or later who starts to set \nU-Boot variables starting with \"fwu\" (\"Fair World Unit\", maybe ?) and he \nwill complain it does not work.\n\n> \n> Keeping libfwumdata separate avoids forcing FWU metadata management inside\n> the libubootenv library. This approach gives users a seamless bootenv: \n> interface\n> while keeping the underlying architectures clean.\n\nI do not see the advantage here - on the opposite, if it is integrated, \nuser has the same interface.\n\n> \n> Would this compromise be acceptable to you for v2?\n> \n\nSorry, not.\n\nBest regards,\nStefano\n\n> Thanks and regards,\n> Dario\n> \n>     Then SWUpdate hasn't another interface, there is\n>     still the bootloader interface, and under the hood the FMU is written\n>     instead of U-Boot env.\n> \n>     Best regards,\n>     Stefano\n> \n>      >\n>      > The handler is a script handler that updates the active_index\n>      > and marks the selected bank as valid during the post-install phase.\n>      >\n>      > Example in sw-description:\n>      >\n>      >      scripts: (\n>      >          {\n>      >              type = \"fwumdata\";\n>      >              properties: {\n>      >                  active = \"1\";\n>      >              }\n>      >          }\n>      >      );\n>      >\n>      > Signed-off-by: Dario Binacchi\n>     <dario.binacchi@amarulasolutions.com\n>     <mailto:dario.binacchi@amarulasolutions.com>>\n>      > ---\n>      >   Kconfig                        |   4 ++\n>      >   Makefile.deps                  |   4 ++\n>      >   Makefile.flags                 |   3 +\n>      >   bootloader/Kconfig             |   7 ++\n>      >   configs/all_handlers_defconfig |   1 +\n>      >   doc/source/handlers.rst        |  37 ++++++++++\n>      >   handlers/Kconfig               |  17 +++++\n>      >   handlers/Makefile              |   1 +\n>      >   handlers/fwumdata_handler.c    | 125 ++++++++++++++++++++++++++\n>     +++++++\n>      >   9 files changed, 199 insertions(+)\n>      >   create mode 100644 handlers/fwumdata_handler.c\n>      >\n>      > diff --git a/Kconfig b/Kconfig\n>      > index 2cf68eb890b0..fcb60f900b3f 100644\n>      > --- a/Kconfig\n>      > +++ b/Kconfig\n>      > @@ -129,6 +129,10 @@ config HAVE_ZCK\n>      >       bool\n>      >       option env=\"HAVE_ZCK\"\n>      >\n>      > +config HAVE_LIBFWUMDATA\n>      > +     bool\n>      > +     option env=\"HAVE_LIBFWUMDATA\"\n>      > +\n>      >   menu \"SWUpdate Settings\"\n>      >\n>      >   menu \"General Configuration\"\n>      > diff --git a/Makefile.deps b/Makefile.deps\n>      > index c759f6876dea..313d5af6230c 100644\n>      > --- a/Makefile.deps\n>      > +++ b/Makefile.deps\n>      > @@ -121,3 +121,7 @@ endif\n>      >   ifeq ($(HAVE_ZCK),)\n>      >   export HAVE_ZCK = y\n>      >   endif\n>      > +\n>      > +ifeq ($(HAVE_LIBFWUMDATA),)\n>      > +export HAVE_LIBFWUMDATA = y\n>      > +endif\n>      > diff --git a/Makefile.flags b/Makefile.flags\n>      > index 40dd3b66856e..76b87e67fe67 100644\n>      > --- a/Makefile.flags\n>      > +++ b/Makefile.flags\n>      > @@ -233,6 +233,9 @@ ifeq ($(CONFIG_UCFWHANDLER),y)\n>      >   LDLIBS += gpiod\n>      >   endif\n>      >\n>      > +ifeq ($(CONFIG_FWUMDATA_HANDLER),y)\n>      > +LDLIBS += fwumdata\n>      > +endif\n>      >\n>      >   ifeq ($(CONFIG_BOOTLOADER_STATIC_LINKED),y)\n>      >   ifeq ($(CONFIG_BOOTLOADER_EBG),y)\n>      > diff --git a/bootloader/Kconfig b/bootloader/Kconfig\n>      > index edc02d99b2d1..36f856507356 100644\n>      > --- a/bootloader/Kconfig\n>      > +++ b/bootloader/Kconfig\n>      > @@ -158,3 +158,10 @@ config UPDATE_STATE_BOOTLOADER\n>      >       help\n>      >         Store update information in Bootloader's environment.\n>      >\n>      > +config FWUMDATA_CONFIG_FILE\n>      > +     string \"FWU Metadata Configuration file\"\n>      > +     depends on HAVE_LIBFWUMDATA\n>      > +     default \"/etc/fwumdata.config\"\n>      > +     help\n>      > +       It tells where the FWU metadata are saved.\n>      > +\n>      > diff --git a/configs/all_handlers_defconfig b/configs/\n>     all_handlers_defconfig\n>      > index 16cd9b6b98f1..63299bd223ae 100644\n>      > --- a/configs/all_handlers_defconfig\n>      > +++ b/configs/all_handlers_defconfig\n>      > @@ -20,6 +20,7 @@ CONFIG_DISKPART=y\n>      >   CONFIG_DISKPART_FORMAT=y\n>      >   CONFIG_DISKFORMAT_HANDLER=y\n>      >   CONFIG_FAT_FILESYSTEM=y\n>      > +CONFIG_FWUMDATA_HANDLER=y\n>      >   CONFIG_EXT_FILESYSTEM=y\n>      >   CONFIG_LUASCRIPTHANDLER=y\n>      >   CONFIG_RAW=y\n>      > diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst\n>      > index 6742c10a58c3..cbfb146f099c 100644\n>      > --- a/doc/source/handlers.rst\n>      > +++ b/doc/source/handlers.rst\n>      > @@ -1710,3 +1710,40 @@ Examples:\n>      >                       name = \"helloworld\";\n>      >               };\n>      >       });\n>      > +\n>      > +FWU Metadata Handler\n>      > +--------------------\n>      > +\n>      > +This is a script handler used to manage the boot selection\n>     process according to\n>      > +the Firmware Update (FWU) metadata specification.\n>      > +\n>      > +The handler implements a post-install script that updates the\n>     metadata to switch\n>      > +the active bank and marks it as valid, ensuring the system boots\n>     from the new\n>      > +bank at the next reset. The ``active`` property defines which\n>     bank must be\n>      > +selected.\n>      > +\n>      > +Example selecting boot bank 1 (bank A in A/B schema):\n>      > +\n>      > +::\n>      > +\n>      > +     scripts: (\n>      > +             {\n>      > +                     type = \"fwumdata\";\n>      > +                     properties: {\n>      > +                             active = \"1\";\n>      > +                     }\n>      > +             }\n>      > +     );\n>      > +\n>      > +Example selecting boot bank 2 (bank B in A/B schema):\n>      > +\n>      > +::\n>      > +\n>      > +     scripts: (\n>      > +             {\n>      > +                     type = \"fwumdata\";\n>      > +                     properties: {\n>      > +                             active = \"2\";\n>      > +                     }\n>      > +             }\n>      > +     );\n>      > diff --git a/handlers/Kconfig b/handlers/Kconfig\n>      > index 152bc08074a1..b7d9e51a20c9 100644\n>      > --- a/handlers/Kconfig\n>      > +++ b/handlers/Kconfig\n>      > @@ -151,6 +151,23 @@ config EMMC_HANDLER\n>      >         with a dual-copy concept. This guarantees that the upgrade\n>      >         is power-cut safe.\n>      >\n>      > +config FWUMDATA_HANDLER\n>      > +     bool \"FWU metadata update\"\n>      > +     depends on HAVE_LIBFWUMDATA\n>      > +     default n\n>      > +     help\n>      > +       This handler allows to manage the boot selection process\n>     using\n>      > +       firmware update (FWU) metadata via libfwumdata.\n>      > +\n>      > +       Selecting the new boot bank automatically triggers the\n>     handler to\n>      > +       set the current bank for rollback and mark the selected\n>     boot-up\n>      > +       bank as 'valid'.\n>      > +\n>      > +       This ensures the system is ready to boot from the updated\n>      > +       partition while maintaining a safe path to revert to the\n>     previous\n>      > +       working state if the new firmware fails to reach the\n>     'accepted'\n>      > +       state\n>      > +\n>      >   config RAW\n>      >       bool \"raw\"\n>      >       default n\n>      > diff --git a/handlers/Makefile b/handlers/Makefile\n>      > index 8490172a10a3..45fcb525e461 100644\n>      > --- a/handlers/Makefile\n>      > +++ b/handlers/Makefile\n>      > @@ -30,3 +30,4 @@ obj-$(CONFIG_SWUFORWARDER_HANDLER) +=\n>     swuforward_handler.o swuforward-ws.o\n>      >   obj-$(CONFIG_UBIVOL)        += ubivol_handler.o\n>      >   obj-$(CONFIG_UCFWHANDLER)   += ucfw_handler.o\n>      >   obj-$(CONFIG_DOCKER)        += docker_handler.o\n>      > +obj-$(CONFIG_FWUMDATA_HANDLER)       += fwumdata_handler.o\n>      > diff --git a/handlers/fwumdata_handler.c b/handlers/\n>     fwumdata_handler.c\n>      > new file mode 100644\n>      > index 000000000000..1331fe64aa74\n>      > --- /dev/null\n>      > +++ b/handlers/fwumdata_handler.c\n>      > @@ -0,0 +1,125 @@\n>      > +#include <stdio.h>\n>      > +#include <unistd.h>\n>      > +#include <fcntl.h>\n>      > +#include <stdlib.h>\n>      > +#include <stdbool.h>\n>      > +#include <errno.h>\n>      > +#include <linux/version.h>\n>      > +#include <sys/ioctl.h>\n>      > +#include <stddef.h>\n>      > +\n>      > +#include \"swupdate_image.h\"\n>      > +#include \"handler.h\"\n>      > +#include \"util.h\"\n>      > +\n>      > +#include <libfwumdata.h>\n>      > +\n>      > +static int _fwumdata_set(uint32_t active_index, uint32_t\n>     previous_index,\n>      > +                      uint8_t bank_state)\n>      > +{\n>      > +     int mdd;\n>      > +     int ret;\n>      > +\n>      > +     mdd = fwumdata_init();\n>      > +     if (mdd < 0) {\n>      > +             ERROR(\"Cannot initialize libfwumdata\\n\");\n>      > +             return mdd;\n>      > +     }\n>      > +\n>      > +     ret = fwumdata_read_config(mdd, CONFIG_FWUMDATA_CONFIG_FILE);\n>      > +     if (ret) {\n>      > +             ERROR(\"Cannot read %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n>      > +             goto exit;\n>      > +     }\n>      > +\n>      > +     ret = fwumdata_open(mdd, 0);\n>      > +     if (ret) {\n>      > +             ERROR(\"Cannot open %s\\n\", CONFIG_FWUMDATA_CONFIG_FILE);\n>      > +             goto exit;\n>      > +     }\n>      > +\n>      > +     ret = fwumdata_set_active_index(mdd, active_index);\n>      > +     if (ret) {\n>      > +             ERROR(\"Cannot set active index\\n\");\n>      > +             goto close;\n>      > +     }\n>      > +\n>      > +     fwumdata_set_previous_index(mdd, previous_index);\n>      > +     if (ret) {\n>      > +             ERROR(\"Cannot set previous index\\n\");\n>      > +             goto close;\n>      > +     }\n>      > +\n>      > +     ret = fwumdata_set_bank_state(mdd, active_index, bank_state);\n>      > +     if (ret) {\n>      > +             ERROR(\"Cannot set bank state\\n\");\n>      > +             goto close;\n>      > +     }\n>      > +\n>      > +        ret = fwumdata_store(mdd);\n>      > +        if (ret) {\n>      > +             ERROR(\"Cannot store fwu metadata\\n\");\n>      > +             goto close;\n>      > +     }\n>      > +\n>      > +     DEBUG(\"fwumdata: active: %d, previous: %d, state: 0x%x\",\n>      > +           active_index, previous_index, bank_state);\n>      > +\n>      > +close:\n>      > +     fwumdata_close(mdd);\n>      > +exit:\n>      > +     fwumdata_exit(mdd);\n>      > +     return ret;\n>      > +}\n>      > +\n>      > +static int fwumdata_set(struct img_type *img, void *data)\n>      > +{\n>      > +     struct script_handler_data *script_data;\n>      > +     char *value;\n>      > +     int active_index = -1;\n>      > +     int previous_index;\n>      > +\n>      > +\n>      > +     if (!data)\n>      > +             return -EINVAL;\n>      > +\n>      > +     script_data = data;\n>      > +\n>      > +     /*\n>      > +      * Call only in case of postinstall\n>      > +      */\n>      > +     if (script_data->scriptfn != POSTINSTALL)\n>      > +             return 0;\n>      > +\n>      > +     value = dict_get_value(&img->properties, \"active\");\n>      > +     if (!value) {\n>      > +             ERROR(\"active: cannot find in sw-description\");\n>      > +             return -EINVAL;\n>      > +     }\n>      > +\n>      > +     active_index = ustrtoull(value, NULL, 10);\n>      > +     if (errno) {\n>      > +             ERROR(\"active %s: ustrotull failed\", value);\n>      > +             return -EINVAL;\n>      > +     }\n>      > +\n>      > +     active_index--;\n>      > +     if (active_index == 0) {\n>      > +             previous_index = 1;\n>      > +     } else if (active_index == 1) {\n>      > +             previous_index = 0;\n>      > +     } else {\n>      > +             ERROR(\"active %s: invalid value\", value);\n>      > +             return -EINVAL;\n>      > +\n>      > +     }\n>      > +\n>      > +     return _fwumdata_set(active_index, previous_index,\n>     FWUMDATA_BANK_VALID);\n>      > +}\n>      > +\n>      > +__attribute__((constructor))\n>      > +void fwumdata_handler(void)\n>      > +{\n>      > +     register_handler(\"fwumdata\", fwumdata_set,\n>      > +                      SCRIPT_HANDLER | NO_DATA_HANDLER, NULL);\n>      > +}\n> \n>     -- \n>     _______________________________________________________________________\n>     Nabla Software Engineering GmbH\n>     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n>     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n>     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n> \n> \n>     -- \n>     _______________________________________________________________________\n>     Nabla Software Engineering GmbH\n>     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n>     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n>     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n> \n> \n> \n> -- \n> *Dario Binacchi*\n> Senior Embedded Software Engineer\n> M. +39 328 0625246\n> dario.binacchi@amarulasolutions.com \n> <mailto:dario.binacchi@amarulasolutions.com>\n> ―――――――――――――――\n> Amarula Solutions SRL\n>   Via Felice Cavallotti 25D, 41012 Carpi, MO, IT\n> info@amarulasolutions.com <mailto:info@amarulasolutions.com>\n> www.amarulasolutions.com <http://www.amarulasolutions.com/>","headers":{"Return-Path":"<swupdate+bncBD2ZDGN6SEKRBAFQZXHQMGQE7LRUB5I@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=vDO6eTkD;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2a00:1450:4864:20::137; helo=mail-lf1-x137.google.com;\n envelope-from=swupdate+bncbd2zdgn6sekrbafqzxhqmgqe7lrub5i@googlegroups.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from mail-lf1-x137.google.com (mail-lf1-x137.google.com\n [IPv6:2a00:1450:4864:20::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5vz05XG3z1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 23:24:27 +1000 (AEST)","by mail-lf1-x137.google.com with SMTP id\n 2adb3069b0e04-59e0abad4fbsf675644e87.2\n        for <incoming@patchwork.ozlabs.org>;\n Thu, 30 Apr 2026 06:24:27 -0700 (PDT)","by 2002:a05:6512:36cb:b0:5a3:ff57:f15f with SMTP id\n 2adb3069b0e04-5a851474b6fls272822e87.0.-pod-prod-09-eu; Thu, 30 Apr 2026\n 06:24:14 -0700 (PDT)","from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.134])\n        by gmr-mx.google.com with ESMTPS id\n 2adb3069b0e04-5a85513c751si27237e87.6.2026.04.30.06.24.14\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Thu, 30 Apr 2026 06:24:14 -0700 (PDT)","from client.hidden.invalid by mrelayeu.kundenserver.de (mreue012\n [212.227.17.165]) with ESMTPSA (Nemesis) id 1MZSJa-1vo8Mt1lFW-00WM5H; Thu, 30\n Apr 2026 15:24:13 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1777555459; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=M7AdlwDQjCcCK0AQ6+VSrxRF+Cea45RiCRMS9x5my0OIE7fm2dKUxW3CCHOebYVmJQ\n         sY8arGhBY5OQmy/Azq8XysmamwmFnHeMlnTcU74kiJVViEX2LPXY96EYIDVLlXCczjA0\n         RX+cq1ue0Aon5GX9BX9Gst1OEqKLm0Onm7PfwlBqeRTyeK6lY2PBh6s+PzVkToDBP4vn\n         1m0/o4NmFAM1+3zWsMyEb1WQH0aMtzzixXUQfGrBmVJCmVhQ2twY9TASV2e4eKXLAu3C\n         TtRlK1sJ5yqBuBFFIqavDemgwHVcvS3gyBygErLNP8xZ+02fcM8XAcVMSTz2IJjwcHLu\n         yf7A==","i=1; a=rsa-sha256; t=1777555454; cv=none;\n        d=google.com; s=arc-20240605;\n        b=g+/7il1wFCpbTVjQ5/DlQlAoF8n+NoEuDuIn9fG5OCG40ArJ2vEhisOhgiYFa5Uw7c\n         3f6hCIaG+eVrAaSk/Aky71NnTizOI0NvrizVxN+jWfDjO5TzkkCV8jC99w/VfT14H8+n\n         sXT4ZFnlvogDfqcXIFdbtw9pvhqRWoWSpZpfx+YzT7Fl/IivXMwvMh8miPK2Lhn6jX7/\n         HKyhEeesxijCejNI9kTA9r8QlCGaQELdlApOVy26Eqb1ECcLAKtbSTMl35DT145NE4w5\n         vf6TtT7kjDQq5CK+1UBJ0NQVGuFn6uVVxYdJqWe8W2TusAFqfSi/YCe3yilfBOjNhrNI\n         E2Ig=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:ui-outboundreport\n         :content-transfer-encoding:in-reply-to:from:content-language\n         :references:cc:to:subject:user-agent:mime-version:date:message-id\n         :sender:dkim-signature;\n        bh=gyCYFQKS8JHKk48dt6iXktiZ1Drc2jpZzbH43q6HHcA=;\n        fh=VyKPntAt3C3u1aCFBUUqhYrIp1iQ9ikaen5P/ya519g=;\n        b=fZ0nFtrcWj1vJ4QTMiljC9cbZblwvGU/RmSfKir0gVafx9vBspmuPNlh4v0qux2JaE\n         j8xrg94To2W/bCL0dH0XIN8j+nSF4AWcsa9fywGZzaABOWliqF020cCITyShx+1DHRqU\n         YflnovXtr5iglNQ2k6MJRP1xp3k4MjjK3LouhouD827DN8lznN51nHf6cP3gTL1oi/jL\n         HnErb1ACYlnrqPyiRRfTOcnyWg3MHDv6UMdF1Qs8VpDDJ8M9IGwSvC9drFLRukh769mK\n         zxrn6YoP6W4AeZkd5+rkzqXtR173eo3Mw7GY3LYJ1t/wUsdwnmkebElT4z/yj98QM3SW\n         wSBg==;\n        darn=patchwork.ozlabs.org","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=ui-outboundreport:content-transfer-encoding:in-reply-to:from\n         :content-language:references:cc:to:subject:user-agent:mime-version\n         :date:message-id:dkim-signature;\n        bh=vCU3dMGHqbDSQFZzEjg0JGpZ1+R7bFDxbdlDnJLyhes=;\n        fh=svUJ80VYLe/iy0nYzWRKxIOnXoh4e5RL4K7RvSyYZRc=;\n        b=KKkq35MgcscLh5vkKxkhFgWzX7nBvHo93dw7TdqaQCdqw1q72PlhnNzcqXPrvZ/WL8\n         t0N3t3+lfpHncG9QrpHMrWc/E6o2tV0hnduPpVd0pP+zAOprmpfsjkLNZOKqZlQ/JV/F\n         TzSVAa9ZEVSInw34sJhN1D/lXlXakFf4CbQTwwq6K1oh2H2tEZwzMpEDN9ishKdESf6s\n         XR8LcwJltt8dVnHvzIJhPBRzl+qvZjKUYBkW2LT/eFQuf/wqZDTh5E2iIV8GVk0OoC3H\n         ols/xBjuvGJwIiwK8R8GDwgBHMSM1MajN2cMppRVOshbJMRet3piU5WIEmzZ9kJCCroE\n         Gsxw==;\n        dara=google.com"],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=voDGRFAh;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.126.134 as permitted sender)\n smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","i=1; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=voDGRFAh;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.126.134 as permitted sender)\n smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1777555459; x=1778160259;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:ui-outboundreport:content-transfer-encoding\n         :in-reply-to:from:content-language:references:cc:to:subject\n         :user-agent:mime-version:date:message-id:sender:from:to:cc:subject\n         :date:message-id:reply-to;\n        bh=gyCYFQKS8JHKk48dt6iXktiZ1Drc2jpZzbH43q6HHcA=;\n        b=vDO6eTkDgu90X4gXBt7vOkZWKMoHtYQvk/1S4V6kjVyiVJ59WoVYJjJy2mT0sz0o3J\n         kAbE9Xzpp//IXoO4K4seGKS9qRKpBf8Oh05YMWB2hVuqVUBOAY1cEgjAWKO0UQlCPxjy\n         QVR9kHiOWgkL/ibCjqtlo4FeK1nit59N91UyNVaamgc0AERe3PYpwSr6k9i+7mrHfMjk\n         hs6X3TX4Y7d82AbFkDwYrmqSfvFZA5e3iZiYqYWW+0N3XMLvBi+3IIVkZhLNpdXI+FjD\n         GZ4JX9twglVCEdip3def1SQKe6HqCOd0vIavEI2RUdFmuu2NtXRWyo+X1su52bnVyAme\n         cmwA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777555459; x=1778160259;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :x-spam-checked-in-group:list-id:mailing-list:precedence\n         :x-original-authentication-results:x-original-sender\n         :ui-outboundreport:content-transfer-encoding:in-reply-to:from\n         :content-language:references:cc:to:subject:user-agent:mime-version\n         :date:message-id:x-beenthere:x-gm-message-state:sender:from:to:cc\n         :subject:date:message-id:reply-to;\n        bh=gyCYFQKS8JHKk48dt6iXktiZ1Drc2jpZzbH43q6HHcA=;\n        b=dUl1hQ+YCtBSYu4p66nxonhf1BkpSKvPdCSP5ZUykUgDcpIToo4KgIwWkr5OjnZCBr\n         Ja9ha3zNJqQSe7KWP1rPT1QBR2yEAWIeOMmWbc0BggyKe2Rx7Cqsx/I10qxNbGBdGyVN\n         LC/lw5il+H18oqEO9J7piWY68yGB7l3LuRpopAZkQZ0CUOfjSxXFjAXx1NyPrhV9URci\n         E8mjKiiiPbJEoEfnaW+2a3Fn8+c6cB/Ze3nGrrWMoi0oPiixnlCyNrUh+ZJ7E0p3p2tM\n         xBA/PuHGcobwHbq9zrpJWF7yrdkqZ51+VTCfnQy7ScPwa4f1O+eh3cnC1wL7QmlkQe0O\n         K98w==","Sender":"swupdate@googlegroups.com","X-Forwarded-Encrypted":"i=2;\n AFNElJ9Hu2UGTfREwAsf/7LNuUFTaWbRafnGA3iBrwi9a02UavdZo4whRZQh2PGPc4M4GgDFv2HSAqaxsg==@patchwork.ozlabs.org","X-Gm-Message-State":"AOJu0YwFCMbu/6495lMnrK3qD6BodUuJM/S8DSCsHtWHYWvD5fymHHNr\n\tgEj61WRSXbIE6ghrFV5F6fyCDq06KT3CkFvG6zUx23OKXLdtoLuWzwvX","X-Received":["by 2002:a05:6512:108d:b0:5a4:10b5:624c with SMTP id\n 2adb3069b0e04-5a8522d5a65mr1311429e87.23.1777555458862;\n        Thu, 30 Apr 2026 06:24:18 -0700 (PDT)","by 2002:a05:6512:4007:b0:5a2:bebd:45b5 with SMTP id\n 2adb3069b0e04-5a8522af2b7mr869397e87.4.1777555454261;\n        Thu, 30 Apr 2026 06:24:14 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com;\n h=\"AUV6zMMbkoWp5VXCzIRPOHeV8TVMS8GlKLtn+vHZ1HdED2pLvA==\"","Received-SPF":"pass (google.com: domain of stefano.babic@swupdate.org\n designates 212.227.126.134 as permitted sender) client-ip=212.227.126.134;","X-UI-Sender-Class":"55c96926-9e95-11ee-ae09-1f7a4046a0f6","Message-ID":"<a5d5d0da-0235-4571-a7b9-ca2bfe50972e@swupdate.org>","Date":"Thu, 30 Apr 2026 15:24:12 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","To":"Dario Binacchi <dario.binacchi@amarulasolutions.com>","Cc":"swupdate@googlegroups.com, linux-amarula@amarulasolutions.com","References":"<20260429140130.615536-1-dario.binacchi@amarulasolutions.com>\n <20260429140130.615536-2-dario.binacchi@amarulasolutions.com>\n <10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>\n <CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>","Content-Language":"en-US","From":"Stefano Babic <stefano.babic@swupdate.org>","In-Reply-To":"\n <CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"; format=flowed","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:qwFeDOfFTYH9bh6JoRWNd41uKvnoic+UGkJ4Nf5pNaWOmPlvWzJ\n dA0K15Mfz2gG0yVxbzHXNCjk5EVI3m24nQFTJcm8LOdj7PTqtwYHiAPY5IOXaQ1OEmetQn2\n WDBRPTeuGCpVe6FU7y2rbRt4BCgzefFY0EqVW2ckKPbm0yG1dAGNyqdgR0eCAv3Ni5tszlT\n UJ4FyE88NHvIO/aZtIX1w==","X-Spam-Flag":"NO","UI-OutboundReport":"notjunk:1;M01:P0:jOGNFv9xfZ4=;WnkCJy3x4fH3b5BSqaS3P5ZTJim\n Mw1NRBKeZ+6qROtct+1nmVSvtOUvp2WOd3I3Wmb39zgE9LoclrQA7RVmYkwlCJlIbr/ZNpIvt\n HsS/OBALRDua3wgx0YlorPMq1DknElH0aULFdBQEYI8x78OQQ1wMQg3jl1ym+JoOmN7a5E+jn\n 7/picxLcRn/UQFLcaYm3sjBWONSLhIJNwJyilFxS3pJY/C5X+bGN2r6PlktbvGjjAWr8ii12b\n PCrYVHX3UWmpyq6TG7XW3yfsGV80PFNrKzmY1YNWRIMKqtRJXRM5xPlv+vW4x4T/J6gcs1/va\n yJdQujElzNk6W/8pq2GYIjmEuF6B2nUyWCOa8axMxyekOYi2iRa3II4IOJ0vofGQfPW1dmwKZ\n 4VfjvhTGxCBxiwDmvnA6i428y2IOB4DPXFFEy5Ig2YHoARKNSQAj20kdgGTSK8YuhCk4TO0FU\n f7B72hbhgBMfObKqpuaQCUw+9SyQ4MEut2IE+Hv0F4D+V1+vfrZ9GqIyeuADN/71VNigRlTpp\n Jpj44fVDJOQI2c2/nnYNcGRpAiG9B8bu4IIn3CMYD4QpTuTrPxx1P1MnbWdHMsiitzBMqYejw\n n1aCZLv2nj85hCM8PlTiLKP5RJ10XdtmY1igIfFDpzr+sIotgQ7Z2qUhxJjJWW1mu2C7y/olx\n vaSwvAiCwi9LFNfl84VU+3Ozl1wK47a1kKEFknY+TP8Dme48XJ9pSFxR0cfW2BUXlPXUvkzsT\n F0h0SxxHNIaD6uCd9zDyHbqDf5W+yZ7/oEV4vznkQGE/vvcALPvBmF0446uA21PpJCqx7lJmA\n K82nyhvg1J/BRHqD7PGdozYXTXu6say96WWwbopaZuu9fth6AkDgKGrOEeM0sEQQ3mWmWpiGk\n iu/Qg5on0OR5l/ZCPr+qWJ/nIlAe1D+XjI0TlctrcKo9/66ud9m8bXl8uUGxBpd9AsuAEcxfS\n lrJD++yW4BgIlb1PzcESvN60vSNQjOViCuCb4QYy7A5Yva3i6xEl2wfl61GB19r0lV4Zj7ROt\n ePlUYe5a9KTNx1nOQUY8NNOZJnREMCfShzjydS15zgEfL9fFf+GKThWgog6aVgpErjPKmy27E\n uBKrVFrqg8ZuE0LHBm4sSU1EVbB3ByruCp/GIEeY40SNcJuDMvBJHCSse6V6FuRHWZ4+IzrIH\n S9tAwYiEIMZI4Ep7jzRxzhMoNLwSQrwlLDjCpvkM6HDnjCBNt3rk09jk6aPmkGdIRPMt3N6cy\n cabIDdT0yxfghItNDdilqZQE1ROD0NkJ20GFzTOqkVrXy7s07uEj2RVMXHBJJO0JGRv+3hlat\n OYUamdby2NtwcJvrgSLo+ZVLBICBewv7pekZugLfbnlzT6uKAdjD9sQQkfRCN6LLQiZn12plx\n 5qwiOlm1xwz4vyR2bJmhGavNqSPlN3po0cK2NA/6nPA5k+Y1AWVw+xZekSGOUQKpK9iXpyPx5\n xGaKJ4PYNQLFarxDGhj0mquRSeTtHMwEbJ2+x5aN1WCEDJpS8w8c0pZcBDVTFD8nS74MEBd7U\n K8nJcKBVCAZO3FsjKRwb3zYlrUgEGW65lPR3RHZdzx01D0/yvLHCXs4WIYddP2NucgcS6SYh3\n Iztm+GdqxVabiJ6BByaLUkZDvt+7b3ZchRNx9e/ukmhaMRCksoIktV6C01mrZGqeTAHeWZ4AI\n pldx2s24czmofzFcxyIaxa/mmR3B3JXjRLg/F/twig7wSgvbpvoJAEOmz2Dw8Q1i+eFKWmBh4\n MPGOucUaMXX+04ZcaHE3GzMoJxC//AwWeIP1w6TtyN4hlCrq9ZFfwSpM684f7IX2Kuoj9Z069\n q1HkkcFLTMDwGm53SeZDh03hjLtHw7ems6/ZpBfbNweRZ/UqjObXv1GlEm0oNCOUS/fZGVDdE\n Q7DL4PXpBf3POu1GS1BrFddQWCufGJOTvxEyQg=","X-Original-Sender":"stefano.babic@swupdate.org","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n header.i=@swupdate.org header.s=s1-ionos header.b=voDGRFAh;       spf=pass\n (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.134\n as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"}},{"id":3684742,"web_url":"http://patchwork.ozlabs.org/comment/3684742/","msgid":"<CABGWkvrFwZCjJx=70tNh=Zm__eXq22kaaNGxvZ8sESZ6eBPj_w@mail.gmail.com>","list_archive_url":null,"date":"2026-04-30T14:15:52","subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","submitter":{"id":83038,"url":"http://patchwork.ozlabs.org/api/people/83038/","name":"Dario Binacchi","email":"dario.binacchi@amarulasolutions.com"},"content":"Hi Stefano,\n\nOn Thu, Apr 30, 2026 at 3:24 PM Stefano Babic <stefano.babic@swupdate.org>\nwrote:\n\n> Hi Dario,\n>\n> On 4/30/26 14:52, Dario Binacchi wrote:\n> > Hi Stefano,\n> >\n> > On Wed, Apr 29, 2026 at 5:12 PM Stefano Babic\n> > <stefano.babic@swupdate.org <mailto:stefano.babic@swupdate.org>> wrote:\n> >\n> >     Hi Dario,\n> >\n> >     On 4/29/26 16:01, Dario Binacchi wrote:\n> >      > Add a handler to manage the boot selection process according to\n> >      > the Firmware Update (FWU) metadata specification using the\n> >      > libfwumdata library.\n> >\n> >     This seems that the specification is something generic, but this is\n> >     really just for STM32MP2, as described in the cover. Then an\n> according\n> >     documentation should be added.\n> >\n> >\n> > AFAIK the FWU (Firmware Update) metadata is a fully generic specification\n> > (part of the Arm FWU specification). While the STM32MP2 is my use case\n> > and the\n> > reason I wrote this patch, the standard and this implementation are not\n> > ST-specific. Other platforms already implement and use FWU metadata in\n> > U-Boot,\n> > so the handler is meant to be completely platform-agnostic.\n> >\n> >\n> >     Nevertheless, I will raise a basic issue about the concept. I cannot\n> >     find the patches sent to openembedded-core, too.\n> >\n> >\n> > You can find the patch submitted to oe-core here:\n> > https://patchwork.yoctoproject.org/project/oe-core/\n> > patch/20260429145136.618168-1-dario.binacchi@amarulasolutions.com/\n> > <https://patchwork.yoctoproject.org/project/oe-core/\n> > patch/20260429145136.618168-1-dario.binacchi@amarulasolutions.com/>\n>\n> Thanks !\n>\n> >\n> >\n> >     According to the related patches merged into U-Boot, this is a ST\n> >     replacement for fw_setenv / fw_printenv. The configuration file, at\n> >     least the one pushed to U-Boot, has the same old format as U-Boot's\n> >     tools. So I am just asking why we should have a separate tool (yes, I\n> >     saw in U-Boot, too) instead of integrating into the current\n> ecosystem.\n> >\n> >       From a concept view, the tool is used to select which is the active\n> >     image to be booted, and select also some parms (flags) for it. In\n> >     SWUpdate, this is the \"bootloader\" interface, and not a \"script\"\n> >     handler. That can be implemented also as script, as here, is clear,\n> but\n> >     from the logical point of view, it does not belong to.\n> >\n> >\n> > Implementing it as a \"script\" handler was simply the easiest and fastest\n> > path for me to validate the concept, and I should have probably tagged\n> >   the patch as an RFC for this reason. I agree that, from a logical\n> point of\n> >   view, this belongs in the \"bootloader\" interface.\n> >\n>\n> Ok\n>\n> >\n> >     And the second main aspect: if this is just to choose the active\n> >     software set, and the fwumdata.c is poushed as replacement for FWU\n> >     metadata of fw_setenv, and also taken into account that its code\n> seems\n> >     to me pretty simple, whhy shouldn't be integrated as storage into\n> >     libubootenv, instead ?\n> >\n> >\n> > I believe it should remain a separate library (libfwumdata) for a couple\n> > of reasons:\n> >\n> > Conceptual separation: U-Boot itself keeps the standard environment and\n> > FWU metadata separated. They serve different purposes and have\n> > entirely different structures (a flexible key-value store vs. a rigidly\n> > defined A/B state structure). Merging FWU metadata handling into\n> > libubootenv could lead to conceptual misunderstandings.\n>\n> But libubootenv maintains the name, but it is already not only thought\n> for U-Boot. Currently, it is used to store persistently tuple\n\n\n FWU metadata is fundamentally not a collection of arbitrary tuples\n(key-value pairs). It is a rigidly\n defined binary structure. I think that forcing the FWU metadata to be\naccessed and managed through a\n generic tuple-based interface is an architectural stretch. It would\nartificially limit the correct management\nof the data and any future implementation of the FWU specification features\njust to fit into a key-value paradigm.\n\n\n> that must\n> survive an update. Namespaces allow to set vars into different domains\n> than U-Boot (bootloader vars vs application vars is the most typical use\n> case). A FWU will be just a different namespace, but interface remains\n> coherent.\n>\n> >\n> > Dedicated API: I think it's correct to have a dedicated, minimal C\n> library\n> > specifically designed to allow any userspace application - not just\n> > SWUpdate,\n>  > but also other OTA managers or proprietary system services - to\n> easily > switch\n>\n> Well, this was one reason for the libubootenv, and it is used by other\n> OTA updater, too. It is not bound to SWUpdate, SWUpdate is just an user\n> of the library.\n>\n> So checking inside your libfwumdata, and seeing the analogies with\n> libubootenv, and you have already stated in the header that there are\n> parts taken from libubootenv, I am even less convinced that adding\n> another additional library is the best way to go.\n\n\n The similarities you noticed with libubootenv are absolutely intentional,\n but they are strictly limited to the API design pattern (the init, open,\nstore, close flow)\nand the configuration file parsing. I adopted this pattern because it is a\nfamiliar and\nrobust approach for the ecosystem, not because the underlying data models\nare compatible.\nFurthermore, there are specific FWU API functions that simply cannot be\nimplemented as\n standard get/set functions due to this completely different data\nstructure. A clear proof of\n this structural divergence is the implementation of the yafwumdata tool\nitself, which mimics\n the U-Boot tool but is specifically tailored to handle the unique logic of\nthe FWU standard.\n\nSince you know SWUpdate's architecture inside out, I want to leave the ball\nin your court.\nIs there really no other way to implement this cleanly without shoehorning\na fixed binary\nstructure into a string dictionary like libubootenv?\n\nIs it possible to find a design compromise that respects the nature of the\nFWU standard\nand doesn't leave either of us completely dissatisfied?\n\nThanks and regards,\nDario\n\nIf I can agree about\n> the separation from U-B0oot environment (and this is already provided\n> via name3space), why is this not simply done by adding to libubootenv ?\n> It can be still used by any OTA, it is still separated by U-Boot's env\n> (ok, not the name..), configuration is already in a more modern and\n> flexible way as in old U-Boot and in libfwumdata, that takes over from\n> U-Boot (YAML).\n>\n> The most practical way seems to extend the current library instead of\n> creating a new one.\n>\n> > boot banks. It differs from U-Boot's mkfwumdata (which generates the\n> > metadata\n> > image from scratch at build time) and fwumdata (the CLI tool for\n> > targeted updates).\n> > libfwumdata provides a strictly limited, safe C API to update just the 3\n> > fields needed for a bank switch.\n> >\n> > So, can we meet halfway? We could integrate the management of FWU\n> variables\n> > inside bootloader/uboot.c.\n>\n> Not at all. It is a bad solution for you, too. We agree that is\n> separated by U-Boot, then this mixes all up.\n>\n> > If a variable has the fwu- prefix (e.g., fwu-\n> > active),\n> > it will be saved using libfwumdata; otherwise, it will be handled by\n> > libubootenv as usual.\n>\n> This is just a hack - I fully disagree here.\n>\n> And be sure, there will be some user early or later who starts to set\n> U-Boot variables starting with \"fwu\" (\"Fair World Unit\", maybe ?) and he\n> will complain it does not work.\n>\n> >\n> > Keeping libfwumdata separate avoids forcing FWU metadata management\n> inside\n> > the libubootenv library. This approach gives users a seamless bootenv:\n> > interface\n> > while keeping the underlying architectures clean.\n>\n> I do not see the advantage here - on the opposite, if it is integrated,\n> user has the same interface.\n>\n> >\n> > Would this compromise be acceptable to you for v2?\n> >\n>\n> Sorry, not.\n>\n> Best regards,\n> Stefano\n>\n> > Thanks and regards,\n> > Dario\n> >\n> >     Then SWUpdate hasn't another interface, there is\n> >     still the bootloader interface, and under the hood the FMU is written\n> >     instead of U-Boot env.\n> >\n> >     Best regards,\n> >     Stefano\n> >\n> >      >\n> >      > The handler is a script handler that updates the active_index\n> >      > and marks the selected bank as valid during the post-install\n> phase.\n> >      >\n> >      > Example in sw-description:\n> >      >\n> >      >      scripts: (\n> >      >          {\n> >      >              type = \"fwumdata\";\n> >      >              properties: {\n> >      >                  active = \"1\";\n> >      >              }\n> >      >          }\n> >      >      );\n> >      >\n> >      > Signed-off-by: Dario Binacchi\n> >     <dario.binacchi@amarulasolutions.com\n> >     <mailto:dario.binacchi@amarulasolutions.com>>\n> >      > ---\n> >      >   Kconfig                        |   4 ++\n> >      >   Makefile.deps                  |   4 ++\n> >      >   Makefile.flags                 |   3 +\n> >      >   bootloader/Kconfig             |   7 ++\n> >      >   configs/all_handlers_defconfig |   1 +\n> >      >   doc/source/handlers.rst        |  37 ++++++++++\n> >      >   handlers/Kconfig               |  17 +++++\n> >      >   handlers/Makefile              |   1 +\n> >      >   handlers/fwumdata_handler.c    | 125 ++++++++++++++++++++++++++\n> >     +++++++\n> >      >   9 files changed, 199 insertions(+)\n> >      >   create mode 100644 handlers/fwumdata_handler.c\n> >      >\n> >      > diff --git a/Kconfig b/Kconfig\n> >      > index 2cf68eb890b0..fcb60f900b3f 100644\n> >      > --- a/Kconfig\n> >      > +++ b/Kconfig\n> >      > @@ -129,6 +129,10 @@ config HAVE_ZCK\n> >      >       bool\n> >      >       option env=\"HAVE_ZCK\"\n> >      >\n> >      > +config HAVE_LIBFWUMDATA\n> >      > +     bool\n> >      > +     option env=\"HAVE_LIBFWUMDATA\"\n> >      > +\n> >      >   menu \"SWUpdate Settings\"\n> >      >\n> >      >   menu \"General Configuration\"\n> >      > diff --git a/Makefile.deps b/Makefile.deps\n> >      > index c759f6876dea..313d5af6230c 100644\n> >      > --- a/Makefile.deps\n> >      > +++ b/Makefile.deps\n> >      > @@ -121,3 +121,7 @@ endif\n> >      >   ifeq ($(HAVE_ZCK),)\n> >      >   export HAVE_ZCK = y\n> >      >   endif\n> >      > +\n> >      > +ifeq ($(HAVE_LIBFWUMDATA),)\n> >      > +export HAVE_LIBFWUMDATA = y\n> >      > +endif\n> >      > diff --git a/Makefile.flags b/Makefile.flags\n> >      > index 40dd3b66856e..76b87e67fe67 100644\n> >      > --- a/Makefile.flags\n> >      > +++ b/Makefile.flags\n> >      > @@ -233,6 +233,9 @@ ifeq ($(CONFIG_UCFWHANDLER),y)\n> >      >   LDLIBS += gpiod\n> >      >   endif\n> >      >\n> >      > +ifeq ($(CONFIG_FWUMDATA_HANDLER),y)\n> >      > +LDLIBS += fwumdata\n> >      > +endif\n> >      >\n> >      >   ifeq ($(CONFIG_BOOTLOADER_STATIC_LINKED),y)\n> >      >   ifeq ($(CONFIG_BOOTLOADER_EBG),y)\n> >      > diff --git a/bootloader/Kconfig b/bootloader/Kconfig\n> >      > index edc02d99b2d1..36f856507356 100644\n> >      > --- a/bootloader/Kconfig\n> >      > +++ b/bootloader/Kconfig\n> >      > @@ -158,3 +158,10 @@ config UPDATE_STATE_BOOTLOADER\n> >      >       help\n> >      >         Store update information in Bootloader's environment.\n> >      >\n> >      > +config FWUMDATA_CONFIG_FILE\n> >      > +     string \"FWU Metadata Configuration file\"\n> >      > +     depends on HAVE_LIBFWUMDATA\n> >      > +     default \"/etc/fwumdata.config\"\n> >      > +     help\n> >      > +       It tells where the FWU metadata are saved.\n> >      > +\n> >      > diff --git a/configs/all_handlers_defconfig b/configs/\n> >     all_handlers_defconfig\n> >      > index 16cd9b6b98f1..63299bd223ae 100644\n> >      > --- a/configs/all_handlers_defconfig\n> >      > +++ b/configs/all_handlers_defconfig\n> >      > @@ -20,6 +20,7 @@ CONFIG_DISKPART=y\n> >      >   CONFIG_DISKPART_FORMAT=y\n> >      >   CONFIG_DISKFORMAT_HANDLER=y\n> >      >   CONFIG_FAT_FILESYSTEM=y\n> >      > +CONFIG_FWUMDATA_HANDLER=y\n> >      >   CONFIG_EXT_FILESYSTEM=y\n> >      >   CONFIG_LUASCRIPTHANDLER=y\n> >      >   CONFIG_RAW=y\n> >      > diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst\n> >      > index 6742c10a58c3..cbfb146f099c 100644\n> >      > --- a/doc/source/handlers.rst\n> >      > +++ b/doc/source/handlers.rst\n> >      > @@ -1710,3 +1710,40 @@ Examples:\n> >      >                       name = \"helloworld\";\n> >      >               };\n> >      >       });\n> >      > +\n> >      > +FWU Metadata Handler\n> >      > +--------------------\n> >      > +\n> >      > +This is a script handler used to manage the boot selection\n> >     process according to\n> >      > +the Firmware Update (FWU) metadata specification.\n> >      > +\n> >      > +The handler implements a post-install script that updates the\n> >     metadata to switch\n> >      > +the active bank and marks it as valid, ensuring the system boots\n> >     from the new\n> >      > +bank at the next reset. The ``active`` property defines which\n> >     bank must be\n> >      > +selected.\n> >      > +\n> >      > +Example selecting boot bank 1 (bank A in A/B schema):\n> >      > +\n> >      > +::\n> >      > +\n> >      > +     scripts: (\n> >      > +             {\n> >      > +                     type = \"fwumdata\";\n> >      > +                     properties: {\n> >      > +                             active = \"1\";\n> >      > +                     }\n> >      > +             }\n> >      > +     );\n> >      > +\n> >      > +Example selecting boot bank 2 (bank B in A/B schema):\n> >      > +\n> >      > +::\n> >      > +\n> >      > +     scripts: (\n> >      > +             {\n> >      > +                     type = \"fwumdata\";\n> >      > +                     properties: {\n> >      > +                             active = \"2\";\n> >      > +                     }\n> >      > +             }\n> >      > +     );\n> >      > diff --git a/handlers/Kconfig b/handlers/Kconfig\n> >      > index 152bc08074a1..b7d9e51a20c9 100644\n> >      > --- a/handlers/Kconfig\n> >      > +++ b/handlers/Kconfig\n> >      > @@ -151,6 +151,23 @@ config EMMC_HANDLER\n> >      >         with a dual-copy concept. This guarantees that the upgrade\n> >      >         is power-cut safe.\n> >      >\n> >      > +config FWUMDATA_HANDLER\n> >      > +     bool \"FWU metadata update\"\n> >      > +     depends on HAVE_LIBFWUMDATA\n> >      > +     default n\n> >      > +     help\n> >      > +       This handler allows to manage the boot selection process\n> >     using\n> >      > +       firmware update (FWU) metadata via libfwumdata.\n> >      > +\n> >      > +       Selecting the new boot bank automatically triggers the\n> >     handler to\n> >      > +       set the current bank for rollback and mark the selected\n> >     boot-up\n> >      > +       bank as 'valid'.\n> >      > +\n> >      > +       This ensures the system is ready to boot from the updated\n> >      > +       partition while maintaining a safe path to revert to the\n> >     previous\n> >      > +       working state if the new firmware fails to reach the\n> >     'accepted'\n> >      > +       state\n> >      > +\n> >      >   config RAW\n> >      >       bool \"raw\"\n> >      >       default n\n> >      > diff --git a/handlers/Makefile b/handlers/Makefile\n> >      > index 8490172a10a3..45fcb525e461 100644\n> >      > --- a/handlers/Makefile\n> >      > +++ b/handlers/Makefile\n> >      > @@ -30,3 +30,4 @@ obj-$(CONFIG_SWUFORWARDER_HANDLER) +=\n> >     swuforward_handler.o swuforward-ws.o\n> >      >   obj-$(CONFIG_UBIVOL)        += ubivol_handler.o\n> >      >   obj-$(CONFIG_UCFWHANDLER)   += ucfw_handler.o\n> >      >   obj-$(CONFIG_DOCKER)        += docker_handler.o\n> >      > +obj-$(CONFIG_FWUMDATA_HANDLER)       += fwumdata_handler.o\n> >      > diff --git a/handlers/fwumdata_handler.c b/handlers/\n> >     fwumdata_handler.c\n> >      > new file mode 100644\n> >      > index 000000000000..1331fe64aa74\n> >      > --- /dev/null\n> >      > +++ b/handlers/fwumdata_handler.c\n> >      > @@ -0,0 +1,125 @@\n> >      > +#include <stdio.h>\n> >      > +#include <unistd.h>\n> >      > +#include <fcntl.h>\n> >      > +#include <stdlib.h>\n> >      > +#include <stdbool.h>\n> >      > +#include <errno.h>\n> >      > +#include <linux/version.h>\n> >      > +#include <sys/ioctl.h>\n> >      > +#include <stddef.h>\n> >      > +\n> >      > +#include \"swupdate_image.h\"\n> >      > +#include \"handler.h\"\n> >      > +#include \"util.h\"\n> >      > +\n> >      > +#include <libfwumdata.h>\n> >      > +\n> >      > +static int _fwumdata_set(uint32_t active_index, uint32_t\n> >     previous_index,\n> >      > +                      uint8_t bank_state)\n> >      > +{\n> >      > +     int mdd;\n> >      > +     int ret;\n> >      > +\n> >      > +     mdd = fwumdata_init();\n> >      > +     if (mdd < 0) {\n> >      > +             ERROR(\"Cannot initialize libfwumdata\\n\");\n> >      > +             return mdd;\n> >      > +     }\n> >      > +\n> >      > +     ret = fwumdata_read_config(mdd,\n> CONFIG_FWUMDATA_CONFIG_FILE);\n> >      > +     if (ret) {\n> >      > +             ERROR(\"Cannot read %s\\n\",\n> CONFIG_FWUMDATA_CONFIG_FILE);\n> >      > +             goto exit;\n> >      > +     }\n> >      > +\n> >      > +     ret = fwumdata_open(mdd, 0);\n> >      > +     if (ret) {\n> >      > +             ERROR(\"Cannot open %s\\n\",\n> CONFIG_FWUMDATA_CONFIG_FILE);\n> >      > +             goto exit;\n> >      > +     }\n> >      > +\n> >      > +     ret = fwumdata_set_active_index(mdd, active_index);\n> >      > +     if (ret) {\n> >      > +             ERROR(\"Cannot set active index\\n\");\n> >      > +             goto close;\n> >      > +     }\n> >      > +\n> >      > +     fwumdata_set_previous_index(mdd, previous_index);\n> >      > +     if (ret) {\n> >      > +             ERROR(\"Cannot set previous index\\n\");\n> >      > +             goto close;\n> >      > +     }\n> >      > +\n> >      > +     ret = fwumdata_set_bank_state(mdd, active_index,\n> bank_state);\n> >      > +     if (ret) {\n> >      > +             ERROR(\"Cannot set bank state\\n\");\n> >      > +             goto close;\n> >      > +     }\n> >      > +\n> >      > +        ret = fwumdata_store(mdd);\n> >      > +        if (ret) {\n> >      > +             ERROR(\"Cannot store fwu metadata\\n\");\n> >      > +             goto close;\n> >      > +     }\n> >      > +\n> >      > +     DEBUG(\"fwumdata: active: %d, previous: %d, state: 0x%x\",\n> >      > +           active_index, previous_index, bank_state);\n> >      > +\n> >      > +close:\n> >      > +     fwumdata_close(mdd);\n> >      > +exit:\n> >      > +     fwumdata_exit(mdd);\n> >      > +     return ret;\n> >      > +}\n> >      > +\n> >      > +static int fwumdata_set(struct img_type *img, void *data)\n> >      > +{\n> >      > +     struct script_handler_data *script_data;\n> >      > +     char *value;\n> >      > +     int active_index = -1;\n> >      > +     int previous_index;\n> >      > +\n> >      > +\n> >      > +     if (!data)\n> >      > +             return -EINVAL;\n> >      > +\n> >      > +     script_data = data;\n> >      > +\n> >      > +     /*\n> >      > +      * Call only in case of postinstall\n> >      > +      */\n> >      > +     if (script_data->scriptfn != POSTINSTALL)\n> >      > +             return 0;\n> >      > +\n> >      > +     value = dict_get_value(&img->properties, \"active\");\n> >      > +     if (!value) {\n> >      > +             ERROR(\"active: cannot find in sw-description\");\n> >      > +             return -EINVAL;\n> >      > +     }\n> >      > +\n> >      > +     active_index = ustrtoull(value, NULL, 10);\n> >      > +     if (errno) {\n> >      > +             ERROR(\"active %s: ustrotull failed\", value);\n> >      > +             return -EINVAL;\n> >      > +     }\n> >      > +\n> >      > +     active_index--;\n> >      > +     if (active_index == 0) {\n> >      > +             previous_index = 1;\n> >      > +     } else if (active_index == 1) {\n> >      > +             previous_index = 0;\n> >      > +     } else {\n> >      > +             ERROR(\"active %s: invalid value\", value);\n> >      > +             return -EINVAL;\n> >      > +\n> >      > +     }\n> >      > +\n> >      > +     return _fwumdata_set(active_index, previous_index,\n> >     FWUMDATA_BANK_VALID);\n> >      > +}\n> >      > +\n> >      > +__attribute__((constructor))\n> >      > +void fwumdata_handler(void)\n> >      > +{\n> >      > +     register_handler(\"fwumdata\", fwumdata_set,\n> >      > +                      SCRIPT_HANDLER | NO_DATA_HANDLER, NULL);\n> >      > +}\n> >\n> >     --\n> >\n>  _______________________________________________________________________\n> >     Nabla Software Engineering GmbH\n> >     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n> >     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n> >     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n> >\n> >\n> >     --\n> >\n>  _______________________________________________________________________\n> >     Nabla Software Engineering GmbH\n> >     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n> >     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n> >     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n> >\n> >\n> >\n> > --\n> > *Dario Binacchi*\n> > Senior Embedded Software Engineer\n> > M. +39 328 0625246\n> > dario.binacchi@amarulasolutions.com\n> > <mailto:dario.binacchi@amarulasolutions.com>\n> > ―――――――――――――――\n> > Amarula Solutions SRL\n> >   Via Felice Cavallotti 25D, 41012 Carpi, MO, IT\n> > info@amarulasolutions.com <mailto:info@amarulasolutions.com>\n> > www.amarulasolutions.com <http://www.amarulasolutions.com/>\n>\n>\n> --\n> _______________________________________________________________________\n> Nabla Software Engineering GmbH\n> Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n> Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n> E-Mail: sbabic@nabladev.com\n>","headers":{"Return-Path":"<swupdate+bncBCQ4XFG47UFRBJ6IZXHQMGQE6Y2GWLI@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=vA/cTEjF;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2607:f8b0:4864:20::133f; helo=mail-dy1-x133f.google.com;\n envelope-from=swupdate+bncbcq4xfg47ufrbj6izxhqmgqe6y2gwli@googlegroups.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from mail-dy1-x133f.google.com (mail-dy1-x133f.google.com\n [IPv6:2607:f8b0:4864:20::133f])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5xJG6Vg6z1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 00:24:29 +1000 (AEST)","by mail-dy1-x133f.google.com with SMTP id\n 5a478bee46e88-2de07c12745sf5490703eec.1\n        for <incoming@patchwork.ozlabs.org>;\n Thu, 30 Apr 2026 07:24:29 -0700 (PDT)","by 2002:aa7:8c18:0:b0:824:a3a8:32c0 with SMTP id\n d2e1a72fcca58-834fc467f52ls1157631b3a.1.-pod-prod-02-us;\n Thu, 30 Apr 2026 07:16:06 -0700 (PDT)","from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com.\n [2607:f8b0:4864:20::1132])\n        by gmr-mx.google.com with ESMTPS id\n 41be03b00d2f7-c7fd648a713si201983a12.3.2026.04.30.07.16.05\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n        Thu, 30 Apr 2026 07:16:05 -0700 (PDT)","by mail-yw1-x1132.google.com with SMTP id\n 00721157ae682-7a4f9cf2b4eso8216187b3.3\n        for <swupdate@googlegroups.com>; Thu, 30 Apr 2026 07:16:05 -0700 (PDT)"],"ARC-Seal":["i=3; a=rsa-sha256; t=1777559065; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=P8H6faO3UIqZPxTg1i5JsgPgpgO6eZw1NiqeePVfmJLiEYT99E8MGedwjrASeUSHFn\n         JeEvY3/Kt2KObKbS0InXbZjly7/yH2o4F5iZAiZZzAEbFSEsTSC7QLEZjbKxYNlqMF2I\n         IJqc/JdFa2krmcEEui+Cnm09pNtpJnk+ezurJ+InWTsGSKuwN+6DXfJ9/RKYy71bT5Td\n         GAvZJAh+RMrrY9vU/HpThr0SN370K+wLUt3CvP1T6ZCZYoPfwonw+2F5ovwOQb4BmaDO\n         mx7OgyIrTklr3yjrCrgwTfyds0njx3bdItao/ZAQ+dFSP6Q0vLV1V93YS2NZqLElmm4t\n         nDkg==","i=2; a=rsa-sha256; t=1777558566; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=JPcblpFKyfCXRZVouusUvliHr2dNYWcAvv3aA5nPgQte3Wgnp156w30drqf+9sC4OS\n         FAqrjXFIw3pa7BAjZ5UXEqBp26ooTijQb9wVR7HYaSwjRcGBaOplSe0WcH0db4ElFQP2\n         nbV0AfcMurTw8WO+0No34RFhmyIHN6nIEobP6nGwbq9KeLTb1XE+0wkn9dHVBnii8/EF\n         1i117uvYk8RS3xZcxXxoHiF1T/RC0fQmfFQ3jr1CBCEr/K7vv2EYAItVQgZvLf0tYg3E\n         kFap5nxcs8zULHTcpctyLhlhJghb6fMOQU0iwqE053hPT0tzSx4gbAXsmbB2Fb9zo09n\n         M9FA==","i=1; a=rsa-sha256; t=1777558565; cv=none;\n        d=google.com; s=arc-20240605;\n        b=RBvuwloTF4ECuxfww36atMQK6fklQJq4RqcCK3YJrledxcKgX5/tt4H00JfEPbhRGS\n         hwBng63EImIuiRgTjFrlI2WGl6sbnM8rUB0egp0bPTExrJ0mRHlWAk84/gTPct5+MCRA\n         9ThjW0SobyZdr9WpWXlefQN+ASscQC9Fo6+U5Ww2+KMSZYaMWfEEaDj5vqzi20mH7wM2\n         yeliIMILWfW8o5SvQYwmmf1/78Di8y6roinaPDrHr5zW+TIiZvANH0+MGzEm9u9JdHlr\n         zuQ+RD+0Bkefn+TO+NFpclFkROD89on1LPhWyfq7T3QnPjqM8jJhE1xeLejAQcGffFmO\n         lywg=="],"ARC-Message-Signature":["i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:sender:dkim-signature;\n        bh=MZJ3ER/QvWhXe4Y5tMCQWRzFw3X3hXGdBU1M5MbmeRo=;\n        fh=h9xKMy62GctA3pbmGrACuYXzfsbRe4NrWNZ373uD2AI=;\n        b=h5b4jBr83AZATOW9EbHtldp4PSi2NALKHDgM5e9RaR37FUcV8ONXuRCOSnaXlBsrbM\n         WAeMguuEHVj+yippiX8j+NXNjciw14GBVqnBJ/GP3URBNNv43PoardYXPkVVB3pAeWl9\n         cf9wd8sGv6eqlvFSfLmSkRN/tj6/O0LySobk7cXwB5nvaqj4zLX2Sf3OUJoFXuh0KBp9\n         P+bCa0a7OHkrRu9a+sf3F07Mgx99msIMyFYRJrjXXwzNq8gWrGFEsf1tmQACVwl57SZN\n         hTIaq5w+BbhAqNoUAYEbQU6xDR7psf83QEshoTw2NrJzbj2AIBdvQ8piib72OrfJvCrb\n         QiLA==;\n        darn=patchwork.ozlabs.org","i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:dkim-signature;\n        bh=0w8Mkhtlrf6frKgflqUsr41atmhz0Y07ovMcSTzwZBw=;\n        fh=XlaocOg4+hEg9m6vkXgFAGy4bjo1d4y6YkK6a6dOTeU=;\n        b=Xd9tVPWrMCbCf3GdpIcBHLJQ82LI/Fi+vBiQFTVdgLDl47JyM8xp1MoM0KWqIHfJgi\n         vVMvoWyeUH2k/76TNWKQR+/pslrJoyNx5MplckF1xuDZ6jW3bMXtQ/Rdjs6AjRd1uhLJ\n         tRUDDf1rDmqTsBjl4BrFejXC+u75O/FtoUE5vxPFPp3vZkD8F9v144TISpX31dB5puS4\n         H/b2rQsbMP7b/lCmOQJo6WXjzV02Z7OjtWgIjhRRICrOObBGVOlIYNp9riG4isMFc8gw\n         2fE7NaFbBXM7qaQ4/epUWlX5u0aWiifhwig8V22O8a82UGorZ1LGYTxs8N1EzNs4v8ur\n         njZQ==;\n        dara=google.com","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:dkim-signature;\n        bh=0w8Mkhtlrf6frKgflqUsr41atmhz0Y07ovMcSTzwZBw=;\n        fh=XlaocOg4+hEg9m6vkXgFAGy4bjo1d4y6YkK6a6dOTeU=;\n        b=F/0jZ7Md61De9tP86wbn3WMDnxOtWKBn2qP2/E5yuycuodOzSuju5hd2rJWwSIMbZx\n         6k6T/w4U6sl6XCFTEaTxME4YLqNvBoA7f/EAAeb7h6aRZJKrlfLi6NRTEinHOcQDTnI+\n         /oz7G+s9VuTQiu6ho/F4rS3zM+I2xXIAYyX0X7Xv7uaLM0nKt4pPUGguEoxMq92bL3BZ\n         +7w/4NQz6JAqDqWXAZmWoXZWFXdku4S0x4G9cDBAlAvMcTPRVq3NJ+KiuVsBm40D3ArD\n         GOm/YR118pd6mRqL15cLe3ZbRh0SJg2yg7AWUwXnucnHcRH9PKaUIIibdFdHs90Bm4kY\n         KCsA==;\n        dara=google.com"],"ARC-Authentication-Results":["i=3; gmr-mx.google.com;\n       dkim=pass header.i=@amarulasolutions.com header.s=google\n header.b=MP2wuMpe;\n       arc=pass (i=1);\n       spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1132 as permitted sender)\n smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","i=2; gmr-mx.google.com;\n       dkim=pass header.i=@amarulasolutions.com header.s=google\n header.b=MP2wuMpe;\n       arc=pass (i=1);\n       spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1132 as permitted sender)\n smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","i=1; mx.google.com; arc=none"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1777559065; x=1778163865;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:cc:to:subject:message-id:date:from:in-reply-to\n         :references:mime-version:sender:from:to:cc:subject:date:message-id\n         :reply-to;\n        bh=MZJ3ER/QvWhXe4Y5tMCQWRzFw3X3hXGdBU1M5MbmeRo=;\n        b=vA/cTEjFpGB73AvcWuihuNh1l5Zm1fdnHLvIxiacgyDzbniKxDRa98bZk5JsTepTG4\n         CY7tJBfUwTBPVuCr9cmjw7leVzkoI7dUHLDnzZ/96ZqmfXz98/M4kGyZ0N0u7b2fv1Rr\n         EygGPyqr3SwZGHyDIQkCH8PeJBzbm/eF74raqWaGaUb97Y6jQvNwYXCxRcy7BQaBbdxZ\n         EUV9ijvqZ3guuvmGsxrVJ1jlGLsGawhONZNx14RL9ej9p//6Do4LxRFQkXT7NcCIXwXb\n         tV2XiQB1Me0/eh4I4mWI3621Suy/XAa0/ldN4LsrSNUIm50PIYG6ohquZipP/QARG81z\n         IJRA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777559065; x=1778163865;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :x-spam-checked-in-group:list-id:mailing-list:precedence\n         :x-original-authentication-results:x-original-sender:cc:to:subject\n         :message-id:date:from:in-reply-to:references:mime-version:x-gm-gg\n         :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=MZJ3ER/QvWhXe4Y5tMCQWRzFw3X3hXGdBU1M5MbmeRo=;\n        b=ai57u505Nx8xoHwgh6M47aJntdIpQ4h5pV3Ec6hRGWM/ybM1hkWttdTpAd6IS84BWG\n         tC0+aDWFsQvDQPSChLreoNcKjwgaEFBq9iHB5RO0OIWrBMQ5kRem+/TNoDEO3gW9KfyC\n         YUqRMKiP9ayCIiU5X6tXVmz3WKJZAxfkEuLljScxmJkpFP2//GM6pPHlWwG0qIYPIEDw\n         AlRkNRc5G2mIChrydutjPlkyCCHYfPE+H/e+cHBJlHLipWLPVOmb8ZUO7XjnKGOsA0fr\n         A20w3LLY8aH6AmcaxmpoJePib3zYjh+CLfs73XyrmW9rVRNbHJ16Z68k48han+uRVcpX\n         cH7g==","Sender":"swupdate@googlegroups.com","X-Forwarded-Encrypted":"i=3;\n AFNElJ/BNgcJ3uIOlxeLWc6Y5ngBSz+olvQcz7sevdEelPS1nAhbtpAjzk+Aw9+qeXwyEK/ey6XbrsL2IA==@patchwork.ozlabs.org","X-Gm-Message-State":"AOJu0YwgkkB7YX3HWp+vMNyaAI6NmDwe+weuDlB+1gDt50YcWQH6YaVS\n\tqUaPPgN6w15AJpCnlxalCCD1c4XS8nijl4HtUpKq4wfDsm3jvSuNrpNK","X-Received":["by 2002:a05:6a20:a120:b0:3a2:e0d3:37ea with SMTP id\n adf61e73a8af0-3a3cf4fa1e1mr3806682637.11.1777558568663;\n        Thu, 30 Apr 2026 07:16:08 -0700 (PDT)","by 2002:a05:6300:2109:b0:39b:87f0:758e with SMTP id\n adf61e73a8af0-3a3cf507712mr3737351637.8.1777558566073;\n        Thu, 30 Apr 2026 07:16:06 -0700 (PDT)","by 2002:a05:690c:e3cf:b0:7b2:6b19:df2b with SMTP id\n 00721157ae682-7bd5285b603mr32245127b3.17.1777558564451; Thu, 30 Apr 2026\n 07:16:04 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com;\n h=\"AUV6zMM3We7lfIXWkBcxPyEq/FwlJhRkVkwObfnBxtd77A+rVw==\"","Received-SPF":"pass (google.com: domain of dario.binacchi@amarulasolutions.com\n designates 2607:f8b0:4864:20::1132 as permitted sender)\n client-ip=2607:f8b0:4864:20::1132;","X-Gm-Gg":"AeBDietARbxObVB9/ihMJLO7AMnmEDCy5YBnrwGBOI27rdbWvE4FNIOtq4bhZKDJ54N\n\ttYf25FDGB94GdIa0ZbU5ff0mpqqAbP9CdCxxgZJB4zuywKU3boICp7daLjrRWsNpyjdSG7L9Zlv\n\toujKN5/6+MVX23cQ/suB1yqRQ2NJUsvsKrd3WuOlEJQy6SjCvNn92PBBrB+Ko7HkgWvmnF6KW03\n\tHVbMl8c+AwYtgL1B9xFWMmWSBkpxajpc2RaMdmH0Ehq6iSx3EJSJzPjNhlBhip1+jKUmaZTARcj\n\tLzKjPESalexIqiTqQPen71XdjWCV/TJEGBpc2TQuFYjys79P","MIME-Version":"1.0","References":"<20260429140130.615536-1-dario.binacchi@amarulasolutions.com>\n <20260429140130.615536-2-dario.binacchi@amarulasolutions.com>\n <10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>\n <CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>\n <a5d5d0da-0235-4571-a7b9-ca2bfe50972e@swupdate.org>","In-Reply-To":"<a5d5d0da-0235-4571-a7b9-ca2bfe50972e@swupdate.org>","From":"Dario Binacchi <dario.binacchi@amarulasolutions.com>","Date":"Thu, 30 Apr 2026 16:15:52 +0200","X-Gm-Features":"AVHnY4Ltfk8njwmml9u1gEUsA55HUD2DzOsRw5BWnmZm0mn4djgkySyO6ifHB9Q","Message-ID":"\n <CABGWkvrFwZCjJx=70tNh=Zm__eXq22kaaNGxvZ8sESZ6eBPj_w@mail.gmail.com>","Subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","To":"Stefano Babic <stefano.babic@swupdate.org>","Cc":"swupdate@googlegroups.com, linux-amarula@amarulasolutions.com","Content-Type":"multipart/alternative; boundary=\"000000000000cd4b050650ae1aed\"","X-Original-Sender":"dario.binacchi@amarulasolutions.com","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n header.i=@amarulasolutions.com header.s=google header.b=MP2wuMpe;\n       arc=pass (i=1);       spf=pass (google.com: domain of\n dario.binacchi@amarulasolutions.com designates 2607:f8b0:4864:20::1132 as\n permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;\n       dara=pass header.i=@googlegroups.com","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"}},{"id":3685057,"web_url":"http://patchwork.ozlabs.org/comment/3685057/","msgid":"<a312cddc-1b7f-4b4d-87d8-13710721279c@swupdate.org>","list_archive_url":null,"date":"2026-05-01T08:20:35","subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","submitter":{"id":86869,"url":"http://patchwork.ozlabs.org/api/people/86869/","name":"Stefano Babic","email":"stefano.babic@swupdate.org"},"content":"Hi Dario,\n\nOn 4/30/26 16:15, Dario Binacchi wrote:\n> Hi Stefano,\n> \n> On Thu, Apr 30, 2026 at 3:24 PM Stefano Babic \n> <stefano.babic@swupdate.org <mailto:stefano.babic@swupdate.org>> wrote:\n> \n>     Hi Dario,\n> \n>     On 4/30/26 14:52, Dario Binacchi wrote:\n>      > Hi Stefano,\n>      >\n>      > On Wed, Apr 29, 2026 at 5:12 PM Stefano Babic\n>      > <stefano.babic@swupdate.org <mailto:stefano.babic@swupdate.org>\n>     <mailto:stefano.babic@swupdate.org\n>     <mailto:stefano.babic@swupdate.org>>> wrote:\n>      >\n>      >     Hi Dario,\n>      >\n>      >     On 4/29/26 16:01, Dario Binacchi wrote:\n>      >      > Add a handler to manage the boot selection process\n>     according to\n>      >      > the Firmware Update (FWU) metadata specification using the\n>      >      > libfwumdata library.\n>      >\n>      >     This seems that the specification is something generic, but\n>     this is\n>      >     really just for STM32MP2, as described in the cover. Then an\n>     according\n>      >     documentation should be added.\n>      >\n>      >\n>      > AFAIK the FWU (Firmware Update) metadata is a fully generic\n>     specification\n>      > (part of the Arm FWU specification). While the STM32MP2 is my use\n>     case\n>      > and the\n>      > reason I wrote this patch, the standard and this implementation\n>     are not\n>      > ST-specific. Other platforms already implement and use FWU\n>     metadata in\n>      > U-Boot,\n>      > so the handler is meant to be completely platform-agnostic.\n>      >\n>      >\n>      >     Nevertheless, I will raise a basic issue about the concept. I\n>     cannot\n>      >     find the patches sent to openembedded-core, too.\n>      >\n>      >\n>      > You can find the patch submitted to oe-core here:\n>      > https://patchwork.yoctoproject.org/project/oe-core/ <https://\n>     patchwork.yoctoproject.org/project/oe-core/>\n>      > patch/20260429145136.618168-1-\n>     dario.binacchi@amarulasolutions.com/\n>     <http://20260429145136.618168-1-dario.binacchi@amarulasolutions.com/>\n>      > <https://patchwork.yoctoproject.org/project/oe-core/ <https://\n>     patchwork.yoctoproject.org/project/oe-core/>\n>      > patch/20260429145136.618168-1-\n>     dario.binacchi@amarulasolutions.com/\n>     <http://20260429145136.618168-1-dario.binacchi@amarulasolutions.com/>>\n> \n>     Thanks !\n> \n>      >\n>      >\n>      >     According to the related patches merged into U-Boot, this is a ST\n>      >     replacement for fw_setenv / fw_printenv. The configuration\n>     file, at\n>      >     least the one pushed to U-Boot, has the same old format as U-\n>     Boot's\n>      >     tools. So I am just asking why we should have a separate tool\n>     (yes, I\n>      >     saw in U-Boot, too) instead of integrating into the current\n>     ecosystem.\n>      >\n>      >       From a concept view, the tool is used to select which is\n>     the active\n>      >     image to be booted, and select also some parms (flags) for it. In\n>      >     SWUpdate, this is the \"bootloader\" interface, and not a \"script\"\n>      >     handler. That can be implemented also as script, as here, is\n>     clear, but\n>      >     from the logical point of view, it does not belong to.\n>      >\n>      >\n>      > Implementing it as a \"script\" handler was simply the easiest and\n>     fastest\n>      > path for me to validate the concept, and I should have probably\n>     tagged\n>      >   the patch as an RFC for this reason. I agree that, from a\n>     logical point of\n>      >   view, this belongs in the \"bootloader\" interface.\n>      >\n> \n>     Ok\n> \n>      >\n>      >     And the second main aspect: if this is just to choose the active\n>      >     software set, and the fwumdata.c is poushed as replacement\n>     for FWU\n>      >     metadata of fw_setenv, and also taken into account that its\n>     code seems\n>      >     to me pretty simple, whhy shouldn't be integrated as storage into\n>      >     libubootenv, instead ?\n>      >\n>      >\n>      > I believe it should remain a separate library (libfwumdata) for a\n>     couple\n>      > of reasons:\n>      >\n>      > Conceptual separation: U-Boot itself keeps the standard\n>     environment and\n>      > FWU metadata separated. They serve different purposes and have\n>      > entirely different structures (a flexible key-value store vs. a\n>     rigidly\n>      > defined A/B state structure). Merging FWU metadata handling into\n>      > libubootenv could lead to conceptual misunderstandings.\n> \n>     But libubootenv maintains the name, but it is already not only thought\n>     for U-Boot. Currently, it is used to store persistently tuple \n> \n> \n>   FWU metadata is fundamentally not a collection of arbitrary tuples \n> (key-value pairs). It is a rigidly\n>   defined binary structure.\n\nBut this just means that the accepted vars or better state is limited \nand match into a well defined storage.\n\n> I think that forcing the FWU metadata to be \n> accessed and managed through a\n>   generic tuple-based interface is an architectural stretch.\n\nI do not want this, too. But taking into account that API and at the end \nthe goal is the same, this can be done by generalizing the libubootenv \nstructure and use callbacks to write into the storage.\n\nAt the end, we have the same in U-Boot for the Update, the bank / \npartition (or better, the chosen software set) is selected. And from the \nAPI...\n\n\tU-Boot ==> fw_setenv swset 1\n\tfwumdata ==> yafwumdata -a 1\n\nIMHO we have a duplication of goals and libraries. Reading the comments \non the patches on OE-CORE, it looks like I am not the only one with this \nfeeling. Sorry that you do not see the same.\n\n> It would \n> artificially limit the correct management\n> of the data and any future implementation of the FWU specification \n> features just to fit into a key-value paradigm.\n\nI do not want to constrain this but I think we do not need such kind off \nconstrain.\n\n> \n>     that must\n>     survive an update. Namespaces allow to set vars into different domains\n>     than U-Boot (bootloader vars vs application vars is the most typical\n>     use\n>     case). A FWU will be just a different namespace, but interface remains\n>     coherent.\n> \n>      >\n>      > Dedicated API: I think it's correct to have a dedicated, minimal\n>     C library\n>      > specifically designed to allow any userspace application - not just\n>      > SWUpdate,\n>       > but also other OTA managers or proprietary system services - to\n>     easily > switch\n> \n>     Well, this was one reason for the libubootenv, and it is used by other\n>     OTA updater, too. It is not bound to SWUpdate, SWUpdate is just an user\n>     of the library.\n> \n>     So checking inside your libfwumdata, and seeing the analogies with\n>     libubootenv, and you have already stated in the header that there are\n>     parts taken from libubootenv, I am even less convinced that adding\n>     another additional library is the best way to go. \n> \n> \n>   The similarities you noticed with |libubootenv| are absolutely \n> intentional,\n>   but they are strictly limited to the API design pattern (the |init|, | \n> open|, |store|, |close| flow)\n> and the configuration file parsing. I adopted this pattern because it is \n> a familiar and\n> robust approach for the ecosystem, not because the underlying data \n> models are compatible.\n\nBut as I said, the library can be configured so that a different \nunderlying data is possible.\n\n> Furthermore, there are specific FWU API functions that simply cannot be \n> implemented as\n>   standard |get|/|set| functions due to this completely different data \n> structure. A clear proof of\n>   this structural divergence is the implementation of the |yafwumdata| \n> tool itself, which mimics\n>   the U-Boot tool but is specifically tailored to handle the unique \n> logic of the FWU standard.\n\nI do not see in the code any blocking point to decide for a different \nsolution.\n\n\n> \n> Since you know SWUpdate's architecture inside out, I want to leave the \n> ball in your court.\n> Is there really no other way to implement this cleanly without \n> shoehorning a fixed binary\n> structure into a string dictionary like libubootenv?\n> \n> Is it possible to find a design compromise that respects the nature of \n> the FWU standard\n> and doesn't leave either of us completely dissatisfied?\n> \n\nIt is not to find a compromise, it is to find which should be the best \nand maintainable solution without introducing duplication and \nfragmentation. So again, I am not convinced at all this is the way to go.\n\nBest regards,\nStefano\n\n> Thanks and regards,\n> Dario\n> \n>     If I can agree about\n>     the separation from U-B0oot environment (and this is already provided\n>     via name3space), why is this not simply done by adding to libubootenv ?\n>     It can be still used by any OTA, it is still separated by U-Boot's env\n>     (ok, not the name..), configuration is already in a more modern and\n>     flexible way as in old U-Boot and in libfwumdata, that takes over from\n>     U-Boot (YAML).\n> \n>     The most practical way seems to extend the current library instead of\n>     creating a new one.\n> \n>      > boot banks. It differs from U-Boot's mkfwumdata (which generates the\n>      > metadata\n>      > image from scratch at build time) and fwumdata (the CLI tool for\n>      > targeted updates).\n>      > libfwumdata provides a strictly limited, safe C API to update\n>     just the 3\n>      > fields needed for a bank switch.\n>      >\n>      > So, can we meet halfway? We could integrate the management of FWU\n>     variables\n>      > inside bootloader/uboot.c.\n> \n>     Not at all. It is a bad solution for you, too. We agree that is\n>     separated by U-Boot, then this mixes all up.\n> \n>      > If a variable has the fwu- prefix (e.g., fwu-\n>      > active),\n>      > it will be saved using libfwumdata; otherwise, it will be handled by\n>      > libubootenv as usual.\n> \n>     This is just a hack - I fully disagree here.\n> \n>     And be sure, there will be some user early or later who starts to set\n>     U-Boot variables starting with \"fwu\" (\"Fair World Unit\", maybe ?)\n>     and he\n>     will complain it does not work.\n> \n>      >\n>      > Keeping libfwumdata separate avoids forcing FWU metadata\n>     management inside\n>      > the libubootenv library. This approach gives users a seamless\n>     bootenv:\n>      > interface\n>      > while keeping the underlying architectures clean.\n> \n>     I do not see the advantage here - on the opposite, if it is integrated,\n>     user has the same interface.\n> \n>      >\n>      > Would this compromise be acceptable to you for v2?\n>      >\n> \n>     Sorry, not.\n> \n>     Best regards,\n>     Stefano\n> \n>      > Thanks and regards,\n>      > Dario\n>      >\n>      >     Then SWUpdate hasn't another interface, there is\n>      >     still the bootloader interface, and under the hood the FMU is\n>     written\n>      >     instead of U-Boot env.\n>      >\n>      >     Best regards,\n>      >     Stefano\n>      >\n>      >      >\n>      >      > The handler is a script handler that updates the active_index\n>      >      > and marks the selected bank as valid during the post-\n>     install phase.\n>      >      >\n>      >      > Example in sw-description:\n>      >      >\n>      >      >      scripts: (\n>      >      >          {\n>      >      >              type = \"fwumdata\";\n>      >      >              properties: {\n>      >      >                  active = \"1\";\n>      >      >              }\n>      >      >          }\n>      >      >      );\n>      >      >\n>      >      > Signed-off-by: Dario Binacchi\n>      >     <dario.binacchi@amarulasolutions.com\n>     <mailto:dario.binacchi@amarulasolutions.com>\n>      >     <mailto:dario.binacchi@amarulasolutions.com\n>     <mailto:dario.binacchi@amarulasolutions.com>>>\n>      >      > ---\n>      >      >   Kconfig                        |   4 ++\n>      >      >   Makefile.deps                  |   4 ++\n>      >      >   Makefile.flags                 |   3 +\n>      >      >   bootloader/Kconfig             |   7 ++\n>      >      >   configs/all_handlers_defconfig |   1 +\n>      >      >   doc/source/handlers.rst        |  37 ++++++++++\n>      >      >   handlers/Kconfig               |  17 +++++\n>      >      >   handlers/Makefile              |   1 +\n>      >      >   handlers/fwumdata_handler.c    | 125 +++++++++++++++++++\n>     +++++++\n>      >     +++++++\n>      >      >   9 files changed, 199 insertions(+)\n>      >      >   create mode 100644 handlers/fwumdata_handler.c\n>      >      >\n>      >      > diff --git a/Kconfig b/Kconfig\n>      >      > index 2cf68eb890b0..fcb60f900b3f 100644\n>      >      > --- a/Kconfig\n>      >      > +++ b/Kconfig\n>      >      > @@ -129,6 +129,10 @@ config HAVE_ZCK\n>      >      >       bool\n>      >      >       option env=\"HAVE_ZCK\"\n>      >      >\n>      >      > +config HAVE_LIBFWUMDATA\n>      >      > +     bool\n>      >      > +     option env=\"HAVE_LIBFWUMDATA\"\n>      >      > +\n>      >      >   menu \"SWUpdate Settings\"\n>      >      >\n>      >      >   menu \"General Configuration\"\n>      >      > diff --git a/Makefile.deps b/Makefile.deps\n>      >      > index c759f6876dea..313d5af6230c 100644\n>      >      > --- a/Makefile.deps\n>      >      > +++ b/Makefile.deps\n>      >      > @@ -121,3 +121,7 @@ endif\n>      >      >   ifeq ($(HAVE_ZCK),)\n>      >      >   export HAVE_ZCK = y\n>      >      >   endif\n>      >      > +\n>      >      > +ifeq ($(HAVE_LIBFWUMDATA),)\n>      >      > +export HAVE_LIBFWUMDATA = y\n>      >      > +endif\n>      >      > diff --git a/Makefile.flags b/Makefile.flags\n>      >      > index 40dd3b66856e..76b87e67fe67 100644\n>      >      > --- a/Makefile.flags\n>      >      > +++ b/Makefile.flags\n>      >      > @@ -233,6 +233,9 @@ ifeq ($(CONFIG_UCFWHANDLER),y)\n>      >      >   LDLIBS += gpiod\n>      >      >   endif\n>      >      >\n>      >      > +ifeq ($(CONFIG_FWUMDATA_HANDLER),y)\n>      >      > +LDLIBS += fwumdata\n>      >      > +endif\n>      >      >\n>      >      >   ifeq ($(CONFIG_BOOTLOADER_STATIC_LINKED),y)\n>      >      >   ifeq ($(CONFIG_BOOTLOADER_EBG),y)\n>      >      > diff --git a/bootloader/Kconfig b/bootloader/Kconfig\n>      >      > index edc02d99b2d1..36f856507356 100644\n>      >      > --- a/bootloader/Kconfig\n>      >      > +++ b/bootloader/Kconfig\n>      >      > @@ -158,3 +158,10 @@ config UPDATE_STATE_BOOTLOADER\n>      >      >       help\n>      >      >         Store update information in Bootloader's environment.\n>      >      >\n>      >      > +config FWUMDATA_CONFIG_FILE\n>      >      > +     string \"FWU Metadata Configuration file\"\n>      >      > +     depends on HAVE_LIBFWUMDATA\n>      >      > +     default \"/etc/fwumdata.config\"\n>      >      > +     help\n>      >      > +       It tells where the FWU metadata are saved.\n>      >      > +\n>      >      > diff --git a/configs/all_handlers_defconfig b/configs/\n>      >     all_handlers_defconfig\n>      >      > index 16cd9b6b98f1..63299bd223ae 100644\n>      >      > --- a/configs/all_handlers_defconfig\n>      >      > +++ b/configs/all_handlers_defconfig\n>      >      > @@ -20,6 +20,7 @@ CONFIG_DISKPART=y\n>      >      >   CONFIG_DISKPART_FORMAT=y\n>      >      >   CONFIG_DISKFORMAT_HANDLER=y\n>      >      >   CONFIG_FAT_FILESYSTEM=y\n>      >      > +CONFIG_FWUMDATA_HANDLER=y\n>      >      >   CONFIG_EXT_FILESYSTEM=y\n>      >      >   CONFIG_LUASCRIPTHANDLER=y\n>      >      >   CONFIG_RAW=y\n>      >      > diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst\n>      >      > index 6742c10a58c3..cbfb146f099c 100644\n>      >      > --- a/doc/source/handlers.rst\n>      >      > +++ b/doc/source/handlers.rst\n>      >      > @@ -1710,3 +1710,40 @@ Examples:\n>      >      >                       name = \"helloworld\";\n>      >      >               };\n>      >      >       });\n>      >      > +\n>      >      > +FWU Metadata Handler\n>      >      > +--------------------\n>      >      > +\n>      >      > +This is a script handler used to manage the boot selection\n>      >     process according to\n>      >      > +the Firmware Update (FWU) metadata specification.\n>      >      > +\n>      >      > +The handler implements a post-install script that updates the\n>      >     metadata to switch\n>      >      > +the active bank and marks it as valid, ensuring the\n>     system boots\n>      >     from the new\n>      >      > +bank at the next reset. The ``active`` property defines which\n>      >     bank must be\n>      >      > +selected.\n>      >      > +\n>      >      > +Example selecting boot bank 1 (bank A in A/B schema):\n>      >      > +\n>      >      > +::\n>      >      > +\n>      >      > +     scripts: (\n>      >      > +             {\n>      >      > +                     type = \"fwumdata\";\n>      >      > +                     properties: {\n>      >      > +                             active = \"1\";\n>      >      > +                     }\n>      >      > +             }\n>      >      > +     );\n>      >      > +\n>      >      > +Example selecting boot bank 2 (bank B in A/B schema):\n>      >      > +\n>      >      > +::\n>      >      > +\n>      >      > +     scripts: (\n>      >      > +             {\n>      >      > +                     type = \"fwumdata\";\n>      >      > +                     properties: {\n>      >      > +                             active = \"2\";\n>      >      > +                     }\n>      >      > +             }\n>      >      > +     );\n>      >      > diff --git a/handlers/Kconfig b/handlers/Kconfig\n>      >      > index 152bc08074a1..b7d9e51a20c9 100644\n>      >      > --- a/handlers/Kconfig\n>      >      > +++ b/handlers/Kconfig\n>      >      > @@ -151,6 +151,23 @@ config EMMC_HANDLER\n>      >      >         with a dual-copy concept. This guarantees that the\n>     upgrade\n>      >      >         is power-cut safe.\n>      >      >\n>      >      > +config FWUMDATA_HANDLER\n>      >      > +     bool \"FWU metadata update\"\n>      >      > +     depends on HAVE_LIBFWUMDATA\n>      >      > +     default n\n>      >      > +     help\n>      >      > +       This handler allows to manage the boot selection\n>     process\n>      >     using\n>      >      > +       firmware update (FWU) metadata via libfwumdata.\n>      >      > +\n>      >      > +       Selecting the new boot bank automatically triggers the\n>      >     handler to\n>      >      > +       set the current bank for rollback and mark the\n>     selected\n>      >     boot-up\n>      >      > +       bank as 'valid'.\n>      >      > +\n>      >      > +       This ensures the system is ready to boot from the\n>     updated\n>      >      > +       partition while maintaining a safe path to revert\n>     to the\n>      >     previous\n>      >      > +       working state if the new firmware fails to reach the\n>      >     'accepted'\n>      >      > +       state\n>      >      > +\n>      >      >   config RAW\n>      >      >       bool \"raw\"\n>      >      >       default n\n>      >      > diff --git a/handlers/Makefile b/handlers/Makefile\n>      >      > index 8490172a10a3..45fcb525e461 100644\n>      >      > --- a/handlers/Makefile\n>      >      > +++ b/handlers/Makefile\n>      >      > @@ -30,3 +30,4 @@ obj-$(CONFIG_SWUFORWARDER_HANDLER) +=\n>      >     swuforward_handler.o swuforward-ws.o\n>      >      >   obj-$(CONFIG_UBIVOL)        += ubivol_handler.o\n>      >      >   obj-$(CONFIG_UCFWHANDLER)   += ucfw_handler.o\n>      >      >   obj-$(CONFIG_DOCKER)        += docker_handler.o\n>      >      > +obj-$(CONFIG_FWUMDATA_HANDLER)       += fwumdata_handler.o\n>      >      > diff --git a/handlers/fwumdata_handler.c b/handlers/\n>      >     fwumdata_handler.c\n>      >      > new file mode 100644\n>      >      > index 000000000000..1331fe64aa74\n>      >      > --- /dev/null\n>      >      > +++ b/handlers/fwumdata_handler.c\n>      >      > @@ -0,0 +1,125 @@\n>      >      > +#include <stdio.h>\n>      >      > +#include <unistd.h>\n>      >      > +#include <fcntl.h>\n>      >      > +#include <stdlib.h>\n>      >      > +#include <stdbool.h>\n>      >      > +#include <errno.h>\n>      >      > +#include <linux/version.h>\n>      >      > +#include <sys/ioctl.h>\n>      >      > +#include <stddef.h>\n>      >      > +\n>      >      > +#include \"swupdate_image.h\"\n>      >      > +#include \"handler.h\"\n>      >      > +#include \"util.h\"\n>      >      > +\n>      >      > +#include <libfwumdata.h>\n>      >      > +\n>      >      > +static int _fwumdata_set(uint32_t active_index, uint32_t\n>      >     previous_index,\n>      >      > +                      uint8_t bank_state)\n>      >      > +{\n>      >      > +     int mdd;\n>      >      > +     int ret;\n>      >      > +\n>      >      > +     mdd = fwumdata_init();\n>      >      > +     if (mdd < 0) {\n>      >      > +             ERROR(\"Cannot initialize libfwumdata\\n\");\n>      >      > +             return mdd;\n>      >      > +     }\n>      >      > +\n>      >      > +     ret = fwumdata_read_config(mdd,\n>     CONFIG_FWUMDATA_CONFIG_FILE);\n>      >      > +     if (ret) {\n>      >      > +             ERROR(\"Cannot read %s\\n\",\n>     CONFIG_FWUMDATA_CONFIG_FILE);\n>      >      > +             goto exit;\n>      >      > +     }\n>      >      > +\n>      >      > +     ret = fwumdata_open(mdd, 0);\n>      >      > +     if (ret) {\n>      >      > +             ERROR(\"Cannot open %s\\n\",\n>     CONFIG_FWUMDATA_CONFIG_FILE);\n>      >      > +             goto exit;\n>      >      > +     }\n>      >      > +\n>      >      > +     ret = fwumdata_set_active_index(mdd, active_index);\n>      >      > +     if (ret) {\n>      >      > +             ERROR(\"Cannot set active index\\n\");\n>      >      > +             goto close;\n>      >      > +     }\n>      >      > +\n>      >      > +     fwumdata_set_previous_index(mdd, previous_index);\n>      >      > +     if (ret) {\n>      >      > +             ERROR(\"Cannot set previous index\\n\");\n>      >      > +             goto close;\n>      >      > +     }\n>      >      > +\n>      >      > +     ret = fwumdata_set_bank_state(mdd, active_index,\n>     bank_state);\n>      >      > +     if (ret) {\n>      >      > +             ERROR(\"Cannot set bank state\\n\");\n>      >      > +             goto close;\n>      >      > +     }\n>      >      > +\n>      >      > +        ret = fwumdata_store(mdd);\n>      >      > +        if (ret) {\n>      >      > +             ERROR(\"Cannot store fwu metadata\\n\");\n>      >      > +             goto close;\n>      >      > +     }\n>      >      > +\n>      >      > +     DEBUG(\"fwumdata: active: %d, previous: %d, state: 0x%x\",\n>      >      > +           active_index, previous_index, bank_state);\n>      >      > +\n>      >      > +close:\n>      >      > +     fwumdata_close(mdd);\n>      >      > +exit:\n>      >      > +     fwumdata_exit(mdd);\n>      >      > +     return ret;\n>      >      > +}\n>      >      > +\n>      >      > +static int fwumdata_set(struct img_type *img, void *data)\n>      >      > +{\n>      >      > +     struct script_handler_data *script_data;\n>      >      > +     char *value;\n>      >      > +     int active_index = -1;\n>      >      > +     int previous_index;\n>      >      > +\n>      >      > +\n>      >      > +     if (!data)\n>      >      > +             return -EINVAL;\n>      >      > +\n>      >      > +     script_data = data;\n>      >      > +\n>      >      > +     /*\n>      >      > +      * Call only in case of postinstall\n>      >      > +      */\n>      >      > +     if (script_data->scriptfn != POSTINSTALL)\n>      >      > +             return 0;\n>      >      > +\n>      >      > +     value = dict_get_value(&img->properties, \"active\");\n>      >      > +     if (!value) {\n>      >      > +             ERROR(\"active: cannot find in sw-description\");\n>      >      > +             return -EINVAL;\n>      >      > +     }\n>      >      > +\n>      >      > +     active_index = ustrtoull(value, NULL, 10);\n>      >      > +     if (errno) {\n>      >      > +             ERROR(\"active %s: ustrotull failed\", value);\n>      >      > +             return -EINVAL;\n>      >      > +     }\n>      >      > +\n>      >      > +     active_index--;\n>      >      > +     if (active_index == 0) {\n>      >      > +             previous_index = 1;\n>      >      > +     } else if (active_index == 1) {\n>      >      > +             previous_index = 0;\n>      >      > +     } else {\n>      >      > +             ERROR(\"active %s: invalid value\", value);\n>      >      > +             return -EINVAL;\n>      >      > +\n>      >      > +     }\n>      >      > +\n>      >      > +     return _fwumdata_set(active_index, previous_index,\n>      >     FWUMDATA_BANK_VALID);\n>      >      > +}\n>      >      > +\n>      >      > +__attribute__((constructor))\n>      >      > +void fwumdata_handler(void)\n>      >      > +{\n>      >      > +     register_handler(\"fwumdata\", fwumdata_set,\n>      >      > +                      SCRIPT_HANDLER | NO_DATA_HANDLER,\n>     NULL);\n>      >      > +}\n>      >\n>      >     --\n>      >   \n>       _______________________________________________________________________\n>      >     Nabla Software Engineering GmbH\n>      >     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n>      >     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n>      >     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n>     <mailto:sbabic@nabladev.com <mailto:sbabic@nabladev.com>>\n>      >\n>      >\n>      >     --\n>      >   \n>       _______________________________________________________________________\n>      >     Nabla Software Engineering GmbH\n>      >     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n>      >     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n>      >     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n>     <mailto:sbabic@nabladev.com <mailto:sbabic@nabladev.com>>\n>      >\n>      >\n>      >\n>      > --\n>      > *Dario Binacchi*\n>      > Senior Embedded Software Engineer\n>      > M. +39 328 0625246\n>      > dario.binacchi@amarulasolutions.com\n>     <mailto:dario.binacchi@amarulasolutions.com>\n>      > <mailto:dario.binacchi@amarulasolutions.com\n>     <mailto:dario.binacchi@amarulasolutions.com>>\n>      > ―――――――――――――――\n>      > Amarula Solutions SRL\n>      >   Via Felice Cavallotti 25D, 41012 Carpi, MO, IT\n>      > info@amarulasolutions.com <mailto:info@amarulasolutions.com>\n>     <mailto:info@amarulasolutions.com <mailto:info@amarulasolutions.com>>\n>      > www.amarulasolutions.com <http://www.amarulasolutions.com>\n>     <http://www.amarulasolutions.com/ <http://www.amarulasolutions.com/>>\n> \n> \n>     -- \n>     _______________________________________________________________________\n>     Nabla Software Engineering GmbH\n>     Hirschstr. 111A    | 86156 Augsburg | Tel: +49 821 45592596\n>     Geschäftsführer : Stefano Babic     | HRB 40522 Augsburg\n>     E-Mail: sbabic@nabladev.com <mailto:sbabic@nabladev.com>\n> \n> \n> \n> -- \n> *Dario Binacchi*\n> Senior Embedded Software Engineer\n> M. +39 328 0625246\n> dario.binacchi@amarulasolutions.com \n> <mailto:dario.binacchi@amarulasolutions.com>\n> ―――――――――――――――\n> Amarula Solutions SRL\n>   Via Felice Cavallotti 25D, 41012 Carpi, MO, IT\n> info@amarulasolutions.com <mailto:info@amarulasolutions.com>\n> www.amarulasolutions.com <http://www.amarulasolutions.com/>\n> \n> -- \n> You received this message because you are subscribed to the Google \n> Groups \"swupdate\" group.\n> To unsubscribe from this group and stop receiving emails from it, send \n> an email to swupdate+unsubscribe@googlegroups.com \n> <mailto:swupdate+unsubscribe@googlegroups.com>.\n> To view this discussion visit https://groups.google.com/d/msgid/ \n> swupdate/ \n> CABGWkvrFwZCjJx%3D70tNh%3DZm__eXq22kaaNGxvZ8sESZ6eBPj_w%40mail.gmail.com \n> <https://groups.google.com/d/msgid/swupdate/ \n> CABGWkvrFwZCjJx%3D70tNh%3DZm__eXq22kaaNGxvZ8sESZ6eBPj_w%40mail.gmail.com?utm_medium=email&utm_source=footer>.","headers":{"Return-Path":"<swupdate+bncBD2ZDGN6SEKRBV6E2HHQMGQEFHL4M3Q@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=gewJLUov;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2a00:1450:4864:20::13a; helo=mail-lf1-x13a.google.com;\n envelope-from=swupdate+bncbd2zdgn6sekrbv6e2hhqmgqefhl4m3q@googlegroups.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from mail-lf1-x13a.google.com (mail-lf1-x13a.google.com\n [IPv6:2a00:1450:4864:20::13a])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g6PBD4q6Rz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 18:20:51 +1000 (AEST)","by mail-lf1-x13a.google.com with SMTP id\n 2adb3069b0e04-59f8dc94e84sf1082506e87.0\n        for <incoming@patchwork.ozlabs.org>;\n Fri, 01 May 2026 01:20:51 -0700 (PDT)","by 2002:a05:6512:5d0:b0:5a2:b22f:8f12 with SMTP id\n 2adb3069b0e04-5a858328373ls282790e87.2.-pod-prod-05-eu; Fri, 01 May 2026\n 01:20:38 -0700 (PDT)","from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.130])\n        by gmr-mx.google.com with ESMTPS id\n 38308e7fff4ca-393613bca12si424991fa.8.2026.05.01.01.20.37\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Fri, 01 May 2026 01:20:37 -0700 (PDT)","from client.hidden.invalid by mrelayeu.kundenserver.de (mreue011\n [212.227.15.134]) with ESMTPSA (Nemesis) id 1M2ep5-1wKfBj3fQt-006BkA; Fri, 01\n May 2026 10:20:37 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1777623643; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=TcytSVfixaVYKRgcFXEVSm7phX7dmEhcA0GIORf4vRbnumQnu+CkYc1G8VHbJ3G7kA\n         LNVXxEht903nRYIJJWWbZWau0ZYZnv7j6e+wCaiBcKpRVEyCNC/ppkD2BSYEc8i/tqgh\n         JzmQ771RaFLAYfEzsTtuJsGPspi10pF9d8EeN2s9dc0fGNrPhyH7h8i+OxgHowPnLRVI\n         hvgKLw+mAmd4T0+aigq5rXCkXASeSJVXRQihPAVFFzUhwfKoVGPt23JKy5OhvzGCFEIL\n         RA3fnkjyZLdoK1Gc5psAPC/6Zj9c+CgWGCrAGp97AA05OKkMQcz3tJxxSWtWBaA3w2N0\n         OaSw==","i=1; a=rsa-sha256; t=1777623638; cv=none;\n        d=google.com; s=arc-20240605;\n        b=Otk25/8krkT5WKWsAkOOz17n9UV3J/Iw8E1n0O1nLJiVvnfAwccqs0mWHNA8CxIpnv\n         pWfO+w+3zAayajWYQg//gyZrFW4p7r3Ky3ehCarBQyB1T0RgjzLp4V1qsRdie3JStYmV\n         8ILZKctelVqvCRaK3NwHymawHzKCgXLDM++QZDVTUnlwExjl6t5BZ84Bc4DWnB/NUqGZ\n         0ONjo7bW3Tmb1zhIJbHzJAa9DX9LHgKt+GSFtBZbbi4VbB7HmlPtMrsN2fsrVWZc2t7h\n         dEiQ+d4cj/UEz3t3wmVCB7ebM2PGqv6QZGbcTB7Oz8qwyNRtIThWUFcE7thc0EjNBznc\n         BUQA=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:ui-outboundreport\n         :content-transfer-encoding:in-reply-to:from:content-language\n         :references:cc:to:subject:user-agent:mime-version:date:message-id\n         :sender:dkim-signature;\n        bh=JTUNNM6mbBNNY9hUp8n+0a/i+C9LZtfS2lOxl19o1iM=;\n        fh=YPKrPWOm/q/QLJUuIzRbM8N5zArgZh9qospIGAEMSvI=;\n        b=Vs52YhQOfqHqqJsJ257yL9E0YnY2Z+Y6k7n4owbE4VsQzmMEkxT0+nodyDpn9HhDQ2\n         CqiMlZYvGevQwgMvDsw8aWHmqpVp9/scdqdjXW7wObu13UDCt4bSbQjWbZRFPZ8w+7M+\n         DrSZC6fbZvQsPfxuGv60R7EJEgvXSkbIqItE2gNLZfz+TlOlrw8w1aibi0sHJqCxH3Xw\n         bakbawkgGiQPMGxW3cZIm0liLrljot1RBL5vc9KmKQ211ayL+7dscEHINQIS72b7YuHH\n         05+oYfARKBYNtIWXec93daQ7/BBFbA4zVGjLQpOUBlrImgE+Tz9KSS9Zr7G4WVONYsb/\n         lbEw==;\n        darn=patchwork.ozlabs.org","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=ui-outboundreport:content-transfer-encoding:in-reply-to:from\n         :content-language:references:cc:to:subject:user-agent:mime-version\n         :date:message-id:dkim-signature;\n        bh=Y6W7CdQf0n4AFCDNGpnInzu6/AhWt59PuYVlywsezL8=;\n        fh=9I3TlhiCRqBIYekcBuksAn22BR55b3HWnR7h51gnxHo=;\n        b=V9x7VCt4DfX1tNIAPAK1IDumcpHQm9smYe5Z8q1s8+m+nPDwLJCC8oXCIqimZVpQZq\n         NHofigNf3xWhQirpM4inoquWeE5DMC3aJWiJ84uE9leC/dddXxa97GnGAzlUhOgZk0dr\n         pHjcNpnPZWkT8ktTund+GOA7AjiYrNbMMKAH9ckVm0acBfYMqFQ0kx3GWbsiPKVDjjzs\n         7F5izkACU4SYCFZLn30pQPygWze+ZVdTQwFUJGm1uRMyEAiVNwOf5qHgvad9yYt14yfU\n         sAwinXPzhRzMNrDERZQGmt5Ni2YNX5PrFYGWrpZGS0y66On9dCHMBzPBrVn7KdJSca70\n         wieQ==;\n        dara=google.com"],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=yUm1dUlw;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.126.130 as permitted sender)\n smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","i=1; gmr-mx.google.com;\n       dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=yUm1dUlw;\n       spf=pass (google.com: domain of stefano.babic@swupdate.org designates\n 212.227.126.130 as permitted sender)\n smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1777623643; x=1778228443;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:ui-outboundreport:content-transfer-encoding\n         :in-reply-to:from:content-language:references:cc:to:subject\n         :user-agent:mime-version:date:message-id:sender:from:to:cc:subject\n         :date:message-id:reply-to;\n        bh=JTUNNM6mbBNNY9hUp8n+0a/i+C9LZtfS2lOxl19o1iM=;\n        b=gewJLUovYIOTuKNJRQ8vG/1skl70c/P8zEruz+pdhHlqZmmS8p0DoWVe88/yDyBaX8\n         rbZHEDUTHl/5Ajw2nWVOOnk4yX7TgsnuQRwWZuiJIAr+peXlfhwEPL5thhKGOXQzXWj9\n         jsza3gfKjqYRhddfHb+C/tEBWY6TtudKn41uzlrlbmzKGRpIp1Zqaktmet42h5R7kL9U\n         lssC5Y8YpTZkwIfHEGvx9/LnStZ1e9u6UE6MJhDaRZiiirYpTAKn+pO/Wbmo33KPsZQ9\n         6a2aOhQlBSOHPkTIo4sXSQnfGU2gslZVrbloOce/2382MRDA5kG3nfEAHsGyRZUWxnVc\n         apyA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777623643; x=1778228443;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :x-spam-checked-in-group:list-id:mailing-list:precedence\n         :x-original-authentication-results:x-original-sender\n         :ui-outboundreport:content-transfer-encoding:in-reply-to:from\n         :content-language:references:cc:to:subject:user-agent:mime-version\n         :date:message-id:x-beenthere:x-gm-message-state:sender:from:to:cc\n         :subject:date:message-id:reply-to;\n        bh=JTUNNM6mbBNNY9hUp8n+0a/i+C9LZtfS2lOxl19o1iM=;\n        b=Ec5N4A9ckwuA3TUKh6d2mSCrlPtE3/dahpzmr9tCBZEDiorpL2r+bUgZfJsvjBPzSe\n         k0Ilhi4q4RfB4Cx1/h27EBe69FfFGL6ngGA4/E3kymelh+aNqslywCeHA7vSkCO5BIge\n         +6vuk98zEhyIoyT0/tvIilioeT/r6o2p4g/Avgo98F39sI3gBzZNm5Rw4NxAT3BcaUCc\n         jx2VYaNlIfKSABFPlPXRHqMYssCmi8QSZX4YWLVXHUIPvmEUOk9iOCqJqyAMPSn1uBRl\n         aD8pa+fBNpOrw7A1RoAu98wzcGovDnoaCD2gRdEpFRZt2Er8xU2W80rhWahiTDT3Dif5\n         8UFw==","Sender":"swupdate@googlegroups.com","X-Forwarded-Encrypted":"i=2;\n AFNElJ8MXTwQe0S5U9sP5E0jeEAvuHLtV4DDj7zxJx47ZfHd/yRXEPAjHerZb6v5NHvTLuUCh/OBiBLsBg==@patchwork.ozlabs.org","X-Gm-Message-State":"AOJu0Yyl6mI3b651xgh435W9cPRZUT+ps7tW4WeM3I4tfsBZ9lwj3YC/\n\tAOcYCtdPbCp5ZUo5UcxWeo+pFHDb+INXC2ncYwABxR+z0oZmO50HbOdq","X-Received":["by 2002:a05:6512:308f:b0:5a7:42d6:529b with SMTP id\n 2adb3069b0e04-5a8522dc224mr2429764e87.34.1777623643122;\n        Fri, 01 May 2026 01:20:43 -0700 (PDT)","by 2002:a05:6512:12c6:b0:5a2:86a3:709f with SMTP id\n 2adb3069b0e04-5a8522c0eb3mr2400974e87.17.1777623638007;\n        Fri, 01 May 2026 01:20:38 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com;\n h=\"AUV6zMMy3wxuJj562/44Ap/3Mc2oUF179NsdOUODUaIoOqhPng==\"","Received-SPF":"pass (google.com: domain of stefano.babic@swupdate.org\n designates 212.227.126.130 as permitted sender) client-ip=212.227.126.130;","X-UI-Sender-Class":"55c96926-9e95-11ee-ae09-1f7a4046a0f6","Message-ID":"<a312cddc-1b7f-4b4d-87d8-13710721279c@swupdate.org>","Date":"Fri, 1 May 2026 10:20:35 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [swupdate] [PATCH 1/1] handler: add \"fwumdata\" handler","To":"Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n Stefano Babic <stefano.babic@swupdate.org>","Cc":"swupdate@googlegroups.com, linux-amarula@amarulasolutions.com","References":"<20260429140130.615536-1-dario.binacchi@amarulasolutions.com>\n <20260429140130.615536-2-dario.binacchi@amarulasolutions.com>\n <10f085f7-4ff1-4fa9-919d-93b06a9b9e9f@swupdate.org>\n <CABGWkvrQ1O=QwNK82pL=kQFgjH7mxUFRVbvMsFw59WHfHxN1nw@mail.gmail.com>\n <a5d5d0da-0235-4571-a7b9-ca2bfe50972e@swupdate.org>\n <CABGWkvrFwZCjJx=70tNh=Zm__eXq22kaaNGxvZ8sESZ6eBPj_w@mail.gmail.com>","Content-Language":"en-US","From":"Stefano Babic <stefano.babic@swupdate.org>","In-Reply-To":"\n <CABGWkvrFwZCjJx=70tNh=Zm__eXq22kaaNGxvZ8sESZ6eBPj_w@mail.gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"; format=flowed","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:sjhSDkxGSDFkKiXMlU1ztZDlpUeqbZD6KIvcpseLqk4QGMfdp7O\n fS+q4ArJtDbTeLdLPpZkTul+Klg4z93x+ou2TQqYss2XGUAmbokZNpOHrvbF0G0aSl8Zx4i\n 3pm5gDvM8K2jDBbnJVJmHGA2TUW0hbOamcjCPYShZH4WVLo3Wtx9agy+toM/EKGWLs+0WZy\n lIjhDaZ4NG5gzTvD44URg==","X-Spam-Flag":"NO","UI-OutboundReport":"notjunk:1;M01:P0:05465FhAO3s=;6dGkjJTBzlapzFUHi/7QDwwqyno\n 5SDsQlftp3dA60CF2Cum/v3/olzujQjNfp+kAkmovLK+D9rbmk+x33Yun8EO7nYziRQ3hZW8Q\n w9AVJYmOfAzLVymvr9+UEXNUEpOI3g4mTzEANfxG05lmKKraiWZeYybm8EM9M2f544TV5GOMj\n dw6ELgzVnk4/Ahn9sSMOgUGkIbERaEYx5b16aMKVkU3Qoz8i7ylhkLLJ1JBeFyRBixn+Bq9RO\n FLkJ2dHXfewX1KL1uuRPhuDEYfMu56mJa9T/YyIxeaTa+/N+cjOJawszg6vMLnLhMQFPUpYtI\n HN4m6MklomDtqRCohOxOcSm0eVV634OQVmv+J+njunMPcYmqjm2nK9iTj81GwwgJ5ZY74KX97\n 8RHQSkq5/vCTHpCpHP8NiHwXJqk98sBagju8XnBPfmREst7/O5cmbvREqK6eqGwCaQw366qeL\n agtD6BCuvfOMssTk8Il7ATKWjpW317+UWBwJUot8nVlGbyhcLEtqudah7LWDJTJNxtmGpwNSa\n OBdP9JbKgR7vP2ljhiL2NkP2xM1+Qc5GJnN1XX8fLnxFKPQFecaHnMQFRevAL6x/ThbLx4LHr\n rl8aCdxdj3T+285cM0gXGPp+F346i1VUy0RezfhV9GHTZLCwBaj+v63lLEZRiCVmeAk7iXbc2\n gheKIrjxMSmiShfMjN42WMfIu+1nPeQ5hFASK6sZTGK9AarKcmZlXiYPKhQ8zpwEOJ1bsj4It\n 8gEnGU+RyTlt3psl8DcUcMvfh3n3YQqunfs6KfI0DJT6SWgtTFHZE2OBt3kb7ZADOLLEL8boM\n dKneNJgh77oXWjGPStKlQQSjFcb6X+LlCC2lOmpV27NYbozCFcK3dbXj2Vhtoc0CxCEHd5kR2\n R2CsWZlnoBY2EJHNeLOybGvwuFJ0XyfGEHJ3OGwXN6L34pV8D0KbEKrghiej9VhjFs4N2RQj2\n qXm/Tv2sXU7nzu6GqnP3vvvX83qnbzknfrsEGz6TAzPQ7DGMVfwD+vj7BW5YaJgntXlJwuC+E\n rJtBXEx6YIkXzWSaCQi9IpZBuuYPPCFHNHj/idrkdJ0ndqS8x1+DxRLHAZ23jXsZFVxWw4itV\n +SeLZ2ji8KBNZvC8FoliSgyq2usw1TB94jt2fU1z7cCvoQcC/z5OuV8ddW5BOJp15MZOH1HOG\n TnTCgSvzn2RguBzCNIqZvrguF72Jm2YRtnVFvSnWM7AU+b2LrNDV5+8KjKVGZZw4E9URmx208\n M8rUBKsHNvaI28FVqAHevuo6YaAyPWRBUQs2f0KWBH+jyDLL1z2vmlhvL0drlBrrAx7e2iIjB\n I9FfsGanr/ovd+DujFHV1dKZvn/zAa++mVGaMPha/+etBoVbtalV5E5UGhPVEOXaXxGsG3YLb\n ivl/I/0rKSt3xxm3a0EQT8MnDLb6MSwoWEBSaWMNaPGvADmq7/KbJL/GP3drOzdCfhHPhnTDj\n U5GtglAU8hN8mqsIQ1FQbsb0/V6WdkOVLJQUP0wIk26ND+IroG3wHbjMDPLpLvc2ZEFOkuzIp\n +CCGtVKIP1y8wUgqPzvLkSciKQjagGFHh0Yve4jXaDyFVOWbhvL2+7t2hXOnoNdVRxRGi8Rhg\n etBsxqmHVD+UqoxP5w8QF7zzCO8miRxl4NAbH7Agx/hWObi0kJK50VtJA/AmejGc0TiZUX0KL\n CHKGwHMzpNHAvfAeXlVhSVKj+tyKT94PqQQ1r1qv9S4txFNj7NXNGv4BUpv+zqAgPXxqdvnxC\n ylzBTknz/UT9FjyjxVqErsvuUpaxADX3VvgkaqEqf2DLuOLTwwOlYT381kbklkKX0dYhoMR84\n nWFcLfgbM+zeA1QAkn8v49qsVcOkyCLn0kc/Af+YflcJWmwkAF44Q+MHcAKlklsZPCUW/TBfH\n 0xRJaEEi6gs0mRsVs5M5rfsrAEhy7JvX0syP0OqMmhID/5C7v8Tgxoa4/sx74SnEf8Ss5V3PA\n 5RgvsUmhjmA5yejmO6Jo7qn2uS+LvIXKd5aeLQq1oj2/og6NYSORu3CAKTjMVoYXxMhyRA8hk\n ctbJuj850OGY0TvzzM1XZM5oPj2L4YMZgllSo61E1TUADoPMazhmFmc98ZdC4QghIb+udx0JW\n I7SUOP8Zgn8=","X-Original-Sender":"stefano.babic@swupdate.org","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n header.i=@swupdate.org header.s=s1-ionos header.b=yUm1dUlw;       spf=pass\n (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.130\n as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=swupdate.org","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"}}]