diff options
author | Suzuki Poulose <suzuki@in.ibm.com> | 2011-12-14 17:59:57 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@gmail.com> | 2011-12-20 10:22:56 -0500 |
commit | c55aef0e5bc61539ad5c915c1400103f1c79942e (patch) | |
tree | 1d866c77c2cbf4234687dde2bbbe1dc7ec3f2b3e /arch/powerpc/boot | |
parent | 5b2e478da032b7d443833402fa586f832397f3be (diff) |
powerpc/boot: Change the load address for the wrapper to fit the kernel
The wrapper code which uncompresses the kernel in case of a 'ppc' boot
is by default loaded at 0x00400000 and the kernel will be uncompressed
to fit the location 0-0x00400000. But with dynamic relocations, the size
of the kernel may exceed 0x00400000(4M). This would cause an overlap
of the uncompressed kernel and the boot wrapper, causing a failure in
boot.
The message looks like :
zImage starting: loaded at 0x00400000 (sp: 0x0065ffb0)
Allocating 0x5ce650 bytes for kernel ...
Insufficient memory for kernel at address 0! (_start=00400000, uncompressed size=00591a20)
This patch shifts the load address of the boot wrapper code to the next
higher MB, according to the size of the uncompressed vmlinux.
With the patch, we get the following message while building the image :
WARN: Uncompressed kernel (size 0x5b0344) overlaps the address of the wrapper(0x400000)
WARN: Fixing the link_address of wrapper to (0x600000)
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
Diffstat (limited to 'arch/powerpc/boot')
-rwxr-xr-x | arch/powerpc/boot/wrapper | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index eb78e437ec1b..3790dcd13640 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -260,6 +260,8 @@ vmz="$tmpdir/`basename \"$kernel\"`.$ext" | |||
260 | if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then | 260 | if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then |
261 | ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" | 261 | ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" |
262 | 262 | ||
263 | strip_size=$(stat -c %s $vmz.$$) | ||
264 | |||
263 | if [ -n "$gzip" ]; then | 265 | if [ -n "$gzip" ]; then |
264 | gzip -n -f -9 "$vmz.$$" | 266 | gzip -n -f -9 "$vmz.$$" |
265 | fi | 267 | fi |
@@ -269,6 +271,24 @@ if [ -z "$cacheit" -o ! -f "$vmz$gzip" -o "$vmz$gzip" -ot "$kernel" ]; then | |||
269 | else | 271 | else |
270 | vmz="$vmz.$$" | 272 | vmz="$vmz.$$" |
271 | fi | 273 | fi |
274 | else | ||
275 | # Calculate the vmlinux.strip size | ||
276 | ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" | ||
277 | strip_size=$(stat -c %s $vmz.$$) | ||
278 | rm -f $vmz.$$ | ||
279 | fi | ||
280 | |||
281 | # Round the size to next higher MB limit | ||
282 | round_size=$(((strip_size + 0xfffff) & 0xfff00000)) | ||
283 | |||
284 | round_size=0x$(printf "%x" $round_size) | ||
285 | link_addr=$(printf "%d" $link_address) | ||
286 | |||
287 | if [ $link_addr -lt $strip_size ]; then | ||
288 | echo "WARN: Uncompressed kernel (size 0x$(printf "%x\n" $strip_size))" \ | ||
289 | "overlaps the address of the wrapper($link_address)" | ||
290 | echo "WARN: Fixing the link_address of wrapper to ($round_size)" | ||
291 | link_address=$round_size | ||
272 | fi | 292 | fi |
273 | 293 | ||
274 | vmz="$vmz$gzip" | 294 | vmz="$vmz$gzip" |