diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/includes/packing.inc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/includes/packing.inc b/server/includes/packing.inc index 2891aeef..7141dcbd 100644 --- a/server/includes/packing.inc +++ b/server/includes/packing.inc @@ -11,7 +11,14 @@ generate_initramfs() { cd "$1" || perror "Cannot cd to '$1'" rm -f -- "$3" - find $2 | cpio --format="newc" --create | xz --check=crc32 --lzma2=dict=1MiB > "$3" + local cmd="gzip" + local args= + if grep -qF "CONFIG_RD_ZSTD=y" "$1/../kernel/config" && command -v zstd; then + cmd="zstd" + args="-T0 -16" + pinfo "Accompanying kernel supports zstd, using that" + fi + find $2 | cpio --format="newc" --create | $cmd $args > "$3" local PS=(${PIPESTATUS[*]}) [ "x${PS[0]}" != "x0" ] && perror "'find $2' in '$(pwd)' failed." [ "x${PS[1]}" != "x0" ] && perror "cpio create failed." @@ -65,7 +72,10 @@ generate_squashfs() { fi # Detect mksquashfs xz support local PARAMS - if mksquashfs 2>&1 | grep -A 8 '^-comp' | grep -q '\sxz'; then + if mksquashfs 2>&1 | grep -A 10 '^-comp' | grep -q '\szstd' && grep -qF "CONFIG_SQUASHFS_ZSTD=y" "$1/../kernel/config"; then + pinfo "Using zstd compression" + PARAMS="-comp zstd -Xcompression-level 20" + elif mksquashfs 2>&1 | grep -A 10 '^-comp' | grep -q '\sxz'; then pinfo "Using xz compression" PARAMS="-comp xz" else |