From patchwork Wed Mar 20 10:32:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13597721 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 D7820CD11DE for ; Wed, 20 Mar 2024 10:32:01 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.134]) by mx.groups.io with SMTP id smtpd.web10.40302.1710930712530080067 for ; Wed, 20 Mar 2024 03:31:53 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.134, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 42KAVphp3644378; Wed, 20 Mar 2024 19:31:51 +0900 X-Iguazu-Qid: 2yAamVQ9TFi7Qej6Ho X-Iguazu-QSIG: v=2; s=0; t=1710930710; q=2yAamVQ9TFi7Qej6Ho; m=j7/8yn5CGtrQFANy1+GbQ0iN6Yqa+7Wbum9wTR5Ha5k= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1800) id 42KAVnag1294791 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 20 Mar 2024 19:31:50 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, adithya.balakumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][RFC v2 1/4] swupdate-handler-roundrobin: Increase revision for Delta Handler support Date: Wed, 20 Mar 2024 16:02:26 +0530 X-TSB-HOP2: ON Message-Id: <20240320103229.1078738-2-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2024 10:31:46.0630 (UTC) FILETIME=[CF48B660:01DA7AB1] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 20 Mar 2024 10:32:01 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15380 This revision allows the use of delta handler in swupdate for zchunk based delta updates Signed-off-by: Adithya Balakumar Tested-by: Felix Moessbauer --- .../swupdate-handler-roundrobin_0.1.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-core/swupdate-handler-roundrobin/swupdate-handler-roundrobin_0.1.bb b/recipes-core/swupdate-handler-roundrobin/swupdate-handler-roundrobin_0.1.bb index b39278e..41eb06c 100644 --- a/recipes-core/swupdate-handler-roundrobin/swupdate-handler-roundrobin_0.1.bb +++ b/recipes-core/swupdate-handler-roundrobin/swupdate-handler-roundrobin_0.1.bb @@ -13,7 +13,7 @@ inherit dpkg-raw PROVIDES = "swupdate-handlers" SRC_URI += "git://gitlab.com/cip-project/cip-sw-updates/swupdate-handler-roundrobin.git;protocol=https;destsuffix=swupdate-handler-roundrobin;name=swupdate-handler-roundrobin;nobranch=1" -SRCREV_swupdate-handler-roundrobin ?= "bb35127231ec08a67f79a7584ccfc0cada88cc4e" +SRCREV_swupdate-handler-roundrobin ?= "e6936b8c29a20cb6a6893faae57e12499ebbc342" SWUPDATE_LUASCRIPT = "swupdate-handler-roundrobin/swupdate_handlers_roundrobin.lua" From patchwork Wed Mar 20 10:32:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13597722 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 A5FB8CD11DB for ; Wed, 20 Mar 2024 10:32:01 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.135]) by mx.groups.io with SMTP id smtpd.web11.40525.1710930713397130886 for ; Wed, 20 Mar 2024 03:31:53 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.135, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1801) id 42KAVpbt1405268; Wed, 20 Mar 2024 19:31:51 +0900 X-Iguazu-Qid: 2yAaAnXldsbUhuyPku X-Iguazu-QSIG: v=2; s=0; t=1710930711; q=2yAaAnXldsbUhuyPku; m=xPa6qIJx/zetLKo4G0mKXF0UyXooY0rWCB5AyiC87Xw= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1801) id 42KAVoMm874689 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 20 Mar 2024 19:31:51 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, adithya.balakumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][RFC v2 2/4] Add Delta update support with rdiff_image and delta handler Date: Wed, 20 Mar 2024 16:02:27 +0530 X-TSB-HOP2: ON Message-Id: <20240320103229.1078738-3-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2024 10:31:46.0646 (UTC) FILETIME=[CF4B2760:01DA7AB1] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 20 Mar 2024 10:32:01 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15381 swupdate supports delta updates with rdiff_image and delta(zchunk) handler. This change adds support to use either of the handler for creating delta update artifacts. zchunk based updates are supported only for sid. DELTA_UPDATE_TYPE, DELTA_RDIFF_REF_IMAGE and DELTA_ZCK_URL variables can be modified based on the update type in the swupdate.yml file. Signed-off-by: Adithya Balakumar --- classes/delta-update.bbclass | 107 +++++++++++++++++++++++++++++++++++ conf/layer.conf | 2 +- kas/opt/swupdate.yml | 5 ++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 classes/delta-update.bbclass diff --git a/classes/delta-update.bbclass b/classes/delta-update.bbclass new file mode 100644 index 0000000..8443f35 --- /dev/null +++ b/classes/delta-update.bbclass @@ -0,0 +1,107 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Toshiba Corporation 2024 +# +# Authors: +# Adithya Balakumar +# +# SPDX-License-Identifier: MIT +# + +IMAGER_INSTALL:delta_update .= "fdisk zchunk rdiff" + +FILESEXTRAPATHS:append = ":${LAYERDIR_cip-core}" +do_image_delta_update[cleandirs] += "${WORKDIR}/delta_interim_artifacts" + +DELTA_UPDATE_TYPE ??= "rdiff" +DELTA_RDIFF_REF_IMAGE ??= "image-v1/${IMAGE_FULLNAME}.${SWU_ROOTFS_TYPE}" +DELTA_ZCK_URL ??= "" + +def disable_delta_update_tasks(d): + d.appendVarFlag("do_image_delta_update", "noexec", "1") + d.appendVarFlag("do_delta_rdiff_ref_image_fetch", "noexec", "1") + d.setVar("DELTA_UPDATE_TYPE", "") + +python () { + import os + path = d.getVar("LAYERDIR_cip-core") + "/" + d.getVar("DELTA_RDIFF_REF_IMAGE") + if d.getVar("DELTA_UPDATE_TYPE") == "rdiff": + if not os.path.isfile(path): + disable_delta_update_tasks(d) + elif d.getVar("DELTA_UPDATE_TYPE") == "zchunk": + if d.getVar("DISTRO") != "cip-core-sid": + disable_delta_update_tasks(d) + else: + disable_delta_update_tasks(d) +} + +python do_delta_rdiff_ref_image_fetch () { + import bb + import os + path = d.getVar("LAYERDIR_cip-core") + "/" + d.getVar("DELTA_RDIFF_REF_IMAGE") + if d.getVar("DELTA_UPDATE_TYPE") == "rdiff": + if os.path.isfile(path): + artifact_uri = "file://" + (d.getVar('DELTA_RDIFF_REF_IMAGE') or "") + artifact_uri_list = artifact_uri.split() + fetcher = bb.fetch2.Fetch(artifact_uri_list, d) + fetcher.download() + fetcher.unpack(d.getVar('WORKDIR')) +} +addtask do_delta_rdiff_ref_image_fetch before do_transform_template + +create_rdiff_delta_artifact() { + if [ -z "${DELTA_RDIFF_REF_IMAGE}" ]; then + bbfatal "You must set DELTA_RDIFF_REF_IMAGE and provide the required files as artifacts to this recipe" + fi + + rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.delta + # create signature file with rdiff + ${SUDO_CHROOT} /usr/bin/rdiff signature ${WORKDIR}/${DELTA_RDIFF_REF_IMAGE} \ + ${WORKDIR}/delta_interim_artifacts/old-image-rootfs.sig + + # create delta file with the signature file + ${SUDO_CHROOT} /usr/bin/rdiff delta ${WORKDIR}/delta_interim_artifacts/old-image-rootfs.sig \ + ${PP_DEPLOY}/${IMAGE_FULLNAME}.${SWU_ROOTFS_TYPE} ${PP_DEPLOY}/${IMAGE_FULLNAME}.delta + + DELTA_ARTIFACT_SWU=${IMAGE_FULLNAME}.delta + + # create a symbolic link as IMAGE_CMD expects a *.delta_update file in deploy image directory + ln -sf ${DELTA_ARTIFACT_SWU} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.delta_update +} + +create_zchunk_delta_artifact() { + # Create .zck file + ${SUDO_CHROOT} /bin/zck \ + --output ${PP_DEPLOY}/${IMAGE_FULLNAME}.zck \ + -u --chunk-hash-type sha256 \ + ${PP_DEPLOY}/${IMAGE_FULLNAME}.${SWU_ROOTFS_TYPE} + + # Calculate size of zck header + HSIZE="$(${SUDO_CHROOT} /bin/zck_read_header -v ${PP_DEPLOY}/${IMAGE_FULLNAME}.zck | grep "Header size" | cut -d ':' -f 2)" + + # Extract the zck header + ${SUDO_CHROOT} /bin/dd if="${PP_DEPLOY}/${IMAGE_FULLNAME}".zck of="${PP_DEPLOY}/${IMAGE_FULLNAME}".zck.header bs=1 count="$HSIZE" status=none + + DELTA_ARTIFACT_SWU=${IMAGE_FULLNAME}.zck.header + + # create a symbolic link as IMAGE_CMD expects a *.delta_update file in deploy image directory + ln -sf ${DELTA_ARTIFACT_SWU} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.delta_update +} + +do_image_delta_update[depends] += "${PN}:do_transform_template" +IMAGE_CMD:delta_update() { + case "${DELTA_UPDATE_TYPE}" in + "rdiff") + create_rdiff_delta_artifact + ;; + "zchunk") + create_zchunk_delta_artifact + ;; + *) + bbfatal "You must set a valid DELTA_UPDATE_TYPE (rdiff/zchunk)" + ;; + esac +} + +addtask do_image_delta_update before do_image_swu after do_image_wic diff --git a/conf/layer.conf b/conf/layer.conf index 82b4084..d4c87a6 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -23,6 +23,6 @@ LAYERSERIES_COMPAT_cip-core = "next" LAYERDIR_cip-core = "${LAYERDIR}" LAYERDIR_cip-core[vardepvalue] = "isar-cip-core" -IMAGE_CLASSES += "squashfs verity swupdate" +IMAGE_CLASSES += "squashfs verity swupdate delta-update" SOURCE_DATE_EPOCH := "${@bb.process.run("git -C ${LAYERDIR_cip-core} log -1 --pretty=%ct | tr -d '\n'")[0]}" diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml index ef61e4e..50ded36 100644 --- a/kas/opt/swupdate.yml +++ b/kas/opt/swupdate.yml @@ -30,3 +30,8 @@ local_conf_header: ABROOTFS_PART_UUID_B ?= "fedcba98-7654-3210-cafe-5e0710000002" PREFERRED_PROVIDER_swupdate-certificates-key ??= "swupdate-certificates-key-snakeoil" PREFERRED_PROVIDER_swupdate-certificates ??= "swupdate-certificates-snakeoil" + # delta update specific variables" + IMAGE_FSTYPES:append = " delta_update" + DELTA_UPDATE_TYPE = "rdiff" + DELTA_RDIFF_REF_IMAGE = "image-v1/${IMAGE_FULLNAME}.${SWU_ROOTFS_TYPE}" + DELTA_ZCK_URL = "" From patchwork Wed Mar 20 10:32:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13597719 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 B3B42CD11DC for ; Wed, 20 Mar 2024 10:32:01 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.131]) by mx.groups.io with SMTP id smtpd.web10.40306.1710930717437342179 for ; Wed, 20 Mar 2024 03:31:57 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.131, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1120) id 42KAVsv72310932; Wed, 20 Mar 2024 19:31:55 +0900 X-Iguazu-Qid: 2rWgsWh2CfKM0v34CG X-Iguazu-QSIG: v=2; s=0; t=1710930714; q=2rWgsWh2CfKM0v34CG; m=F6/9kRZY/D7+UfCcsxridlJ2rC+940ZlOnYGvt9EaBA= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1122) id 42KAVqrg849698 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 20 Mar 2024 19:31:54 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, adithya.balakumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][RFC v2 3/4] swupdate.bbclass: Generate swu for delta updates Date: Wed, 20 Mar 2024 16:02:28 +0530 X-TSB-HOP2: ON Message-Id: <20240320103229.1078738-4-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2024 10:31:46.0724 (UTC) FILETIME=[CF570E40:01DA7AB1] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 20 Mar 2024 10:32:01 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15383 This allows the creation of a swu file for delta update. Signed-off-by: Adithya Balakumar --- classes/swupdate.bbclass | 32 ++++++++++++++- .../images/swu/sw-description-delta.tmpl | 39 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 recipes-core/images/swu/sw-description-delta.tmpl diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index e23261d..1c495da 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -26,10 +26,12 @@ SWU_EBG_UPDATE ?= "" SWU_EFI_BOOT_DEVICE ?= "/dev/disk/by-uuid/4321-DCBA" SWU_BOOTLOADER ??= "ebg" SWU_DESCRIPITION_FILE_BOOTLOADER ??= "${SWU_DESCRIPTION_FILE}-${SWU_BOOTLOADER}" +SWU_DESCRIPITION_FILE_DELTA_UPDATE ??= "${SWU_DESCRIPTION_FILE}-delta" +SWU_DELTA_UPDATE_ARTIFACT = "${SWU_ROOTFS_NAME}.delta_update${@get_swu_compression_type(d)}" +SWU_DELTA_UPDATE_ARTIFACT_TYPE = "delta_update${@get_swu_compression_type(d)}" SWU_IMAGE_FILE ?= "${IMAGE_FULLNAME}" SWU_DESCRIPTION_FILE ?= "sw-description" -SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}" SWU_SIGNED ??= "" SWU_SIGNATURE_EXT ?= "sig" SWU_SIGNATURE_TYPE ?= "cms" @@ -37,6 +39,7 @@ SWU_SIGNATURE_TYPE ?= "cms" SWU_BUILDCHROOT_IMAGE_FILE ?= "${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" IMAGE_TYPEDEP:swu = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" +IMAGE_TYPEDEP:swu += "${@ '${SWU_DELTA_UPDATE_ARTIFACT_TYPE}' if d.getVar('DELTA_UPDATE_TYPE') else ''}" IMAGER_BUILD_DEPS:swu += "${@'swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGER_INSTALL:swu += "cpio ${@'openssl swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGE_INSTALL += "${@'swupdate-certificates' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" @@ -44,8 +47,10 @@ IMAGE_INSTALL += "${@'swupdate-certificates' if bb.utils.to_boolean(d.getVar('SW IMAGE_SRC_URI:swu = "file://${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_SRC_URI:swu += "file://${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" +IMAGE_SRC_URI:delta_update += "file://${SWU_DESCRIPITION_FILE_DELTA_UPDATE}.tmpl" IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_FILES:swu += "${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" +IMAGE_TEMPLATE_FILES:delta_update += "${SWU_DESCRIPITION_FILE_DELTA_UPDATE}.tmpl" IMAGE_TEMPLATE_VARS:swu = " \ SWU_ROOTFS_PARTITION_NAME \ TARGET_IMAGE_UUID \ @@ -58,6 +63,8 @@ IMAGE_TEMPLATE_VARS:swu = " \ SWU_FILE_NODES \ SWU_BOOTLOADER_FILE_NODE \ SWU_SCRIPTS_NODE \ + SWU_DELTA_UPDATE_ARTIFACT \ + SWU_DELTA_UPDATE_PROPERTIES \ " # TARGET_IMAGE_UUID needs to be generated before completing the template @@ -148,6 +155,22 @@ python add_scripts_node() { d.appendVar('SWU_SCRIPTS_NODE', swu_scripts_node) } +SWU_EXTEND_SW_DESCRIPTION += "add_swu_delta_update_properties" +python add_swu_delta_update_properties() { + delta_type = d.getVar('DELTA_UPDATE_TYPE') + swu_delta_update_properties = "" + if delta_type == "rdiff": + swu_delta_update_properties = 'chainhandler = "rdiff_image";' + elif delta_type == "zchunk": + zck_url = d.getVar('DELTA_ZCK_URL') + swu_delta_update_properties = f""" + chainhandler = "delta"; + url = "{zck_url}"; + zckloglevel = "error"; + """ + d.setVar('SWU_DELTA_UPDATE_PROPERTIES', swu_delta_update_properties) +} + # convert between swupdate compressor name and imagetype extension def get_swu_compression_type(d): swu_ct = d.getVar('SWU_COMPRESSION_TYPE') @@ -167,13 +190,20 @@ FILESEXTRAPATHS:append = ":${LAYERDIR_cip-core}/recipes-core/images/swu" do_image_swu[depends] += "${PN}:do_transform_template" do_image_swu[stamp-extra-info] = "${DISTRO}-${MACHINE}" do_image_swu[cleandirs] += "${WORKDIR}/swu ${WORKDIR}/swu-${SWU_BOOTLOADER}" +do_image_swu[cleandirs] += "${@ d.getVar("WORKDIR")+'/swu-delta' if d.getVar("DELTA_UPDATE_TYPE") else ''}" do_image_swu[prefuncs] = "do_extend_sw_description" IMAGE_CMD:swu() { rm -f '${DEPLOY_DIR_IMAGE}/${SWU_IMAGE_FILE}'*.swu + if [ -z "${DELTA_UPDATE_TYPE}" ]; then + rm -rf ${WORKDIR}/swu-delta + fi cp '${WORKDIR}/${SWU_DESCRIPTION_FILE}' '${WORKDIR}/swu/${SWU_DESCRIPTION_FILE}' if [ -f '${WORKDIR}/${SWU_DESCRIPITION_FILE_BOOTLOADER}' ]; then cp '${WORKDIR}/${SWU_DESCRIPITION_FILE_BOOTLOADER}' '${WORKDIR}/swu-${SWU_BOOTLOADER}/${SWU_DESCRIPTION_FILE}' fi + if [ ! -z "${DELTA_UPDATE_TYPE}" ] && [ -f '${WORKDIR}/${SWU_DESCRIPITION_FILE_DELTA_UPDATE}' ]; then + cp '${WORKDIR}/${SWU_DESCRIPITION_FILE_DELTA_UPDATE}' '${WORKDIR}/swu-delta/${SWU_DESCRIPTION_FILE}' + fi for swu_file in "${WORKDIR}"/swu*; do swu_file_base=$(basename $swu_file) diff --git a/recipes-core/images/swu/sw-description-delta.tmpl b/recipes-core/images/swu/sw-description-delta.tmpl new file mode 100644 index 0000000..7f7d623 --- /dev/null +++ b/recipes-core/images/swu/sw-description-delta.tmpl @@ -0,0 +1,39 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Siemens AG, 2020 +# +# Authors: +# Quirin Gylstorff +# +# SPDX-License-Identifier: MIT +# +software = +{ + version = "${SWU_VERSION}"; + name = "${SWU_NAME}"; + ${SWU_HW_COMPAT_NODE} + images: ({ + filename = "${SWU_DELTA_UPDATE_ARTIFACT}"; + device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; + type = "roundrobin"; + ${SWU_COMPRESSION_NODE} + properties: { + subtype = "image"; + configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; + ${SWU_DELTA_UPDATE_PROPERTIES} + }; + sha256 = "${SWU_DELTA_UPDATE_ARTIFACT}-sha256"; + }); + files: ({ + filename = "linux.efi"; + path = "linux.efi"; + type = "roundrobin"; + device = "C:BOOT0:linux.efi->BOOT0,C:BOOT1:linux.efi->BOOT1"; + filesystem = "vfat"; + properties: { + subtype = "kernel"; + }; + sha256 = "linux.efi-sha256"; + }${SWU_FILE_NODES}); +} From patchwork Wed Mar 20 10:32:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13597720 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 A963ECD11DD for ; Wed, 20 Mar 2024 10:32:01 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.152]) by mx.groups.io with SMTP id smtpd.web10.40305.1710930715197145078 for ; Wed, 20 Mar 2024 03:31:55 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.152, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1802) id 42KAVrUf1398294; Wed, 20 Mar 2024 19:31:54 +0900 X-Iguazu-Qid: 2yAacku13V7Qm92dvM X-Iguazu-QSIG: v=2; s=0; t=1710930713; q=2yAacku13V7Qm92dvM; m=nATAD/1hZWC1FXMK72CfM/FKHfmBGHdB1pfWcErzUO8= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1803) id 42KAVrhp744680 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 20 Mar 2024 19:31:53 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, adithya.balakumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][RFC v2 4/4] doc/README.swupdate.md: Update steps to test Delta software Update Date: Wed, 20 Mar 2024 16:02:29 +0530 X-TSB-HOP2: ON Message-Id: <20240320103229.1078738-5-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240320103229.1078738-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 20 Mar 2024 10:31:46.0818 (UTC) FILETIME=[CF656620:01DA7AB1] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 20 Mar 2024 10:32:01 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15382 This change includes steps to verify Delta Software Update with rdiff_image and delta handler Signed-off-by: Adithya Balakumar --- doc/README.swupdate.md | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/doc/README.swupdate.md b/doc/README.swupdate.md index b7e13f7..3862649 100644 --- a/doc/README.swupdate.md +++ b/doc/README.swupdate.md @@ -360,6 +360,65 @@ user variables: ``` +# Building and testing the CIP Core image for Delta Software Update + +Set up `kas-container` as described in the [top-level README](../README.md), and then proceed with the following steps. + +First build an image using the following command: +``` +host$ ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/rt.yml +``` + +## Delta Software Update using rdiff_image handler + +Creating an delta update file for rdiff_image handler requires a reference image (against which the delta is computed). In this case, the image built in the previous section can be used as the reference image artifact. By default the `DELTA_UPDATE_TYPE` is set to `rdiff` and `DELTA_RDIFF_REF_IMAGE` is set to the path `image-v1/.squashfs` (or .verity in the case of Secure boot enabled image). +Copy the reference artifact to the mentioned directory in project folder. + +Custom artifact path can be set in `DELTA_RDIFF_REF_IMAGE` manually by adding the variable in the `swupdate.yml` file. + +Build the image with the modification as shown above with the following command: +``` +KAS_BUILD_DIR=image2 ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml +``` +Now start the first image (which does not contain the packages vim and nano), run the following commands: +``` +host$ DISTRO_RELEASE=bookworm SWUPDATE_BOOT=y ./start-qemu.sh amd64 +``` +Copy `cip-core-image-cip-core-bookworm-qemu-amd64-delta.swu` file from `image2/tmp/deploy/images/qemu-amd64/` folder into the running system: +``` +host$ cd image2/tmp/deploy/images/qemu-amd64/ +host$ scp -P 22222 ./cip-core-image-cip-core-bookworm-qemu-amd64-delta.swu root@localhost: +``` + +### Delta Software Update Verification + +Follow the steps mentioned in the section [SWUpdate verification](#swupdate-verification) for verification. + +## Delta Software Update using delta handler + +Currently zchunk based delta updates are supported only in Sid images. +For Delta update with zchunk, set the variable `DELTA_ZCK_URL` with the URL of the zck file that is hosted in a http server and set the `DELTA_UPDATE_TYPE` to `zchunk` im `swupdate.yml` file. + +Build the image with the modification as shown above with the following command: +``` +KAS_BUILD_DIR=image2 ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml +``` +Now start the first image (which does not contain the packages vim and nano), run the following commands: +``` +host$ DISTRO_RELEASE=bookworm SWUPDATE_BOOT=y ./start-qemu.sh amd64 +``` +Copy `cip-core-image-cip-core-bookworm-qemu-amd64-delta.swu` file from `image2/tmp/deploy/images/qemu-amd64/` folder into the running system: +``` +host$ cd image2/tmp/deploy/images/qemu-amd64/ +host$ scp -P 22222 ./cip-core-image-cip-core-bookworm-qemu-amd64-delta.swu root@localhost: +``` +The `cip-core-image-cip-core-bookworm-qemu-amd64.zck` file must be hosted in a server. + +### Delta Software Update Verification + +Follow the steps mentioned in the section [Delta Software Update Verification](#delta-software-update-verification) for verification. + + # Building and testing the CIP Core image for BBB Follow the steps mentioned in the section [Building and testing the CIP Core image](README.swupdate.md#building-and-testing-the-cip-core-image) for creating images and .swu files.