summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Lange <nolange79@gmail.com>2020-07-29 00:10:37 +0200
committerNorbert Lange <nolange79@gmail.com>2020-07-29 00:53:38 +0200
commite94f410c71e90598b4fabca3970c7f282b5bd0a0 (patch)
tree610c29a38e90b51953f9e8d27a0b11f9a7ce0528
parent482897b9a6001c69b16c651d4bc5b3a49a28d40f (diff)
un-,mkinitramfs: add support for zstd
Add support for zstd compression and decompression. Always use multithreaded compression, as zstd still generates identical archives. The zstd cmdline tool is usually able to decompress gzip, xz, lzma and lz4 so make sure to try the tool early. Signed-off-by: Norbert Lange <nolange79@gmail.com>
-rw-r--r--conf/initramfs.conf2
-rwxr-xr-xmkinitramfs1
-rwxr-xr-xunmkinitramfs2
3 files changed, 4 insertions, 1 deletions
diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index dd76996..1d782f3 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -38,7 +38,7 @@ BUSYBOX=auto
KEYMAP=n
#
-# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ]
+# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ]
#
COMPRESS=gzip
diff --git a/mkinitramfs b/mkinitramfs
index bb902f8..d66a047 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -185,6 +185,7 @@ gzip) # If we're doing a reproducible build, use gzip -n
fi
;;
lz4) compress="lz4 -9 -l" ;;
+zstd) compress="zstd -q -19 -T0" ;;
xz) compress="xz --check=crc32"
# If we're not doing a reproducible build, enable multithreading
test -z "${SOURCE_DATE_EPOCH}" && compress="$compress --threads=0"
diff --git a/unmkinitramfs b/unmkinitramfs
index 3f8c75d..d1226c3 100755
--- a/unmkinitramfs
+++ b/unmkinitramfs
@@ -31,6 +31,8 @@ xcpio()
if gzip -t "$archive" >/dev/null 2>&1 ; then
gzip -c -d "$archive"
+ elif zstd -q -c -t "$archive" >/dev/null 2>&1 ; then
+ zstd -q -c -d "$archive"
elif xzcat -t "$archive" >/dev/null 2>&1 ; then
xzcat "$archive"
elif lz4cat -t < "$archive" >/dev/null 2>&1 ; then