Subject: Re: Compressed kernel boot
To: David Brownlee <D.K.Brownlee@city.ac.uk>
From: Matthias Pfaller <email@example.com>
Date: 08/30/1995 14:26:16
> I've just noticed some commits for the pc532 for compressed
> kernel boot (apologies if I'm mistaken, but it looks like the
> boot program knows how to decompress a kernel on load).
> This looks like a really useful feature to have on all ports -
> the i386 in particular would benefit from a compressed kernel
> on the install floppies...
And that's the only reason I did it. Compressed kernels don't give you
much in the general case. For example you don't have a symbol table...
> There might be problems with there not being enough space for
> the decompression code in the boot blocks - if so the
> decompression code could be added into the kernel (which would
> load then decompress itself).
The uncompressing code does not go into the boot block (or /boot), but
into /netbsd. I have done a program called "cloak" that takes it's stdin
and encapsulatetes it into an a.out object file. So you first create a
file called netbsd.o with
"gzip -9 </sys/arch/pc532/compile/INSTALL/netbsd|cloak >netbsd.o"
Then you link this with /usr/mdec/zboot.o. Then you install the resulting
binary on your install disk as /netbsd. My kernel on the install disk is
about 230k. That way I have only one 1.44 meg install disk for my pc532.
> Having the decompression code in the kernel leads to another
> interesting possibility - compressed binaries on the install
> floppy (crunched _then_ compressed?) though that would throw
> deman paging out just a little :)
An easier aproach would be (and that's what I plan to do for the pc532)
to have a static array in the kernel (about 2meg I'd say), that is
initialized with some magic to make it possible to find the starting of
the array in the kernel binary. Then you create your usual install disk
image and inject it into the kernel (you need a driver that can use
the array as a disk device, the pc532 already has such a driver). Now
you compress the resulting image and install it as the only file on your
> Anyway - is anyone looking at having a MI implementation for
> compressed kernels?
I think my code is pretty generic. Most of it is stolen from unzip 5.2
anyway. There are a few things that would have to get changed, but its
not much. Any takers to port this to another platform?