All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
To: jan.kiszka@siemens.com, cip-dev@lists.cip-project.org
Subject: [cip-dev][isar-cip-core][PATCH] classes: Use extracted partitions provided by wic
Date: Mon,  7 Mar 2022 12:50:53 +0100	[thread overview]
Message-ID: <20220307115053.1972214-1-Quirin.Gylstorff@siemens.com> (raw)

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Newer versions of the wic provide separated disk partitions
therefore, the extraction code is no longer necessary.

Rename the class from extract-partition to
compress-swupdate-rootfs to clarify the use case.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 classes/compress_swupdate_rootfs.bbclass | 21 +++++++++++++++++++
 classes/extract-partition.bbclass        | 26 ------------------------
 classes/secure-swupdate-img.bbclass      |  6 +++---
 classes/wic-swu-img.bbclass              |  6 +++---
 recipes-core/images/secureboot.inc       |  4 ++--
 recipes-core/images/swupdate.inc         |  4 ++--
 6 files changed, 31 insertions(+), 36 deletions(-)
 create mode 100644 classes/compress_swupdate_rootfs.bbclass
 delete mode 100644 classes/extract-partition.bbclass

diff --git a/classes/compress_swupdate_rootfs.bbclass b/classes/compress_swupdate_rootfs.bbclass
new file mode 100644
index 0000000..2a01e59
--- /dev/null
+++ b/classes/compress_swupdate_rootfs.bbclass
@@ -0,0 +1,21 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2022
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+EXTRACT_PARTITIONS ?= "${IMAGE_FULLNAME}.wic.img.p4"
+
+do_compress_swupdate_rootfs () {
+    for PARTITION in ${EXTRACT_PARTITIONS}; do
+        if [ -e ${DEPLOY_DIR_IMAGE}/${PARTITION} ]; then
+            rm -f ${DEPLOY_DIR_IMAGE}/${PARTITION}.gz
+            gzip ${DEPLOY_DIR_IMAGE}/${PARTITION}
+        fi
+    done
+}
diff --git a/classes/extract-partition.bbclass b/classes/extract-partition.bbclass
deleted file mode 100644
index e9de8fc..0000000
--- a/classes/extract-partition.bbclass
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# CIP Core, generic profile
-#
-# Copyright (c) Siemens AG, 2020
-#
-# Authors:
-#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
-#
-# SPDX-License-Identifier: MIT
-#
-
-SOURCE_IMAGE_FILE ?= "${WIC_IMAGE_FILE}"
-EXTRACT_PARTITIONS ?= "img4"
-
-do_extract_partition () {
-    for PARTITION in ${EXTRACT_PARTITIONS}; do
-        rm -f ${DEPLOY_DIR_IMAGE}/${PARTITION}.gz
-        PART_START=$(fdisk -lu ${SOURCE_IMAGE_FILE} | grep ${PARTITION} | awk '{ print $2 }'  )
-        PART_END=$(fdisk -lu ${SOURCE_IMAGE_FILE} | grep ${PARTITION} | awk '{ print $3 }'  )
-        PART_COUNT=$(expr ${PART_END} - ${PART_START} + 1 )
-
-        dd if=${SOURCE_IMAGE_FILE} of=${DEPLOY_DIR_IMAGE}/${PARTITION} bs=512 skip=${PART_START} count=${PART_COUNT}
-
-        gzip ${DEPLOY_DIR_IMAGE}/${PARTITION}
-    done
-}
diff --git a/classes/secure-swupdate-img.bbclass b/classes/secure-swupdate-img.bbclass
index 431939b..1715c8a 100644
--- a/classes/secure-swupdate-img.bbclass
+++ b/classes/secure-swupdate-img.bbclass
@@ -21,12 +21,12 @@ INITRD_IMAGE = "${INITRAMFS_RECIPE}-${DISTRO}-${MACHINE}.initrd.img"
 
 inherit verity-img
 inherit wic-img
-inherit extract-partition
+inherit compress_swupdate_rootfs
 inherit swupdate-img
 
 SOURCE_IMAGE_FILE = "${WIC_IMAGE_FILE}"
 
 addtask do_verity_image after do_${SECURE_IMAGE_FSTYPE}_image
 addtask do_wic_image after do_verity_image
-addtask do_extract_partition after do_wic_image
-addtask do_swupdate_image after do_extract_partition
+addtask do_compress_swupdate_rootfs after do_wic_image
+addtask do_swupdate_image after do_compress_swupdate_rootfs
diff --git a/classes/wic-swu-img.bbclass b/classes/wic-swu-img.bbclass
index c8532ba..3a09721 100644
--- a/classes/wic-swu-img.bbclass
+++ b/classes/wic-swu-img.bbclass
@@ -11,10 +11,10 @@
 
 
 inherit wic-img
-inherit extract-partition
+inherit compress_swupdate_rootfs
 inherit swupdate-img
 
 SOURCE_IMAGE_FILE = "${WIC_IMAGE_FILE}"
 
-addtask do_extract_partition after do_wic_image
-addtask do_swupdate_image after do_extract_partition
+addtask do_compress_swupdate_rootfs after do_wic_image
+addtask do_swupdate_image after do_compress_swupdate_rootfs
diff --git a/recipes-core/images/secureboot.inc b/recipes-core/images/secureboot.inc
index f048497..b619b50 100644
--- a/recipes-core/images/secureboot.inc
+++ b/recipes-core/images/secureboot.inc
@@ -11,8 +11,8 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/files/secure-boot:"
 
-EXTRACT_PARTITIONS = "img4"
-ROOTFS_PARTITION_NAME="img4.gz"
+EXTRACT_PARTITIONS = "${IMAGE_FULLNAME}.wic.img.p4"
+ROOTFS_PARTITION_NAME="${IMAGE_FULLNAME}.wic.img.p4.gz"
 
 SRC_URI += "file://sw-description.tmpl"
 TEMPLATE_FILES += "sw-description.tmpl"
diff --git a/recipes-core/images/swupdate.inc b/recipes-core/images/swupdate.inc
index 06ad5af..2e9094a 100644
--- a/recipes-core/images/swupdate.inc
+++ b/recipes-core/images/swupdate.inc
@@ -11,8 +11,8 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
-EXTRACT_PARTITIONS = "img4"
-ROOTFS_PARTITION_NAME="img4.gz"
+EXTRACT_PARTITIONS = "${IMAGE_FULLNAME}.wic.img.p4"
+ROOTFS_PARTITION_NAME="${IMAGE_FULLNAME}.wic.img.p4.gz"
 
 SRC_URI += "file://sw-description.tmpl"
 TEMPLATE_FILES += "sw-description.tmpl"
-- 
2.34.1



             reply	other threads:[~2022-03-07 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 11:50 Q. Gylstorff [this message]
2022-03-07 12:41 ` [cip-dev][isar-cip-core][PATCH] classes: Use extracted partitions provided by wic Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307115053.1972214-1-Quirin.Gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.