home: hub: mkinitfs

Download patch

ref: 59204d36985de5ba2444d5f3e0d50a119287ec51
parent: 961726b6aeb8e12176009675f22ed0ffc2b26e14
author: Sören Tempel <soeren+git@soeren-tempel.net>
date: Sat Jan 25 06:04:32 CST 2020

mkinitfs: add optional support for pigz

pigz(1) is a parallel gzip implementation. As such, it significantly
faster than gzip(1). This patch uses pigz(1) instead of gzip(1),
if it is installed, otherwise it just falls back to gzip(1). This is
similar to the current pigz support in abuild.

Without this patch:

	$ time mkinitfs
	==> initramfs: creating /boot/initramfs-lts
	real	0m 38.19s
	user	0m 35.47s
	sys	0m 0.49s

With this patch applied and pigz installed:

	==> initramfs: creating /boot/initramfs-lts
	real	0m 13.24s
	user	0m 38.30s
	sys	0m 0.56s

This change was discussed on IRC with _ikke_ and mps.

--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -278,7 +278,7 @@
 fi
 
 case "$initfscomp" in
-	gzip) comp="gzip -9" ;;
+	gzip) comp="$(command -v pigz 2>/dev/null || echo gzip) -9" ;;
 	xz) cmd_exists xz; comp="xz -C crc32 -T 0" ;;
 	*) echo "Initramfs compression \"$initfscomp\" not supported!"; exit 1 ;;
 esac