[PATCH] Gunzip call fix for PPC kernel images >4MB

Tom Rini trini at kernel.crashing.org
Thu Aug 17 15:04:08 EST 2006

On Wed, Aug 16, 2006 at 11:31:37AM +0200, Benjamin Heyne wrote:

> If Kernel images for PPC grow >4MB inflating of the kernel fails.
> Increasing the link/load address doesn't help. Problem is 
> solved by replacing the fixed address of the gunzip() call in
> misc-embedded.c with CONFIG_BOOT_LOAD.

I've thought about this a bit and I think the general concept is OK, but
this works with a bit of luck I think.

The arch/ppc/boot code makes some assumptions such as that 4MB-8MB (except
on 40x which is end of the wrapper code to 8MB, and BOOT_LOAD defaults
to 4MB here) is free to use for malloc()'ing for the inflate routine.

It also assumes that the vmlinux.gz will live at BOOT_LOAD + a bit, when
the wrapper is set to kick off linux.

Finally, in arch/ppc/boot/ (for both OF and !OF cases) gunzip looks
void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)

So I see 2 problems here.

First, there are other calls to gunzip with dstlen hard-coded to 4MB, so
the problem would still exist.

Second, and more complexly we want to make sure that we don't tell
gunzip that the destination size grows into the area it would also be
using to malloc buffers, unless someone can (and please do if possible)
explain that it's really OK to uncompress into our zalloc space (there
is no zfree so maybe it's going to be OK, but I don't know that the
algorithm wouldn't try and reuse buffers which would be bad).


Tom Rini

More information about the Linuxppc-dev mailing list