In this one, s/xz/lzma/g. On Sat, Aug 14, 2010 at 2:23 PM, Victor Lowther <victor.lowther@xxxxxxxxx> wrote: > Current kernels know how to uncompress bzip2 and xz, so use them for compressing > the initramfs if asked. The more compression the merrier. > > Also add support for generating uncompressed images, although they > are usually not what you want. > > --- > dracut | 21 ++++++++++++++++++--- > mkinitrd-dracut.sh | 2 +- > 2 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/dracut b/dracut > index a2bc312..5c1c4b4 100755 > --- a/dracut > +++ b/dracut > @@ -75,6 +75,17 @@ Creates initial ramdisk images for preloading modules > Target directory in the final initramfs. > -I, --install [LIST] Install the space separated list of files into the > initramfs. > + --gzip Compress the generated initramfs using gzip. > + This will be done by default, unless another > + compression option or --no-compress is passed. > + --bzip2 Compress the generated initramfs using bzip2. > + Make sure your kernel has bzip2 decompression support > + compiled in, otherwise you will not be able to boot. > + --xz Compress the generated initramfs using xz. > + Make sure your kernel has xz support compiled in, > + otherwise you will not be able to boot. > + --no-compress Do not compress the generated initramfs. This will > + override any other compression options. > " > } > > @@ -111,6 +122,10 @@ while (($# > 0)); do > --fstab) use_fstab_l="yes" ;; > -i|--include) include_src="$2"; include_target="$3"; shift 2;; > -I|--install) install_items="$2"; shift;; > + --gzip) [[ $compress != cat ]] && compress="gzip -9";; > + --bzip2) [[$compress != cat ]] && compress="bzip2 -9";; > + --xz) [[ $compress != cat ]] && compress="xz -9";; > + --no-compress) compress="cat";; > -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;; > *) break ;; > esac > @@ -174,6 +189,7 @@ fw_dir=${fw_dir//:/ } > > [[ $hostonly = yes ]] && hostonly="-h" > [[ $hostonly != "-h" ]] && unset hostonly > +[[ $compress ]] || compress="gzip -9" > > if [[ -f $dracutbasedir/dracut-functions ]]; then > . $dracutbasedir/dracut-functions > @@ -323,8 +339,8 @@ type hardlink &>/dev/null && { > hardlink "$initdir" 2>&1 > } > > -type pigz &>/dev/null && gzip=pigz || gzip=gzip > -( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |$gzip -9 > "$outfile"; ) > +[[ $compress = gzip* ]] && type pigz > /dev/null 2>&1 && compress="pigz -9" > +( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |$compress > "$outfile"; ) > if [ $? -ne 0 ]; then > derror "dracut: creation of $outfile failed" > exit 1 > @@ -333,4 +349,3 @@ fi > [[ $beverbose = yes ]] && ls -lh "$outfile" > > exit 0 > - > diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh > index 64b3069..59333a7 100644 > --- a/mkinitrd-dracut.sh > +++ b/mkinitrd-dracut.sh > @@ -96,7 +96,7 @@ while [ $# -gt 0 ]; do > --without*) ;; > --without-usb) ;; > --fstab*) ;; > - --nocompress) ;; > + --nocompress) dracut_args="$dracut_args --no-compress";; > --ifneeded) ;; > --omit-scsi-modules) ;; > --omit-ide-modules) ;; > -- > 1.7.2.1 > > -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html