Re: bzImage decompression

Yann DRONEAUD (lch@multimania.com)
Tue, 28 Sep 1999 10:14:38 +0100


On Mon, 27 Sep 1999, Richard B. Johnson wrote:

> On Mon, 27 Sep 1999, Pascal Schmitt wrote:

> > Hi,
> >
> > For a very particular thing, I need to decompress a bzImage in order to
> > get the uncompressed kernel ( I need an uncompressed kernel for a bootp
> > client on a linux bootp server, but I don't have enough place to store
> two kernels on it : compressed and uncompressed, so I will uncompress
> > its kernel).
> > I take the bzImage, remove the bootsect.s and setup.s header to get the
> > compressed kernel. but I can't unzip it because the extracted kernel
> > does not begin with gzip magic number (0x1f,0x8b|| 0x9e). But it should
> > (if I look to arch/i386/boot/compressed/misc.c and gunzip() ).
> >
> > Why ??
The zImage contain bootsect.o + setup.o + misc.o + piggy.o

piggy.o contain the gzipped vmlinux file in its data section (ELF)
(see compressed/Makefile piggy.o)

> You could always use the uncompressed image, vmlinux, which in the
> top directory after a build. Otherwise, uncompress bzImage first.

Be warn that you can't boot directly a vmlinux file, because it rely on some work made only in boot image
First there is setup.s that create some data in the zero-page (see Documentation/i386/zero-page.txt in the kernel source tree) : hard drive geometry, video mode, memory, PS/2, APM, MCA
After that it switch to protected mode, jump to 0x1000 or 0x10000 (depending on the image type)
Then compressed/head.S initialize stack, SMP , and give control to compressed/misc.c that decompress the kernel and give control to it.

PS: all source file mentionned are in arch/i386/boot

-----------------------------------
Yann Droneaud <lch@multimania.com>

http://www.multimania.com/lch
http://www.multimania.com/lch/projects/linux

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/