summaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120/image/lzma-loader/src/Makefile
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-09-06 16:27:37 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-09-06 16:27:37 +0000
commit17c7b6c3fdc48301e50d22cc6138ede16bd1be24 (patch)
treea5d41b991a151e72663527a96fbc6c494565d65c /target/linux/adm5120/image/lzma-loader/src/Makefile
parent5389989abaa52926b22f9f030d1481df1e73d745 (diff)
strip the kernel version suffix from target directories, except for brcm-2.4 (the -2.4 will be included in the board name here). CONFIG_LINUX_<ver>_<board> becomes CONFIG_TARGET_<board>, same for profiles.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8653 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120/image/lzma-loader/src/Makefile')
-rw-r--r--target/linux/adm5120/image/lzma-loader/src/Makefile99
1 files changed, 99 insertions, 0 deletions
diff --git a/target/linux/adm5120/image/lzma-loader/src/Makefile b/target/linux/adm5120/image/lzma-loader/src/Makefile
new file mode 100644
index 000000000..a553b7fde
--- /dev/null
+++ b/target/linux/adm5120/image/lzma-loader/src/Makefile
@@ -0,0 +1,99 @@
+#
+# Makefile for Broadcom BCM947XX boards
+#
+# Copyright 2001-2003, Broadcom Corporation
+# All Rights Reserved.
+#
+# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+#
+# Copyright 2004 Manuel Novoa III <mjn3@codepoet.org>
+# Modified to support bzip'd kernels.
+# Of course, it would be better to integrate bunzip capability into CFE.
+#
+# Copyright 2005 Oleg I. Vdovikin <oleg@cs.msu.su>
+# Cleaned up, modified for lzma support, removed from kernel
+#
+# Copyright 2007 Gabor Juhos <juhosg at openwrt.org>
+# Modified to support user defined entry point address.
+# Added support for make targets with different names
+#
+
+LOADADDR := 0x80001000
+LZMA_TEXT_START := 0x80500000
+LZMA_STARTUP_ORG:= 0
+LOADER_DATA :=
+CONFIG_PASS_KARGS :=
+CONFIG_BOARD :=
+
+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 \
+ -ffreestanding \
+ -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
+CFLAGS += -DLOADADDR=$(LOADADDR)
+
+ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
+
+LDFLAGS = -static --gc-sections -no-warn-mismatch
+LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
+
+O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
+
+OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o
+
+ifneq ($(strip $(LOADER_DATA)),)
+OBJECTS += data.o
+CFLAGS += -DLZMA_WRAPPER=1
+else
+CFLAGS += -D_LZMA_IN_CB
+endif
+
+ifneq ($(strip $(CONFIG_PASS_KARGS)),)
+CFLAGS += -DCONFIG_PASS_KARGS
+endif
+
+BOARD_DEF := $(strip $(CONFIG_BOARD))
+BOARD_DEF := $(shell echo $(BOARD_DEF) | tr a-z A-Z | tr -d -)
+ifneq ($(BOARD_DEF),)
+CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF)
+endif
+
+all: loader.bin
+
+# Don't build dependencies, this may die if $(CC) isn't gcc
+dep:
+
+install:
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.o : %.S
+ $(CC) $(ASFLAGS) -c -o $@ $<
+
+data.o: $(LOADER_DATA)
+ $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
+
+loader.bin: loader.elf
+ $(OBJCOPY) $(BIN_FLAGS) $< $@
+
+loader.elf: $(OBJECTS)
+ $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
+
+mrproper: clean
+
+clean:
+ rm -f *.elf *.bin *.o
+
+
+