kernel presentation at ILUG on Sat.

Hal Duston hduston at speedscript.com
Mon May 5 17:33:18 CDT 2003


On Mon, 2003-05-05 at 11:13, James Colannino wrote:
> I live in another part of the United States and so I wouldn't have been 
> able to be there, but I have a couple questions about the kernel that I 
> have been itching to figure out and was wondering if anyone could help 
> enlighten me :)
> 
> First, how exactly does the kernel uncompress itself?  Are there a few 
> lines of code at the beginning of the binary that instruct the computer 
> on how to uncompress the rest?  What program handles the compression 
> during compilation and what sort of algorithm is used?  Gzip maybe?
> 
> lol I'm hoping SOMEONE can help me out with this.  I haven't found much 
> googling, partly because I'm not sure exactly under what terms I should 
> search for, and also, I've posted similiar questions to a couple other 
> user groups in my area, and no one seems to have an answer.

The kernel is compressed at build time with gzip.  There is enough of
the gzip code included in the kernel image to do the gunzipping of it.

The boot loader loads the kernel image, and then jumps to the gunzip
part, which unzips it, moves it to the proper location in memory, and
then jumps to the actual kernel.  Contrary to popuplar opinion, bzImage
stands for BIG gzipped image, and _not_ bzipped image.  zImage had a
limit of 512K or so, I think.

The kernel itself is "just" an executable.  The gzip part is glued on to
the front of the compressed kernel, and that (with an oboselete boot
sector) becomes the kernel image.

You can find all the source code for this in arc/i386/boot of wherever
you kernel source code tree is.

--
Hal




More information about the Kclug mailing list