From: Anshul Dalal <anshuld@ti.com>
To: <meta-arago@lists.yoctoproject.org>
Cc: Anshul Dalal <anshuld@ti.com>, <vigneshr@ti.com>,
<denys@konsulko.com>, <reatmon@ti.com>
Subject: [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs
Date: Tue, 2 Dec 2025 16:45:58 +0530 [thread overview]
Message-ID: <20251202111603.1616989-2-anshuld@ti.com> (raw)
In-Reply-To: <20251202111603.1616989-1-anshuld@ti.com>
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
next prev parent reply other threads:[~2025-12-02 11:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251202111603.1616989-2-anshuld@ti.com \
--to=anshuld@ti.com \
--cc=denys@konsulko.com \
--cc=meta-arago@lists.yoctoproject.org \
--cc=reatmon@ti.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.