Commit 9b09c6d909dfd8de96b99b9b9c808b94b0a71614

Authored by Tony Breeds
Committed by Paul Mackerras
1 parent c230328def

powerpc: Change the default link address for pSeries zImage kernels

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>

Showing 5 changed files with 26 additions and 7 deletions Side-by-side Diff

arch/powerpc/boot/addnote.c
... ... @@ -25,7 +25,7 @@
25 25 #define N_DESCR 6
26 26 unsigned int descr[N_DESCR] = {
27 27 0xffffffff, /* real-mode = true */
28   - 0x00c00000, /* real-base, i.e. where we expect OF to be */
  28 + 0x02000000, /* real-base, i.e. where we expect OF to be */
29 29 0xffffffff, /* real-size */
30 30 0xffffffff, /* virt-base */
31 31 0xffffffff, /* virt-size */
arch/powerpc/boot/oflib.c
... ... @@ -168,8 +168,19 @@
168 168  
169 169 void *of_vmlinux_alloc(unsigned long size)
170 170 {
171   - void *p = malloc(size);
  171 + unsigned long start = (unsigned long)_start, end = (unsigned long)_end;
  172 + void *addr;
  173 + void *p;
172 174  
  175 + /* With some older POWER4 firmware we need to claim the area the kernel
  176 + * will reside in. Newer firmwares don't need this so we just ignore
  177 + * the return value.
  178 + */
  179 + addr = of_claim(start, end - start, 0);
  180 + printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %p\r\n",
  181 + start, end, end - start, addr);
  182 +
  183 + p = malloc(size);
173 184 if (!p)
174 185 fatal("Can't allocate memory for kernel image!\n\r");
175 186  
arch/powerpc/boot/wrapper
... ... @@ -138,14 +138,20 @@
138 138 tmp=$tmpdir/zImage.$$.o
139 139 ksection=.kernel:vmlinux.strip
140 140 isection=.kernel:initrd
  141 +link_address='0x400000'
141 142  
142 143 case "$platform" in
143   -pmac|pseries|chrp)
  144 +pseries)
144 145 platformo=$object/of.o
  146 + link_address='0x4000000'
145 147 ;;
  148 +pmac|chrp)
  149 + platformo=$object/of.o
  150 + ;;
146 151 coff)
147 152 platformo=$object/of.o
148 153 lds=$object/zImage.coff.lds
  154 + link_address='0x500000'
149 155 ;;
150 156 miboot|uboot)
151 157 # miboot and U-boot want just the bare bits, not an ELF binary
... ... @@ -190,6 +196,7 @@
190 196 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
191 197 ksection=.kernel:vmlinux.bin
192 198 isection=.kernel:initrd
  199 + link_address=''
193 200 ;;
194 201 ep88xc|ep405|ep8248e)
195 202 platformo="$object/fixed-head.o $object/$platform.o"
... ... @@ -272,7 +279,10 @@
272 279 fi
273 280  
274 281 if [ "$platform" != "miboot" ]; then
275   - ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
  282 + if [ -n "$link_address" ] ; then
  283 + text_start="-Ttext $link_address --defsym _start=$link_address"
  284 + fi
  285 + ${CROSS}ld -m elf32ppc -T $lds $text_start -o "$ofile" \
276 286 $platformo $tmp $object/wrapper.a
277 287 rm $tmp
278 288 fi
arch/powerpc/boot/zImage.coff.lds.S
... ... @@ -3,7 +3,6 @@
3 3 EXTERN(_zimage_start_opd)
4 4 SECTIONS
5 5 {
6   - . = (5*1024*1024);
7 6 _start = .;
8 7 .text :
9 8 {
arch/powerpc/boot/zImage.lds.S
... ... @@ -3,7 +3,6 @@
3 3 EXTERN(_zimage_start)
4 4 SECTIONS
5 5 {
6   - . = (4*1024*1024);
7 6 _start = .;
8 7 .text :
9 8 {