* [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate
@ 2025-12-02 11:15 Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Anshul Dalal
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-02 11:15 UTC (permalink / raw)
To: meta-arago; +Cc: Anshul Dalal, vigneshr, denys, reatmon
Hi all,
This RFC adds support for SWUpdate[1] to meta-arago, this provides us with OTA
updates with A/B redundancy for the rootfs.
For now the support is enabled for eMMC boot only based on the 'ti-swupdate'
override. The below steps can be used to test this RFC on an AM62x EVM:
1. Add 'meta-swupdate' layer[2] to the SDK sources directory.
2. Since the bootloader side changes have not been merged to ti-u-boot yet,
make use of the 'swupdate' branch from my own U-Boot fork[3].
3. Enable 'swupdate' support by setting the 'ti-swupdate' override in
local.conf as follows:
DISTROOVERRIDES:append = ":ti-swupdate"
4. Flash the U-Boot binaries to the correct offsets on boot0 partition as
per the docs[4] and run 'env save' on first boot to save the environment to
eMMC's hw partition.
Regards,
Anshul
[1]: https://swupdate.org/
[2]: https://github.com/sbabic/meta-swupdate
[3]: https://github.com/ArchUsr64/u-boot/tree/swupdate
[4]: https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM62X/latest/exports/docs/linux/How_to_Guides/Target/How_to_emmc_boot.html#how-to-emmc-boot
Anshul Dalal (4):
swupdate: add systemd service to rootfs
swupdate: add creation of update image
swupdate: add bootloader support
swupdate: enable authentication for update image
meta-arago-distro/conf/distro/arago.conf | 3 ++
.../images/files/sw-description | 46 +++++++++++++++++++
.../recipes-swupdate/images/update-image.bb | 27 +++++++++++
.../libubootenv/files/fw_env.config | 5 ++
.../libubootenv/libubootenv_%.bbappend | 10 ++++
.../recipes-swupdate/swupdate/files/defconfig | 12 +++++
.../swupdate/files/swupdate.cfg | 13 ++++++
.../swupdate/files/swupdate.sh | 15 ++++++
.../swupdate/swupdate_%.bbappend | 35 ++++++++++++++
.../wic/sdimage-2part-swupdate.wks | 6 +++
10 files changed, 172 insertions(+)
create mode 100644 meta-arago-distro/recipes-swupdate/images/files/sw-description
create mode 100644 meta-arago-distro/recipes-swupdate/images/update-image.bb
create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
create mode 100644 meta-arago-distro/wic/sdimage-2part-swupdate.wks
--
2.52.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
@ 2025-12-02 11:15 ` Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 2/4] swupdate: add creation of update image Anshul Dalal
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-02 11:15 UTC (permalink / raw)
To: meta-arago; +Cc: Anshul Dalal, vigneshr, denys, reatmon
This patch adds basic support for A/B dual update mechanism where the
rootfs is duplicated to provide redundancy in case of an update failure.
The bbappend adds the modifications required to make SWUpdate suitable
for our use case. The new swupdate systemd service invokes swupdate.sh
on startup which starts an update server on the target platform.
The "ti-swupdate" override is used to selectively enable SWUpdate
support to the final tisdk image.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
meta-arago-distro/conf/distro/arago.conf | 1 +
.../recipes-swupdate/swupdate/files/defconfig | 9 ++++++
.../swupdate/files/swupdate.cfg | 13 +++++++++
.../swupdate/files/swupdate.sh | 11 ++++++++
.../swupdate/swupdate_%.bbappend | 28 +++++++++++++++++++
.../wic/sdimage-2part-swupdate.wks | 6 ++++
6 files changed, 68 insertions(+)
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
create mode 100644 meta-arago-distro/wic/sdimage-2part-swupdate.wks
diff --git a/meta-arago-distro/conf/distro/arago.conf b/meta-arago-distro/conf/distro/arago.conf
index abbe4faf..d8630718 100644
--- a/meta-arago-distro/conf/distro/arago.conf
+++ b/meta-arago-distro/conf/distro/arago.conf
@@ -34,6 +34,7 @@ IMAGE_FSTYPES += "tar.xz.md5sum"
# Extra boot files for WIC images
do_image_wic[depends] += "tisdk-uenv:do_deploy"
+WKS_FILE:ti-swupdate = "sdimage-2part-swupdate.wks"
IMAGE_BOOT_FILES += "uEnv.txt"
# Mask any broken recipes (currently none)
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
new file mode 100644
index 00000000..b1362eaa
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
@@ -0,0 +1,9 @@
+CONFIG_HW_COMPATIBILITY=y
+# CONFIG_LUA is not set
+# CONFIG_BOOTLOADER_NONE is not set
+CONFIG_SYSTEMD=y
+CONFIG_WEBSERVER=y
+CONFIG_CFI=y
+CONFIG_EMMC_HANDLER=y
+CONFIG_RAW=y
+CONFIG_SHELLSCRIPTHANDLER=y
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
new file mode 100644
index 00000000..5cb04b0c
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
@@ -0,0 +1,13 @@
+globals :
+{
+ verbose = true;
+ loglevel = 5;
+ syslog = true;
+};
+
+webserver :
+{
+ document_root = "/www";
+ userid = 0;
+ groupid = 0;
+};
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
new file mode 100644
index 00000000..bb3a3593
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+rootfs=$(swupdate -g)
+
+if [ $rootfs == '/dev/mmcblk0p2' ];then
+ SELECTION="-e stable,copy1"
+else
+ SELECTION="-e stable,copy2"
+fi
+
+swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
new file mode 100644
index 00000000..0ce763f9
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
@@ -0,0 +1,28 @@
+inherit swupdate-lib
+
+FILESEXTRAPATHS:append := "${THISDIR}/files:"
+
+FILES:${PN} += " \
+ ${SWUPDATE_HW_COMPATIBILITY_FILE} \
+"
+
+SRC_URI += " \
+ file://defconfig \
+ file://swupdate.sh \
+ file://swupdate.cfg \
+ "
+
+do_install:append () {
+ install -d ${D}
+ echo "${MACHINE} 1.0" > ${D}/${@d.getVar("SWUPDATE_HW_COMPATIBILITY_FILE")}
+
+ # We don't make use of conf.d in our swupdate.sh
+ rm -rf ${D}${libdir}/swupdate/conf.d
+
+ install -m 0755 ${WORKDIR}/swupdate.sh ${D}${libdir}/swupdate/
+ sed -i "s#@MACHINE@#${MACHINE}#g" ${D}${libdir}/swupdate/swupdate.sh
+
+ install -d ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
+ sed -i "s#@MACHINE@#${MACHINE}#g" ${D}${sysconfdir}/swupdate.cfg
+}
diff --git a/meta-arago-distro/wic/sdimage-2part-swupdate.wks b/meta-arago-distro/wic/sdimage-2part-swupdate.wks
new file mode 100644
index 00000000..cf3b6f03
--- /dev/null
+++ b/meta-arago-distro/wic/sdimage-2part-swupdate.wks
@@ -0,0 +1,6 @@
+# short-description: Create SD card image with A/B partitions for SWUpdate
+# long-description: Creates a partitioned SD card image for TI platforms with SWUpdate support.
+# Check https://sbabic.github.io/swupdate/scenarios.html#double-copy-with-fall-back
+
+part / --source rootfs --fstype=ext4 --label rootfs_1 --align 1024 --use-uuid
+part / --source rootfs --fstype=ext4 --label rootfs_2 --align 1024 --use-uuid
--
2.52.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [meta-arago][scarthgap][PATCH RFC 2/4] swupdate: add creation of update image
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Anshul Dalal
@ 2025-12-02 11:15 ` Anshul Dalal
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-02 11:15 UTC (permalink / raw)
To: meta-arago; +Cc: Anshul Dalal, vigneshr, denys, reatmon
SWUpdate makes use of a CPIO archive with a sw-description header that
contains the metadata for the update image.
This patch adds a new update-image recipe which enables creation of such
image based on what the user sets IMAGE_BASENAME to.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
meta-arago-distro/conf/distro/arago.conf | 2 ++
.../images/files/sw-description | 32 +++++++++++++++++++
.../recipes-swupdate/images/update-image.bb | 23 +++++++++++++
3 files changed, 57 insertions(+)
create mode 100644 meta-arago-distro/recipes-swupdate/images/files/sw-description
create mode 100644 meta-arago-distro/recipes-swupdate/images/update-image.bb
diff --git a/meta-arago-distro/conf/distro/arago.conf b/meta-arago-distro/conf/distro/arago.conf
index d8630718..42124577 100644
--- a/meta-arago-distro/conf/distro/arago.conf
+++ b/meta-arago-distro/conf/distro/arago.conf
@@ -31,6 +31,8 @@ SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_VERSION}"
SDKPATHINSTALL = "/opt/${SDK_NAME}"
IMAGE_FSTYPES += "tar.xz.md5sum"
+IMAGE_FSTYPES:append:ti-swupdate = " ext4.gz"
+IMAGE_INSTALL:append:ti-swupdate = " swupdate swupdate-www"
# Extra boot files for WIC images
do_image_wic[depends] += "tisdk-uenv:do_deploy"
diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
new file mode 100644
index 00000000..8dc4e2b2
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
@@ -0,0 +1,32 @@
+software =
+{
+ version = "0.1.0";
+
+ @@MACHINE@@ = {
+ hardware-compatibility: [ "1.0"];
+ stable : {
+
+ copy1 : {
+ images: (
+ {
+ filename = "@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz";
+ device = "/dev/mmcblk0p1";
+ type = "raw";
+ compressed = "zlib";
+ },
+ );
+ };
+
+ copy2 : {
+ images: (
+ {
+ filename = "@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz";
+ device = "/dev/mmcblk0p2";
+ type = "raw";
+ compressed = "zlib";
+ },
+ );
+ };
+ };
+ }
+}
diff --git a/meta-arago-distro/recipes-swupdate/images/update-image.bb b/meta-arago-distro/recipes-swupdate/images/update-image.bb
new file mode 100644
index 00000000..33b0b74c
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/images/update-image.bb
@@ -0,0 +1,23 @@
+inherit swupdate
+
+IMAGE_BASENAME ?= "tisdk-default-image"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "\
+ file://sw-description \
+"
+
+# images to build before building swupdate image
+IMAGE_DEPENDS = "${IMAGE_BASENAME}"
+
+SWUPDATE_IMAGES = "${IMAGE_BASENAME}"
+
+SWUPDATE_IMAGES_FSTYPES[tisdk-base-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-tiny-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-default-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-jailhouse-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-thinlinux-image] = ".rootfs.ext4.gz"
+SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-base-image] = ".rootfs.ext4.gz"
--
2.52.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 2/4] swupdate: add creation of update image Anshul Dalal
@ 2025-12-02 11:16 ` Anshul Dalal
2025-12-02 19:23 ` Andrew Davis
2025-12-03 5:58 ` Yogesh Hegde
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 4/4] swupdate: enable authentication for update image Anshul Dalal
` (2 subsequent siblings)
5 siblings, 2 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-02 11:16 UTC (permalink / raw)
To: meta-arago; +Cc: Anshul Dalal, vigneshr, denys, reatmon
U-Boot uses the 'bootpart' env variable to configure the rootfs for the
kernel at boot. The BACKUP_REG0 MMR is also used to store bootcount as
per U-Boot requirements[1].
After each reset, U-Boot increments the bootcount and it's reset to 0 by
the swupdate service indicating a successful boot. If the kernel panics
however (eg. if the update failed), the bootcount is never reset and
keeps on getting incremented by U-Boot until it reaches certain
threshold after which U-Boot switches to the other non-updated partition
to ensure a successful boot.
This patch adds support for the same to the final .swu image generated
by the update-image recipe.
[1]: https://docs.u-boot.org/en/latest/api/bootcount.html
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
.../recipes-swupdate/images/files/sw-description | 12 ++++++++++++
.../recipes-swupdate/libubootenv/files/fw_env.config | 5 +++++
.../libubootenv/libubootenv_%.bbappend | 10 ++++++++++
.../recipes-swupdate/swupdate/files/defconfig | 2 ++
.../recipes-swupdate/swupdate/files/swupdate.sh | 4 ++++
.../recipes-swupdate/swupdate/swupdate_%.bbappend | 2 ++
6 files changed, 35 insertions(+)
create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
index 8dc4e2b2..241bc95c 100644
--- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
+++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
@@ -15,6 +15,12 @@ software =
compressed = "zlib";
},
);
+ uboot: (
+ {
+ name = "bootpart";
+ value = "0:1";
+ },
+ );
};
copy2 : {
@@ -26,6 +32,12 @@ software =
compressed = "zlib";
},
);
+ uboot: (
+ {
+ name = "bootpart";
+ value = "0:2";
+ },
+ );
};
};
}
diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
new file mode 100644
index 00000000..57eec5fc
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
@@ -0,0 +1,5 @@
+# Describes the env location for U-Boot in the hw partition
+# Second entry indicates redundant env
+# Boot dev Offset Size
+/dev/mmcblk0boot0 0x680000 0x20000
+/dev/mmcblk0boot0 0x6a0000 0x20000
diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
new file mode 100644
index 00000000..e3d142f2
--- /dev/null
+++ b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = " file://fw_env.config"
+
+do_install:append() {
+ install -d ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}
+}
+
+FILES:${PN}:append = " ${sysconfdir}"
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
index b1362eaa..4a2d78c0 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
@@ -1,8 +1,10 @@
CONFIG_HW_COMPATIBILITY=y
# CONFIG_LUA is not set
# CONFIG_BOOTLOADER_NONE is not set
+CONFIG_UBOOT=y
CONFIG_SYSTEMD=y
CONFIG_WEBSERVER=y
+CONFIG_BOOTLOADERHANDLER=y
CONFIG_CFI=y
CONFIG_EMMC_HANDLER=y
CONFIG_RAW=y
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
index bb3a3593..2083062e 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
@@ -8,4 +8,8 @@ else
SELECTION="-e stable,copy2"
fi
+# BACKUP_REG0 MMR on AM62x
+UBOOT_BOOTCOUNT_ADDR=0x4301c100
+
+devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
index 0ce763f9..20f87435 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
+++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
@@ -2,6 +2,8 @@ inherit swupdate-lib
FILESEXTRAPATHS:append := "${THISDIR}/files:"
+RDEPENDS:${PN} += "devmem2"
+
FILES:${PN} += " \
${SWUPDATE_HW_COMPATIBILITY_FILE} \
"
--
2.52.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [meta-arago][scarthgap][PATCH RFC 4/4] swupdate: enable authentication for update image
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
` (2 preceding siblings ...)
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
@ 2025-12-02 11:16 ` Anshul Dalal
2025-12-02 20:59 ` [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Denys Dmytriyenko
2026-05-29 12:33 ` Romain Naour
5 siblings, 0 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-02 11:16 UTC (permalink / raw)
To: meta-arago; +Cc: Anshul Dalal, vigneshr, denys, reatmon
To ensure the platform can only be updated from an authorised source,
this patch adds signing to the .swu update image using the pre-existing
custMpk keys from ti-secdev.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
.../recipes-swupdate/images/files/sw-description | 2 ++
meta-arago-distro/recipes-swupdate/images/update-image.bb | 4 ++++
meta-arago-distro/recipes-swupdate/swupdate/files/defconfig | 1 +
.../recipes-swupdate/swupdate/files/swupdate.sh | 2 +-
.../recipes-swupdate/swupdate/swupdate_%.bbappend | 5 +++++
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
index 241bc95c..8a7e5f4d 100644
--- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
+++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
@@ -13,6 +13,7 @@ software =
device = "/dev/mmcblk0p1";
type = "raw";
compressed = "zlib";
+ sha256 = "$swupdate_get_sha256(@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz)";
},
);
uboot: (
@@ -30,6 +31,7 @@ software =
device = "/dev/mmcblk0p2";
type = "raw";
compressed = "zlib";
+ sha256 = "$swupdate_get_sha256(@@IMAGE_BASENAME@@-@@MACHINE@@.rootfs.ext4.gz)";
},
);
uboot: (
diff --git a/meta-arago-distro/recipes-swupdate/images/update-image.bb b/meta-arago-distro/recipes-swupdate/images/update-image.bb
index 33b0b74c..6176e5a6 100644
--- a/meta-arago-distro/recipes-swupdate/images/update-image.bb
+++ b/meta-arago-distro/recipes-swupdate/images/update-image.bb
@@ -1,4 +1,5 @@
inherit swupdate
+inherit ti-secdev
IMAGE_BASENAME ?= "tisdk-default-image"
@@ -21,3 +22,6 @@ SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-image] = ".rootfs.ext4.gz"
SWUPDATE_IMAGES_FSTYPES[tisdk-jailhouse-image] = ".rootfs.ext4.gz"
SWUPDATE_IMAGES_FSTYPES[tisdk-thinlinux-image] = ".rootfs.ext4.gz"
SWUPDATE_IMAGES_FSTYPES[tisdk-bootstrap-base-image] = ".rootfs.ext4.gz"
+
+SWUPDATE_SIGNING = "RSA"
+SWUPDATE_PRIVATE_KEY = "${TI_SECURE_DEV_PKG}/keys/custMpk.key"
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
index 4a2d78c0..0bf605f7 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
@@ -4,6 +4,7 @@ CONFIG_HW_COMPATIBILITY=y
CONFIG_UBOOT=y
CONFIG_SYSTEMD=y
CONFIG_WEBSERVER=y
+CONFIG_SIGNED_IMAGES=y
CONFIG_BOOTLOADERHANDLER=y
CONFIG_CFI=y
CONFIG_EMMC_HANDLER=y
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
index 2083062e..fc32e4cf 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
+++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
@@ -12,4 +12,4 @@ fi
UBOOT_BOOTCOUNT_ADDR=0x4301c100
devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
-swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
+swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080" -k /etc/custMpk.pub
diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
index 20f87435..bff44926 100644
--- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
+++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
@@ -1,4 +1,5 @@
inherit swupdate-lib
+inherit ti-secdev
FILESEXTRAPATHS:append := "${THISDIR}/files:"
@@ -8,6 +9,8 @@ FILES:${PN} += " \
${SWUPDATE_HW_COMPATIBILITY_FILE} \
"
+DEPENDS += "openssl-native"
+
SRC_URI += " \
file://defconfig \
file://swupdate.sh \
@@ -27,4 +30,6 @@ do_install:append () {
install -d ${D}${sysconfdir}
install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
sed -i "s#@MACHINE@#${MACHINE}#g" ${D}${sysconfdir}/swupdate.cfg
+
+ openssl rsa -in ${TI_SECURE_DEV_PKG}/keys/custMpk.key -pubout -out ${D}/etc/custMpk.pub
}
--
2.52.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
@ 2025-12-02 19:23 ` Andrew Davis
2025-12-03 10:16 ` Anshul Dalal
2025-12-03 5:58 ` Yogesh Hegde
1 sibling, 1 reply; 12+ messages in thread
From: Andrew Davis @ 2025-12-02 19:23 UTC (permalink / raw)
To: anshuld, meta-arago; +Cc: vigneshr, denys, reatmon
On 12/2/25 5:16 AM, Anshul Dalal via lists.yoctoproject.org wrote:
> U-Boot uses the 'bootpart' env variable to configure the rootfs for the
> kernel at boot. The BACKUP_REG0 MMR is also used to store bootcount as
> per U-Boot requirements[1].
>
> After each reset, U-Boot increments the bootcount and it's reset to 0 by
> the swupdate service indicating a successful boot. If the kernel panics
> however (eg. if the update failed), the bootcount is never reset and
> keeps on getting incremented by U-Boot until it reaches certain
> threshold after which U-Boot switches to the other non-updated partition
> to ensure a successful boot.
>
> This patch adds support for the same to the final .swu image generated
> by the update-image recipe.
>
> [1]: https://docs.u-boot.org/en/latest/api/bootcount.html
>
> Signed-off-by: Anshul Dalal <anshuld@ti.com>
> ---
> .../recipes-swupdate/images/files/sw-description | 12 ++++++++++++
> .../recipes-swupdate/libubootenv/files/fw_env.config | 5 +++++
> .../libubootenv/libubootenv_%.bbappend | 10 ++++++++++
> .../recipes-swupdate/swupdate/files/defconfig | 2 ++
> .../recipes-swupdate/swupdate/files/swupdate.sh | 4 ++++
> .../recipes-swupdate/swupdate/swupdate_%.bbappend | 2 ++
> 6 files changed, 35 insertions(+)
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>
> diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
> index 8dc4e2b2..241bc95c 100644
> --- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
> +++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
> @@ -15,6 +15,12 @@ software =
> compressed = "zlib";
> },
> );
> + uboot: (
> + {
> + name = "bootpart";
> + value = "0:1";
> + },
> + );
> };
>
> copy2 : {
> @@ -26,6 +32,12 @@ software =
> compressed = "zlib";
> },
> );
> + uboot: (
> + {
> + name = "bootpart";
> + value = "0:2";
> + },
> + );
> };
> };
> }
> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> new file mode 100644
> index 00000000..57eec5fc
> --- /dev/null
> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> @@ -0,0 +1,5 @@
> +# Describes the env location for U-Boot in the hw partition
> +# Second entry indicates redundant env
> +# Boot dev Offset Size
> +/dev/mmcblk0boot0 0x680000 0x20000
> +/dev/mmcblk0boot0 0x6a0000 0x20000
> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> new file mode 100644
> index 00000000..e3d142f2
> --- /dev/null
> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> @@ -0,0 +1,10 @@
> +FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
> +
> +SRC_URI:append = " file://fw_env.config"
> +
> +do_install:append() {
> + install -d ${D}${sysconfdir}
> + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}
> +}
> +
> +FILES:${PN}:append = " ${sysconfdir}"
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> index b1362eaa..4a2d78c0 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> @@ -1,8 +1,10 @@
> CONFIG_HW_COMPATIBILITY=y
> # CONFIG_LUA is not set
> # CONFIG_BOOTLOADER_NONE is not set
> +CONFIG_UBOOT=y
> CONFIG_SYSTEMD=y
> CONFIG_WEBSERVER=y
> +CONFIG_BOOTLOADERHANDLER=y
> CONFIG_CFI=y
> CONFIG_EMMC_HANDLER=y
> CONFIG_RAW=y
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> index bb3a3593..2083062e 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> @@ -8,4 +8,8 @@ else
> SELECTION="-e stable,copy2"
> fi
>
> +# BACKUP_REG0 MMR on AM62x
> +UBOOT_BOOTCOUNT_ADDR=0x4301c100
> +
> +devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
Yuck, magic memory locations and /dev/mem, I'm trying to get
rid of our dependence on /dev/mem in general so let's not add
to the problem. How about CONFIG_BOOTCOUNT_FS?
Or maybe store it in an EFI variable, look into efivarfs and
see if we can do something with that to allow usersapce access
to this count.
Andrew
> swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> index 0ce763f9..20f87435 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> @@ -2,6 +2,8 @@ inherit swupdate-lib
>
> FILESEXTRAPATHS:append := "${THISDIR}/files:"
>
> +RDEPENDS:${PN} += "devmem2"
> +
> FILES:${PN} += " \
> ${SWUPDATE_HW_COMPATIBILITY_FILE} \
> "
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
` (3 preceding siblings ...)
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 4/4] swupdate: enable authentication for update image Anshul Dalal
@ 2025-12-02 20:59 ` Denys Dmytriyenko
2025-12-03 14:07 ` Raghavendra, Vignesh
2026-05-29 12:33 ` Romain Naour
5 siblings, 1 reply; 12+ messages in thread
From: Denys Dmytriyenko @ 2025-12-02 20:59 UTC (permalink / raw)
To: anshuld; +Cc: meta-arago, vigneshr, denys, reatmon
On Tue, Dec 02, 2025 at 04:45:57PM +0530, Anshul Dalal via lists.yoctoproject.org wrote:
> Hi all,
>
> This RFC adds support for SWUpdate[1] to meta-arago, this provides us with OTA
> updates with A/B redundancy for the rootfs.
>
> For now the support is enabled for eMMC boot only based on the 'ti-swupdate'
> override. The below steps can be used to test this RFC on an AM62x EVM:
>
> 1. Add 'meta-swupdate' layer[2] to the SDK sources directory.
>
> 2. Since the bootloader side changes have not been merged to ti-u-boot yet,
> make use of the 'swupdate' branch from my own U-Boot fork[3].
>
> 3. Enable 'swupdate' support by setting the 'ti-swupdate' override in
> local.conf as follows:
>
> DISTROOVERRIDES:append = ":ti-swupdate"
>
> 4. Flash the U-Boot binaries to the correct offsets on boot0 partition as
> per the docs[4] and run 'env save' on first boot to save the environment to
> eMMC's hw partition.
Why not use a more established A/B solution, such as RAUC (or even Mender)?
> Regards,
> Anshul
>
> [1]: https://swupdate.org/
> [2]: https://github.com/sbabic/meta-swupdate
> [3]: https://github.com/ArchUsr64/u-boot/tree/swupdate
> [4]: https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM62X/latest/exports/docs/linux/How_to_Guides/Target/How_to_emmc_boot.html#how-to-emmc-boot
>
> Anshul Dalal (4):
> swupdate: add systemd service to rootfs
> swupdate: add creation of update image
> swupdate: add bootloader support
> swupdate: enable authentication for update image
>
> meta-arago-distro/conf/distro/arago.conf | 3 ++
> .../images/files/sw-description | 46 +++++++++++++++++++
> .../recipes-swupdate/images/update-image.bb | 27 +++++++++++
> .../libubootenv/files/fw_env.config | 5 ++
> .../libubootenv/libubootenv_%.bbappend | 10 ++++
> .../recipes-swupdate/swupdate/files/defconfig | 12 +++++
> .../swupdate/files/swupdate.cfg | 13 ++++++
> .../swupdate/files/swupdate.sh | 15 ++++++
> .../swupdate/swupdate_%.bbappend | 35 ++++++++++++++
> .../wic/sdimage-2part-swupdate.wks | 6 +++
> 10 files changed, 172 insertions(+)
> create mode 100644 meta-arago-distro/recipes-swupdate/images/files/sw-description
> create mode 100644 meta-arago-distro/recipes-swupdate/images/update-image.bb
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> create mode 100644 meta-arago-distro/wic/sdimage-2part-swupdate.wks
>
> --
> 2.52.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
2025-12-02 19:23 ` Andrew Davis
@ 2025-12-03 5:58 ` Yogesh Hegde
2025-12-03 10:23 ` Anshul Dalal
1 sibling, 1 reply; 12+ messages in thread
From: Yogesh Hegde @ 2025-12-03 5:58 UTC (permalink / raw)
To: anshuld; +Cc: meta-arago, vigneshr, denys, reatmon
On 16:46-20251202, Anshul Dalal via lists.yoctoproject.org wrote:
> U-Boot uses the 'bootpart' env variable to configure the rootfs for the
> kernel at boot. The BACKUP_REG0 MMR is also used to store bootcount as
> per U-Boot requirements[1].
>
> After each reset, U-Boot increments the bootcount and it's reset to 0 by
> the swupdate service indicating a successful boot. If the kernel panics
> however (eg. if the update failed), the bootcount is never reset and
> keeps on getting incremented by U-Boot until it reaches certain
> threshold after which U-Boot switches to the other non-updated partition
> to ensure a successful boot.
>
> This patch adds support for the same to the final .swu image generated
> by the update-image recipe.
>
> [1]: https://docs.u-boot.org/en/latest/api/bootcount.html
>
> Signed-off-by: Anshul Dalal <anshuld@ti.com>
> ---
> .../recipes-swupdate/images/files/sw-description | 12 ++++++++++++
> .../recipes-swupdate/libubootenv/files/fw_env.config | 5 +++++
> .../libubootenv/libubootenv_%.bbappend | 10 ++++++++++
> .../recipes-swupdate/swupdate/files/defconfig | 2 ++
> .../recipes-swupdate/swupdate/files/swupdate.sh | 4 ++++
> .../recipes-swupdate/swupdate/swupdate_%.bbappend | 2 ++
> 6 files changed, 35 insertions(+)
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>
> diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
> index 8dc4e2b2..241bc95c 100644
> --- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
> +++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
> @@ -15,6 +15,12 @@ software =
> compressed = "zlib";
> },
> );
> + uboot: (
> + {
> + name = "bootpart";
> + value = "0:1";
> + },
> + );
> };
>
> copy2 : {
> @@ -26,6 +32,12 @@ software =
> compressed = "zlib";
> },
> );
> + uboot: (
> + {
> + name = "bootpart";
> + value = "0:2";
> + },
> + );
> };
> };
> }
> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> new file mode 100644
> index 00000000..57eec5fc
> --- /dev/null
> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> @@ -0,0 +1,5 @@
> +# Describes the env location for U-Boot in the hw partition
> +# Second entry indicates redundant env
> +# Boot dev Offset Size
> +/dev/mmcblk0boot0 0x680000 0x20000
> +/dev/mmcblk0boot0 0x6a0000 0x20000
Does this fw_env.config work for all machines?
> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> new file mode 100644
> index 00000000..e3d142f2
> --- /dev/null
> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> @@ -0,0 +1,10 @@
> +FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
> +
> +SRC_URI:append = " file://fw_env.config"
If this config is not tested on all boards, it would be best to only append it
to the machines that are tested.
> +
> +do_install:append() {
> + install -d ${D}${sysconfdir}
> + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}
> +}
> +
> +FILES:${PN}:append = " ${sysconfdir}"
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> index b1362eaa..4a2d78c0 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> @@ -1,8 +1,10 @@
> CONFIG_HW_COMPATIBILITY=y
> # CONFIG_LUA is not set
> # CONFIG_BOOTLOADER_NONE is not set
> +CONFIG_UBOOT=y
> CONFIG_SYSTEMD=y
> CONFIG_WEBSERVER=y
> +CONFIG_BOOTLOADERHANDLER=y
> CONFIG_CFI=y
> CONFIG_EMMC_HANDLER=y
> CONFIG_RAW=y
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> index bb3a3593..2083062e 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> @@ -8,4 +8,8 @@ else
> SELECTION="-e stable,copy2"
> fi
>
> +# BACKUP_REG0 MMR on AM62x
> +UBOOT_BOOTCOUNT_ADDR=0x4301c100
> +
> +devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
Using devmem2 might be a bad idea. Consider using fw_setenv [1] to set
the bootcount to 0.
[1] https://manpages.debian.org/testing/libubootenv-tool/fw_setenv.8.en.html
-- Yogesh
> swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> index 0ce763f9..20f87435 100644
> --- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> +++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> @@ -2,6 +2,8 @@ inherit swupdate-lib
>
> FILESEXTRAPATHS:append := "${THISDIR}/files:"
>
> +RDEPENDS:${PN} += "devmem2"
> +
> FILES:${PN} += " \
> ${SWUPDATE_HW_COMPATIBILITY_FILE} \
> "
> --
> 2.52.0
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16850): https://lists.yoctoproject.org/g/meta-arago/message/16850
> Mute This Topic: https://lists.yoctoproject.org/mt/116574476/9980049
> Group Owner: meta-arago+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub [y-hegde@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support
2025-12-02 19:23 ` Andrew Davis
@ 2025-12-03 10:16 ` Anshul Dalal
0 siblings, 0 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-03 10:16 UTC (permalink / raw)
To: Andrew Davis, anshuld, meta-arago; +Cc: vigneshr, denys, reatmon
On Wed Dec 3, 2025 at 12:53 AM IST, Andrew Davis wrote:
> On 12/2/25 5:16 AM, Anshul Dalal via lists.yoctoproject.org wrote:
>> U-Boot uses the 'bootpart' env variable to configure the rootfs for the
>> kernel at boot. The BACKUP_REG0 MMR is also used to store bootcount as
>> per U-Boot requirements[1].
>>
>> After each reset, U-Boot increments the bootcount and it's reset to 0 by
>> the swupdate service indicating a successful boot. If the kernel panics
>> however (eg. if the update failed), the bootcount is never reset and
>> keeps on getting incremented by U-Boot until it reaches certain
>> threshold after which U-Boot switches to the other non-updated partition
>> to ensure a successful boot.
>>
>> This patch adds support for the same to the final .swu image generated
>> by the update-image recipe.
>>
>> [1]: https://docs.u-boot.org/en/latest/api/bootcount.html
>>
>> Signed-off-by: Anshul Dalal <anshuld@ti.com>
>> ---
>> .../recipes-swupdate/images/files/sw-description | 12 ++++++++++++
>> .../recipes-swupdate/libubootenv/files/fw_env.config | 5 +++++
>> .../libubootenv/libubootenv_%.bbappend | 10 ++++++++++
>> .../recipes-swupdate/swupdate/files/defconfig | 2 ++
>> .../recipes-swupdate/swupdate/files/swupdate.sh | 4 ++++
>> .../recipes-swupdate/swupdate/swupdate_%.bbappend | 2 ++
>> 6 files changed, 35 insertions(+)
>> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>>
>> diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> index 8dc4e2b2..241bc95c 100644
>> --- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> +++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> @@ -15,6 +15,12 @@ software =
>> compressed = "zlib";
>> },
>> );
>> + uboot: (
>> + {
>> + name = "bootpart";
>> + value = "0:1";
>> + },
>> + );
>> };
>>
>> copy2 : {
>> @@ -26,6 +32,12 @@ software =
>> compressed = "zlib";
>> },
>> );
>> + uboot: (
>> + {
>> + name = "bootpart";
>> + value = "0:2";
>> + },
>> + );
>> };
>> };
>> }
>> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> new file mode 100644
>> index 00000000..57eec5fc
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> @@ -0,0 +1,5 @@
>> +# Describes the env location for U-Boot in the hw partition
>> +# Second entry indicates redundant env
>> +# Boot dev Offset Size
>> +/dev/mmcblk0boot0 0x680000 0x20000
>> +/dev/mmcblk0boot0 0x6a0000 0x20000
>> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>> new file mode 100644
>> index 00000000..e3d142f2
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>> @@ -0,0 +1,10 @@
>> +FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
>> +
>> +SRC_URI:append = " file://fw_env.config"
>> +
>> +do_install:append() {
>> + install -d ${D}${sysconfdir}
>> + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}
>> +}
>> +
>> +FILES:${PN}:append = " ${sysconfdir}"
>> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> index b1362eaa..4a2d78c0 100644
>> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> @@ -1,8 +1,10 @@
>> CONFIG_HW_COMPATIBILITY=y
>> # CONFIG_LUA is not set
>> # CONFIG_BOOTLOADER_NONE is not set
>> +CONFIG_UBOOT=y
>> CONFIG_SYSTEMD=y
>> CONFIG_WEBSERVER=y
>> +CONFIG_BOOTLOADERHANDLER=y
>> CONFIG_CFI=y
>> CONFIG_EMMC_HANDLER=y
>> CONFIG_RAW=y
>> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> index bb3a3593..2083062e 100644
>> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> @@ -8,4 +8,8 @@ else
>> SELECTION="-e stable,copy2"
>> fi
>>
>> +# BACKUP_REG0 MMR on AM62x
>> +UBOOT_BOOTCOUNT_ADDR=0x4301c100
>> +
>> +devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
>
> Yuck, magic memory locations and /dev/mem, I'm trying to get
> rid of our dependence on /dev/mem in general so let's not add
> to the problem. How about CONFIG_BOOTCOUNT_FS?
>
As Yogesh suggested, it might be better to go with env since it's more
commonly used.
This would eliminate the need for devmem as well.
> Or maybe store it in an EFI variable, look into efivarfs and
> see if we can do something with that to allow usersapce access
> to this count.
>
The A/B rollback is already well supported with EFI (that's how CIP does
it for example), what we want to provide is redundancy for the entire
software stack including the bootloader. This RFC doesn't implement it
yet but this will be added in a later revision.
Regards,
Anshul
[snip]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support
2025-12-03 5:58 ` Yogesh Hegde
@ 2025-12-03 10:23 ` Anshul Dalal
0 siblings, 0 replies; 12+ messages in thread
From: Anshul Dalal @ 2025-12-03 10:23 UTC (permalink / raw)
To: Yogesh Hegde, anshuld; +Cc: meta-arago, vigneshr, denys, reatmon
On Wed Dec 3, 2025 at 11:28 AM IST, Yogesh Hegde wrote:
> On 16:46-20251202, Anshul Dalal via lists.yoctoproject.org wrote:
>> U-Boot uses the 'bootpart' env variable to configure the rootfs for the
>> kernel at boot. The BACKUP_REG0 MMR is also used to store bootcount as
>> per U-Boot requirements[1].
>>
>> After each reset, U-Boot increments the bootcount and it's reset to 0 by
>> the swupdate service indicating a successful boot. If the kernel panics
>> however (eg. if the update failed), the bootcount is never reset and
>> keeps on getting incremented by U-Boot until it reaches certain
>> threshold after which U-Boot switches to the other non-updated partition
>> to ensure a successful boot.
>>
>> This patch adds support for the same to the final .swu image generated
>> by the update-image recipe.
>>
>> [1]: https://docs.u-boot.org/en/latest/api/bootcount.html
>>
>> Signed-off-by: Anshul Dalal <anshuld@ti.com>
>> ---
>> .../recipes-swupdate/images/files/sw-description | 12 ++++++++++++
>> .../recipes-swupdate/libubootenv/files/fw_env.config | 5 +++++
>> .../libubootenv/libubootenv_%.bbappend | 10 ++++++++++
>> .../recipes-swupdate/swupdate/files/defconfig | 2 ++
>> .../recipes-swupdate/swupdate/files/swupdate.sh | 4 ++++
>> .../recipes-swupdate/swupdate/swupdate_%.bbappend | 2 ++
>> 6 files changed, 35 insertions(+)
>> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>>
>> diff --git a/meta-arago-distro/recipes-swupdate/images/files/sw-description b/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> index 8dc4e2b2..241bc95c 100644
>> --- a/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> +++ b/meta-arago-distro/recipes-swupdate/images/files/sw-description
>> @@ -15,6 +15,12 @@ software =
>> compressed = "zlib";
>> },
>> );
>> + uboot: (
>> + {
>> + name = "bootpart";
>> + value = "0:1";
>> + },
>> + );
>> };
>>
>> copy2 : {
>> @@ -26,6 +32,12 @@ software =
>> compressed = "zlib";
>> },
>> );
>> + uboot: (
>> + {
>> + name = "bootpart";
>> + value = "0:2";
>> + },
>> + );
>> };
>> };
>> }
>> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> new file mode 100644
>> index 00000000..57eec5fc
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
>> @@ -0,0 +1,5 @@
>> +# Describes the env location for U-Boot in the hw partition
>> +# Second entry indicates redundant env
>> +# Boot dev Offset Size
>> +/dev/mmcblk0boot0 0x680000 0x20000
>> +/dev/mmcblk0boot0 0x6a0000 0x20000
>
> Does this fw_env.config work for all machines?
>
No, AM64x and J7200 make use of different offsets. Though it might make
sense to move the libubootenv configuration to meta-ti altogether with
the config under libubootenv/files/<SOC_OVERRIDE>/fw_env.config.
Since this config is not only useful for SWUpdate with arago but anybody
trying to make use fw_* tools on our platforms.
>> diff --git a/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>> new file mode 100644
>> index 00000000..e3d142f2
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
>> @@ -0,0 +1,10 @@
>> +FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
>> +
>> +SRC_URI:append = " file://fw_env.config"
>
> If this config is not tested on all boards, it would be best to only append it
> to the machines that are tested.
>
That's fair, perhaps we should error out on builds with untested
platforms with 'ti-swupdate' active.
>> +
>> +do_install:append() {
>> + install -d ${D}${sysconfdir}
>> + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}
>> +}
>> +
>> +FILES:${PN}:append = " ${sysconfdir}"
>> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> index b1362eaa..4a2d78c0 100644
>> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
>> @@ -1,8 +1,10 @@
>> CONFIG_HW_COMPATIBILITY=y
>> # CONFIG_LUA is not set
>> # CONFIG_BOOTLOADER_NONE is not set
>> +CONFIG_UBOOT=y
>> CONFIG_SYSTEMD=y
>> CONFIG_WEBSERVER=y
>> +CONFIG_BOOTLOADERHANDLER=y
>> CONFIG_CFI=y
>> CONFIG_EMMC_HANDLER=y
>> CONFIG_RAW=y
>> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> index bb3a3593..2083062e 100644
>> --- a/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> +++ b/meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
>> @@ -8,4 +8,8 @@ else
>> SELECTION="-e stable,copy2"
>> fi
>>
>> +# BACKUP_REG0 MMR on AM62x
>> +UBOOT_BOOTCOUNT_ADDR=0x4301c100
>> +
>> +devmem2 $UBOOT_BOOTCOUNT_ADDR w 0
>
> Using devmem2 might be a bad idea. Consider using fw_setenv [1] to set
> the bootcount to 0.
>
Yeah, this should be trivial to support with libubootenv-bin added to
IMAGE_INSTALL.
Regards,
Anshul
>
>> swupdate -H @MACHINE@:1.0 ${SELECTION} -p 'reboot' -f /etc/swupdate.cfg -w "-r /www -p 8080"
>> diff --git a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
>> index 0ce763f9..20f87435 100644
>> --- a/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
>> +++ b/meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
>> @@ -2,6 +2,8 @@ inherit swupdate-lib
>>
>> FILESEXTRAPATHS:append := "${THISDIR}/files:"
>>
>> +RDEPENDS:${PN} += "devmem2"
>> +
>> FILES:${PN} += " \
>> ${SWUPDATE_HW_COMPATIBILITY_FILE} \
>> "
>> --
>> 2.52.0
>>
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#16850): https://lists.yoctoproject.org/g/meta-arago/message/16850
>> Mute This Topic: https://lists.yoctoproject.org/mt/116574476/9980049
>> Group Owner: meta-arago+owner@lists.yoctoproject.org
>> Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub [y-hegde@ti.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate
2025-12-02 20:59 ` [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Denys Dmytriyenko
@ 2025-12-03 14:07 ` Raghavendra, Vignesh
0 siblings, 0 replies; 12+ messages in thread
From: Raghavendra, Vignesh @ 2025-12-03 14:07 UTC (permalink / raw)
To: Denys Dmytriyenko, anshuld; +Cc: meta-arago, denys, reatmon
Hi Denys,
On 12/3/2025 2:29 AM, Denys Dmytriyenko wrote:
> On Tue, Dec 02, 2025 at 04:45:57PM +0530, Anshul Dalal via lists.yoctoproject.org wrote:
>> Hi all,
>>
>> This RFC adds support for SWUpdate[1] to meta-arago, this provides us with OTA
>> updates with A/B redundancy for the rootfs.
>>
>> For now the support is enabled for eMMC boot only based on the 'ti-swupdate'
>> override. The below steps can be used to test this RFC on an AM62x EVM:
>>
>> 1. Add 'meta-swupdate' layer[2] to the SDK sources directory.
>>
>> 2. Since the bootloader side changes have not been merged to ti-u-boot yet,
>> make use of the 'swupdate' branch from my own U-Boot fork[3].
>>
>> 3. Enable 'swupdate' support by setting the 'ti-swupdate' override in
>> local.conf as follows:
>>
>> DISTROOVERRIDES:append = ":ti-swupdate"
>>
>> 4. Flash the U-Boot binaries to the correct offsets on boot0 partition as
>> per the docs[4] and run 'env save' on first boot to save the environment to
>> eMMC's hw partition.
> Why not use a more established A/B solution, such as RAUC (or even Mender)?
>
SWUpdate is still the most widely requested option from users of TI K3
SoC. Its a more versatile than RAUC as it provides flexibility wrt image
level vs file vs block level updates.
AFAIK, Both RAUC and SWUpdate are equally powerfully and well
established. Could you help me understand why RAUC is more established
than SWUpdate?
AGL seems to be on OSTree. OpenWRT, CIP is SWUPdate. Buildroot supports
both (default is SWUpdate), so there isnt a common theme. Though
SWUpdate seems more common in industrial focused distro space as far as
my knowledge goes.
Mender is a different story though, its open source but has commercial
element to it. And at least K3 based beagle devices are already
supported via mender.io [1].
[1] https://hub.mender.io/t/board-support-index/5742
Regards
Vignesh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
` (4 preceding siblings ...)
2025-12-02 20:59 ` [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Denys Dmytriyenko
@ 2026-05-29 12:33 ` Romain Naour
5 siblings, 0 replies; 12+ messages in thread
From: Romain Naour @ 2026-05-29 12:33 UTC (permalink / raw)
To: Anshul Dalal, meta-arago; +Cc: vigneshr, denys, reatmon, Alban MOIZAN
Hello Anshul, All,
Le 02/12/2025 à 12:15, Anshul Dalal a écrit :
> Hi all,
>
> This RFC adds support for SWUpdate[1] to meta-arago, this provides us with OTA
> updates with A/B redundancy for the rootfs.
Do you have some recommendation when an upgrade should include a TI firmwares
updates (TI SCI, DM)? On the rootfs we can have some remoteproc firmwares built
with a specific TI SDK version that imply a specific TI SCI/DM firmware version
being used.
What if we want to update the system with OTA? It seems we have to update u-boot
too.
Example:
The system is running with a Yocto kirkstone based image and we want to deploy a
new Scarthgap based image. The kirkstone image will provide a DSP firmware build
with the TI SDK 09.02.00.05 while the Scarthgap image will provide a DSP
firmware build with the TI SDK 11.02.00.06.
On meta-ti kirkstone I had a regression with a DSP firmware at runtime due to a
ti-linux-fw version bump: https://lists.yoctoproject.org/g/meta-ti/message/19322
(It was probably due to an IPC/mailbox change between TI SDK 9 and 10).
The K3 bootflow that is already complex doesn't seems to expect using A/B
redundancy for the bootloader. One of the "safer" solution would to flash the
eMMC with a new image after booting with an SD card.
Best regards,
Romain
>
> For now the support is enabled for eMMC boot only based on the 'ti-swupdate'
> override. The below steps can be used to test this RFC on an AM62x EVM:
>
> 1. Add 'meta-swupdate' layer[2] to the SDK sources directory.
>
> 2. Since the bootloader side changes have not been merged to ti-u-boot yet,
> make use of the 'swupdate' branch from my own U-Boot fork[3].
>
> 3. Enable 'swupdate' support by setting the 'ti-swupdate' override in
> local.conf as follows:
>
> DISTROOVERRIDES:append = ":ti-swupdate"
>
> 4. Flash the U-Boot binaries to the correct offsets on boot0 partition as
> per the docs[4] and run 'env save' on first boot to save the environment to
> eMMC's hw partition.
>
> Regards,
> Anshul
>
> [1]: https://swupdate.org/
> [2]: https://github.com/sbabic/meta-swupdate
> [3]: https://github.com/ArchUsr64/u-boot/tree/swupdate
> [4]: https://software-dl.ti.com/processor-sdk-linux-rt/esd/AM62X/latest/exports/docs/linux/How_to_Guides/Target/How_to_emmc_boot.html#how-to-emmc-boot
>
> Anshul Dalal (4):
> swupdate: add systemd service to rootfs
> swupdate: add creation of update image
> swupdate: add bootloader support
> swupdate: enable authentication for update image
>
> meta-arago-distro/conf/distro/arago.conf | 3 ++
> .../images/files/sw-description | 46 +++++++++++++++++++
> .../recipes-swupdate/images/update-image.bb | 27 +++++++++++
> .../libubootenv/files/fw_env.config | 5 ++
> .../libubootenv/libubootenv_%.bbappend | 10 ++++
> .../recipes-swupdate/swupdate/files/defconfig | 12 +++++
> .../swupdate/files/swupdate.cfg | 13 ++++++
> .../swupdate/files/swupdate.sh | 15 ++++++
> .../swupdate/swupdate_%.bbappend | 35 ++++++++++++++
> .../wic/sdimage-2part-swupdate.wks | 6 +++
> 10 files changed, 172 insertions(+)
> create mode 100644 meta-arago-distro/recipes-swupdate/images/files/sw-description
> create mode 100644 meta-arago-distro/recipes-swupdate/images/update-image.bb
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/files/fw_env.config
> create mode 100644 meta-arago-distro/recipes-swupdate/libubootenv/libubootenv_%.bbappend
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/defconfig
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.cfg
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/files/swupdate.sh
> create mode 100644 meta-arago-distro/recipes-swupdate/swupdate/swupdate_%.bbappend
> create mode 100644 meta-arago-distro/wic/sdimage-2part-swupdate.wks
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-05-29 12:33 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 11:15 [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Anshul Dalal
2025-12-02 11:15 ` [meta-arago][scarthgap][PATCH RFC 2/4] swupdate: add creation of update image Anshul Dalal
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 3/4] swupdate: add bootloader support Anshul Dalal
2025-12-02 19:23 ` Andrew Davis
2025-12-03 10:16 ` Anshul Dalal
2025-12-03 5:58 ` Yogesh Hegde
2025-12-03 10:23 ` Anshul Dalal
2025-12-02 11:16 ` [meta-arago][scarthgap][PATCH RFC 4/4] swupdate: enable authentication for update image Anshul Dalal
2025-12-02 20:59 ` [meta-arago][scarthgap][PATCH RFC 0/4] Add support for SWUpdate Denys Dmytriyenko
2025-12-03 14:07 ` Raghavendra, Vignesh
2026-05-29 12:33 ` Romain Naour
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.