linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper
@ 2007-09-24 11:36 Valentine Barshak
  2007-09-25  2:29 ` David Gibson
  0 siblings, 1 reply; 12+ messages in thread
From: Valentine Barshak @ 2007-09-24 11:36 UTC (permalink / raw)
  To: linuxppc-dev

Currently zImage is linked at the 4MB base address.
Some platforms (using cuboot, treeboot) need the zImage's
entry point and base address. They place zImage exactly
at the base address it's been linked to. Sometimes 4MB left
at the start of the memory is simply not enough to unpack zImage.
This could happen with initramfs enabled, since the kernel image
packed along with initramfs.cpio could be over 5MB in size.
This patch checks vmlinux image size and links zImage at
the base address that is equal to the unpacked image size
aligned to 4MB boundary. This way zImage base address is 4MB
only if unpacked kernel image size is less then 4MB.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
 arch/powerpc/boot/wrapper      |    6 ++++--
 arch/powerpc/boot/zImage.lds.S |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff -ruN linux-2.6.orig/arch/powerpc/boot/wrapper linux-2.6/arch/powerpc/boot/wrapper
--- linux-2.6.orig/arch/powerpc/boot/wrapper	2007-09-22 00:48:08.000000000 +0400
+++ linux-2.6/arch/powerpc/boot/wrapper	2007-09-22 04:03:40.000000000 +0400
@@ -215,8 +215,10 @@
 fi
 
 if [ "$platform" != "miboot" ]; then
-    ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
-	$platformo $tmp $object/wrapper.a
+    kstart=0x`${CROSS}nm "$kernel" | grep ' _start$' | cut -d' ' -f1`
+    kend=0x`${CROSS}nm "$kernel" | grep ' _end$' | cut -d' ' -f1`
+    ${CROSS}ld -m elf32ppc --defsym _kstart=$kstart --defsym _kend=$kend \
+	-T $lds -o "$ofile" $platformo $tmp $object/wrapper.a
     rm $tmp
 fi
 
diff -ruN linux-2.6.orig/arch/powerpc/boot/zImage.lds.S linux-2.6/arch/powerpc/boot/zImage.lds.S
--- linux-2.6.orig/arch/powerpc/boot/zImage.lds.S	2007-09-22 00:48:08.000000000 +0400
+++ linux-2.6/arch/powerpc/boot/zImage.lds.S	2007-09-22 04:03:58.000000000 +0400
@@ -3,7 +3,7 @@
 EXTERN(_zimage_start)
 SECTIONS
 {
-  . = (4*1024*1024);
+  . = ALIGN((_kend - _kstart), (4*1024*1024));
   _start = .;
   .text      :
   {

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-10-12 21:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 11:36 [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper Valentine Barshak
2007-09-25  2:29 ` David Gibson
2007-09-28 14:23   ` Valentine Barshak
2007-10-03  5:50     ` David Gibson
2007-10-05  1:58       ` Mark A. Greer
2007-10-05  2:25         ` David Gibson
2007-10-05  2:59           ` Mark A. Greer
2007-10-05  3:08             ` Mark A. Greer
2007-10-05 17:30         ` Scott Wood
2007-10-05 21:03           ` Mark A. Greer
2007-10-08  1:31             ` Scott Wood
2007-10-12 21:53               ` Mark A. Greer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).