]> err.no Git - linux-2.6/commitdiff
powerpc: Change the default link address for pSeries zImage kernels
authorTony Breeds <tony@bakeyournoodle.com>
Tue, 24 Jun 2008 04:20:29 +0000 (14:20 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 1 Jul 2008 01:28:32 +0000 (11:28 +1000)
Currently we set the start of the .text section to be 4Mb for pSeries.
In situations where the zImage is > 8Mb we'll fail to boot (due to
overlapping with OF).  Move .text in a zImage from 4MB to 64MB
(well past OF).

We still will not be able to load large zImage unless we also move OF,
to that end, add a note to the zImage ELF to move OF to 32Mb.  If this
is the very first kernel booted then we'll need to move OF manually by
setting real-base.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/boot/addnote.c
arch/powerpc/boot/oflib.c
arch/powerpc/boot/wrapper
arch/powerpc/boot/zImage.coff.lds.S
arch/powerpc/boot/zImage.lds.S

index 8041a9845ab7efa9c94d58505a1d32c949b7e716..b1e5611b2ab1d639edd67346ca50f88d625b9629 100644 (file)
@@ -25,7 +25,7 @@ char arch[] = "PowerPC";
 #define N_DESCR        6
 unsigned int descr[N_DESCR] = {
        0xffffffff,             /* real-mode = true */
-       0x00c00000,             /* real-base, i.e. where we expect OF to be */
+       0x02000000,             /* real-base, i.e. where we expect OF to be */
        0xffffffff,             /* real-size */
        0xffffffff,             /* virt-base */
        0xffffffff,             /* virt-size */
index 95b8fd69a403b65874a272435f4915ced50e6d84..b0ec9cf3eaaf6e6bf44f9a77aeb079761a2d628c 100644 (file)
@@ -168,8 +168,19 @@ void *of_claim(unsigned long virt, unsigned long size, unsigned long align)
 
 void *of_vmlinux_alloc(unsigned long size)
 {
-       void *p = malloc(size);
-
+       unsigned long start = (unsigned long)_start, end = (unsigned long)_end;
+       void *addr;
+       void *p;
+
+       /* With some older POWER4 firmware we need to claim the area the kernel
+        * will reside in.  Newer firmwares don't need this so we just ignore
+        * the return value.
+        */
+       addr = of_claim(start, end - start, 0);
+       printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %p\r\n",
+              start, end, end - start, addr);
+
+       p = malloc(size);
        if (!p)
                fatal("Can't allocate memory for kernel image!\n\r");
 
index cb87a015be7cddbc6accc17f5629ca2d8264a8de..df2358e9f1ca7eef060e5a8a564ddfbc3ab80592 100755 (executable)
@@ -138,14 +138,20 @@ objflags=-S
 tmp=$tmpdir/zImage.$$.o
 ksection=.kernel:vmlinux.strip
 isection=.kernel:initrd
+link_address='0x400000'
 
 case "$platform" in
-pmac|pseries|chrp)
+pseries)
+    platformo=$object/of.o
+    link_address='0x4000000'
+    ;;
+pmac|chrp)
     platformo=$object/of.o
     ;;
 coff)
     platformo=$object/of.o
     lds=$object/zImage.coff.lds
+    link_address='0x500000'
     ;;
 miboot|uboot)
     # miboot and U-boot want just the bare bits, not an ELF binary
@@ -190,6 +196,7 @@ ps3)
     objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
     ksection=.kernel:vmlinux.bin
     isection=.kernel:initrd
+    link_address=''
     ;;
 ep88xc|ep405|ep8248e)
     platformo="$object/fixed-head.o $object/$platform.o"
@@ -272,7 +279,10 @@ if [ -n "$dtb" ]; then
 fi
 
 if [ "$platform" != "miboot" ]; then
-    ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
+    if [ -n "$link_address" ] ; then
+        text_start="-Ttext $link_address --defsym _start=$link_address"
+    fi
+    ${CROSS}ld -m elf32ppc -T $lds $text_start -o "$ofile" \
        $platformo $tmp $object/wrapper.a
     rm $tmp
 fi
index fe87a90ce7f1a606bba00f50597ac9677757598c..856dc78b14ef8f3d2b8062ba5c0b5d6b22f49e4d 100644 (file)
@@ -3,7 +3,6 @@ ENTRY(_zimage_start_opd)
 EXTERN(_zimage_start_opd)
 SECTIONS
 {
-  . = (5*1024*1024);
   _start = .;
   .text      :
   {
index f6e380fdb388903a01394c1643f3a7b71ae2c455..0962d62bdb5051c7e4ae61ff0b461e34bc952e46 100644 (file)
@@ -3,7 +3,6 @@ ENTRY(_zimage_start)
 EXTERN(_zimage_start)
 SECTIONS
 {
-  . = (4*1024*1024);
   _start = .;
   .text      :
   {