Re: [PATCH] init: bzip2 or lzma -compressed kernels and initrds

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rob Landley
Date: Saturday, September 6, 2008 - 11:17 pm

On Saturday 06 September 2008 17:59:25 Alain Knaff wrote:

I vaguely recall that lzma requires more memory to decompress than bzip2 does, 
although I don't remember the details.  I know that bzip2 takes around 4 megs 
(although you need space for the decompressed kernel on _top_ of that, so you 
should be able to do it in about 8 megs total).  gunzip uses a 64k sliding 
window plus dictionary and the whole mess should fit in about 1/4 of a meg.

Actually, from what I've seen the main reason lzma doesn't get used for 
tarballs a lot is that whoever originally created it didn't include a 
fingerprint.  You can go "file tar.gz" or "file tar.bz2" and it can figure 
out by looking at the contents of the file what it _is_, but last I checked 
there's no obvious way to tell an lzma file from the output of /dev/urandom.  
This causes all sorts of small but annoying problems, and discourages its use 
a bit...

(Also, the decompressor's not so bad but the compressor was _painfully_ slow, 
last I checked.  It's been a couple years since I was really paying 
attention, though...)


Eh, anybody can mess with arm, powerpc, and mips.

1) Install qemu 0.9.1.

2) Go to http://landley.net/code/firmware/downloads

In the binaries/system-image directory are tarballs of prebuilt systems with 
zImage files of kernels qemu can boot, and ext2 image files of uClibc/busybox 
root filesystems.  There are also ./run-emulator.sh scripts that will boot 
the above under qemu 0.9.1 (giving you a shell prompt).

If you'd like to replace the zImage files with ones you build yourself, you'll 
need to either grab the source tarballs at the top level and run the whole 
build yourself (try "./build.sh armv4l" for example; you can run it with no 
arguments to see available targets) or grab the appropriate tarball out of 
binaries/cross-compiler/host-x86_64, extract it, add its "bin" subdirectory 
to your $PATH, and then build the kernel via something like:

  make CROSS_COMPILE=armv4l- ARCH=arm

With the appropriate .config of course (look at the defconfig files under 
arch/arm/config or grab mine out of the source).  I'm using arm as an example 
because it's pretty much the most popular embedded processor and has 90% 
share in the cell phone market.  FWL also supports powerpc, mips, and so on.  
(Sparc's boots but won't give you a shell prompt, it's a uClibc 0.9.29 bug.  
sh4 isn't properly supported by qemu yet, hopefully next release.)

Feel free to email me if you've got any questions, this is a hobby of mine. :)

Rob
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] init: bzip2 or lzma -compressed kernels and in ..., Rob Landley, (Sat Sep 6, 11:17 pm)
Re: [PATCH] init: bzip2 or lzma -compressed kernels and in ..., Frans Meulenbroeks, (Mon Sep 15, 5:46 am)
Re: [PATCH] init: bzip2 or lzma -compressed kernels and in ..., Leon Woestenberg, (Fri Sep 26, 11:53 am)