All of lore.kernel.org
 help / color / mirror / Atom feed
* [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups
@ 2022-03-10 18:50 Jan Kiszka
  2022-03-10 18:50 ` [isar-cip-core][PATCH 1/2] Drop redundant SWU_DESCRIPTION_FILE assignment Jan Kiszka
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Kiszka @ 2022-03-10 18:50 UTC (permalink / raw)
  To: cip-dev; +Cc: Quirin Gylstorff

Primarily auto-compression for SWU_ADDITIONAL_FILES.

Jan

Jan Kiszka (2):
  Drop redundant SWU_DESCRIPTION_FILE assignment
  swupdate-img: Add support for automatically compressing files

 classes/compress_swupdate_rootfs.bbclass | 21 ---------------------
 classes/secure-swupdate-img.bbclass      |  4 +---
 classes/swupdate-img.bbclass             | 15 +++++++++++++++
 classes/wic-swu-img.bbclass              |  5 +----
 recipes-core/images/secureboot.inc       |  4 +---
 recipes-core/images/swupdate.inc         |  4 ++--
 6 files changed, 20 insertions(+), 33 deletions(-)
 delete mode 100644 classes/compress_swupdate_rootfs.bbclass

-- 
2.34.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [isar-cip-core][PATCH 1/2] Drop redundant SWU_DESCRIPTION_FILE assignment
  2022-03-10 18:50 [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Jan Kiszka
@ 2022-03-10 18:50 ` Jan Kiszka
  2022-03-10 18:50 ` [isar-cip-core][PATCH 2/2] swupdate-img: Add support for automatically compressing files Jan Kiszka
  2022-03-11 14:08 ` [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Gylstorff Quirin
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2022-03-10 18:50 UTC (permalink / raw)
  To: cip-dev; +Cc: Quirin Gylstorff

From: Jan Kiszka <jan.kiszka@siemens.com>

Already set as default in swupdate-img.bbclass.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 recipes-core/images/secureboot.inc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/recipes-core/images/secureboot.inc b/recipes-core/images/secureboot.inc
index b619b50..950b41a 100644
--- a/recipes-core/images/secureboot.inc
+++ b/recipes-core/images/secureboot.inc
@@ -19,5 +19,4 @@ TEMPLATE_FILES += "sw-description.tmpl"
 
 TEMPLATE_VARS += "PN ROOTFS_PARTITION_NAME"
 
-SWU_DESCRIPTION_FILE = "sw-description"
 SWU_ADDITIONAL_FILES += "linux.signed.efi ${ROOTFS_PARTITION_NAME}"
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [isar-cip-core][PATCH 2/2] swupdate-img: Add support for automatically compressing files
  2022-03-10 18:50 [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Jan Kiszka
  2022-03-10 18:50 ` [isar-cip-core][PATCH 1/2] Drop redundant SWU_DESCRIPTION_FILE assignment Jan Kiszka
@ 2022-03-10 18:50 ` Jan Kiszka
  2022-03-10 19:25   ` [isar-cip-core][PATCH 3/2] swupdate-img: Use pigz where available Jan Kiszka
  2022-03-11 14:08 ` [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Gylstorff Quirin
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2022-03-10 18:50 UTC (permalink / raw)
  To: cip-dev; +Cc: Quirin Gylstorff

From: Jan Kiszka <jan.kiszka@siemens.com>

Automatically gzip files specified in SWU_ADDITIONAL_FILES if they end
on .gz and there is an uncompressed version (without .gz suffix) in the
search path. This obsoletes the extra compress_swupdate_rootfs class
and makes the usage more convenient.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 classes/compress_swupdate_rootfs.bbclass | 21 ---------------------
 classes/secure-swupdate-img.bbclass      |  4 +---
 classes/swupdate-img.bbclass             | 15 +++++++++++++++
 classes/wic-swu-img.bbclass              |  5 +----
 recipes-core/images/secureboot.inc       |  3 +--
 recipes-core/images/swupdate.inc         |  4 ++--
 6 files changed, 20 insertions(+), 32 deletions(-)
 delete mode 100644 classes/compress_swupdate_rootfs.bbclass

diff --git a/classes/compress_swupdate_rootfs.bbclass b/classes/compress_swupdate_rootfs.bbclass
deleted file mode 100644
index 2a01e59..0000000
--- a/classes/compress_swupdate_rootfs.bbclass
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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/secure-swupdate-img.bbclass b/classes/secure-swupdate-img.bbclass
index 1715c8a..330f619 100644
--- a/classes/secure-swupdate-img.bbclass
+++ b/classes/secure-swupdate-img.bbclass
@@ -21,12 +21,10 @@ INITRD_IMAGE = "${INITRAMFS_RECIPE}-${DISTRO}-${MACHINE}.initrd.img"
 
 inherit verity-img
 inherit wic-img
-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_compress_swupdate_rootfs after do_wic_image
-addtask do_swupdate_image after do_compress_swupdate_rootfs
+addtask do_swupdate_image after do_wic_image
diff --git a/classes/swupdate-img.bbclass b/classes/swupdate-img.bbclass
index 7b7154f..97e833e 100644
--- a/classes/swupdate-img.bbclass
+++ b/classes/swupdate-img.bbclass
@@ -24,6 +24,21 @@ do_swupdate_image() {
     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"
+                gzip "$uncompressed"
+                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/classes/wic-swu-img.bbclass b/classes/wic-swu-img.bbclass
index 3a09721..5e6de40 100644
--- a/classes/wic-swu-img.bbclass
+++ b/classes/wic-swu-img.bbclass
@@ -9,12 +9,9 @@
 # SPDX-License-Identifier: MIT
 #
 
-
 inherit wic-img
-inherit compress_swupdate_rootfs
 inherit swupdate-img
 
 SOURCE_IMAGE_FILE = "${WIC_IMAGE_FILE}"
 
-addtask do_compress_swupdate_rootfs after do_wic_image
-addtask do_swupdate_image after do_compress_swupdate_rootfs
+addtask do_swupdate_image after do_wic_image
diff --git a/recipes-core/images/secureboot.inc b/recipes-core/images/secureboot.inc
index 950b41a..3e6eef8 100644
--- a/recipes-core/images/secureboot.inc
+++ b/recipes-core/images/secureboot.inc
@@ -11,8 +11,7 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/files/secure-boot:"
 
-EXTRACT_PARTITIONS = "${IMAGE_FULLNAME}.wic.img.p4"
-ROOTFS_PARTITION_NAME="${IMAGE_FULLNAME}.wic.img.p4.gz"
+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 2e9094a..c23c103 100644
--- a/recipes-core/images/swupdate.inc
+++ b/recipes-core/images/swupdate.inc
@@ -11,11 +11,11 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
-EXTRACT_PARTITIONS = "${IMAGE_FULLNAME}.wic.img.p4"
-ROOTFS_PARTITION_NAME="${IMAGE_FULLNAME}.wic.img.p4.gz"
+ROOTFS_PARTITION_NAME = "${IMAGE_FULLNAME}.wic.img.p4.gz"
 
 SRC_URI += "file://sw-description.tmpl"
 TEMPLATE_FILES += "sw-description.tmpl"
+
 TEMPLATE_VARS += "PN ROOTFS_PARTITION_NAME KERNEL_IMAGE INITRD_IMAGE"
 
 SWU_ADDITIONAL_FILES += "${INITRD_IMAGE} ${KERNEL_IMAGE} ${ROOTFS_PARTITION_NAME}"
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [isar-cip-core][PATCH 3/2] swupdate-img: Use pigz where available
  2022-03-10 18:50 ` [isar-cip-core][PATCH 2/2] swupdate-img: Add support for automatically compressing files Jan Kiszka
@ 2022-03-10 19:25   ` Jan Kiszka
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2022-03-10 19:25 UTC (permalink / raw)
  To: cip-dev; +Cc: Quirin Gylstorff

From: Jan Kiszka <jan.kiszka@siemens.com>

Accelerates the compression by using multiple cores.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 classes/swupdate-img.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/classes/swupdate-img.bbclass b/classes/swupdate-img.bbclass
index 97e833e..1437c07 100644
--- a/classes/swupdate-img.bbclass
+++ b/classes/swupdate-img.bbclass
@@ -33,7 +33,11 @@ do_swupdate_image() {
         for uncompressed in "${WORKDIR}/$basefile" "${DEPLOY_DIR_IMAGE}/$basefile"; do
             if [ -e "$uncompressed" ]; then
                 rm  -f "$uncompressed.gz"
-                gzip "$uncompressed"
+                if [ -x "$(command -v pigz)" ]; then
+                    pigz "$uncompressed"
+                else
+                    gzip "$uncompressed"
+                fi
                 break
             fi
         done
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups
  2022-03-10 18:50 [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Jan Kiszka
  2022-03-10 18:50 ` [isar-cip-core][PATCH 1/2] Drop redundant SWU_DESCRIPTION_FILE assignment Jan Kiszka
  2022-03-10 18:50 ` [isar-cip-core][PATCH 2/2] swupdate-img: Add support for automatically compressing files Jan Kiszka
@ 2022-03-11 14:08 ` Gylstorff Quirin
  2 siblings, 0 replies; 5+ messages in thread
From: Gylstorff Quirin @ 2022-03-11 14:08 UTC (permalink / raw)
  To: Jan Kiszka, cip-dev



On 3/10/22 19:50, Jan Kiszka wrote:
> Primarily auto-compression for SWU_ADDITIONAL_FILES.
> 
> Jan
> 
> Jan Kiszka (2):
>    Drop redundant SWU_DESCRIPTION_FILE assignment
>    swupdate-img: Add support for automatically compressing files
> 
>   classes/compress_swupdate_rootfs.bbclass | 21 ---------------------
>   classes/secure-swupdate-img.bbclass      |  4 +---
>   classes/swupdate-img.bbclass             | 15 +++++++++++++++
>   classes/wic-swu-img.bbclass              |  5 +----
>   recipes-core/images/secureboot.inc       |  4 +---
>   recipes-core/images/swupdate.inc         |  4 ++--
>   6 files changed, 20 insertions(+), 33 deletions(-)
>   delete mode 100644 classes/compress_swupdate_rootfs.bbclass
> 

Looks good to me.

Quirin


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-11 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 18:50 [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Jan Kiszka
2022-03-10 18:50 ` [isar-cip-core][PATCH 1/2] Drop redundant SWU_DESCRIPTION_FILE assignment Jan Kiszka
2022-03-10 18:50 ` [isar-cip-core][PATCH 2/2] swupdate-img: Add support for automatically compressing files Jan Kiszka
2022-03-10 19:25   ` [isar-cip-core][PATCH 3/2] swupdate-img: Use pigz where available Jan Kiszka
2022-03-11 14:08 ` [isar-cip-core][PATCH 0/2] SWUpdate-related cleanups Gylstorff Quirin

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.