[RFC PATCH 5/7] powerpc: Consider a non-zero boot address when computing the bootwrapper start
Michal Simek
monstr at monstr.eu
Fri Jun 17 00:14:26 EST 2011
From: John Williams <john.williams at petalogix.com>
There's no fundamental reason the bootwrapper can't boot off a non-zero base,
we just need to make sure we account for it in the link.
Do this by adding the (up-aligned) kernel size to membase, and using that as
the link address.
Signed-off-by: John Williams <john.williams at petalogix.com>
---
arch/powerpc/boot/wrapper | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index e148053..594aa02 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -139,9 +139,16 @@ tmp=$tmpdir/zImage.$$.o
ksection=.kernel:vmlinux.strip
isection=.kernel:initrd
-# default auto-calculate link_address to make room for the kernel
+# physical offset of kernel image
+membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'`
+
+# auto-calculate link_address to make room for the kernel
# round up kernel image size to nearest megabyte
-link_address=`${CROSS}size -x ${kernel} | grep ${kernel} | awk '{printf("0x%08x", and($4 + 0x0fffff, 0xfffe0000))}'`
+
+# don't forget to add membase for non-zero kernel boot
+membase_dec=`printf "%d" $membase`
+
+link_address=`${CROSS}size -x ${kernel} | grep ${kernel} | awk -v membase=$membase_dec '{printf("0x%08x", membase + and($4 + 0x0fffff, 0xfffe0000))}'`
case "$platform" in
pseries)
@@ -259,9 +266,6 @@ if [ -n "$version" ]; then
uboot_version="-n Linux-$version"
fi
-# physical offset of kernel image
-membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'`
-
case "$platform" in
uboot)
rm -f "$ofile"
--
1.5.5.6
More information about the Linuxppc-dev
mailing list