[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

COMPRESS=xz support for mkinitramfs



Hi, now that upstream linux-2.6 kernels support xz-compressed
ramdisks, I would like update-initramfs to support generating them.

This minimal patch WORKS FOR ME:

    $ sed '/lzop/ {p; s/lzop/xz/g; }' /usr/sbin/mkinitramfs | diff -pud /usr/sbin/mkinitramfs -
    --- /usr/sbin/mkinitramfs	2010-09-27 20:46:10.000000000 +1000
    +++ -	2011-02-17 01:41:52.028878435 +1100
    @@ -148,6 +148,7 @@ if ! `grep -q -i ^config_rd_${COMPRESS%p
     fi

     [ "${compress}" = lzop ] && compress="lzop -9"
    +[ "${compress}" = xz ] && compress="xz -9"

     if [ -d "${outfile}" ]; then
            echo "${outfile} is a directory" >&2

At least this far:

    $ file -s /var/tmp/cdeboo*/boot/initr*
    /var/tmp/cdebootstrap-amd64~/boot/initrd.img-2.6.38-rc5:
    gzip compressed data, from Unix, last modified: Thu Feb 17 01:25:54 2011
    /var/tmp/cdebootstrap-amd64/boot/initrd.img-2.6.38-rc5:
    xz compressed data

I haven't actually tried booting it yet, and obviously updating the
documentation is left as an exercise for the reader.

PS: xz has an -e option for "compress me harder".  Given the
compress/decompress ratio for ramdisks (i.e. once vs. every boot), it
might be advisable to do "xz -9e" instead of the "xz -9" above.


Reply to: