kernel presentation at ILUG on Sat.

Charles Steinkuehler charles at steinkuehler.net
Mon May 5 18:34:45 CDT 2003


Jason Clinton wrote:

> On the compression subject, I see that post 2.4.18 certain library 
> operations are built in to the kernel. (Like gzip and fast-sort). How 
> can I call these library functions from C/C++ and why would I want to?

Anything in the kernel would have to be called from the kernel, or from 
kernel space (ie kernel module code), unless there's been a kernel 
interface provided to access the features (ie perhaps to allow hardware 
acceleration of your gzip commands, in which case you'd probably want to 
use a user-space library written for the purpose of accessing the new 
kernel functions).

> Is it possible to use BZip2 compression for the kernel?

Sure, if you write the appropriate bootstrap code.  See for instance, 
the "Ultimate Packer for eXecutables", which is able to compress (and 
decompress on boot) the kernel with an alternate compression scheme:

http://upx.sourceforge.net/

Note: You have to use the "beta" version to compress a linux kernel, but 
I've never had any problems.  I use UPX compressed kernels for my floppy 
based firewall distributions, as it saves quite a bit of space 
(typically 50-100K of a 400-500K zImage kernel file).

If you're serious about wanting to do a bz2 compression for the kernel, 
you should look at the UPX code.  You simply run UPX on a pre-existing 
[b]zImage kernel file, and UPX seperates the various boot-strap pieces 
of the kernel, replaces the gzip portion with UPX enabled code, 
extracts/recompresses the "main" kernel image, and finally generates a 
new (typically much smaller) [b]zImage file.

-- 
Charles Steinkuehler
charles at steinkuehler.net




More information about the Kclug mailing list