aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-25 16:22:52 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-25 16:22:52 +0000
commit73fba7988564ef93fe5af07e6890f3ea8e197ca4 (patch)
tree56168a482afc1ee5ae0f25ee7cb4bdc6918b9cea
parentfc22669ed039ff4e2fc68931d80a672c614e76e0 (diff)
downloadopenwrt-73fba7988564ef93fe5af07e6890f3ea8e197ca4.tar.gz
openwrt-73fba7988564ef93fe5af07e6890f3ea8e197ca4.zip
AA: ar71xx/image: relink loader.elf image to LOADADDR
Backport of r34271. This allows to load the resulting image directly from RouterBOOT. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@34364 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ar71xx/image/lzma-loader/src/Makefile16
-rw-r--r--target/linux/ar71xx/image/lzma-loader/src/loader2.lds10
2 files changed, 21 insertions, 5 deletions
diff --git a/target/linux/ar71xx/image/lzma-loader/src/Makefile b/target/linux/ar71xx/image/lzma-loader/src/Makefile
index 3e6839c7c..8038b2fba 100644
--- a/target/linux/ar71xx/image/lzma-loader/src/Makefile
+++ b/target/linux/ar71xx/image/lzma-loader/src/Makefile
@@ -68,7 +68,7 @@ ifneq ($(BOARD_DEF),)
CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF)
endif
-all: loader.bin
+all: loader.elf
# Don't build dependencies, this may die if $(CC) isn't gcc
dep:
@@ -84,16 +84,22 @@ install:
data.o: $(LOADER_DATA)
$(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
-loader.bin: loader.elf
+loader: $(OBJECTS)
+ $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
+
+loader.bin: loader
$(OBJCOPY) $(BIN_FLAGS) $< $@
-loader.elf: $(OBJECTS)
- $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
+loader2.o: loader.bin
+ $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
+
+loader.elf: loader2.o
+ $(LD) -e startup -T loader2.lds -Ttext $(LOADADDR) -o $@ $<
mrproper: clean
clean:
- rm -f *.elf *.bin *.o
+ rm -f loader *.elf *.bin *.o
diff --git a/target/linux/ar71xx/image/lzma-loader/src/loader2.lds b/target/linux/ar71xx/image/lzma-loader/src/loader2.lds
new file mode 100644
index 000000000..db0bb4642
--- /dev/null
+++ b/target/linux/ar71xx/image/lzma-loader/src/loader2.lds
@@ -0,0 +1,10 @@
+OUTPUT_ARCH(mips)
+SECTIONS {
+ .text : {
+ startup = .;
+ *(.text)
+ *(.text.*)
+ *(.data)
+ *(.data.*)
+ }
+}