From 2ece298402ee047a9141e6bb7e4ea36ec671fa4b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 1 Apr 2020 16:29:59 +0200 Subject: [PATCH] initramfs xz-compress: use default xz compression level MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Quoting from the bug report: | How many threads are used also depends on the compression level. At -6, | I've seen it use 3-4 threads, which speeds up initramfs compression a lot. | With -8, it always only uses one thread (although maybe it also depends on | the amount of data being compressed; I don't know). The default compression preset level is -6, so there's no need to specify it. This also matches the behavior of initramfs-tools >=0.119: | commit cf9691da3847a6bfadb4a5c9e0f6213bd7d10fdc | Author: Ben Hutchings | Date: Thu Oct 16 15:34:54 2014 +0200 | | mkinitramfs: Use default xz compression level rather than -8 | | xz -8 wants 370 MB VM for compression, but Debian tries to support | systems with less physical memory than that. | | The benchmark results given in commit bedf1e3c0882 ('Use -8 for | compression with xz.') show only a 1% increase in size when changing | to -6, but VM usage will be reduced by 75%. | | Closes: #697335 | Signed-off-by: Ben Hutchings | | diff --git mkinitramfs mkinitramfs | index 07190ed..25932c1 100755 | --- mkinitramfs | +++ mkinitramfs | @@ -146,7 +146,7 @@ if dpkg --compare-versions "${version}" lt "2.6.38" 2>/dev/null; then | fi | | [ "${compress}" = lzop ] && compress="lzop -9" | -[ "${compress}" = xz ] && compress="xz -8 --check=crc32" | +[ "${compress}" = xz ] && compress="xz --check=crc32" | | if [ -d "${outfile}" ]; then | echo "${outfile} is a directory" >&2 Let's keep the xz wrapper though, to force its usage independent of the initramfs-tools version being used and have it available, if we decide to add further custom options in the future. Thanks: Dr. András Korn Closes: https://github.com/grml/grml-live/issues/48 --- .../fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE b/etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE index 4e6b5b3..3631ac8 100644 --- a/etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE +++ b/etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE @@ -3,7 +3,7 @@ # this is a workaround to pass custom options to the xz compression xz() { - command xz -8 --check=crc32 + command xz --check=crc32 } # enable XZ compression, reducing initramfs size from ~17MB to ~12MB -- 2.1.4