Skip to contentSkip to conversation

libfwumdata: add new recipe

PATCH Superseded Dario Binacchi 4 participants 7 messages Apr 29 – Apr 30

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libfwumdata: add new recipe

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

---
 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +22 -0
new file mode 100644
index 000000000000..838b4983c21d
@@ -0,0 +1,22 @@
+SUMMARY = "Library to access Firmware Update (FWU) metadata"
+
+DESCRIPTION = "This package contains a library to read and modify FWU \
+metadata. It provides a minimal API to allow userspace applications, such as \
+SWUpdate, RAUC or any other OTA update manager, to modify the boot bank \
+selection."
+
+HOMEPAGE = "https://github.com/passgat/libfwumdata"
+LICENSE = "LGPL-2.1-or-later"
+LIC_FILES_CHKSUM = "file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"
+SECTION = "libs"
+
+SRC_URI = "git://github.com/passgat/libfwumdata;protocol=https;branch=master"
+SRCREV = "c6e235d3cf0467211ca6946bd10a2c8bdc0d5053"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package
+
+DEPENDS = "zlib"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.43.0
#1 lore raw

This should probably go to meta-oe? Oe-core carries essential packages and toolchains and this doesn't seem like it meets the criteria.

Alex

Quoted 52 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

---
 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +22 -1
new file mode 100644
index 000000000000..838b4983c21d
@@ -0,0 +1,22 @@
+SUMMARY = "Library to access Firmware Update (FWU) metadata"
+
+DESCRIPTION = "This package contains a library to read and modify FWU \
+metadata. It provides a minimal API to allow userspace applications, such as \
+SWUpdate, RAUC or any other OTA update manager, to modify the boot bank \
+selection."
+
+HOMEPAGE = "https://github.com/passgat/libfwumdata"
+LICENSE = "LGPL-2.1-or-later"
+LIC_FILES_CHKSUM = "file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"
+SECTION = "libs"
+
+SRC_URI = "git://github.com/passgat/libfwumdata;protocol=https;branch=master"
+SRCREV = "c6e235d3cf0467211ca6946bd10a2c8bdc0d5053"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package
+
+DEPENDS = "zlib"
+
+BBCLASSEXTEND = "native"
--

2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#236110): https://lists.openembedded.org/g/openembedded-core/message/236110
Mute This Topic: https://lists.openembedded.org/mt/119065936/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hello Dario

I have some questions.

Why are you maintaining a custom version for this ?

I can see that U-boot has already a support for this:
https://github.com/u-boot/u-boot/tree/master/tools/fwumdata_src

Also, vendors U-boot provide support for this, such as ST/iMX:
https://github.com/STMicroelectronics/u-boot/blob/v2023.10-stm32mp/tools/mkfwumdata.c

I see that the already provided tool is enough to update metadata (supports V2), so what your library is adding to that ?

Do we really need it in OE core or meta-oe ?

Kind regards
Talel

Quoted 71 lines · Alexander Kanavin via lists.openembedded.org

This should probably go to meta-oe? Oe-core carries essential packages and toolchains and this doesn't seem like it meets the criteria.

Alex

Quoted 6 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

Review

Quoted 7 lines
---
 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb
(quoted diff) +0 -0

b/meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 4

Quoted 9 lines

new file mode 100644
index 000000000000..838b4983c21d

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +4 -0
@@ -0,0 +1,22 @@
+SUMMARY = "Library to access Firmware Update (FWU) metadata"
+
+DESCRIPTION = "This package contains a library to read and modify FWU \
+metadata. It provides a minimal API to allow userspace applications,

such as \

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 5

Quoted 1 line
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +1 -0
+SWUpdate, RAUC or any other OTA update manager, to modify the boot bank

\

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 5 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +5 -0
+selection."
+
+HOMEPAGE = "https://github.com/passgat/libfwumdata"
+LICENSE = "LGPL-2.1-or-later"
+LIC_FILES_CHKSUM =

"file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 3 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +3 -0
+SECTION = "libs"
+
+SRC_URI = "git://

github.com/passgat/libfwumdata;protocol=https;branch=master"

Quoted 10 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +9 -1
+SRCREV = "c6e235d3cf0467211ca6946bd10a2c8bdc0d5053"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package
+
+DEPENDS = "zlib"
+
+BBCLASSEXTEND = "native"
--
Quoted 5 lines

2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#236111):
https://lists.openembedded.org/g/openembedded-core/message/236111
Mute This Topic: https://lists.openembedded.org/mt/119065936/1955228
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Hi Talel,

