From: robertkaiser Date: Fri, 14 Mar 2003 17:59:25 +0000 (+0000) Subject: Fixed bugs in ramdisk image relocation, thanks to Mladen Barjaktarevic X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=24e83cbb71c86535740ca9222d96140696aebb3e;p=users%2Frw%2Farmboot.git Fixed bugs in ramdisk image relocation, thanks to Mladen Barjaktarevic for spotting this --- diff --git a/common/armlinux.c b/common/armlinux.c index cd9d319..8878889 100644 --- a/common/armlinux.c +++ b/common/armlinux.c @@ -61,6 +61,12 @@ void boot_linux(cmd_tbl_t *cmdtp, void (*theKernel)(int zero, int arch); image_header_t *hdr = &header; + /* + * get the kernel entry address *before* we possibly + * clobber the header buffer when verifying a ramdisk image + */ + theKernel = (void (*)(int, int))SWAP32(hdr->ih_ep); + /* * Check if there is an initrd image */ @@ -146,7 +152,7 @@ void boot_linux(cmd_tbl_t *cmdtp, #endif if (data) { - initrd_start = data; + initrd_start = SWAP32(hdr->ih_load); initrd_end = initrd_start + len; printf (" Loading Ramdisk to %08lx, end %08lx ... ", initrd_start, initrd_end); @@ -157,8 +163,6 @@ void boot_linux(cmd_tbl_t *cmdtp, initrd_end = 0; } - theKernel = (void (*)(int, int))SWAP32(hdr->ih_ep); - #ifdef DEBUG printf ("## Transferring control to Linux (at address %08lx) ...\n", (ulong)theKernel);