From 625697454aa6f2b0819f204c3b2fef93714572b7 Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Sun, 24 Dec 2023 11:22:51 +0100 Subject: kernel-{build,install}.eclass: compress generic initrd with xz Some basic benchmarks: -rw------- 1 root root 103494321 Dec 24 11:10 bzip2 -rw------- 1 root root 112179814 Dec 24 11:02 gzip-nostrip -rw------- 1 root root 112179814 Dec 24 11:06 gzip-strip -rw------- 1 root root 112179814 Dec 24 11:08 gzip-strip-aggressive -rw------- 1 root root 130847597 Dec 24 11:19 lz4 -rw------- 1 root root 66948253 Dec 24 11:13 lzma -rw------- 1 root root 124285638 Dec 24 11:18 lzop -rw------- 1 root root 80242444 Dec 24 11:14 xz -rw------- 1 root root 66744036 Dec 24 11:59 xz-9e--check -rw------- 1 root root 85917687 Dec 24 11:20 zstd Strip does nothing, which makes sense since portage already did this. xz is our size champion so pick this one to compress our initrd With this change the generic UKI is: 82515840, versus My own hostonly UKI of the same kernel version: 29390720. Which is still 2.8 times larger, but significantly better then the 5 times larger we had before! Signed-off-by: Andrew Ammerlaan Closes: https://github.com/gentoo/gentoo/pull/34024 Signed-off-by: Andrew Ammerlaan --- eclass/kernel-install.eclass | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'eclass/kernel-install.eclass') diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 919a5d11fd84..d2b3b94123d4 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -430,6 +430,12 @@ kernel-install_test() { > "${T}"/empty-file || die mkdir -p "${T}"/empty-directory || die + local compress="gzip" + if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then + # Test with same compression method as the generic initrd + compress="xz -9e --check=crc32" + fi + dracut \ --conf "${T}"/empty-file \ --confdir "${T}"/empty-directory \ @@ -439,6 +445,7 @@ kernel-install_test() { --omit "${omit_mods[*]}" \ --nostrip \ --no-early-microcode \ + --compress="${compress}" \ "${T}/initrd" "${version}" || die kernel-install_create_qemu_image "${T}/fs.img" -- cgit v1.2.3-65-gdbad