From patchwork Tue Dec 2 11:15:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshul Dalal X-Patchwork-Id: 75715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 949CECFD2F6 for ; Tue, 2 Dec 2025 11:16:20 +0000 (UTC) Received: from PH8PR06CU001.outbound.protection.outlook.com (PH8PR06CU001.outbound.protection.outlook.com [40.107.209.51]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5553.1764674176967399902 for ; Tue, 02 Dec 2025 03:16:17 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@ti.com header.s=selector1 header.b=dTy6dd29; spf=permerror, err=parse error for token &{10 18 spf.protection.outlook.com}: limit exceeded (domain: ti.com, ip: 40.107.209.51, mailfrom: anshuld@ti.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JddPL8EomRIXHRDv5Nowsw9qxKFAwiABXF7sRJvvQRejF0Gk1javADCpe/0KA1ibTn+Tfsu21JEDEiznUoK7PFPjK7kn+TQ+tcfLa3RTJyh18PC6zRoAcSHSQFs9S0WjHTh5hOJY/plieS3MSwlZJZ5rNTHu5+q1T412Vrr2FU+J6IxoEQ8dAFuazyCMOwPyFm9ALr5vvK24hmJVoO43/6UcdAM6jGDFj6tMe2IMAwzc2jb5FJ9x/kM5ZavYTKwYELs+SHkCNXKaZ6tV17TC3RBn05pYPAU6xd94TVS8F0b0we8PNtYNWq5CGmc8rfsyMjCxsVCtsPJm3QtJLHqCgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=doKhlZPXTH9FKcYSa88Q/KK2s4rAyh9rDGX2F0p+sME=; b=u6omLMgBBEuPfZvkM+nXm1KlIXL3P07B+3X0Kb7TQrEANoYyXZLVXnRfSRrT6CjVF3DlS4lpXgcyqLIitc61T7VQZXOFuLVA/8WflWw/kOyR6cXtNo5c0yQfxgVvHxgtQ01taN0S+w2xufJsn7lF42tADpgxUXD0HqbPusnh1zoLVpsWOQeHbXJwN7+5JhqCTRuDo50Qo0d/8TCyxYZbEmzrT2xVKaoslswr/Dc9cA9CnE4HFeutA1ohUQH+MpQPlWX3EcgcrTq8TRA9FrhvGz6aCaGrXFRlsNCvFJL+7bS2SIetqxd8sbxf0Uxa/ylEClrMgvh26ph27NQE9pK/GA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.195) smtp.rcpttodomain=konsulko.com smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=doKhlZPXTH9FKcYSa88Q/KK2s4rAyh9rDGX2F0p+sME=; b=dTy6dd29rQ5KdloZB/zvzzlRIgddvMJYPnvMvewEN2P03ztvxcY7kWTh7FObX97SnBosFRtkozSnh2u+1IujNslbUIaioxmm5ZrjNAyzsP/kOzddKnXbIvC0921JnQ93GQ/0PuiGDUq0foDZeC7vfEFLC9OZApTc+X72jRuqsOM= Received: from BN9PR03CA0285.namprd03.prod.outlook.com (2603:10b6:408:f5::20) by PH0PR10MB4582.namprd10.prod.outlook.com (2603:10b6:510:39::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.9; Tue, 2 Dec 2025 11:16:14 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:f5:cafe::ba) by BN9PR03CA0285.outlook.office365.com (2603:10b6:408:f5::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9366.17 via Frontend Transport; Tue, 2 Dec 2025 11:16:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.195; helo=lewvzet201.ext.ti.com; pr=C Received: from lewvzet201.ext.ti.com (198.47.23.195) by BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.8 via Frontend Transport; Tue, 2 Dec 2025 11:16:13 +0000 Received: from DLEE201.ent.ti.com (157.170.170.76) by lewvzet201.ext.ti.com (10.4.14.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Tue, 2 Dec 2025 05:16:11 -0600 Received: from DLEE214.ent.ti.com (157.170.170.117) by DLEE201.ent.ti.com (157.170.170.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Tue, 2 Dec 2025 05:16:11 -0600 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE214.ent.ti.com (157.170.170.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Tue, 2 Dec 2025 05:16:10 -0600 Received: from localhost (dhcp-172-24-233-105.dhcp.ti.com [172.24.233.105]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 5B2BG9lF2143130; Tue, 2 Dec 2025 05:16:10 -0600 From: Anshul Dalal To: CC: Anshul Dalal , , , Subject: [meta-arago][scarthgap][PATCH RFC 1/4] swupdate: add systemd service to rootfs Date: Tue, 2 Dec 2025 16:45:58 +0530 Message-ID: <20251202111603.1616989-2-anshuld@ti.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202111603.1616989-1-anshuld@ti.com> References: <20251202111603.1616989-1-anshuld@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|PH0PR10MB4582:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b648865-aa91-4deb-c86e-08de31943457 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: lgajpNTzkT4awyM+koInP4/TTS79L79uErCOB3Lw0olZIlVgM2tyaFQ7+ao2POCA/RVYOsHW4reDZII3iAPoZp3kj+lblr485d2Lwt+Tg326CHm49yXeD6C/JDuEGDXKnVoiWU+1BVaUB2GGpUzXT/qKSmH+Y1KYFGXCapVzdOa+xjDlvD4kzvPIH00KOlgIx9dEFxjH+S3zEkBZb4ASPQHQfhb2bUOagAWcw8uYthKHlSrqfRd6m2pC2gvJSmkoBIfqFb/fu4SyKn5vCN+9til+ZlbQMXs5a2YUmlMCYb5TK9EP8rapfL2lJuQnHI0gjP9m0qkYwKlRp+B5vy/tKVvrH5jH4czt62XHz9n0NNgXyZxxsDSVvhMiG81IVMetEfLG3mOVBrXVqDbBnwyZlwBTptcwro0/EdYzmyMrmTPyED9J46Tu54LzzAOnJauLuzFCyWnZ/Ldiwhqass0ZSiRXLSZ12ryq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;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet201.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2025 11:16:13.5058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b648865-aa91-4deb-c86e-08de31943457 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.195];Helo=[lewvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4582 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 02 Dec 2025 11:16:20 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arago/message/16847 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 --- 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