--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
--lvmconf --nolvmconf --debug --profile --verbose --quiet
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
- --xz --no-compress --gzip --list-modules --show-modules --keep
+ --xz -zstd --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
--uefi
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
+elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
+ rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
will not be able to boot.
====
+**--zstd**::
+ Compress the generated initramfs using Zstandard.
+[WARNING]
+====
+Make sure your kernel has zstd decompression support compiled in, otherwise you
+will not be able to boot.
+====
+
**--compress** _<compressor>_::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
Specify additional files to include in the initramfs, separated by spaces,
if they exist.
-*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|<compressor [args ...]>}__"::
+*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
--lz4 Compress the generated initramfs using lz4.
Make sure that your kernel has lz4 support compiled
in, otherwise you will not be able to boot.
+ --zstd Compress the generated initramfs using Zstandard.
+ Make sure that your kernel has zstd support compiled
+ in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel
knows how to decompress the generated initramfs,
--long xz \
--long lzo \
--long lz4 \
+ --long zstd \
--long no-compress \
--long gzip \
--long list-modules \
--xz) compress_l="xz";;
--lzo) compress_l="lzo";;
--lz4) compress_l="lz4";;
+ --zstd) compress_l="zstd";;
--no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";;
--list-modules) do_list="yes";;
if ! [[ $compress ]]; then
# check all known compressors, if none specified
- for i in pigz gzip lz4 lzop lzma xz lbzip2 bzip2 cat; do
+ for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
command -v "$i" &>/dev/null || continue
compress="$i"
break
lz4)
compress="lz4 -l -9"
;;
+ zstd)
+ compress="zstd -15 -q -T0"
+ ;;
esac
[[ $hostonly = yes ]] && hostonly="-h"
$'\x89'LZO$'\0'*)
CAT="lzop -d -c"
;;
+ $'0xFD2FB528'*)
+ CAT="zstd -d -c"
+ ;;
*)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream --"
# works with stdin if $1 is not set.
det_archive() {
# NOTE: echo -e works in ash and bash, but not dash
- local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')"
+ local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '0xFD2FB528')"
local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2>/dev/null)"
case "$headerblock" in
$xz*) echo "xz" ;;
$gz*) echo "gzip" ;;
$bz*) echo "bzip2" ;;
+ $zs*) echo "zstd" ;;
07070*) echo "cpio" ;;
*ustar) echo "tar" ;;
esac
local img="$1" outdir="$2" archiver="" decompr=""
local ft="$(det_archive $img)"
case "$ft" in
- xz|gzip|bzip2) decompr="$ft -dc" ;;
+ xz|gzip|bzip2|zstd) decompr="$ft -dc" ;;
cpio|tar) decompr="cat";;
*) return 1 ;;
esac
install() {
inst_multiple tar gzip dd bash
# TODO: make this conditional on a cmdline flag / config option
- inst_multiple -o cpio xz bzip2
+ inst_multiple -o cpio xz bzip2 zstd
inst_simple "$moddir/img-lib.sh" "/lib/img-lib.sh"
}