summaryrefslogtreecommitdiff
path: root/target/linux/adm5120-2.6/image/lzma-loader/src/Makefile
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-05-30 10:35:27 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-05-30 10:35:27 +0000
commit12603cc0fbbfd50d11d764c2f91c3ae182a20d65 (patch)
treef01887d4e90bb875edb7b4effcbf283c4861090d /target/linux/adm5120-2.6/image/lzma-loader/src/Makefile
parenta0dcd51d4e4e43a29e08674cfacec0ca8117cf3a (diff)
Add board specific code, autodetect the kernel, fixes #1707, thanks Gabor Juhos
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7398 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120-2.6/image/lzma-loader/src/Makefile')
-rw-r--r--target/linux/adm5120-2.6/image/lzma-loader/src/Makefile56
1 files changed, 35 insertions, 21 deletions
diff --git a/target/linux/adm5120-2.6/image/lzma-loader/src/Makefile b/target/linux/adm5120-2.6/image/lzma-loader/src/Makefile
index e94be307da..0f4ffa63a9 100644
--- a/target/linux/adm5120-2.6/image/lzma-loader/src/Makefile
+++ b/target/linux/adm5120-2.6/image/lzma-loader/src/Makefile
@@ -22,51 +22,65 @@
#
LOADADDR := 0x80001000
-BZ_TEXT_START := 0x80300000
-BZ_STARTUP_ORG := 0
-LOADER := loader
+LZMA_TEXT_START := 0x80500000
+LZMA_STARTUP_ORG:= 0
+LOADER_DATA :=
-OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
+CC := $(CROSS_COMPILE)gcc
+LD := $(CROSS_COMPILE)ld
+OBJCOPY := $(CROSS_COMPILE)objcopy
+OBJDUMP := $(CROSS_COMPILE)objdump
+
+BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
-ffunction-sections -pipe -mlong-calls -fno-common \
-mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
-CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_IN_CB
+CFLAGS += -DLOADADDR=$(LOADADDR)
-ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_STARTUP_ORG=$(BZ_STARTUP_ORG)
+ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
LDFLAGS = -static --gc-sections -no-warn-mismatch
-LDFLAGS += -e startup -Ttext $(BZ_TEXT_START) -T loader.lds.in
+LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
+
+O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
-OBJECTS := $(LOADER)-head.o decompress.o LzmaDecode.o
+OBJECTS := head.o decompress.o board.o LzmaDecode.o
-all: $(LOADER).gz $(LOADER).elf
+ifneq ($(strip $(LOADER_DATA)),)
+OBJECTS += data.o
+CFLAGS += -DLZMA_WRAPPER=1
+else
+CFLAGS += -D_LZMA_IN_CB
+endif
+
+all: loader.bin
# Don't build dependencies, this may die if $(CC) isn't gcc
dep:
install:
-decompress.o:
- $(CC) $(CFLAGS) -c decompress.c -o $@
-
-$(LOADER)-head.o:
- $(CC) $(ASFLAGS) -c head.S -o $@
+%.o : %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
-$(LOADER).gz: $(LOADER).bin
- gzip -nc9 $< > $@
+%.o : %.S
+ $(CC) $(ASFLAGS) -c -o $@ $<
-$(LOADER).elf: $(LOADER).o
- cp $< $@
+data.o: $(LOADER_DATA)
+ $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
-$(LOADER).bin: $(LOADER).o
- $(OBJCOPY) -O binary $< $@
+loader.bin: loader.elf
+ $(OBJCOPY) $(BIN_FLAGS) $< $@
-$(LOADER).o: $(OBJECTS)
+loader.elf: $(OBJECTS)
$(LD) $(LDFLAGS) -o $@ $(OBJECTS)
mrproper: clean
clean:
rm -f *.gz *.elf *.bin *.o
+
+
+