On Tuesday, July 2, 2024 at 7:11:00 PM UTC+5:30 srinuv...@siemens.com wrote:
From: srinuvasan <srinuv...@siemens.com>

By default initrd compressed with gzip tool, with the present bullseye base image
of amd64 the initrd size is almost 27MB, this can be reduced with the help of xz tool,
using this one the generated initrd size is almost 18MB, we saved almost 9MB.

Signed-off-by: srinuvasan <srinuv...@siemens.com>
---
kas/package/Kconfig | 9 ++++++++
kas/package/pkg_compress_initrd.yaml | 9 ++++++++
.../compress-initrd/compress-initrd.bb | 21 +++++++++++++++++++
.../compress-initrd/files/postinst | 5 +++++
4 files changed, 44 insertions(+)
create mode 100644 kas/package/pkg_compress_initrd.yaml
create mode 100644 meta-isar/recipes-initramfs/compress-initrd/compress-initrd.bb
create mode 100644 meta-isar/recipes-initramfs/compress-initrd/files/postinst

diff --git a/kas/package/Kconfig b/kas/package/Kconfig
index 35ba7cf1..9c24a680 100644
--- a/kas/package/Kconfig
+++ b/kas/package/Kconfig
@@ -146,6 +146,15 @@ config KAS_INCLUDE_PACKAGE_ISAR_CI_SSH_SETUP
default "kas/package/pkg_sshd-regen-keys.yaml"
depends on PACKAGE_ISAR_CI_SSH_SETUP

+config PACKAGE_COMPRESS_INITRD
+ bool "compress initrd"
+ default y
+
+config KAS_INCLUDE_PACKAGE_COMPRESS_INITRD
+ string
+ default "kas/package/pkg_compress_initrd.yaml"
+ depends on PACKAGE_COMPRESS_INITRD
+
endmenu

config KAS_IMAGE_PREINSTALL
diff --git a/kas/package/pkg_compress_initrd.yaml b/kas/package/pkg_compress_initrd.yaml
new file mode 100644
index 00000000..376a280c
--- /dev/null
+++ b/kas/package/pkg_compress_initrd.yaml
@@ -0,0 +1,9 @@
+# This software is a part of ISAR.
+# Copyright (C) 2024 ilbers GmbH
+
+header:
+ version: 14
+
+local_conf_header:
+ package-compress-initrd: |
+ IMAGE_INSTALL:append = " compress-initrd"
diff --git a/meta-isar/recipes-initramfs/compress-initrd/compress-initrd.bb b/meta-isar/recipes-initramfs/compress-initrd/compress-initrd.bb
new file mode 100644
index 00000000..b1a5909b
--- /dev/null
+++ b/meta-isar/recipes-initramfs/compress-initrd/compress-initrd.bb
@@ -0,0 +1,21 @@
+# Sample recipe to configure the desired compression tool
+# during initramfs generation
+#
+# This software is a part of ISAR.
+
+DESCRIPTION = "Compress the initrd with configured compression tool"
+MAINTAINER = "Your name here <y...@domain.com>"
+
+inherit dpkg-raw
+
+COMPRESS_TOOL ?= "xz"
+
+DEBIAN_DEPENDS = "linux-image-${KERNEL_NAME}, xz-utils, initramfs-tools"
+
+SRC_URI = " \
+ file://postinst \
+"
+do_install() {
+ install -v -d "${D}/etc/initramfs-tools/conf.d/"
+ echo "COMPRESS=${COMPRESS_TOOL}" > "${D}/etc/initramfs-tools/conf.d/${PN}.conf"
+}
diff --git a/meta-isar/recipes-initramfs/compress-initrd/files/postinst b/meta-isar/recipes-initramfs/compress-initrd/files/postinst
new file mode 100644
index 00000000..0db52142
--- /dev/null
+++ b/meta-isar/recipes-initramfs/compress-initrd/files/postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+update-initramfs -c -k all
--
2.34.1


   Hi All,

             Any update on this patch?

Many thanks,
Srinu 

--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/2ef644ca-b0fa-4583-8ac0-7635e9a4b05cn%40googlegroups.com.