summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-04-28 09:57:45 -0700
committerSimon Glass <sjg@chromium.org>2011-08-24 09:56:21 -0700
commit29897caccd59d51e110475edbaa483175f1f363f (patch)
tree85206a6f7c12ddcbc2dcd866947ab53dd2ecb18d
parentfdbcf5a4ff6491f24d17a17636ace3ea6a1b8726 (diff)
Add option to disable code relocation
This permits disabling the code relation in U-Boot which is useful when debugging with an ICE. To use it define CONFIG_SYS_SKIP_ARM_RELOCATION in your board. BUG=chromium-os:13875 TEST=build and boot U-Boot on seaboard with and without the option Change-Id: I8242a80f491e975e16f9990cd17de8f3589c8991 Reviewed-on: http://gerrit.chromium.org/gerrit/193 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/arm/config.mk2
-rw-r--r--arch/arm/cpu/armv7/start.S2
-rw-r--r--arch/arm/lib/board.c5
3 files changed, 8 insertions, 1 deletions
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 788d4c12b7a..cbe4518327a 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -71,5 +71,7 @@ endif
# needed for relocation
ifndef CONFIG_NAND_SPL
+ifndef CONFIG_SYS_SKIP_ARM_RELOCATION
LDFLAGS_u-boot += -pie
endif
+endif
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 27599cc26da..3cc8b946b37 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -183,7 +183,7 @@ stack_setup:
adr r0, _start
#ifndef CONFIG_PRELOADER
- cmp r0, r6
+ subs r9, r6, r0 /* r9 <- relocation offset */
beq clear_bss /* skip relocation */
#endif
mov r1, r6 /* r1 <- scratch for copy_loop */
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 72aab21dd1b..1a9fe7eb5bc 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -359,6 +359,7 @@ void board_init_f (ulong bootflag)
#endif /* CONFIG_FB_ADDR */
#endif /* CONFIG_LCD */
+#ifndef CONFIG_SYS_SKIP_ARM_RELOCATION
/*
* reserve memory for U-Boot code, data & bss
* round down to next 4 kB limit
@@ -367,6 +368,7 @@ void board_init_f (ulong bootflag)
addr &= ~(4096 - 1);
debug ("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
+#endif
#ifndef CONFIG_PRELOADER
/*
@@ -418,6 +420,9 @@ void board_init_f (ulong bootflag)
dram_init_banksize();
display_dram_config(); /* and display it */
+#ifdef CONFIG_SYS_SKIP_ARM_RELOCATION
+ addr = _TEXT_BASE;
+#endif
gd->relocaddr = addr;
gd->start_addr_sp = addr_sp;
gd->reloc_off = addr - _TEXT_BASE;