Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Fix BootX booting with an initrd

The bootx_init.c trampoline didn't properly add the ramdisk to the
"reserve map" (list of reserved areas of memory), thus causing all sorts
of failures when using BootX with an initrd. Also fixes a possible
problem if the ramdisk is located before the device-tree passed by
BootX.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Benjamin Herrenschmidt and committed by
Paul Mackerras
6cdd2bdf 5db9fa95

+11 -4
+11 -4
arch/powerpc/platforms/powermac/bootx_init.c
··· 411 411 DBG("End of boot params: %x\n", mem_end); 412 412 rsvmap[0] = mem_start; 413 413 rsvmap[1] = mem_end; 414 - rsvmap[2] = 0; 415 - rsvmap[3] = 0; 414 + if (bootx_info->ramDisk) { 415 + rsvmap[2] = ((unsigned long)bootx_info) + bootx_info->ramDisk; 416 + rsvmap[3] = rsvmap[2] + bootx_info->ramDiskSize; 417 + rsvmap[4] = 0; 418 + rsvmap[5] = 0; 419 + } else { 420 + rsvmap[2] = 0; 421 + rsvmap[3] = 0; 422 + } 416 423 417 424 return (unsigned long)hdr; 418 425 } ··· 550 543 */ 551 544 if (bi->version < 5) { 552 545 space = bi->deviceTreeOffset + bi->deviceTreeSize; 553 - if (bi->ramDisk) 546 + if (bi->ramDisk >= space) 554 547 space = bi->ramDisk + bi->ramDiskSize; 555 548 } else 556 549 space = bi->totalParamsSize; 557 550 558 - bootx_printf("Total space used by parameters & ramdisk: %x \n", space); 551 + bootx_printf("Total space used by parameters & ramdisk: 0x%x \n", space); 559 552 560 553 /* New BootX will have flushed all TLBs and enters kernel with 561 554 * MMU switched OFF, so this should not be useful anymore.