aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/boot/compressed
diff options
context:
space:
mode:
authorEric Miao <eric.miao@canonical.com>2010-07-05 15:56:50 +0200
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-07-12 10:11:50 +0200
commite69edc7939abda1f696c482faa8168d80420f75c (patch)
tree55209745a63b2c3fd4f85827dc1969fdd2a16b7a /arch/arm/boot/compressed
parentdb7b2b4b0e0513627420940d3d62be44a37f0524 (diff)
ARM: Auto calculate ZRELADDR and provide option for exceptions
As long as the zImage is placed within the 128MB range from the start of memory, ZRELADDR (Address where the decompressed kernel will be placed, usually == PHYS_OFFSET + TEXT_OFFSET) can be determined at run-time by masking PC with 0xf80000000. Running through all the Makefile.boot, all those zreladdr-y addresses == 0x[0-f][08]00_0000 + TEXT_OFFSET can be determined at run-time. Option CONFIG_AUTO_ZRELADDR and CONFIG_ZRELADDR are introduced, CONFIG_ZRELADDR _must_ be explicitly specified if: - ((zreladdr-y - TEXT_OFFSET) & ~0xf8000000) != 0, which means masking PC with 0xf8000000 will result in an incorrect address. Currently this is only a problem on u300. - or the assumption of the zImage being loaded by the bootloader within the first 128MB of RAM is incorrect - or when ZBOOT_ROM is used, where the above assumption is usually wrong. [ukleinek: changed mask from 0xf0000000 to 0xf8000000 for mx1 and shark + some review fixes from the mailing list] Original-Idea-and-Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Eric Miao <eric.miao@canonical.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/boot/compressed')
-rw-r--r--arch/arm/boot/compressed/Makefile3
-rw-r--r--arch/arm/boot/compressed/head.S12
2 files changed, 10 insertions, 5 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 2a80c9de6ea..cc8380b879f 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -4,6 +4,7 @@
# create a compressed vmlinuz image from the original vmlinux
#
+AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
HEAD = head.o
OBJS = misc.o decompress.o
FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
@@ -79,8 +80,6 @@ endif
EXTRA_CFLAGS := -fpic -fno-builtin
EXTRA_AFLAGS := -Wa,-march=all
-# Supply ZRELADDR to the decompressor via a linker symbol.
-LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR)
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
endif
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index d27faa13179..abf4d65acf6 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -170,9 +170,16 @@ not_angel:
.text
adr r0, LC0
- ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip, sp})
- THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip} )
+ ARM( ldmia r0, {r1, r2, r3, r5, r6, r11, ip, sp})
+ THUMB( ldmia r0, {r1, r2, r3, r5, r6, r11, ip} )
THUMB( ldr sp, [r0, #32] )
+#ifdef CONFIG_AUTO_ZRELADDR
+ @ determine final kernel image address
+ and r4, pc, #0xf8000000
+ add r4, r4, #TEXT_OFFSET
+#else
+ ldr r4, =CONFIG_ZRELADDR
+#endif
subs r0, r0, r1 @ calculate the delta offset
@ if delta is zero, we are
@@ -310,7 +317,6 @@ wont_overwrite: mov r0, r4
LC0: .word LC0 @ r1
.word __bss_start @ r2
.word _end @ r3
- .word zreladdr @ r4
.word _start @ r5
.word _image_size @ r6
.word _got_start @ r11