From patchwork Sun Feb 12 08:27:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137638 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 D77E7C636D7 for ; Sun, 12 Feb 2023 22:54:13 +0000 (UTC) Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by mx.groups.io with SMTP id smtpd.web10.7532.1676190496701915908 for ; Sun, 12 Feb 2023 00:28:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=IdPOknv7; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.225, mailfrom: fm-72506-202302120828147535b40333f996cc49-eqedmb@rts-flowmailer.siemens.com) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 202302120828147535b40333f996cc49 for ; Sun, 12 Feb 2023 09:28:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=4/kDUXu/3oHRiaaFFSxG6ppJQPmO1zJWp1pjRSL0Q5Q=; b=IdPOknv7z8aeLrmBJQlSG+rgD0nesPjmn7hdW3Egc1q4DdhV6diEBjAYK7GpLImJt6Dyjp eZNIxtblkGCgtCq1FhNwqWyC3OweZV7Yu7JAlEnJBNHiIza0fgbQ/tV2gLpmbhKB/6O+IQVg vegLrMks6xbvpE89nFZVPhwfAab+E=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 1/8] register image classes via layer.conf Date: Sun, 12 Feb 2023 08:27:51 +0000 Message-Id: <20230212082758.1166262-2-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:13 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10672 This patch registers the provided image classes via the bblayer.conf file. By that, no manual additions of these classes via kas is required and erronous implementations are detected early (e.g. mandatory inputs without defaults). Signed-off-by: Felix Moessbauer --- conf/layer.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/layer.conf b/conf/layer.conf index 0c5fd39..2c888b2 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -22,3 +22,5 @@ LAYERSERIES_COMPAT_cip-core = "next" LAYERDIR_cip-core = "${LAYERDIR}" LAYERDIR_cip-core[vardepvalue] = "isar-cip-core" + +IMAGE_CLASSES += "squashfs verity swupdate" From patchwork Sun Feb 12 08:27:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137637 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 D6833C05027 for ; Sun, 12 Feb 2023 22:54:13 +0000 (UTC) Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.web11.7476.1676190495478615198 for ; Sun, 12 Feb 2023 00:28:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=RpZ4VqZh; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-72506-20230212082816420d1ec5e9ce729b25-od5j7t@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20230212082816420d1ec5e9ce729b25 for ; Sun, 12 Feb 2023 09:28:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=wn+EwePjQE5LWd6UBAuAIna9KpGeeLPoNQnMrkYT/Bs=; b=RpZ4VqZhziNWvEcKb+5kPD9V4n9J3VcIBV6NIAI63vCz7F64TQfqaAb5Tt9BK9O8T4rseB I6Y6qz4UaIk5nMaVurw29HmUTbwmMnC8h8fpN2+Q66yBWRMeK63ItLdvMUsT30Qd4mIF5eG/ 55pxBhlo+jqekhL5ADwfSq3TW/fXI=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 2/8] refactor: use imagetypes for swu generation Date: Sun, 12 Feb 2023 08:27:52 +0000 Message-Id: <20230212082758.1166262-3-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:13 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10671 This patch reworks the implementation of the swupdate type. All generic aspects are moved from the swupdate.inc file into the swupdate class and made conditional on the swu type. The sw-description file is now referenced using the image-type infrastructure, which avoids manual additions to FILESEXTRAPATHS and accidental overwrites of SRC_URI. The templating logic is moved into the generic one provided by imagetypes. Signed-off-by: Felix Moessbauer --- classes/swupdate.bbclass | 26 ++++++++++++------- kas/opt/swupdate.yml | 5 +--- .../images/{files => swu}/sw-description.tmpl | 0 recipes-core/images/swupdate.inc | 15 ----------- 4 files changed, 18 insertions(+), 28 deletions(-) rename recipes-core/images/{files => swu}/sw-description.tmpl (100%) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 5eb4936..966f7c0 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -8,23 +8,33 @@ # Quirin Gylstorff # # SPDX-License-Identifier: MIT +ROOTFS_PARTITION_NAME ?= "${IMAGE_FULLNAME}.wic.p4.gz" SWU_IMAGE_FILE ?= "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.swu" SWU_DESCRIPTION_FILE ?= "sw-description" -SWU_ADDITIONAL_FILES ?= "" +SWU_ADDITIONAL_FILES ?= "linux.efi ${ROOTFS_PARTITION_NAME}" SWU_SIGNED ?= "" SWU_SIGNATURE_EXT ?= "sig" SWU_SIGNATURE_TYPE ?= "rsa" BUILDCHROOT_IMAGE_FILE ?= "${PP_DEPLOY}/${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" -IMAGER_INSTALL += "cpio" -IMAGER_INSTALL += "${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" +IMAGE_TYPEDEP:wic += "squashfs" +IMAGE_TYPEDEP:swu = "wic" +IMAGER_INSTALL:swu += "cpio ${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" -do_swupdate_binary[stamp-extra-info] = "${DISTRO}-${MACHINE}" -do_swupdate_binary[cleandirs] += "${WORKDIR}/swu" -do_swupdate_binary[network] = "${TASK_USE_SUDO}" -do_swupdate_binary() { +IMAGE_SRC_URI:swu = "file://${SWU_DESCRIPTION_FILE}.tmpl" +IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" +IMAGE_TEMPLATE_VARS:swu = "ROOTFS_PARTITION_NAME TARGET_IMAGE_UUID ABROOTFS_PART_UUID_A ABROOTFS_PART_UUID_B" + +# This imagetype is neither machine nor distro specific. Hence, we cannot +# use paths in FILESOVERRIDES. Manual modifications of this variable are +# discouradged and hard to implement. Instead, we register this path explicitly +FILESEXTRAPATHS:prepend = "${LAYERDIR_cip-core}/recipes-core/images/swu:" + +do_image_swu[stamp-extra-info] = "${DISTRO}-${MACHINE}" +do_image_swu[cleandirs] += "${WORKDIR}/swu" +IMAGE_CMD:swu() { rm -f '${SWU_IMAGE_FILE}' cp '${WORKDIR}/${SWU_DESCRIPTION_FILE}' '${WORKDIR}/swu/${SWU_DESCRIPTION_FILE}' @@ -91,5 +101,3 @@ do_swupdate_binary() { fi done | cpio -ovL -H crc > "${BUILDCHROOT_IMAGE_FILE}"' } - -addtask swupdate_binary before do_build after do_deploy do_copy_boot_files do_install_imager_deps do_transform_template diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml index ae5e3a1..80cd86e 100644 --- a/kas/opt/swupdate.yml +++ b/kas/opt/swupdate.yml @@ -19,11 +19,8 @@ local_conf_header: CIP_IMAGE_OPTIONS:append = " swupdate.inc" wic-swu: | - IMAGE_CLASSES += "squashfs" - IMAGE_TYPEDEP:wic += "squashfs" - IMAGE_FSTYPES = "wic" + IMAGE_FSTYPES += "swu" WKS_FILE ?= "${MACHINE}-${SWUPDATE_BOOTLOADER}.wks.in" INITRAMFS_INSTALL:append = " initramfs-squashfs-hook" - WIC_DEPLOY_PARTITIONS = "1" ABROOTFS_PART_UUID_A ?= "fedcba98-7654-3210-cafe-5e0710000001" ABROOTFS_PART_UUID_B ?= "fedcba98-7654-3210-cafe-5e0710000002" diff --git a/recipes-core/images/files/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl similarity index 100% rename from recipes-core/images/files/sw-description.tmpl rename to recipes-core/images/swu/sw-description.tmpl diff --git a/recipes-core/images/swupdate.inc b/recipes-core/images/swupdate.inc index ee893dd..f4f5c42 100644 --- a/recipes-core/images/swupdate.inc +++ b/recipes-core/images/swupdate.inc @@ -10,26 +10,11 @@ # inherit image_uuid -inherit swupdate inherit read-only-rootfs IMAGE_INSTALL += " swupdate" IMAGE_INSTALL += " swupdate-handler-roundrobin" -ROOTFS_PARTITION_NAME = "${IMAGE_FULLNAME}.wic.p4.gz" - -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI += "file://sw-description.tmpl" -TEMPLATE_FILES += "sw-description.tmpl" - -do_transform_template[vardeps] += "TARGET_IMAGE_UUID" -addtask do_transform_template before do_swupdate_binary after do_generate_image_uuid - -TEMPLATE_VARS += "ROOTFS_PARTITION_NAME TARGET_IMAGE_UUID ABROOTFS_PART_UUID_A ABROOTFS_PART_UUID_B" - -SWU_ADDITIONAL_FILES += "linux.efi ${ROOTFS_PARTITION_NAME}" - python() { for u in ['A', 'B']: if not d.getVar('ABROOTFS_PART_UUID_' + u): From patchwork Sun Feb 12 08:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137639 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 E58F6C636D3 for ; Sun, 12 Feb 2023 22:54:13 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.web11.7477.1676190510835088738 for ; Sun, 12 Feb 2023 00:28:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=fedlJWjQ; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-72506-202302120828283dd73735f5f3870846-zi67aw@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202302120828283dd73735f5f3870846 for ; Sun, 12 Feb 2023 09:28:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=OfXHq/mn5YzILBo2750DpvFhLN6g54O0quepi0MgxR0=; b=fedlJWjQbzvHnFOgtxPMi6RrLwpw8eGAXWnoTitQ8vDKrsXiuop3UmIFh8mAt+b4NYZPrJ 2e3ymTKiZQKgZRipqoTiNn7NQgvsX2VrR61mda2bnbf89E6TOrmRc8BC5QrZlf6oAALLKR0P GBTGVp+QPdxkTk5aEZZa28kmLgdLc=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 3/8] swu: directly image from squashfs rootfs Date: Sun, 12 Feb 2023 08:27:53 +0000 Message-Id: <20230212082758.1166262-4-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:13 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10673 This patch reworks the generation of the swu file. Instead of using the rootfs partition created by wic, we directly use the squashfs rootfs as default. By that, we do not have to deploy the WIC partitions and also always select the correct rootfs independent of the partition number. This is especially relevant for embedded boards, where the first partitions contain the u-boot-spl and firmware. For use-cases with other fs formats (like verity), we support to overwrite the SWU_ROOTFS_NAME and SWU_ROOTFS_TYPE. Signed-off-by: Felix Moessbauer --- classes/swupdate.bbclass | 8 +++++--- kas/opt/ebg-secure-boot-snakeoil.yml | 1 + kas/opt/swupdate.yml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 966f7c0..50a15e1 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -6,9 +6,12 @@ # Authors: # Christian Storm # Quirin Gylstorff +# Felix Moessbauer # # SPDX-License-Identifier: MIT -ROOTFS_PARTITION_NAME ?= "${IMAGE_FULLNAME}.wic.p4.gz" +SWU_ROOTFS_TYPE ?= "squashfs" +SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}" +ROOTFS_PARTITION_NAME ?= "${SWU_ROOTFS_NAME}.${SWU_ROOTFS_TYPE}.gz" SWU_IMAGE_FILE ?= "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.swu" SWU_DESCRIPTION_FILE ?= "sw-description" @@ -19,8 +22,7 @@ SWU_SIGNATURE_TYPE ?= "rsa" BUILDCHROOT_IMAGE_FILE ?= "${PP_DEPLOY}/${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" -IMAGE_TYPEDEP:wic += "squashfs" -IMAGE_TYPEDEP:swu = "wic" +IMAGE_TYPEDEP:swu = "wic ${SWU_ROOTFS_TYPE}.gz" IMAGER_INSTALL:swu += "cpio ${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGE_SRC_URI:swu = "file://${SWU_DESCRIPTION_FILE}.tmpl" diff --git a/kas/opt/ebg-secure-boot-snakeoil.yml b/kas/opt/ebg-secure-boot-snakeoil.yml index a182a67..8f2b7bb 100644 --- a/kas/opt/ebg-secure-boot-snakeoil.yml +++ b/kas/opt/ebg-secure-boot-snakeoil.yml @@ -19,6 +19,7 @@ local_conf_header: IMAGE_CLASSES += "verity" IMAGE_FSTYPES = "wic" IMAGE_TYPEDEP:wic += "verity" + SWU_ROOTFS_TYPE = "verity" WKS_FILE = "${MACHINE}-efibootguard-secureboot.wks.in" INITRAMFS_INSTALL:append = " initramfs-verity-hook" # abrootfs cannot be installed together with verity diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml index 80cd86e..236b3c4 100644 --- a/kas/opt/swupdate.yml +++ b/kas/opt/swupdate.yml @@ -19,6 +19,7 @@ local_conf_header: CIP_IMAGE_OPTIONS:append = " swupdate.inc" wic-swu: | + IMAGE_TYPEDEP:wic += "squashfs" IMAGE_FSTYPES += "swu" WKS_FILE ?= "${MACHINE}-${SWUPDATE_BOOTLOADER}.wks.in" INITRAMFS_INSTALL:append = " initramfs-squashfs-hook" From patchwork Sun Feb 12 08:27:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137640 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 CB30AC636D3 for ; Sun, 12 Feb 2023 22:54:23 +0000 (UTC) Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by mx.groups.io with SMTP id smtpd.web10.7533.1676190512775611233 for ; Sun, 12 Feb 2023 00:28:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=amfaT6qm; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.227, mailfrom: fm-72506-20230212082830cc451d5a4318befe3a-uawc_c@rts-flowmailer.siemens.com) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 20230212082830cc451d5a4318befe3a for ; Sun, 12 Feb 2023 09:28:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=dq/SJtvA2ylObjmDy9EGH5ViaMQyt+HXYdQghKCUP8g=; b=amfaT6qmc+ffLZQEN8SDfuRXPiSwsFfroF1SaQKSqPZDKdWm1XUWpYOPqQFKEx1+P5tBKS 3qxrvrHRo3rYGK+8l2rLcMtdbXgzJmnqrHnYpZ5fmm1aSTCGoiRd0/cLsi1qLlYq//0qL3aa S121xJyrc2fE9uKL8qffvwdd3gcWU=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 4/8] swupdate: only check partition uuids on swupdate Date: Sun, 12 Feb 2023 08:27:54 +0000 Message-Id: <20230212082758.1166262-5-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:23 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10674 This patch moves the partition uuid check into a task to only execute the logic in case an swu image is built. Previously this was checked at parse time, leading to errors when not setting these variables and building an image without swupdate support from an layer that also provides images with swupdate support. Signed-off-by: Felix Moessbauer --- classes/swupdate.bbclass | 8 ++++++++ recipes-core/images/swupdate.inc | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 50a15e1..931ac30 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -103,3 +103,11 @@ IMAGE_CMD:swu() { fi done | cpio -ovL -H crc > "${BUILDCHROOT_IMAGE_FILE}"' } + +python do_check_swu_partition_uuids() { + for u in ['A', 'B']: + if not d.getVar('ABROOTFS_PART_UUID_' + u): + bb.fatal('ABROOTFS_PART_UUID_' + u + ' not set') +} + +addtask check_swu_partition_uuids before do_image_swu diff --git a/recipes-core/images/swupdate.inc b/recipes-core/images/swupdate.inc index f4f5c42..08867cd 100644 --- a/recipes-core/images/swupdate.inc +++ b/recipes-core/images/swupdate.inc @@ -14,9 +14,3 @@ inherit read-only-rootfs IMAGE_INSTALL += " swupdate" IMAGE_INSTALL += " swupdate-handler-roundrobin" - -python() { - for u in ['A', 'B']: - if not d.getVar('ABROOTFS_PART_UUID_' + u): - bb.fatal('ABROOTFS_PART_UUID_' + u + ' not set') -} From patchwork Sun Feb 12 08:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137641 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 D1FEEC636D7 for ; Sun, 12 Feb 2023 22:54:23 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.web11.7477.1676190510835088738 for ; Sun, 12 Feb 2023 00:28:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=O+/T3uBN; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-72506-2023021208283213054ab711609acd42-mltxzq@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 2023021208283213054ab711609acd42 for ; Sun, 12 Feb 2023 09:28:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=Gd+DzsYI2y8SpMSvbCti/U3UPJKgvtrSpciqXV5cDRw=; b=O+/T3uBN0XcgbJtBU+425ZbmrpzL80YXb4hyo83/p2W9a188J3OKZHQehSIGBvIUVQhyDv WIDVWliGCzWlOgdNNj0m84jtX0Kw89IP+rnEUBn1Op4VwmuyuNcdIWK5PTY+4b9or2fGtcXN eUn+rsoKGu4M98mRE4VXyQhA0jVz8=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 5/8] make sw-description spec compliant Date: Sun, 12 Feb 2023 08:27:55 +0000 Message-Id: <20230212082758.1166262-6-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:23 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10675 Remove the filesystem attribute from the images object, as this can only be applied to files objects. Signed-off-by: Felix Moessbauer --- recipes-core/images/swu/sw-description.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl index 05125e6..01c5f53 100644 --- a/recipes-core/images/swu/sw-description.tmpl +++ b/recipes-core/images/swu/sw-description.tmpl @@ -17,7 +17,6 @@ software = device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; type = "roundrobin"; compressed = "zlib"; - filesystem = "ext4"; properties: { subtype = "image"; configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; From patchwork Sun Feb 12 08:27:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137642 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 D1CCEC05027 for ; Sun, 12 Feb 2023 22:54:23 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.web10.7539.1676190527045422079 for ; Sun, 12 Feb 2023 00:28:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=molX4xgA; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-72506-202302120828456d8fa169a092f353e6-lmk4em@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202302120828456d8fa169a092f353e6 for ; Sun, 12 Feb 2023 09:28:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=xiiCHROD87do0DVkS7cz3pppyFRhEnd9hhzdyMS4wJs=; b=molX4xgA7aFRPB1NQmNTxN2m7bo8qqHJikASIbS2AagV4LZ3EGDrL8CQPxeKhjgyR3h+kz OVrm2PBxpqS8D3y6FupvY4+KI5WVuAzieuItYElPCR178xTcFlqZmMGNQ8k9dmDWTn0sPN1P QPJWGpEnaVSSJ+ZLtNHpiIf8Z5eSw=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 6/8] swu: replace custom image compression Date: Sun, 12 Feb 2023 08:27:56 +0000 Message-Id: <20230212082758.1166262-7-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:23 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10676 This patch replaces the custom compression logic for the rootfs in the swupdate swu file by using the imagetype infrastructure. This handles some corner-cases and in general streamlines the options used for compressing. With the new infrastructure in place, we add support to compress the image with zstd (only zlib and zstd are supported by swupdate). Signed-off-by: Felix Moessbauer --- classes/swupdate.bbclass | 40 ++++++++++----------- recipes-core/images/swu/sw-description.tmpl | 2 +- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 931ac30..6085dce 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -11,7 +11,9 @@ # SPDX-License-Identifier: MIT SWU_ROOTFS_TYPE ?= "squashfs" SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}" -ROOTFS_PARTITION_NAME ?= "${SWU_ROOTFS_NAME}.${SWU_ROOTFS_TYPE}.gz" +# compression type as defined by swupdate (zlib or zstd) +SWU_COMPRESSION_TYPE ?= "zlib" +ROOTFS_PARTITION_NAME ?= "${SWU_ROOTFS_NAME}.${SWU_ROOTFS_TYPE}.${@get_swu_compression_type(d)}" SWU_IMAGE_FILE ?= "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.swu" SWU_DESCRIPTION_FILE ?= "sw-description" @@ -22,12 +24,25 @@ SWU_SIGNATURE_TYPE ?= "rsa" BUILDCHROOT_IMAGE_FILE ?= "${PP_DEPLOY}/${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" -IMAGE_TYPEDEP:swu = "wic ${SWU_ROOTFS_TYPE}.gz" +IMAGE_TYPEDEP:swu = "wic ${SWU_ROOTFS_TYPE}.${@get_swu_compression_type(d)}" IMAGER_INSTALL:swu += "cpio ${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGE_SRC_URI:swu = "file://${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" -IMAGE_TEMPLATE_VARS:swu = "ROOTFS_PARTITION_NAME TARGET_IMAGE_UUID ABROOTFS_PART_UUID_A ABROOTFS_PART_UUID_B" +IMAGE_TEMPLATE_VARS:swu = " \ + ROOTFS_PARTITION_NAME \ + TARGET_IMAGE_UUID \ + ABROOTFS_PART_UUID_A \ + ABROOTFS_PART_UUID_B \ + SWU_COMPRESSION_TYPE" + +# convert between swupdate compressor name and imagetype extension +def get_swu_compression_type(d): + swu_ct = d.getVar('SWU_COMPRESSION_TYPE', True) + swu_to_image = {'zlib': 'gz', 'zstd': 'zst'} + if swu_ct not in swu_to_image: + bb.fatal('requested SWU_COMPRESSION_TYPE is not supported by swupdate') + return swu_to_image[swu_ct] # This imagetype is neither machine nor distro specific. Hence, we cannot # use paths in FILESOVERRIDES. Manual modifications of this variable are @@ -40,25 +55,6 @@ IMAGE_CMD:swu() { rm -f '${SWU_IMAGE_FILE}' cp '${WORKDIR}/${SWU_DESCRIPTION_FILE}' '${WORKDIR}/swu/${SWU_DESCRIPTION_FILE}' - # Compress files if requested - for file in ${SWU_ADDITIONAL_FILES}; do - basefile=$(basename "$file" .gz) - if [ "$basefile" = "$file" ]; then - continue - fi - for uncompressed in "${WORKDIR}/$basefile" "${DEPLOY_DIR_IMAGE}/$basefile"; do - if [ -e "$uncompressed" ]; then - rm -f "$uncompressed.gz" - if [ -x "$(command -v pigz)" ]; then - pigz "$uncompressed" - else - gzip "$uncompressed" - fi - break - fi - done - done - # Create symlinks for files used in the update image for file in ${SWU_ADDITIONAL_FILES}; do if [ -e "${WORKDIR}/$file" ]; then diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl index 01c5f53..b5a8622 100644 --- a/recipes-core/images/swu/sw-description.tmpl +++ b/recipes-core/images/swu/sw-description.tmpl @@ -16,7 +16,7 @@ software = filename = "${ROOTFS_PARTITION_NAME}"; device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; type = "roundrobin"; - compressed = "zlib"; + compressed = "${SWU_COMPRESSION_TYPE}"; properties: { subtype = "image"; configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; From patchwork Sun Feb 12 08:27:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137643 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 D0977C636D3 for ; Sun, 12 Feb 2023 22:54:33 +0000 (UTC) Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.web11.7482.1676190530380317213 for ; Sun, 12 Feb 2023 00:28:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=Pv6pgF60; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-72506-20230212082848dc3e3ac4bda65e1e9d-rmtncg@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 20230212082848dc3e3ac4bda65e1e9d for ; Sun, 12 Feb 2023 09:28:48 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=Bu13gbe/GiK+Qe2lPWPHvlhUdA1mxXT5/hW1fb25+xo=; b=Pv6pgF602/v4Q/JAewUCVNZTSEf4dzt8st1dfXIvjjUL07Sdb6VDxuTblP+VWqJ+Eu55nK HvGvnThDWtXBAqsxkHTmx3LT5OQ2r7xB4NF0ORc3GU1xBl/Z9I3E6ADDXzutSP7rYpc0Y0LS rrbourG9ENAlT64VZeCCF7PosvJjc=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 7/8] prefix swu related variables with SWU Date: Sun, 12 Feb 2023 08:27:57 +0000 Message-Id: <20230212082758.1166262-8-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:33 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10677 This patch ensures that all variables used in the swupdate.bbclass are either only active when swu is selected, or are prefixed with SWU. By that, we avoid accidental name collisions in the image recipe, as this recipe always inherits the swupdate class (via the imagetype logic). Signed-off-by: Felix Moessbauer --- classes/swupdate.bbclass | 10 +++++----- recipes-core/images/swu/sw-description.tmpl | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 6085dce..fc30df8 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -13,16 +13,16 @@ SWU_ROOTFS_TYPE ?= "squashfs" SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}" # compression type as defined by swupdate (zlib or zstd) SWU_COMPRESSION_TYPE ?= "zlib" -ROOTFS_PARTITION_NAME ?= "${SWU_ROOTFS_NAME}.${SWU_ROOTFS_TYPE}.${@get_swu_compression_type(d)}" +SWU_ROOTFS_PARTITION_NAME ?= "${SWU_ROOTFS_NAME}.${SWU_ROOTFS_TYPE}.${@get_swu_compression_type(d)}" SWU_IMAGE_FILE ?= "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.swu" SWU_DESCRIPTION_FILE ?= "sw-description" -SWU_ADDITIONAL_FILES ?= "linux.efi ${ROOTFS_PARTITION_NAME}" +SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}" SWU_SIGNED ?= "" SWU_SIGNATURE_EXT ?= "sig" SWU_SIGNATURE_TYPE ?= "rsa" -BUILDCHROOT_IMAGE_FILE ?= "${PP_DEPLOY}/${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" +SWU_BUILDCHROOT_IMAGE_FILE ?= "${PP_DEPLOY}/${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" IMAGE_TYPEDEP:swu = "wic ${SWU_ROOTFS_TYPE}.${@get_swu_compression_type(d)}" IMAGER_INSTALL:swu += "cpio ${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" @@ -30,7 +30,7 @@ IMAGER_INSTALL:swu += "cpio ${@'openssl' if bb.utils.to_boolean(d.getVar('SWU_SI IMAGE_SRC_URI:swu = "file://${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_VARS:swu = " \ - ROOTFS_PARTITION_NAME \ + SWU_ROOTFS_PARTITION_NAME \ TARGET_IMAGE_UUID \ ABROOTFS_PART_UUID_A \ ABROOTFS_PART_UUID_B \ @@ -97,7 +97,7 @@ IMAGE_CMD:swu() { fi echo "$file.${SWU_SIGNATURE_EXT}" fi - done | cpio -ovL -H crc > "${BUILDCHROOT_IMAGE_FILE}"' + done | cpio -ovL -H crc > "${SWU_BUILDCHROOT_IMAGE_FILE}"' } python do_check_swu_partition_uuids() { diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl index b5a8622..cade7c3 100644 --- a/recipes-core/images/swu/sw-description.tmpl +++ b/recipes-core/images/swu/sw-description.tmpl @@ -13,7 +13,7 @@ software = version = "0.2"; name = "cip software update"; images: ({ - filename = "${ROOTFS_PARTITION_NAME}"; + filename = "${SWU_ROOTFS_PARTITION_NAME}"; device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; type = "roundrobin"; compressed = "${SWU_COMPRESSION_TYPE}"; @@ -21,7 +21,7 @@ software = subtype = "image"; configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; }; - sha256 = "${ROOTFS_PARTITION_NAME}-sha256"; + sha256 = "${SWU_ROOTFS_PARTITION_NAME}-sha256"; }); files: ({ filename = "linux.efi"; From patchwork Sun Feb 12 08:27:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Moessbauer X-Patchwork-Id: 13137635 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 0931EC636D3 for ; Sun, 12 Feb 2023 22:54:04 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.web10.7540.1676190532419507263 for ; Sun, 12 Feb 2023 00:28:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=felix.moessbauer@siemens.com header.s=fm1 header.b=dZ4pQ4Dh; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-72506-2023021208285071682e7f3623e1e738-ez6kie@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 2023021208285071682e7f3623e1e738 for ; Sun, 12 Feb 2023 09:28:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=b/PI5KraOKL/V/kVevtMIU0uGf7oSI2Y0Uqp1L8cek0=; b=dZ4pQ4Dh3Rb/twgWSZtAgC520opJt4aLkWXEUyo+RsNuGLfXLSKfgUjFTrgZ17f17UHn25 4baAGmyvsi5zpRoGjaok8oZNrAOgOA433+5yA3alQT775LhLj/AoRQYF+Xdt45wyhoaV0sAq 7W6BijZC7MiGjyuqCbQOnNjzkclE0=; From: Felix Moessbauer To: cip-dev@lists.cip-project.org Cc: adriaan.schmidt@siemens.com, jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Felix Moessbauer Subject: [isar-cip-core][PATCH v4 8/8] refactor verity image creation Date: Sun, 12 Feb 2023 08:27:58 +0000 Message-Id: <20230212082758.1166262-9-felix.moessbauer@siemens.com> In-Reply-To: <20230212082758.1166262-1-felix.moessbauer@siemens.com> References: <20230212082758.1166262-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer 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 ; Sun, 12 Feb 2023 22:54:04 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/10669 This patch simplifies the integration of verity with swupdate. We now directly copy the generated verity image into the swu file, instead of going via wic. This solves the issue with leading partitions, shifting the partition layout and resulting in a wrong partition in the swu file. Further, we cleanup some duplicated variables. Signed-off-by: Felix Moessbauer --- classes/verity.bbclass | 7 +------ kas/opt/ebg-secure-boot-snakeoil.yml | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/classes/verity.bbclass b/classes/verity.bbclass index 154b9e1..747a7ae 100644 --- a/classes/verity.bbclass +++ b/classes/verity.bbclass @@ -9,21 +9,16 @@ # SPDX-License-Identifier: MIT # -VERITY_IMAGE_TYPE ?= "squashfs" - -inherit ${VERITY_IMAGE_TYPE} - IMAGE_TYPEDEP:verity = "${VERITY_IMAGE_TYPE}" IMAGER_INSTALL:verity += "cryptsetup" +VERITY_IMAGE_TYPE ?= "squashfs" VERITY_INPUT_IMAGE ?= "${IMAGE_FULLNAME}.${VERITY_IMAGE_TYPE}" VERITY_OUTPUT_IMAGE ?= "${IMAGE_FULLNAME}.verity" VERITY_IMAGE_METADATA = "${VERITY_OUTPUT_IMAGE}.metadata" VERITY_HASH_BLOCK_SIZE ?= "1024" VERITY_DATA_BLOCK_SIZE ?= "1024" -IMAGER_INSTALL += "cryptsetup" - create_verity_env_file() { local ENV="${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.verity.env" diff --git a/kas/opt/ebg-secure-boot-snakeoil.yml b/kas/opt/ebg-secure-boot-snakeoil.yml index 8f2b7bb..3d0e3c9 100644 --- a/kas/opt/ebg-secure-boot-snakeoil.yml +++ b/kas/opt/ebg-secure-boot-snakeoil.yml @@ -16,7 +16,6 @@ header: local_conf_header: secure-boot-image: | - IMAGE_CLASSES += "verity" IMAGE_FSTYPES = "wic" IMAGE_TYPEDEP:wic += "verity" SWU_ROOTFS_TYPE = "verity"