Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd (http://www.linux-archive.org/debian-kernel/678902-bug-549681-bug-549681-mkvmlinuz-use-xz-compress-vmlinuz-boxed-initrd.html)

Milan Kupcevic 07-01-2012 03:01 AM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
> some OpenFirmware implementations, such as the one in the PegasosII,
> have a 12 MB size limit on kernel images, and no initrd loading
> capability. The latter is worked around by merging the initrd into the
> image with the "mkvmlinuz" tool, however the generated images are
> unbootable if they exceed 12 MB.

The attached patch brings vmlinuz from about 13MB to about 9.5MB, which
is well under the 12MB limit. Downside is that xz compressing is
noticeably slower than currently used gzip, but decompressing speed
difference is not noticeable.

I've tested it on Pegasos II machine, it boots really fast. Updated
mkvmlinuz package is waiting on mentors.debian.net for a willing sponsor
for upload.

Milan

Touko Korpela 07-01-2012 11:05 AM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
On Sat, Jun 30, 2012 at 11:01:47PM -0400, Milan Kupcevic wrote:
> The attached patch brings vmlinuz from about 13MB to about 9.5MB, which
> is well under the 12MB limit. Downside is that xz compressing is
> noticeably slower than currently used gzip, but decompressing speed
> difference is not noticeable.
>
> I've tested it on Pegasos II machine, it boots really fast. Updated
> mkvmlinuz package is waiting on mentors.debian.net for a willing sponsor
> for upload.
> ...
> +if test "$post_2_6_38"; then
> + XZ="xz --check=crc32 -8"
> +else
> + XZ=false
> +fi

>From xz(1) manual page (you can ignore DecMem):
Preset DictSize CompCPU CompMem DecMem
-0 256 KiB 0 3 MiB 1 MiB
-1 1 MiB 1 9 MiB 2 MiB
-2 2 MiB 2 17 MiB 3 MiB
-3 4 MiB 3 32 MiB 5 MiB
-4 4 MiB 4 48 MiB 5 MiB
-5 8 MiB 5 94 MiB 9 MiB
-6 8 MiB 6 94 MiB 9 MiB
-7 16 MiB 6 186 MiB 17 MiB
-8 32 MiB 6 370 MiB 33 MiB
-9 64 MiB 6 674 MiB 65 MiB

Better to use default setting "-6" that has lower memory requirement.



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20120701110505.GA6166@tiikeri.vuoristo.local

Ben Hutchings 07-01-2012 04:31 PM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
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.

--
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.

Milan Kupcevic 07-01-2012 07:13 PM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
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

Geert Stappers 07-01-2012 08:13 PM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
On Sun, Jul 01, 2012 at 03:13:57PM -0400, Milan Kupcevic wrote:

> +if grep -q CONFIG_RD_XZ=y /boot/config-$release ; then
> + is_xz_supported=Yes
> +fi
>

Have a look at this test statement

> +if test "$is_xz_supported"; then
> + XZ="xz --check=crc32 -8"
> +else
> + XZ=false
> +fi

And have a look at these test statements:
> + test -z "$verbose" || echo === Creating compressed initrd image
> - if test "`od -A n -c -N 2 $initrd`" = " 037 213"; then
> + if test "`xxd -p -l2 $initrd`" = "1f8b"; then
> + test -z "$verbose" || echo === $initrd is already gzip compressed
> + if test -n "$is_xz_supported" && test "$arch" != "prep"; then
> + test -z "$verbose" || echo === recompressing to xz
> + elif test "`xxd -p -l6 $initrd`" = "fd377a585a00"; then
> + test -z "$verbose" || echo === $initrd is already xz compressed
> + test -z "$verbose" || echo === assuming $initrd was not compressed

Notices that those tests are either

test string = otherstring

or are

test --option "$variable"


They here again a "test --option $variable"
and a strange looking single "test $variable"

>
> @@ -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


Please use the more readable

test -n "$is_xz_supported"



Groeten
Geert Stappers
--
> And is there a policy on top-posting vs. bottom-posting?
Yes.

Milan Kupcevic 07-02-2012 01:43 AM

Bug#549681: bug#549681: mkvmlinuz: use xz to compress vmlinuz-boxed initrd
 
On 07/01/2012 04:13 PM, Geert Stappers wrote:
>
>
> Please use the more readable
>
> test -n "$is_xz_supported"
>

Have a look at this:


test "$string"
test -n "$string"
[ "$string" ]
[ -n "$string" ]


They are just four different expressions of exactly the same thing. It
is hard to please everybody's taste.

M


All times are GMT. The time now is 06:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.