Quoted 9 lines · Talel BELHADJ SALEM

Hello Dario

I have some questions.

Why are you maintaining a custom version for this ?

I can see that U-boot has already a support for this:
https://github.com/u-boot/u-boot/tree/master/tools/fwumdata_src

Quoted 8 lines

Also, vendors U-boot provide support for this, such as ST/iMX:
https://github.com/STMicroelectronics/u-boot/blob/v2023.10-stm32mp/tools/mkfwumdata.c

I see that the already provided tool is enough to update metadata (supports V2), so what your library is adding to that ?

Do we really need it in OE core or meta-oe ?

While the primary purpose of mkfwumdata is to generate a complete metadata image
from scratch, typically during the build process, the fwumdata tool, on the other
hand, was designed for targeted runtime manipulation of existing metadata.

The distinction between the two tools in a real-world scenario, can be seen in
my recent PR for the ST BSP [1];

Build-time: In commit [2] mkfwumdata is used to generate the initial metadata file
to be included in the WIC image.

git grep TF_A_METADATA_TOOL

recipes-bsp/trusted-firmware-a/tf-a-stm32mp.inc:TF_A_METADATA_TOOL_NAME ?= "mkfwumdata"

recipes-bsp/trusted-firmware-a/tf-a-stm32mp.inc:TF_A_METADATA_TOOL ?= "${STAGING_BINDIR_NATIVE}/${TF_A_METADATA_TOOL_NAME}"

Runtime: In commit [3], fwumdata is used within a systemd service. Upon boot, it
checks if the current bank is in the "valid" state and sets
it to "accepted" to
prevent the Arm Trusted Firmware (ATF) from performing an
unwanted rollback.

The next logical step, and the reason for this patch, is to allow OTA managers
like SWUpdate or RAUC, as well as proprietary applications, to easily trigger
a bank switch. While they could theoretically call the fwumdata command-line tool, providing a dedicated, lightweight C library is a much cleaner and more
integrated approach for C/C++ applications than relying on system() or exec().

Furthermore, this first version of libfwumdata (v0.1.0) minimizes write operations to just the three fields strictly necessary for boot bank selection:

- active_index
- previous_index
- bank_state

This limited scope currently provides the added benefit of increasing safety by
preventing userspace applications from accidentally corrupting other parts of
the metadata.

[1] https://github.com/STMicroelectronics/meta-st-stm32mp/pull/110
[2]
https://github.com/STMicroelectronics/meta-st-stm32mp/pull/110/changes/d7e32fdbfca3b4489a30f28101f0184e211733c6
[3]
https://github.com/STMicroelectronics/meta-st-stm32mp/pull/110/changes/ed6a9c52d9d32abcf281f986f0506ff4dbde1c5a

Thanks and regards,
Dario

Quoted 71 lines

Kind regards
Talel

Quoted 63 lines · Alexander Kanavin via lists.openembedded.org

This should probably go to meta-oe? Oe-core carries essential packages and toolchains and this doesn't seem like it meets the criteria.

Alex

Quoted 6 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

Review

Quoted 7 lines
---
 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb
(quoted diff) +0 -0

b/meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 4

Quoted 9 lines

new file mode 100644
index 000000000000..838b4983c21d

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +4 -0
@@ -0,0 +1,22 @@
+SUMMARY = "Library to access Firmware Update (FWU) metadata"
+
+DESCRIPTION = "This package contains a library to read and modify FWU \
+metadata. It provides a minimal API to allow userspace applications,

such as \

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 5

Quoted 1 line
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +1 -0
+SWUpdate, RAUC or any other OTA update manager, to modify the boot

bank \

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 5 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +5 -0
+selection."
+
+HOMEPAGE = "https://github.com/passgat/libfwumdata"
+LICENSE = "LGPL-2.1-or-later"
+LIC_FILES_CHKSUM =

"file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 3 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +3 -0
+SECTION = "libs"
+
+SRC_URI = "git://

github.com/passgat/libfwumdata;protocol=https;branch=master"

Quoted 15 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +9 -1
+SRCREV = "c6e235d3cf0467211ca6946bd10a2c8bdc0d5053"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package
+
+DEPENDS = "zlib"
+
+BBCLASSEXTEND = "native"
--

2.43.0

Signature · 9 lines
*Dario Binacchi*
Senior Embedded Software Engineer
M. +39 328 0625246
[email protected]
―――――――――――――――
Amarula Solutions SRL
 Via Felice Cavallotti 25D, 41012 Carpi, MO, IT
