From patchwork Tue May 7 09:14: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: 13656436 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 8D68BC41513 for ; Tue, 7 May 2024 09:14:24 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.134]) by mx.groups.io with SMTP id smtpd.web11.7173.1715073256029667934 for ; Tue, 07 May 2024 02:14:16 -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 4479EE3M3257002; Tue, 7 May 2024 18:14:14 +0900 X-Iguazu-Qid: 2yAbNsrDJoZAUiTZpD X-Iguazu-QSIG: v=2; s=0; t=1715073253; q=2yAbNsrDJoZAUiTZpD; m=cCW22EtjKZDBOQxVXNDXV+F4EElUPw9SNOP7gE/cSDg= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1802) id 4479EDMt1182850 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 7 May 2024 18:14:13 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: quirin.gylstorff@siemens.com, felix.moessbauer@siemens.com, shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][PATCH v6 1/4] Add Delta update support with rdiff_image and delta handler Date: Tue, 7 May 2024 14:44:29 +0530 X-TSB-HOP2: ON Message-Id: <20240507091432.895626-2-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 May 2024 09:14:11.0061 (UTC) FILETIME=[EC2D4250:01DAA05E] 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 ; Tue, 07 May 2024 09:14:24 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15850 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 delta-update.yml file. Signed-off-by: Adithya Balakumar --- classes/delta-update.bbclass | 99 ++++++++++++++++++++++++++++++++++++ conf/layer.conf | 2 +- kas/opt/delta-update.yml | 20 ++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 classes/delta-update.bbclass create mode 100644 kas/opt/delta-update.yml diff --git a/classes/delta-update.bbclass b/classes/delta-update.bbclass new file mode 100644 index 0000000..c2df266 --- /dev/null +++ b/classes/delta-update.bbclass @@ -0,0 +1,99 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Toshiba Corporation 2024 +# +# Authors: +# Adithya Balakumar +# +# SPDX-License-Identifier: MIT +# + +IMAGER_INSTALL:delta_update .= " zchunk rdiff" + +FILESEXTRAPATHS:prepend = "${TOPDIR}/previous-image:" + +DELTA_UPDATE_TYPE ??= "" +DELTA_RDIFF_REF_IMAGE ??= "" +DELTA_ZCK_URL ??= "" +DELTA_PREV_IMAGE_PATH ??= "${TOPDIR}/previous-image" + +def disable_delta_update_tasks (d): + d.appendVarFlag("do_image_delta_update", "noexec", "1") + d.setVar("DELTA_UPDATE_TYPE", "") + +python () { + if d.getVar("DELTA_UPDATE_TYPE") == "rdiff": + if d.getVar("DELTA_RDIFF_REF_IMAGE") == "": + bb.fatal("You must set DELTA_RDIFF_REF_IMAGE and provide the required files as artifacts to this recipe") + elif d.getVar("DELTA_UPDATE_TYPE") == "zchunk": + if d.getVar("BASE_DISTRO_CODENAME") != "sid": + bb.fatal("Zchunk based delta update is only supported from sid") + else: + disable_delta_update_tasks(d) +} + +python do_fetch_delta_rdiff_ref_image () { + if d.getVar("DELTA_UPDATE_TYPE") == "rdiff": + path = d.getVar("DELTA_PREV_IMAGE_PATH") + "/" + d.getVar("DELTA_RDIFF_REF_IMAGE") + if not os.path.isfile(path): + bb.fatal("No such file found: "+ path + ". Provide the required files at "+ d.getVar("DELTA_PREV_IMAGE_PATH") + " for rdiff based delta update") + else: + d.appendVar("SRC_URI", " file://" + d.getVar("DELTA_RDIFF_REF_IMAGE")) +} + +do_fetch[prefuncs] += "do_fetch_delta_rdiff_ref_image" +do_unpack[prefuncs] += "do_fetch_delta_rdiff_ref_image" + +create_rdiff_delta_artifact() { + 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[cleandirs] += "${WORKDIR}/delta_interim_artifacts" +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 6198e1b..c652a61 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -23,5 +23,5 @@ 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" diff --git a/kas/opt/delta-update.yml b/kas/opt/delta-update.yml new file mode 100644 index 0000000..a2f583c --- /dev/null +++ b/kas/opt/delta-update.yml @@ -0,0 +1,20 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Toshiba Corporation 2024 +# +# Authors: +# Adithya Balakumar +# +# SPDX-License-Identifier: MIT +# + +header: + version: 14 + +local_conf_header: + delta-update: | + IMAGE_FSTYPES:append = " delta_update" + DELTA_UPDATE_TYPE = "rdiff" + DELTA_RDIFF_REF_IMAGE = "${IMAGE_FULLNAME}.${SWU_ROOTFS_TYPE}" + DELTA_ZCK_URL = "" From patchwork Tue May 7 09:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13656438 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 AE107C25B4F for ; Tue, 7 May 2024 09:14:24 +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.7201.1715073258288174807 for ; Tue, 07 May 2024 02:14:18 -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 4479EGBg3257108; Tue, 7 May 2024 18:14:16 +0900 X-Iguazu-Qid: 2yAbrn6vFUkJaO52I7 X-Iguazu-QSIG: v=2; s=0; t=1715073256; q=2yAbrn6vFUkJaO52I7; m=tff3F6bz9c+mkrr+9G1ymU3T/4ZWpvNyTghkIkUYOso= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1802) id 4479EFxH1182938 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 7 May 2024 18:14:16 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: quirin.gylstorff@siemens.com, felix.moessbauer@siemens.com, shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][PATCH v6 2/4] swupdate.bbclass: Generate swu for delta updates Date: Tue, 7 May 2024 14:44:30 +0530 X-TSB-HOP2: ON Message-Id: <20240507091432.895626-3-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 May 2024 09:14:11.0140 (UTC) FILETIME=[EC395040:01DAA05E] 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 ; Tue, 07 May 2024 09:14:24 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15852 This allows the creation of a swu file for delta update when a delta update is chosen through the DELTA_UPDATE_TYPE variable Signed-off-by: Adithya Balakumar --- classes/swupdate.bbclass | 32 +++++++++++++++++++-- recipes-core/images/swu/sw-description.tmpl | 5 ++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 1a7cd4d..e91238d 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -26,17 +26,26 @@ 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_DELTA_UPDATE_ARTIFACT = "${SWU_ROOTFS_NAME}.delta_update${@get_swu_compression_type(d)}" +SWU_ROOTFS_ARTIFACT_NAME = "${@ '${SWU_DELTA_UPDATE_ARTIFACT}' \ + if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" \ + else '${SWU_ROOTFS_PARTITION_NAME}'}" SWU_IMAGE_FILE ?= "${IMAGE_FULLNAME}" SWU_DESCRIPTION_FILE ?= "sw-description" -SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}" +SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_ARTIFACT_NAME}" SWU_SIGNED ??= "" SWU_SIGNATURE_EXT ?= "sig" 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)}" +SWU_UPDATE_ARTIFACT_TYPE = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" +SWU_DELTA_UPDATE_ARTIFACT_TYPE = "delta_update${@get_swu_compression_type(d)}" +IMAGE_TYPEDEP:swu = "${@ '${SWU_DELTA_UPDATE_ARTIFACT_TYPE}' \ + if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" \ + else '${SWU_UPDATE_ARTIFACT_TYPE}' }" + 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 ''}" @@ -47,7 +56,7 @@ IMAGE_SRC_URI:swu += "file://${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_FILES:swu += "${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" IMAGE_TEMPLATE_VARS:swu = " \ - SWU_ROOTFS_PARTITION_NAME \ + SWU_ROOTFS_ARTIFACT_NAME \ TARGET_IMAGE_UUID \ ABROOTFS_PART_UUID_A \ ABROOTFS_PART_UUID_B \ @@ -58,6 +67,7 @@ IMAGE_TEMPLATE_VARS:swu = " \ SWU_FILE_NODES \ SWU_BOOTLOADER_FILE_NODE \ SWU_SCRIPTS_NODE \ + SWU_DELTA_UPDATE_PROPERTIES \ " # TARGET_IMAGE_UUID needs to be generated before completing the template @@ -148,6 +158,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') diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl index 88cb475..eeb8fc2 100644 --- a/recipes-core/images/swu/sw-description.tmpl +++ b/recipes-core/images/swu/sw-description.tmpl @@ -14,15 +14,16 @@ software = name = "${SWU_NAME}"; ${SWU_HW_COMPAT_NODE} images: ({ - filename = "${SWU_ROOTFS_PARTITION_NAME}"; + filename = "${SWU_ROOTFS_ARTIFACT_NAME}"; 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_ROOTFS_PARTITION_NAME}-sha256"; + sha256 = "${SWU_ROOTFS_ARTIFACT_NAME}-sha256"; }); files: ({ filename = "linux.efi"; From patchwork Tue May 7 09:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13656440 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 B3658C25B76 for ; Tue, 7 May 2024 09:14:24 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.158]) by mx.groups.io with SMTP id smtpd.web10.7202.1715073258425635598 for ; Tue, 07 May 2024 02:14:18 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.158, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1122) id 4479EGvd3577460; Tue, 7 May 2024 18:14:16 +0900 X-Iguazu-Qid: 2rWh7Tpb9BTL4Omtiz X-Iguazu-QSIG: v=2; s=0; t=1715073256; q=2rWh7Tpb9BTL4Omtiz; m=+mx7opqDgsRIZp1odcKNi7wagmOFGReY3CaUX8EAkVc= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1123) id 4479EE4N2870638 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 7 May 2024 18:14:15 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: quirin.gylstorff@siemens.com, felix.moessbauer@siemens.com, shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][PATCH v6 3/4] doc/README.swupdate.md: Update steps to test Delta software Update Date: Tue, 7 May 2024 14:44:31 +0530 X-TSB-HOP2: ON Message-Id: <20240507091432.895626-4-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 May 2024 09:14:11.0233 (UTC) FILETIME=[EC478110:01DAA05E] 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 ; Tue, 07 May 2024 09:14:24 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15853 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..4c97ad7 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 +``` +The above image will be used as the base image to which the update is applied. + +## Delta Software Update using rdiff_image handler + +Creating an delta update file for rdiff_image handler requires a reference artifact (against which the delta is computed). In this case, the image built in the previous section can be used as the reference artifact. By default the `DELTA_UPDATE_TYPE` is set to `rdiff` and `DELTA_RDIFF_REF_IMAGE` is set to the name `${IMAGE_FULLNAME}.squashfs` (or ${IMAGE_FULLNAME}.verity in the case of Secure boot enabled image). The values of `DELTA_UPDATE_TYPE` and `DELTA_RDIFF_REF_IMAGE` can be changed in the `delta-update.yml` file. + +The build system looks for the reference artifact in a directory named `previous-image` in the build directory used for the build process. + +Copy the reference artifact to the mentioned directory with the following commands: +``` +mkdir -p build-v2/previous-image +cp build/tmp/deploy/images/qemu-amd64/cip-core-image-cip-core-bookworm-qemu-amd64.squashfs build-v2/previous-image +``` +Build the second image with `build-v2` as the build directory with the following command: +``` +KAS_BUILD_DIR=build-v2 ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/delta-update.yml +``` +Now start the first image. Run the following commands: +``` +host$ DISTRO_RELEASE=bookworm SWUPDATE_BOOT=y ./start-qemu.sh amd64 +``` +Copy `cip-core-image-cip-core-bookworm-qemu-amd64.swu` file from `build-v2/tmp/deploy/images/qemu-amd64/` folder into the running system: +``` +host$ cd build-v2/tmp/deploy/images/qemu-amd64/ +host$ scp -P 22222 ./cip-core-image-cip-core-bookworm-qemu-amd64.swu root@localhost: +``` + +## Delta Software Update using zchunk handler + +Currently zchunk based delta updates are supported only in Sid images. Make sure to build the first image with Sid as the distribution (use `sid.yml` file as part of the build command). +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` in `delta-update.yml` file. + +Build the second image with the modification as shown above with the following command: +``` +KAS_BUILD_DIR=build-v2 ./kas-container build kas-cip.yml:kas/board/qemu-amd64.yml:kas/opt/ebg-swu.yml:kas/opt/sid.yml:kas/opt/delta-update.yml +``` +Now start the first image. Run the following commands: +``` +host$ DISTRO_RELEASE=sid SWUPDATE_BOOT=y ./start-qemu.sh amd64 +``` +Copy `cip-core-image-cip-core-sid-qemu-amd64.swu` file from `build-v2/tmp/deploy/images/qemu-amd64/` folder into the running system: +``` +host$ cd build-v2/tmp/deploy/images/qemu-amd64/ +host$ scp -P 22222 ./cip-core-image-cip-core-sid-qemu-amd64.swu root@localhost: +``` +The `cip-core-image-cip-core-sid-qemu-amd64.zck` file must be hosted in a http server. + +## Delta Software Update Verification + +Follow the steps mentioned in the section [SWUpdate verification](#swupdate-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. From patchwork Tue May 7 09:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 13656439 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 8C08EC25B75 for ; Tue, 7 May 2024 09:14:24 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.158]) by mx.groups.io with SMTP id smtpd.web10.7203.1715073260058806568 for ; Tue, 07 May 2024 02:14:20 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.158, mailfrom: adithya.balakumar@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1122) id 4479EIQi3577598; Tue, 7 May 2024 18:14:18 +0900 X-Iguazu-Qid: 2rWhclmqRFz3t1kaA5 X-Iguazu-QSIG: v=2; s=0; t=1715073258; q=2rWhclmqRFz3t1kaA5; m=NZRt/HJKmPP5OV/tQsF3G+EdGqx5DiPy/Sx/qNMy9/Y= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1120) id 4479EHru3521523 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 7 May 2024 18:14:18 +0900 From: Adithya Balakumar To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: quirin.gylstorff@siemens.com, felix.moessbauer@siemens.com, shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core][PATCH v6 4/4] Kconfig: Add delta update option Date: Tue, 7 May 2024 14:44:32 +0530 X-TSB-HOP2: ON Message-Id: <20240507091432.895626-5-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> References: <20240507091432.895626-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 May 2024 09:14:11.0374 (UTC) FILETIME=[EC5D04E0:01DAA05E] 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 ; Tue, 07 May 2024 09:14:24 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/15854 This change adds a delta update option for swupdate in kas menu Signed-off-by: Adithya Balakumar --- Kconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Kconfig b/Kconfig index 7c19640..3964098 100644 --- a/Kconfig +++ b/Kconfig @@ -192,6 +192,18 @@ config IMAGE_SWUPDATE bool "SWUpdate support for root partition" depends on TARGET_QEMU_AMD64 || TARGET_SIMATIC_IPC227E || TARGET_QEMU_ARM64 || TARGET_QEMU_ARM || TARGET_BBB || ( TARGET_QEMU_RISCV64 && KERNEL_6_1 ) || TARGET_HIHOPE_RZG2M +choice + prompt "Update type" + depends on IMAGE_SWUPDATE + +config IMAGE_COMPLETE_SWUPDATE + bool "Complete Update" + +config IMAGE_DELTA_SWUPDATE + bool "Delta Update" + +endchoice + config IMAGE_SECURE_BOOT bool "Secure boot support" depends on TARGET_QEMU_AMD64 || TARGET_QEMU_ARM64 || TARGET_QEMU_ARM @@ -202,6 +214,10 @@ config KAS_INCLUDE_SWUPDATE_SECBOOT default "kas/opt/ebg-swu.yml" if IMAGE_SWUPDATE && !IMAGE_SECURE_BOOT default "kas/opt/ebg-secure-boot-snakeoil.yml" if IMAGE_SECURE_BOOT +config KAS_INCLUDE_DELTA_UPDATE + string + default "kas/opt/delta-update.yml" if IMAGE_DELTA_SWUPDATE + config IMAGE_DATA_ENCRYPTION bool "Encrypt data partitions on first boot" depends on TARGET_QEMU_AMD64 || TARGET_QEMU_ARM64 || TARGET_QEMU_ARM