Update and slightly refactor compression handling.
This adds a --compress= option along with xz support for 2.6.38 and above.master
parent
e5e5c8952d
commit
5e6c3b035d
34
dracut
34
dracut
|
@ -96,6 +96,13 @@ Creates initial ramdisk images for preloading modules
|
|||
--lzma Compress the generated initramfs using lzma.
|
||||
Make sure your kernel has lzma support compiled in,
|
||||
otherwise you will not be able to boot.
|
||||
--xz Compress the generated initramfs using xz.
|
||||
Make sure that your kernel has xz 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,
|
||||
otherwise you will not be able to boot.
|
||||
--no-compress Do not compress the generated initramfs. This will
|
||||
override any other compression options.
|
||||
--list-modules List all available dracut modules.
|
||||
|
@ -195,6 +202,9 @@ while (($# > 0)); do
|
|||
-c|--conf) read_arg conffile "$@" || shift;;
|
||||
--confdir) read_arg confdir "$@" || shift;;
|
||||
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
|
||||
-I|--install) read_arg install_items "$@" || shift;;
|
||||
--fwdir) read_arg fw_dir_l "$@" || shift;;
|
||||
--compress) read_arg compress "$@" || shift;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
|
@ -212,14 +222,11 @@ while (($# > 0)); do
|
|||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"; push include_target "$3"; shift 2;;
|
||||
--bzip2) [[ $compress != cat ]] && compress="bzip2 -9";;
|
||||
--lzma) [[ $compress != cat ]] && compress="lzma -9";;
|
||||
--xz) [[ $compress != cat ]] && compress="xz --check=crc32";;
|
||||
--no-compress) compress="cat";;
|
||||
--gzip) if [[ $compress != cat ]]; then
|
||||
type pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9"
|
||||
fi;;
|
||||
--bzip2) compress="bzip2";;
|
||||
--lzma) compress="lzma";;
|
||||
--xz) compress="xz";;
|
||||
--no-compress) _no_compress="cat";;
|
||||
--gzip) compress="gzip";;
|
||||
--list-modules)
|
||||
do_list="yes";
|
||||
;;
|
||||
|
@ -241,6 +248,17 @@ if ! [[ $kernel ]] || [[ $kernel = "unset" ]]; then
|
|||
fi
|
||||
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
|
||||
|
||||
case $compress in
|
||||
bzip2) compress="bzip -9";;
|
||||
lzma) compress="lzma -9";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
|
||||
gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
|
||||
compress="gzip -9";;
|
||||
esac
|
||||
if [[ $_no_compress = "cat" ]]; then
|
||||
compress="cat"
|
||||
fi
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
|
|
25
dracut.8.xml
25
dracut.8.xml
|
@ -353,7 +353,7 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
|||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using gzip.
|
||||
This will be done by default, unless another compression option or --no-compress is passed.</para>
|
||||
This will be done by default, unless another compression option or --no-compress is passed. Equivalent to "--compress=gzip -9"</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -363,7 +363,7 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
|||
<listitem>
|
||||
<para>Compress the generated initramfs using bzip2.
|
||||
<warning>
|
||||
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot.</para>
|
||||
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=bzip2"</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -374,10 +374,29 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
|
|||
<listitem>
|
||||
<para>Compress the generated initramfs using lzma.
|
||||
<warning>
|
||||
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot.</para>
|
||||
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=lzma -9"</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--xz</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Compress the generated initramfs using xz.
|
||||
<warning>
|
||||
<para>Make sure your kernel has xz decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=xz --check=crc32 --lzma2=dict=1MiB"</para>
|
||||
</warning></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--compress <replaceable><compressor></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>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 a quoted string with arguments, it will be called with exactly those arguments. Depending on what you pass, this may result in an initramfs that the kernel cannot decompress.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--no-compress</option>
|
||||
|
|
Loading…
Reference in New Issue