initramfs xz-compress: use default xz compression level
authorMichael Prokop <mika@grml.org>
Wed, 1 Apr 2020 14:29:59 +0000 (16:29 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 1 Apr 2020 14:29:59 +0000 (16:29 +0200)
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 <ben@decadent.org.uk>
| 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 <ben@decadent.org.uk>
|
| 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

etc/grml/fai/config/files/etc/initramfs-tools/conf.d/xz-compress/GRMLBASE

index 4e6b5b3..3631ac8 100644 (file)
@@ -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