[email protected]
www.amarulasolutions.com
#4 lore raw
In reply to Alexander Kanavin

Hi Alexander,

Quoted 3 lines · Alexander Kanavin

This should probably go to meta-oe? Oe-core carries essential packages and toolchains and this doesn't seem like it meets the criteria.

Hi Alex,

I submitted this to oe-core because it seems to me similar to libubootenv. On platforms using the FWU A/B scheme (like STM32MP25), FWU metadata effectively
replaces traditional U-Boot variables as the only mechanism to control boot flow.

Furthermore I recently submitted a patch [1] to SWUpdate that uses this library.
The SWUpdate maintainer pointed out that managing these FWU metadata fields belongs logically to SWUpdate's "bootloader" interface, rather than being handled as a generic script. This reinforces that libfwumdata operates in the
exact same domain as U-Boot environment variables.

Finally, since it shares libubootenv's configuration pattern management, oe-core seemed the natural fit. However, I am perfectly fine moving it to meta-oe if you prefer.

[1] https://groups.google.com/g/swupdate/c/kYr2Hy-f3us

Thanks and regards,
Dario

Quoted 58 lines

Alex

Quoted 6 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

Review

Quoted 7 lines
---
 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb
(quoted diff) +0 -0

b/meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 4

Quoted 9 lines

new file mode 100644
index 000000000000..838b4983c21d

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +4 -0
@@ -0,0 +1,22 @@
+SUMMARY = "Library to access Firmware Update (FWU) metadata"
+
+DESCRIPTION = "This package contains a library to read and modify FWU \
+metadata. It provides a minimal API to allow userspace applications,

such as \

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb line 5

Quoted 1 line
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +1 -0
+SWUpdate, RAUC or any other OTA update manager, to modify the boot bank

\

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 5 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +5 -0
+selection."
+
+HOMEPAGE = "https://github.com/passgat/libfwumdata"
+LICENSE = "LGPL-2.1-or-later"
+LIC_FILES_CHKSUM =

"file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"

meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb

Quoted 3 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +3 -0
+SECTION = "libs"
+
+SRC_URI = "git://

github.com/passgat/libfwumdata;protocol=https;branch=master"

Quoted 15 lines
meta/recipes-bsp/u-boot/libfwumdata_0.1.0.bb new file +9 -1
+SRCREV = "c6e235d3cf0467211ca6946bd10a2c8bdc0d5053"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package
+
+DEPENDS = "zlib"
+
+BBCLASSEXTEND = "native"
--

2.43.0

Signature · 9 lines
*Dario Binacchi*
Senior Embedded Software Engineer
M. +39 328 0625246
[email protected]
―――――――――――――――
Amarula Solutions SRL
 Via Felice Cavallotti 25D, 41012 Carpi, MO, IT
[email protected]
www.amarulasolutions.com
#5 lore raw
In reply to Dario Binacchi
Quoted 7 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

---

Hi Dario,

Thanks for your patch.

In addition to Alex comment, I note build is failing on the autobuilder:

ERROR: libfwumdata-0.1.0-r0 do_unpack: Recipes that set S = "${WORKDIR}/git" or S = "${UNPACKDIR}/git" should remove that assignment, as S set by bitbake.conf in oe-core now works.

https://autobuilder.yoctoproject.org/valkyrie/#/builders/59/builds/3709

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

Hi Mathieu,

Quoted 12 lines · Mathieu Dubois-Briand
Quoted 7 lines · Dario Binacchi via lists.openembedded.org

libfwumdata is a lightweight C library for parsing, validating (CRC32), and manipulating Firmware Update (FWU) metadata, allowing tools such as RAUC or SWUpdate, and in general any application, to modify the boot bank selection.

---

Hi Dario,

Quoted 8 lines

Thanks for your patch.

In addition to Alex comment, I note build is failing on the autobuilder:

ERROR: libfwumdata-0.1.0-r0 do_unpack: Recipes that set S = "${WORKDIR}/git" or S = "${UNPACKDIR}/git" should remove that assignment, as S set by bitbake.conf in oe-core now works.

I will drop.

Thanks and regards,
Dario

Quoted 12 lines

https://autobuilder.yoctoproject.org/valkyrie/#/builders/59/builds/3709

Thanks,
Mathieu

--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 9 lines
*Dario Binacchi*
Senior Embedded Software Engineer
M. +39 328 0625246
[email protected]
―――――――――――――――
Amarula Solutions SRL
 Via Felice Cavallotti 25D, 41012 Carpi, MO, IT
[email protected]
www.amarulasolutions.com