[arch-general] mkinitcpio compression
Hello list, I'm using arch on an old laptop with only 128MB RAM. I had problems compressing the initcpio image with lzma, it always failed allocating memory. The following one-line patch allowed me to set my own compression level in mkinitcpio.conf, with COMPRESSION="lzma -4" --- /sbin/mkinitcpio.orig 2010-10-06 03:23:00.966415649 +0300 +++ /sbin/mkinitcpio 2011-02-26 19:11:36.309682053 +0200 @@ -277,7 +277,7 @@ status=0 if [ -n "${GENIMG}" ]; then echo -n ":: Generating image '${GENIMG}'..." - if ! /sbin/gen_init_cpio ${FILELIST} | ${COMPRESSION} -9 > "${GENIMG}"; then + if ! /sbin/gen_init_cpio ${FILELIST} | ${COMPRESSION} > "${GENIMG}"; then echo "FAILED" status=1 else What do you think? Should this make it to the distro? Also I actually think that *not* forcing -9 compression level, and letting the tool use its default is a good thing. Thanks, Dimitris
On Sun, Feb 27, 2011 at 10:12 AM, Dimitrios Apostolou <jimis@gmx.net> wrote:
--- /sbin/mkinitcpio.orig 2010-10-06 03:23:00.966415649 +0300 +++ /sbin/mkinitcpio 2011-02-26 19:11:36.309682053 +0200 @@ -277,7 +277,7 @@ status=0 if [ -n "${GENIMG}" ]; then echo -n ":: Generating image '${GENIMG}'..." - if ! /sbin/gen_init_cpio ${FILELIST} | ${COMPRESSION} -9 > "${GENIMG}"; then + if ! /sbin/gen_init_cpio ${FILELIST} | ${COMPRESSION} > "${GENIMG}"; then echo "FAILED" status=1 else
i think making it something like ${COMPRESSIONLEVEL:--9} is more appropriate.
On Sun, Feb 27, 2011 at 10:12 AM, Dimitrios Apostolou <jimis@gmx.net> wrote:
Hello list,
I'm using arch on an old laptop with only 128MB RAM. I had problems compressing the initcpio image with lzma, it always failed allocating memory. The following one-line patch allowed me to set my own compression level in mkinitcpio.conf, with COMPRESSION="lzma -4"
can you just set XZ_DEFAULTS=--memlimit=48MiB and leave mkinitcpio alone? i am not sure if this approach could work.
Am 27.02.2011 03:12, schrieb Dimitrios Apostolou:
Hello list,
I'm using arch on an old laptop with only 128MB RAM. I had problems compressing the initcpio image with lzma, it always failed allocating memory. The following one-line patch allowed me to set my own compression level in mkinitcpio.conf, with COMPRESSION="lzma -4"
Does it also work if you simply omit any option and use the default? If you read the manpage, lzma -9 shouldn't be used anyway. On another note, I've used this on virtual machines with very few memory and it always worked.
On Sun, 27 Feb 2011, Thomas Bächler wrote:
Am 27.02.2011 03:12, schrieb Dimitrios Apostolou:
Hello list,
I'm using arch on an old laptop with only 128MB RAM. I had problems compressing the initcpio image with lzma, it always failed allocating memory. The following one-line patch allowed me to set my own compression level in mkinitcpio.conf, with COMPRESSION="lzma -4"
Does it also work if you simply omit any option and use the default? If you read the manpage, lzma -9 shouldn't be used anyway.
The default setting is -6 and it works, but I prefer -4 to avoid swapping. But what I'm arguing is that the default should be used anyway, and leave it to the user to choose a custom setting only if necessary. FWIW compressing the kernel26-fallback image with various settings (no_options, -e, -4, -4e, -9, -9e) yields almost identical results, even if -9 needs many times the memory of -6. CPU times are all from 20 to 25 seconds: -rw-r--r-- 1 jimis jimis 10293248 Feb 27 15:19 kernel26-fallback.orig -rw-r--r-- 1 jimis jimis 7860781 Feb 27 15:22 kernel26-fallback.4.lzma -rw-r--r-- 1 jimis jimis 7849183 Feb 27 15:25 kernel26-fallback.4e.lzma -rw-r--r-- 1 jimis jimis 7848882 Feb 27 15:26 kernel26-fallback.6e.lzma -rw-r--r-- 1 jimis jimis 7848866 Feb 27 15:28 kernel26-fallback.9e.lzma -rw-r--r-- 1 jimis jimis 7846985 Feb 27 15:22 kernel26-fallback.9.lzma -rw-r--r-- 1 jimis jimis 7846962 Feb 27 15:21 kernel26-fallback.6.lzma Dimitris
participants (3)
-
Auguste Pop
-
Dimitrios Apostolou
-
Thomas Bächler