aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2017-10-08 18:31:03 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2018-01-06 00:40:00 +0100
commitddedcb19e52909b9de851bcdad500656069046b5 (patch)
treea4f9e79d63104bcd96a5693d541f4ee96d4e4b82 /target
parentda43069f5bf60dfa302ee6983d2e54f2a6a47174 (diff)
downloadupstream-ddedcb19e52909b9de851bcdad500656069046b5.tar.gz
upstream-ddedcb19e52909b9de851bcdad500656069046b5.tar.bz2
upstream-ddedcb19e52909b9de851bcdad500656069046b5.zip
brcm47xx: relocate the stack in loader
By default we are reusing the stack provided by CFE, like it is intended by CFE. On my WRT54GS it is located at 0x8043BF30, so a big kernel image could overwrite it. Relocate it to a different memory region which is still under the 8MB RAM, but in the higher area. We only need this memory region for the stack of the loader, Linux will set up this for its own. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm47xx/image/lzma-loader/src/Makefile5
-rw-r--r--target/linux/brcm47xx/image/lzma-loader/src/head.S1
2 files changed, 4 insertions, 2 deletions
diff --git a/target/linux/brcm47xx/image/lzma-loader/src/Makefile b/target/linux/brcm47xx/image/lzma-loader/src/Makefile
index 444039c558..a08fc05b9f 100644
--- a/target/linux/brcm47xx/image/lzma-loader/src/Makefile
+++ b/target/linux/brcm47xx/image/lzma-loader/src/Makefile
@@ -19,6 +19,7 @@
TEXT_START := 0x80001000
BZ_TEXT_START := 0x80600000
+BZ_STACK_START := 0x80700000
OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
@@ -28,9 +29,9 @@ CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
CFLAGS += -DLOADADDR=$(TEXT_START) -D_LZMA_IN_CB
-ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_TEXT_START=$(BZ_TEXT_START)
+ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_TEXT_START=$(BZ_TEXT_START) -DBZ_STACK_START=$(BZ_STACK_START)
-SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
+SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/BZ_STACK_START/$(BZ_STACK_START)/;s/TEXT_START/$(TEXT_START)/
OBJECTS := head.o data.o
diff --git a/target/linux/brcm47xx/image/lzma-loader/src/head.S b/target/linux/brcm47xx/image/lzma-loader/src/head.S
index 930c9ba277..50c159ce57 100644
--- a/target/linux/brcm47xx/image/lzma-loader/src/head.S
+++ b/target/linux/brcm47xx/image/lzma-loader/src/head.S
@@ -38,6 +38,7 @@
.text
LEAF(startup)
.set noreorder
+ li sp, BZ_STACK_START
addi sp, -48
sw a0, 16(sp)
sw a1, 20(sp)