WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Lzo compression in kernel and initrd  (Read 4393 times)

Offline neonix

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 391
Lzo compression in kernel and initrd
« on: October 24, 2010, 04:23:43 AM »
I want to use lzo compression in kernel and initrd to boot remastered Tinycore 2.x faster. Could someone help me find kernel patches to achive this? I know how to configure and compile the kernel. But patching is my Achilles' heel.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11043
Re: Lzo compression in kernel and initrd
« Reply #1 on: October 24, 2010, 04:47:31 AM »
It would be easier to rebuild the standard kernel of 3.x, as the LZO support was upstream by then.

edit: Also, upx-compressed kernels tend to boot faster than gzip. Probably faster than lzo, but I haven't tested that one.
So, make the above suggestion "rebuild the 3.x kernel with lzo initrd support, but kernel as gzip, and recompress kernel with upx".
« Last Edit: October 24, 2010, 04:54:42 AM by curaga »
The only barriers that can stop you are the ones you create yourself.

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Re: Lzo compression in kernel and initrd
« Reply #2 on: October 24, 2010, 02:09:37 PM »
Hum, upx impresses quite compressive (or the other way around ;)!

If I understand curaga correctly, he means recompiling the kernel with the options:

Quote
CONFIG_RD_LZO=y

Support loading of a LZO encoded initial ramdisk or cpio buffer
instead of CONFIG_RD_GZIP=y
and with keeping the standard tc setting CONFIG_KERNEL_GZIP=y. Upx'ing the bzImage reduces size.

Kernel:
original version: bzImage 2294848
upx'ed version: bzImage 1921857 (with -9 --ultra-brute)

Initramfs:
original version: tinycore.gz 8367526
lzo'ed version: tinycore.lzo 9111454

btw. I'd like to submit a new version of upx, libucl and lzop (directly build for 3.x), upx in repo is quite old and user stevens seems to be inactive for some "years" O_o. Maybe pm wakes him up ;-)

If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11043
Re: Lzo compression in kernel and initrd
« Reply #3 on: October 24, 2010, 03:09:32 PM »
I've usually used the binary version of upx, as last I checked Oberhumer said his closed-source compression was better than the FOSS one.
The only barriers that can stop you are the ones you create yourself.

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Re: Lzo compression in kernel and initrd
« Reply #4 on: October 24, 2010, 03:53:01 PM »
Hm, ok then let's test it, options: -k -f --best --ultra-brute

1. repo version upx 3.03: bzImage 2111767 or 92.02%
2. closed source upx 3.07: bzImage 1916201 or 83.50%
3. foss lzma upx 3.07: bzImage 1921857 or 83.75%

So I'd give the third option a go ;-)

Btw. I recompiled the kernel with option CONFIG_RD_LZO but he doesn't like my lzo compiled tinycore cpio archive. Doesn't lzop compress the right way or did I miss some kernel feature? Decompressing LZO is all enabled by default and CONFIG_KERNEL_LZO would only be for a lzoImage kernel not for the ramfs?!

[edit]
Ok, can confirm it's working. The kernel needs a special patch since 2.6.33.3 is buggy in lzo decompressor, following http://www.spinics.net/lists/mm-commits/msg78260.html. The patch applies well, upx'ed bzImage works too with tinycore.lzo/microcore.lzo.
[/edit]
« Last Edit: October 24, 2010, 06:35:42 PM by gutmensch »
If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)