From: srinuvasan.a@siemens.com
To: isar-users@googlegroups.com
Cc: ubely@ilbers.de, jan.kiszka@siemens.com,
srinuvasan <srinuvasan.a@siemens.com>
Subject: [PATCH V3] recipes-initramfs/compress-initrd: add recipe to compress initrd with xz
Date: Wed, 17 Apr 2024 19:13:47 +0530 [thread overview]
Message-ID: <20240417134347.86724-1-srinuvasan.a@siemens.com> (raw)
In-Reply-To: <e7df0536-3047-429d-a94a-2f7dd56303c4@siemens.com>
From: srinuvasan <srinuvasan.a@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 <srinuvasan.a@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 <you@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
next prev parent reply other threads:[~2024-07-02 13:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 5:26 [PATCH] " srinuvasan.a
2024-05-13 5:27 ` Jan Kiszka
2024-05-13 5:47 ` Srinuvasan Arjunan
2024-05-13 6:29 ` Jan Kiszka
2024-05-13 6:47 ` MOESSBAUER, Felix
2024-05-13 9:41 ` [PATCH v1] " srinuvasan.a
2024-05-30 5:49 ` Uladzimir Bely
2024-05-30 5:52 ` Srinuvasan Arjunan
2024-05-31 7:35 ` Jan Kiszka
2024-04-17 13:43 ` srinuvasan.a [this message]
2024-07-08 9:44 ` [PATCH V3] " Srinuvasan Arjunan
2024-07-18 11:36 ` Srinuvasan Arjunan
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=20240417134347.86724-1-srinuvasan.a@siemens.com \
--to=srinuvasan.a@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=ubely@ilbers.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox