On 07/01/2012 12:31 PM, Ben Hutchings wrote: > On Sat, 2012-06-30 at 23:01 -0400, Milan Kupcevic wrote: > [...] >> --- mkvmlinuz (revision 19233) >> +++ mkvmlinuz (working copy) > [...] >> @@ -158,6 +153,12 @@ >> post_2_6_19= >> fi >> >> +if dpkg --compare-versions $release ge 2.6.38 && test "$arch" != "prep" ; >> then >> + post_2_6_38=Yes >> +else >> + post_2_6_38= >> +fi >> + > [...] > > We should actually check for CONFIG_RD_XZ=y in /boot/config-$release, to > allow for custom kernels that don't enable it. And of course the > variable name should be something like is_xz_supported. > > Ben. >
Updated patch is attached. Milan
Index: mkvmlinuz =================================================================== --- mkvmlinuz (revision 19233) +++ mkvmlinuz (working copy) @@ -133,13 +133,10 @@ # if no release was specified, extract it from the kernel image name if test -z "$release"; then release=$(echo $kernel | sed s/.*vmlinux-//) - if echo $release | grep -q '2\.[46]\.[0-9]*'; then - : - else - release="" - fi fi +test -z "$verbose" || echo === Release version seems to be $release. + if dpkg --compare-versions $release ge 2.6.16 && test "$arch" != "prep" ; then post_2_6_16=Yes else @@ -158,7 +155,9 @@ post_2_6_19= fi -test -z "$verbose" || echo === Release version seems to be $release. +if grep -q CONFIG_RD_XZ=y /boot/config-$release ; then + is_xz_supported=Yes +fi # if no object file directory was specified, try to find one if test -z "$objdir"; then @@ -206,6 +205,11 @@ test -z "$verbose" || echo === Doing build in $work. # utilities +if test "$is_xz_supported"; then + XZ="xz --check=crc32 -8" +else + XZ=false +fi if test "$post_2_6_16"; then ADDNOTE=$objdir/addnote # must be present in mkvmlinuz fallback tools if test \! -f "$ADDNOTE"; then @@ -291,22 +295,35 @@ # create the compressed initrd image file if test -n "$initrd"; then - test -z "$verbose" || echo === Creating compressed initrd image initrd.gz... + test -z "$verbose" || echo === Creating compressed initrd image if test -z "$compressed"; then - # Detect if the file was already compressed by gzip. - if test "`od -A n -c -N 2 $initrd`" = " 037 213"; then - compressed="Yes" + if test "`xxd -p -l2 $initrd`" = "1f8b"; then + test -z "$verbose" || echo === $initrd is already gzip compressed + do_cmd cp -p $initrd $work/initrd.gz + if test -n "$is_xz_supported" && test "$arch" != "prep"; then + test -z "$verbose" || echo === recompressing to xz + zcat $initrd | $XZ - > $work/initrd.xz + fi + elif test "`xxd -p -l6 $initrd`" = "fd377a585a00"; then + test -z "$verbose" || echo === $initrd is already xz compressed + do_cmd cp -p $initrd $work/initrd.xz else + test -z "$verbose" || echo === assuming $initrd was not compressed compressed="No" fi fi case "$compressed" in Yes) do_cmd cp -p $initrd $work/initrd.gz + do_cmd ln -s $work/initrd.gz $work/initrd.xz ;; No) do_cmd cp -p $initrd $work/initrd - do_cmd $GZIP $work/initrd + if test -n "$is_xz_supported" && test "$arch" != "prep"; then + do_cmd $XZ $work/initrd + else + do_cmd $GZIP $work/initrd + fi ;; esac fi @@ -317,7 +334,11 @@ WRAPPER=$objdir/wrapper vmlinuz=$work/vmlinuz.$arch if test -n "$initrd"; then - INITRD="-i $work/initrd.gz" + if test "$is_xz_supported"; then + INITRD="-i $work/initrd.xz" + else + INITRD="-i $work/initrd.gz" + fi fi $WRAPPER -c -o $vmlinuz -p $arch $INITRD -D $objdir -W $work $kernel else
signature.asc
Description: OpenPGP digital signature