home: hub: mkinitfs

Download patch

ref: 830b8ddcfd00c7868cba75a03083f9c93dcc4448
parent: 59204d36985de5ba2444d5f3e0d50a119287ec51
author: iggy <iggy@kws1.com>
date: Mon Dec 21 19:06:21 CST 2020

Add zstd compression support

Now that 5.10 is out and supports zstd compression for the kernel and
initramfs, add support for zstd to mkinitfs. The benefits have been
discussed at length on lkml[1][2].

In my personal experience, the compression (mkinitfs) seems to be
slower, but decompression (booting) seems to be faster. I think most
people boot more than they mkinitfs.

The default is still gzip, so no change should be noticed unless
someone goes looking for trouble.

To test this functionality, just add the following to mkinitfs.conf:

```text
initfscomp=zstd
```

[1] https://lkml.org/lkml/2020/7/23/1010
[2] https://lkml.org/lkml/2020/7/1/722

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