From patchwork Thu Jan 30 09:39:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954373 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 07A96C02198 for ; Thu, 30 Jan 2025 09:39:29 +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.12049.1738229961102574227 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=ONJrfv7m; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-294854-202501300939182e9dfeb6c8bae4e5d2-higbx2@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202501300939182e9dfeb6c8bae4e5d2 for ; Thu, 30 Jan 2025 10:39:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=5qve6P4Fj9MG+wmzEVqJLK23zqS/L7xkLm8L6m8ImiA=; b=ONJrfv7moyc8PHiQaGs1CwJ31YQuJC2hZGpxVFWqdaHw0StOHofucN4RZTXbnKu45kdB/B y81nUpzJbKXI0/vomWbtr47lkqQrcw6kQx/G3ue/lzNRWL6JBZvLclQ1uiLILzjaDc0Uw2Y0 kfTa0c4E/qGSUZFv71IaCTHtSUzM1GaTXOZY/FeKgYo+7mAJM+Rn50dYww0uNgxRgMbP1390 xJNyoTX8o9XFPrEOZt0JZeiZ+HtO63zhPgNLlmKMe4i3zapJqZxAgD71C62gBY+T2HU27AHn I54g7G1R9/NnGW45W1FUqB5FlS361Glz5i2zyy219rUUe62MlR88kB5Q==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 01/10] initramfs-crypt-hook: Add support for btrfs Date: Thu, 30 Jan 2025 10:39:08 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:29 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17707 From: Jan Kiszka Add the required bits to support reencryption of btrfs, thus resizing. To avoid bloating the initramfs if this filesystem is not used, make it opt-in. Signed-off-by: Jan Kiszka --- .../initramfs-crypt-hook/files/local-top-complete | 7 +++++++ .../initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete b/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete index 8adc4e58..54b8a6e0 100644 --- a/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete +++ b/recipes-initramfs/initramfs-crypt-hook/files/local-top-complete @@ -85,6 +85,13 @@ EOF panic "reencryption of partition $1 cannot continue - resizing of the partition failed!" fi ;; + btrfs) + mkdir /.mnt-tmp + mount -t btrfs "$1" /.mnt-tmp + btrfs filesystem resize "${reduced_size_in_kb}" /.mnt-tmp + umount /.mnt-tmp + rmdir /.mnt-tmp + ;; squashfs|swap|erofs|"") [ "$debug" = "y" ] && echo "skip disk resize as it is not supported or unnecessary for fstype: '$partition_fstype'" ;; diff --git a/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb b/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb index 71ee44db..df335c9f 100644 --- a/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb +++ b/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb @@ -82,6 +82,8 @@ INITRAMFS_WATCHDOG_DEVICE ??= "/dev/watchdog" CRYPT_HASH_TYPE ??= "sha256" CRYPT_KEY_ALGORITHM ??= "ecc" CRYPT_ENCRYPTION_OPTIONAL ??= "false" +# add support for btrfs encryption +CRYPT_BTRFS_SUPPORT ??= "0" TEMPLATE_VARS += "CRYPT_PARTITIONS CRYPT_CREATE_FILE_SYSTEM_CMD \ CRYPT_SETUP_TIMEOUT INITRAMFS_WATCHDOG_DEVICE CRYPT_HASH_TYPE \ @@ -92,6 +94,10 @@ OVERRIDES .= "${@':expand-on-crypt' if ':expand' in d.getVar('CRYPT_PARTITIONS') DEBIAN_DEPENDS:append:expand-on-crypt = ", fdisk, util-linux" HOOK_COPY_EXECS:append:expand-on-crypt = " sed sfdisk tail cut dd partx rm" +OVERRIDES .= "${@':btrfs-support' if bb.utils.to_boolean(d.getVar('CRYPT_BTRFS_SUPPORT')) else ''}" +DEBIAN_DEPENDS:append:btrfs-support = ", btrfs-progs" +HOOK_COPY_EXECS:append:btrfs-support = " mkdir rmdir btrfs" + do_install[cleandirs] += "${D}/usr/share/encrypt_partition" do_install:prepend() { install -m 0600 "${WORKDIR}/encrypt_partition.env" "${D}/usr/share/encrypt_partition/encrypt_partition.env" From patchwork Thu Jan 30 09:39:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954375 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 0A6D9C3DA4A for ; Thu, 30 Jan 2025 09:39:29 +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.12047.1738229961127205024 for ; Thu, 30 Jan 2025 01:39:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=AOhLrm9E; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-294854-202501300939182d8535175867336765-ycecnq@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202501300939182d8535175867336765 for ; Thu, 30 Jan 2025 10:39:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=7o/5aGfYbaMv+qJwnX2dKgSAgy9RXCG+q0RliYThbfQ=; b=AOhLrm9EaH1UTqXMoTm8xRfasf4n7dHl0b6ziCLvNosjt8lziwX5WlSDF+6o/CFmeZx6U8 tVXXleUncDExG0h8WYJLwToUK5DpOv+behfYjzYG9fD1kQqtisYul9czQ4nGXmj7R/gffiO6 kVuKIQPGPFv3nLKb1XId/nY06LMEWxAZSc3n5jHhEMm/uD7Dv+RJk45nh8hKn4GF3sQnlYN3 QCPqFgI286HMLmg5Qw8V1/lNIjtlPFFswr6MYc1c3XnGc/RpyEH6B2Swui/ET1g3bSiv4cvR RqlC76AH0Vn5DHJzOYy5yzcFIdJYZL5UhQLXLfC8yiA8Qfi7wRfyR7Ig==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 02/10] initramfs-crypt-hook: Bump revision Date: Thu, 30 Jan 2025 10:39:09 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:29 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17700 From: Jan Kiszka Recent commits modified the recipe in a way that justifies a bump. Signed-off-by: Jan Kiszka --- .../{initramfs-crypt-hook_0.5.bb => initramfs-crypt-hook_0.6.bb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename recipes-initramfs/initramfs-crypt-hook/{initramfs-crypt-hook_0.5.bb => initramfs-crypt-hook_0.6.bb} (100%) diff --git a/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb b/recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.6.bb similarity index 100% rename from recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.5.bb rename to recipes-initramfs/initramfs-crypt-hook/initramfs-crypt-hook_0.6.bb From patchwork Thu Jan 30 09:39:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954368 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 CF341C02190 for ; Thu, 30 Jan 2025 09:39:28 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.web11.12046.1738229960994990639 for ; Thu, 30 Jan 2025 01:39:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=aV4U58uE; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-294854-2025013009391850fe69ba3998d02edd-_v722h@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2025013009391850fe69ba3998d02edd for ; Thu, 30 Jan 2025 10:39:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=CbAEtq8IlQeiviEuVLbDphUu0wXUUOQTceXbOiI7Q9w=; b=aV4U58uEan0+NncmeIBkJ6PcA9iEqd86cfSdtYYMLxx3ar1Xt7DLoJGmnVyp1FRJ3pA/BJ nBhTbY6ziRBsBCEF50EFdIxfXaaQU2JYbFqVKsr1lAS8lOY1S1/W0SiDMTy/2zYVaxYtoT0+ j/YMXJt8UMwZeqrOkg8Xo53sYVUjb0cNCzWY56Zl1VqKvTVLUIQ85BNvdSDGRO7EGaT8oS5U vY88qP7DZ1dUbUzfRbf7dN6oCpBMzKBhd8MEblVstNZ6PdNQdLemCFq+6QjERRgHvWOrFaYq fOxSh0c49EaWYWUDmNUZRmB9yBKdUavTDs5H9/m8pnV2xje7msj3Zh9Q==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 03/10] initramfs: Add hook for managing /var in A/B fashion Date: Thu, 30 Jan 2025 10:39:10 +0100 Message-ID: <37b9560989414bfd128bfe7e1d5afec53a148179.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:28 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17699 From: Jan Kiszka This hook manages snapshots of the filesystem backing /var in an A/B way, aligned with rootfs instances. That means when an new version is first booted in testing mode (EFI Boot Guard ustate=2), a snapshot of the current version is taken before that snapshot is mounted as /var. On rollback, the previous version will still be available and will be used again. After committing a new version, garbage collection of the previous snapshot is happening on next boot. This first version of the hook is written around EFI Boot Guard as A/B boot manager and btrfs as mechanism (here in form of a filesystem) to create and manage snapshots with low overhead. Other implementations are imaginable and would only require small refactorings to enable them as configurable alternatives. Signed-off-by: Jan Kiszka --- .../files/local-bottom.tmpl | 86 +++++++++++++++++++ .../initramfs-abvar-hook_0.1.bb | 31 +++++++ 2 files changed, 117 insertions(+) create mode 100644 recipes-initramfs/initramfs-abvar-hook/files/local-bottom.tmpl create mode 100644 recipes-initramfs/initramfs-abvar-hook/initramfs-abvar-hook_0.1.bb diff --git a/recipes-initramfs/initramfs-abvar-hook/files/local-bottom.tmpl b/recipes-initramfs/initramfs-abvar-hook/files/local-bottom.tmpl new file mode 100644 index 00000000..91b8d017 --- /dev/null +++ b/recipes-initramfs/initramfs-abvar-hook/files/local-bottom.tmpl @@ -0,0 +1,86 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Siemens, 2025 +# +# Authors: +# Jan Kiszka +# + +var_device="${INITRAMFS_VAR_DEVICE}" +var_opts="${INITRAMFS_VAR_MOUNT_OPTIONS}" +btrfs_mnt="/.var-btrfs" +snap_prefix="abvar-" + +. "${rootmnt}/etc/os-release" + +get_default_subvolume() +{ + subvol=$(btrfs subvolume get-default "$1" | grep path || true) + echo "${subvol##*path }" +} + +ustate_val=$(bg_printenv -c -r -o ustate) + +# when in testing state or on first boot, create new snapshot +if [ "$ustate_val" = "USTATE=2" ] || + ! mount -t btrfs -o "$var_opts,subvol=/$snap_prefix$IMAGE_UUID" \ + "$var_device" "${rootmnt}/var" 2>/dev/null; then + log_begin_msg "Creating new /var snapshot for image $IMAGE_UUID" + + mkdir "$btrfs_mnt" + mount -t btrfs -o subvol=/ "$var_device" "$btrfs_mnt" + + # delete any dangling previous snapshot + btrfs subvolume delete "$btrfs_mnt/$snap_prefix$IMAGE_UUID" \ + 2>/dev/null || true + + default_subvol=$(get_default_subvolume "$btrfs_mnt") + btrfs subvolume snapshot "$btrfs_mnt/$default_subvol" \ + "$btrfs_mnt/$snap_prefix$IMAGE_UUID" + + umount "$btrfs_mnt" + rmdir "$btrfs_mnt" + + log_end_msg + + mount -t btrfs -o "$var_opts,subvol=/$snap_prefix$IMAGE_UUID" \ + "$var_device" "${rootmnt}/var" +else + default_subvol=$(get_default_subvolume "${rootmnt}/var") +fi + +active_entry=$(btrfs subvolume list -a "${rootmnt}/var" | + grep "/$snap_prefix$IMAGE_UUID") +active_id="${active_entry#ID }" +active_id="${active_id%% *}" + +# adjust default subvolume to the active one +if [ "$default_subvol" != "$snap_prefix$IMAGE_UUID" ]; then + log_begin_msg "Adjusting /var subvolume default to $IMAGE_UUID" + btrfs subvolume set-default "$active_id" "${rootmnt}/var" + log_end_msg +fi + +if [ "$(bg_printenv -c -r -o ustate)" != "USTATE=0" ]; then + # still testing the current version, skip cleanup + exit 0 +fi + +# get rid of obsolete snapshots, ie. everything but the active one +log_begin_msg "Performing /var snapshot housekeeping" + +IFS=" +" +for entry in $(btrfs subvolume list -aqu "${rootmnt}/var" | + grep "/$snap_prefix"); do + entry_id="${entry#ID }" + entry_id="${entry_id%% *}" + + if [ "$entry_id" != "$active_id" ]; then + btrfs subvolume delete -i "$entry_id" "${rootmnt}/var" + fi +done +unset IFS + +log_end_msg diff --git a/recipes-initramfs/initramfs-abvar-hook/initramfs-abvar-hook_0.1.bb b/recipes-initramfs/initramfs-abvar-hook/initramfs-abvar-hook_0.1.bb new file mode 100644 index 00000000..c7b58243 --- /dev/null +++ b/recipes-initramfs/initramfs-abvar-hook/initramfs-abvar-hook_0.1.bb @@ -0,0 +1,31 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Siemens, 2025 +# +# Authors: +# Jan Kiszka +# +# SPDX-License-Identifier: MIT + +require recipes-initramfs/initramfs-hook/hook.inc + +SRC_URI += " \ + file://local-bottom.tmpl" + +# override this to switch to UUID or PARTUUID based mounts +INITRAMFS_VAR_DEVICE ??= "/dev/disk/by-label/var" + +INITRAMFS_VAR_MOUNT_OPTIONS ??= "defaults,nodev,nosuid,noexec" + +TEMPLATE_FILES += "local-bottom.tmpl" +TEMPLATE_VARS += "\ + INITRAMFS_VAR_DEVICE \ + INITRAMFS_VAR_MOUNT_OPTIONS" + +HOOK_ADD_MODULES = "btrfs" +HOOK_COPY_EXECS = "btrfs grep rmdir bg_printenv" + +DEBIAN_DEPENDS .= ", btrfs-progs, efibootguard" + +SCRIPT_PREREQ = "crypt" From patchwork Thu Jan 30 09:39:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954367 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 C3126C0218A for ; Thu, 30 Jan 2025 09:39:28 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.web10.12053.1738229961421101362 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=cRzZ3K92; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-294854-2025013009391847837b8196446b1150-nnv9hh@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 2025013009391847837b8196446b1150 for ; Thu, 30 Jan 2025 10:39:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=tdvr9Jn/xa/D7LiN716BCDc2wsaYYSU8KsLn5FPJ6HU=; b=cRzZ3K92MRwZvUtJ9Wp/v/A0gtX1YaEETezu29fEDWTNEgKF3LlTyMfQrVRrfMVjYjO1ZG cNX+Hx4XLhef5oH322o+Jog3iP6R7B0ecuUan2p4WBCbjV+RQAaS1k54TMg7BiZSn+JE13yD ayJ4mvbYBWYotAscFj0p2Gitza4Njc+QlEaSs+sZBf5LLpN9I8qJgLAHl8xPbY/jCSLyh85z 2EpOI+tQzD2vLvpAG5oyDEI/N8xl23h70312Xka4E0GW5Y3jGtx7H9Sqtcne5QKny3RGRGfF x3htUWLcmO1hJdFue9OmdumFplLkeTD2LCBWDnNBnnxQsaKrLHYyK3MQ==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 04/10] initramfs-overlay-hook: Optimize variable initialization Date: Thu, 30 Jan 2025 10:39:11 +0100 Message-ID: <8492ee6dbf5634817cfe0bd80a18f0c21fad5bf5.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:28 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17708 From: Jan Kiszka Move some variables that are only relevant if the storage filesystem was not mounted yet into the respective branch. This specifically avoids to uselessly retrieve the filesystem type of the storage. Signed-off-by: Jan Kiszka --- .../initramfs-overlay-hook/files/local-bottom.tmpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes-initramfs/initramfs-overlay-hook/files/local-bottom.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/local-bottom.tmpl index f829a9bb..1087c3f7 100644 --- a/recipes-initramfs/initramfs-overlay-hook/files/local-bottom.tmpl +++ b/recipes-initramfs/initramfs-overlay-hook/files/local-bottom.tmpl @@ -8,17 +8,19 @@ # Quirin Gylstorff # -ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}" ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" -ovl_mount_option="${INITRAMFS_OVERLAY_MOUNT_OPTION}" -ovl_recovery_script="/scripts/${INITRAMFS_OVERLAY_RECOVERY_SCRIPT}" root_mount_storage=${rootmnt}${ovl_storage_path} storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print FS$2}' )" -partition_fstype=$(get_fstype "${ovl_partition_device}") if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then + ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}" + ovl_mount_option="${INITRAMFS_OVERLAY_MOUNT_OPTION}" + ovl_recovery_script="/scripts/${INITRAMFS_OVERLAY_RECOVERY_SCRIPT}" + + partition_fstype=$(get_fstype "${ovl_partition_device}") + case $partition_fstype in ext*) e2fsck -p -f "$ovl_partition_device" From patchwork Thu Jan 30 09:39:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954370 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 CAD1DC02193 for ; Thu, 30 Jan 2025 09:39:28 +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.web10.12050.1738229961122790466 for ; Thu, 30 Jan 2025 01:39:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=g5ydzaba; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-294854-2025013009391942fa2ad604010ca9dc-vu8aut@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2025013009391942fa2ad604010ca9dc for ; Thu, 30 Jan 2025 10:39:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=qXCSlWvupzE/o+Ixyf6ICrd9wX/d6srQv8AyxSMXuco=; b=g5ydzaba5+wywTkdt+8jSsdoI85xfUvoSqBauLn4FdYxfedLnAshr7S0d0q6IzV7x1LmdK ukGrRbxxwTSZY68PNQrQwMIGQ90bm0DRRNeD5gPx+dJA8KS/rZ1lHDRwW1eqGizU62h63bF2 392z6ukNS94GAlVfVqk7hxpFgFaX9YrM8E4qmqVg125CmqLEkvOEkwgCXJgi+MiL6iNG58lc XobMq2dZIvfB2hujZ6aTmQmOUha0xmdOwEb4SAqytIDPqusbtjO1mpA8pr9bEefGANhorMk+ MytfzoVXpYPJdcciAMCJrkASapjUCE8VfB8sChu030TfN3rQhI4rsSvg==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 05/10] initramfs-overlay-hook: Tune the parameter documentation Date: Thu, 30 Jan 2025 10:39:12 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:28 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17698 From: Jan Kiszka Signed-off-by: Jan Kiszka --- .../initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb index 4e2e2922..ec7f85b6 100644 --- a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb +++ b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb @@ -25,12 +25,14 @@ INITRAMFS_OVERLAY_PATHS ??= "/etc" # The variable INITRAMFS_OVERLAY_STORAGE_PATH designates the path were the # changes to the overlayed directory are stored (upper dir). The initramfs -# also mounts the first directory after root to the -# INITRAMFS_OVERLAY_STORAGE_DEVICE. +# hook also mounts the first directory after root to +# INITRAMFS_OVERLAY_STORAGE_DEVICE if it is not mounted yet. INITRAMFS_OVERLAY_STORAGE_PATH ??= "/var/local" # override this to switch to UUID or PARTUUID based mounts INITRAMFS_OVERLAY_STORAGE_DEVICE ??= "/dev/disk/by-label/var" + +# options to use for mounting INITRAMFS_OVERLAY_STORAGE_DEVICE INITRAMFS_OVERLAY_MOUNT_OPTION ??= "defaults,nodev,nosuid,noexec" TEMPLATE_FILES += "local-bottom.tmpl" From patchwork Thu Jan 30 09:39:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954369 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 D1254C02195 for ; Thu, 30 Jan 2025 09:39:28 +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.12048.1738229961207974230 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=Bl8cGMG4; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-294854-2025013009391963dc9ffb9dfc62fcf0-mcvu7b@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2025013009391963dc9ffb9dfc62fcf0 for ; Thu, 30 Jan 2025 10:39:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=y37RzRoqZk9vGn0adegaXIWrpep5ywtxMOkoowVlkS0=; b=Bl8cGMG4row6WmCan3w+TAZr9uShjzCeqqDZmHFNXmhHPuF6D82lRIpTE5HWhpLYwEypNA sZ57VpqzvT21jN5BTigvzJXQQPOuFgDewMxxLQ3B0cgFDH2qTdYMdv6jaGLzn1OeL34nqsVt F5XXUYKrr7dNTwwbVcK+uG4n25NqKUg7knPRvuqB/VOm/lUJRex1bMNPpagX9kyNSe2x2pWc z3ENKNq5T3TA7sKvz4WKx1WEhRhX6lTBia2GCZ89aJMJ7gBYb/zecKTyujMOtiHpf0UqaArl JBIJ35JhhikEs9Tz1oFThS4X6Uva7E1r5sd+TRBwzNO2dg4huvmPFcWg==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 06/10] initramfs-overlay-hook: Add awareness for abvar hook Date: Thu, 30 Jan 2025 10:39:13 +0100 Message-ID: <5dfbfd21727f454c63f2d144d75142815790742e.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:28 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17706 From: Jan Kiszka If the abvar hook is used to mount and manage snapshots for it, overlay mounting has to wait for it. Signed-off-by: Jan Kiszka --- .../initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb index ec7f85b6..073fe070 100644 --- a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb +++ b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb @@ -47,7 +47,7 @@ DEBIAN_DEPENDS .= ", awk, coreutils, util-linux" HOOK_ADD_MODULES = "overlay" HOOK_COPY_EXECS = "mountpoint awk e2fsck mke2fs" -SCRIPT_PREREQ="crypt" +SCRIPT_PREREQ = "crypt abvar" do_install:append() { install -m 0755 "${WORKDIR}/${INITRAMFS_OVERLAY_RECOVERY_SCRIPT}" \ From patchwork Thu Jan 30 09:39:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954371 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 EEDB0C02194 for ; Thu, 30 Jan 2025 09:39:28 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.web10.12051.1738229961322340300 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=c0Y+mffg; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-294854-2025013009391956bfd84c826c0c5d27-33pfd9@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2025013009391956bfd84c826c0c5d27 for ; Thu, 30 Jan 2025 10:39:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=ltHAnYwW3sA1PbZeRTSKGyuzoJMJW6CWeBEmgkSfAro=; b=c0Y+mffgHRK9ehThc8GoqjtI5AeI5RnsL6bmNxixEoTfeNuH7RS0bXlwYM1FKMcUaYsUYV R76MQslx4xA9K8ErKqneVaYBioo4Z7bRmBzrolGvn1xr6uTwbFmNQe29WdnbMKVV0p3nWEPv ZXg8cXQCpxG3t+iykbKU5US1pOA38xbXu/oogMn5rsICqiBDgCCs9Gq2I5uIdiEriE6/4d4g cQ0Iqm8oSKY8oog3xZ+h2Jvi3cceg9oYKSVfbuGak2pNuSjkY3e0kHqBvm8fyPZWkdFen3Ig JIicPDSNqPLLzeh5SxrIWBw3o3vldJUYK5XYVG7RzFHQUQQKxGGi5MAw==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 07/10] initramfs-overlay-hook: Bump revision Date: Thu, 30 Jan 2025 10:39:14 +0100 Message-ID: <83064498bbc4000dbbdc43a7d4e71f693c4f294d.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:28 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17704 From: Jan Kiszka We changed the recipe in the last commits, acknowledge that. Signed-off-by: Jan Kiszka --- ...nitramfs-overlay-hook_0.2.bb => initramfs-overlay-hook_0.3.bb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename recipes-initramfs/initramfs-overlay-hook/{initramfs-overlay-hook_0.2.bb => initramfs-overlay-hook_0.3.bb} (100%) diff --git a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb similarity index 100% rename from recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.2.bb rename to recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.3.bb From patchwork Thu Jan 30 09:39:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954377 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 180C7C0219A for ; Thu, 30 Jan 2025 09:39:29 +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.web10.12052.1738229961373325279 for ; Thu, 30 Jan 2025 01:39:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=RZmgv1yr; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-294854-20250130093919afc18517eda4f21690-3ytw5z@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20250130093919afc18517eda4f21690 for ; Thu, 30 Jan 2025 10:39:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=WgU8HNT4wbOLgbvzNe4r7IOVD5zLpkzdKo17O8TBwQ4=; b=RZmgv1yrwd6FTWvIXm75+7fbobw3RMLHiacAvMVha0Ni/WdQe/pocM/U521PoEu9EWhy39 hSJw2mpSRqCFLHqJtgsUDOS9GAA23pSNsfC0s4hf80Ye5Vat6Vh39hPUlHzd0gbUpGkmpQ8g Wz20o/GAFY5+EIYGp4V/A3gntT6Qjrdxwg58eNPeSFmvM/1Q8+UDUozj0aP3p9g0E1s/87Mi AbINIQtzp6T8DOnFwcJG1+u0w5spxU4M6CC7qKEroZKEDeG0za3kZEaY0glcdwqLiCesn+VA ILFoEzYBJFt5Br8UgrCuVMuZVm2FsO+sJi2NiR/IGO8/crlbLcIbLqSQ==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 08/10] swupdate: Make var filesystem type configurable for update images Date: Thu, 30 Jan 2025 10:39:15 +0100 Message-ID: <15504c79cbd009779ff184606cb8778cf53578dd.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:29 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17701 From: Jan Kiszka This allows to switch to var filesystem type to something else than ext4 which will be needed when enabling A/V snapshots for it. Default remains ext4. Signed-off-by: Jan Kiszka --- classes/swupdate.bbclass | 1 + kas/opt/swupdate.yml | 1 + wic/bbb-efibootguard.wks.in | 2 +- wic/hihope-rzg2m-efibootguard.wks.in | 2 +- wic/qemu-arm64-efibootguard-secureboot.wks.in | 2 +- wic/qemu-arm64-efibootguard.wks.in | 2 +- wic/qemu-riscv64-efibootguard.wks.in | 2 +- wic/x86-uefi-efibootguard-secureboot.wks.in | 2 +- wic/x86-uefi-efibootguard.wks.in | 2 +- 9 files changed, 9 insertions(+), 7 deletions(-) diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 05291ee9..213a8ffb 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -61,6 +61,7 @@ IMAGE_TEMPLATE_VARS:swu = " \ TARGET_IMAGE_UUID \ ABROOTFS_PART_UUID_A \ ABROOTFS_PART_UUID_B \ + VAR_FS_TYPE \ SWU_HW_COMPAT_NODE \ SWU_COMPRESSION_NODE \ SWU_VERSION \ diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml index 38dc3907..c5c5a56a 100644 --- a/kas/opt/swupdate.yml +++ b/kas/opt/swupdate.yml @@ -29,6 +29,7 @@ local_conf_header: INITRAMFS_INSTALL:append = " initramfs-${RO_ROOTFS_TYPE}-hook" ABROOTFS_PART_UUID_A ?= "fedcba98-7654-3210-cafe-5e0710000001" ABROOTFS_PART_UUID_B ?= "fedcba98-7654-3210-cafe-5e0710000002" + VAR_FS_TYPE ??= "ext4" PREFERRED_PROVIDER_swupdate-certificates-key ??= "swupdate-certificates-key-snakeoil" PREFERRED_PROVIDER_swupdate-certificates ??= "swupdate-certificates-snakeoil" PREFERRED_PROVIDER_swupdate-signer ??= "swupdate-signer-cms" diff --git a/wic/bbb-efibootguard.wks.in b/wic/bbb-efibootguard.wks.in index e6c3e158..6effa523 100644 --- a/wic/bbb-efibootguard.wks.in +++ b/wic/bbb-efibootguard.wks.in @@ -16,6 +16,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt --append="rootwait console=ttyO0,115200 omap_wdt.early_enable=1 omap_wdt.nowayout=1 watchdog.handle_boot_enabled=0" diff --git a/wic/hihope-rzg2m-efibootguard.wks.in b/wic/hihope-rzg2m-efibootguard.wks.in index fb3f090a..2305262f 100644 --- a/wic/hihope-rzg2m-efibootguard.wks.in +++ b/wic/hihope-rzg2m-efibootguard.wks.in @@ -9,6 +9,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --extra-space=100M --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt --append="console=tty0 console=ttySC0,115200 rootwait earlyprintk" diff --git a/wic/qemu-arm64-efibootguard-secureboot.wks.in b/wic/qemu-arm64-efibootguard-secureboot.wks.in index 00d627d0..98398e67 100644 --- a/wic/qemu-arm64-efibootguard-secureboot.wks.in +++ b/wic/qemu-arm64-efibootguard-secureboot.wks.in @@ -5,6 +5,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt --append="panic=5" diff --git a/wic/qemu-arm64-efibootguard.wks.in b/wic/qemu-arm64-efibootguard.wks.in index 17434d15..bf0bb82b 100644 --- a/wic/qemu-arm64-efibootguard.wks.in +++ b/wic/qemu-arm64-efibootguard.wks.in @@ -8,6 +8,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt diff --git a/wic/qemu-riscv64-efibootguard.wks.in b/wic/qemu-riscv64-efibootguard.wks.in index 1a2291e3..2acb2f9a 100644 --- a/wic/qemu-riscv64-efibootguard.wks.in +++ b/wic/qemu-riscv64-efibootguard.wks.in @@ -8,6 +8,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt diff --git a/wic/x86-uefi-efibootguard-secureboot.wks.in b/wic/x86-uefi-efibootguard-secureboot.wks.in index 0f4d6374..fe0f7cc5 100644 --- a/wic/x86-uefi-efibootguard-secureboot.wks.in +++ b/wic/x86-uefi-efibootguard-secureboot.wks.in @@ -5,6 +5,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt --append="console=tty0 console=ttyS0,115200 rootwait earlyprintk watchdog.handle_boot_enabled=0 iTCO_wdt.nowayout=1 panic=5" diff --git a/wic/x86-uefi-efibootguard.wks.in b/wic/x86-uefi-efibootguard.wks.in index 9d344f8a..5eab54cf 100644 --- a/wic/x86-uefi-efibootguard.wks.in +++ b/wic/x86-uefi-efibootguard.wks.in @@ -9,6 +9,6 @@ part --source empty --align 1024 --fixed-size 1G --uuid "${ABROOTFS_PART_UUID_B} # home and var are extra partitions part /home --source rootfs --change-directory=home --fstype=ext4 --label home --align 1024 --size 1G --extra-space=100M --fsuuid 1f55d66a-40d8-11ee-be56-0242ac120002 -part /var --fstype=ext4 --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 +part /var --fstype=${VAR_FS_TYPE} --label var --align 1024 --fixed-size 2G --fsuuid 96be3374-4258-11ee-be56-0242ac120002 bootloader --ptable gpt --append="console=tty0 console=ttyS0,115200 rootwait earlyprintk watchdog.handle_boot_enabled=0 iTCO_wdt.nowayout=1 " From patchwork Thu Jan 30 09:39:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954374 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 07F9FC02199 for ; Thu, 30 Jan 2025 09:39:29 +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.12049.1738229961768308809 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=HzfiBzGK; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-294854-20250130093919cfd370f285de64d22f-ln76rd@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 20250130093919cfd370f285de64d22f for ; Thu, 30 Jan 2025 10:39:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=EsKDZ+6UtI7F5jvcL+L8z2VMvxDGZhRUWl0gu2OCWjc=; b=HzfiBzGKgpIgvdIIYguhp1/qzbtS0KGO9Xi8P/s9grL6qGH4Wg8ieC32iZ76YB3A8ErrTp HzA8nFr5ovDjzhsoxeQZFSov1qQQBRUqWF0XZI74M6Ddc7hsrHjHXgB+BIWrbVx33YM26LWe gH35MQPa4LsNQ80Yg/H0PdWwDRQKABXTjHNJFIScrty71S2jfrncivB4dBBMdfjWWseDr7lY jpRxNUXQVlvYhSBqC5zdUg5swzMzN0WBYcqXFpdC5p7QQeEn8lp4+tIOUm4mQmlIQNVpNfyz rRewVgfi3nUVmC6yncLwMIiMAfO3EvJkyLsH9wTO2+uPgDJOPAevgjhA==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 09/10] swupdate: Activate abvar initramfs hook when VAR_FS_TYPE is set to btrfs Date: Thu, 30 Jan 2025 10:39:16 +0100 Message-ID: <869582b7defc0b44faac3ef9cab05234f737d54e.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:29 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17705 From: Jan Kiszka This enables to control whether an swupdate target image uses A/B snapshots for /var by setting VAR_FS_TYPE to btrfs. While we will switch many of our own targets soon, not all are compatible or tested yet and some downstream users may want to continue without snapshots. Signed-off-by: Jan Kiszka --- kas/opt/ebg-swu.yml | 6 +++++- recipes-initramfs/cip-core-initramfs/cip-core-initramfs.bb | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kas/opt/ebg-swu.yml b/kas/opt/ebg-swu.yml index 61a8eeef..9084cea1 100644 --- a/kas/opt/ebg-swu.yml +++ b/kas/opt/ebg-swu.yml @@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2021-2022 +# Copyright (c) Siemens AG, 2021-2025 # # Authors: # Quirin Gylstorff @@ -33,3 +33,7 @@ local_conf_header: IMAGER_BUILD_DEPS:append:qemu-arm64 = " u-boot-qemu-arm64" IMAGER_BUILD_DEPS:append:qemu-arm = " u-boot-qemu-arm" IMAGER_BUILD_DEPS:append:qemu-riscv64 = " opensbi-qemu-riscv64" + ab-persistency: | + OVERRIDES .= "${@':abvar' if d.getVar('VAR_FS_TYPE') == 'btrfs' else ''}" + CRYPT_BTRFS_SUPPORT:abvar = "1" + IMAGE_PREINSTALL:append:abvar = " btrfs-progs" diff --git a/recipes-initramfs/cip-core-initramfs/cip-core-initramfs.bb b/recipes-initramfs/cip-core-initramfs/cip-core-initramfs.bb index 0e4cf743..e6eb34c6 100644 --- a/recipes-initramfs/cip-core-initramfs/cip-core-initramfs.bb +++ b/recipes-initramfs/cip-core-initramfs/cip-core-initramfs.bb @@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2021 - 2023 +# Copyright (c) Siemens AG, 2021 - 2025 # # Authors: # Quirin Gylstorff @@ -15,4 +15,5 @@ INITRAMFS_INSTALL += " \ initramfs-overlay-hook \ " +INITRAMFS_INSTALL:append:abvar = " initramfs-abvar-hook" INITRAMFS_INSTALL:append:encrypt-partitions = " initramfs-crypt-hook" From patchwork Thu Jan 30 09:39:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 13954376 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 22CE0C02196 for ; Thu, 30 Jan 2025 09:39:29 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.web10.12054.1738229961729648921 for ; Thu, 30 Jan 2025 01:39:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=jan.kiszka@siemens.com header.s=fm2 header.b=L7IQ7m3Q; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-294854-2025013009391978161e4903394ceea0-luh_h9@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 2025013009391978161e4903394ceea0 for ; Thu, 30 Jan 2025 10:39:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=jan.kiszka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=dVtxcPlXGjzFFvklSFBUBg6X+UPTjFa1GaSy7DTN9Yg=; b=L7IQ7m3QwqxZIm+ACuP7rHNivX9HYENGbT5AGRilS5pG8KUINa5bWrW3SRRz8lY6d2IFnv Zl3jk6QdWxMQcIzptPw4tMe+xfYpadI0fRiE14YDA0Fo+Rr+7Rx/YDHi9GgvXWggE9gY8z+0 YicJtdnzlfhCx5S0eI9RVjT2I1H+eVPmpQz3uqtcbyPG5hr3H2gFaSwQZ1Rm7WyHLYeAMI8r 4gjTdL2h5aWWTI4XCskM4Eh5MATiEAuUYl4v8W0XWswr1fkytqrrw38sZpSfJmtgk4tFIM3i YJWtAyNWNo87GRngoS6AQ99QdBc8JQKVg3fNTYqgsNSXVV5jjc7o0S/A==; From: Jan Kiszka To: cip-dev@lists.cip-project.org Cc: Christian Storm , Quirin Gylstorff , Felix Moessbauer Subject: [isar-cip-core][RFC][PATCH 10/10] Enable A/B snapshot for /var on x86 and qemu-arm64 Date: Thu, 30 Jan 2025 10:39:17 +0100 Message-ID: <39b2a0d2ec39701f76a2b6b800f34ba3c123b0e8.1738229957.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854: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 ; Thu, 30 Jan 2025 09:39:29 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17702 From: Jan Kiszka Other targets still need testing, some even kernel config tuning. Signed-off-by: Jan Kiszka --- conf/machine/qemu-amd64.conf | 5 ++++- conf/machine/qemu-arm64.conf | 5 ++++- conf/machine/x86-uefi.conf | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/conf/machine/qemu-amd64.conf b/conf/machine/qemu-amd64.conf index d7866468..5244c86a 100644 --- a/conf/machine/qemu-amd64.conf +++ b/conf/machine/qemu-amd64.conf @@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2019-2024 +# Copyright (c) Siemens AG, 2019-2025 # # SPDX-License-Identifier: MIT # @@ -11,3 +11,6 @@ DISTRO_ARCH = "amd64" IMAGE_FSTYPES ?= "ext4" USE_CIP_KERNEL_CONFIG = "1" KERNEL_DEFCONFIG = "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/x86/cip_merged_defconfig" + +IMAGER_INSTALL:wic += "btrfs-progs" +VAR_FS_TYPE = "btrfs" diff --git a/conf/machine/qemu-arm64.conf b/conf/machine/qemu-arm64.conf index a2c5e53e..49323a11 100644 --- a/conf/machine/qemu-arm64.conf +++ b/conf/machine/qemu-arm64.conf @@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2019 +# Copyright (c) Siemens AG, 2019-2025 # # SPDX-License-Identifier: MIT # @@ -16,3 +16,6 @@ KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm64/cip_mer WDOG_TIMEOUT = "0" PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-qemu-arm64" + +IMAGER_INSTALL:wic += "btrfs-progs" +VAR_FS_TYPE = "btrfs" diff --git a/conf/machine/x86-uefi.conf b/conf/machine/x86-uefi.conf index 33f82b16..0a69ea82 100644 --- a/conf/machine/x86-uefi.conf +++ b/conf/machine/x86-uefi.conf @@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2019-2024 +# Copyright (c) Siemens AG, 2019-2025 # # SPDX-License-Identifier: MIT # @@ -10,6 +10,7 @@ DISTRO_ARCH = "amd64" IMAGE_FSTYPES ?= "wic" WKS_FILE ?= "x86_64-generic.wks" -IMAGER_INSTALL:wic += "${GRUB_BOOTLOADER_INSTALL}" +IMAGER_INSTALL:wic += "${GRUB_BOOTLOADER_INSTALL} btrfs-progs" +VAR_FS_TYPE = "btrfs" USE_CIP_KERNEL_CONFIG = "1" KERNEL_DEFCONFIG = "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/x86/cip_merged_defconfig"