e94be307dada0181c055f9bcbb7daf0bd1543a3e
[openwrt/openwrt.git] / target / linux / adm5120-2.6 / image / lzma-loader / src / Makefile
1 #
2 # Makefile for Broadcom BCM947XX boards
3 #
4 # Copyright 2001-2003, Broadcom Corporation
5 # All Rights Reserved.
6 #
7 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 #
12 # Copyright 2004 Manuel Novoa III <mjn3@codepoet.org>
13 # Modified to support bzip'd kernels.
14 # Of course, it would be better to integrate bunzip capability into CFE.
15 #
16 # Copyright 2005 Oleg I. Vdovikin <oleg@cs.msu.su>
17 # Cleaned up, modified for lzma support, removed from kernel
18 #
19 # Copyright 2007 Gabor Juhos <juhosg@freemail.hu>
20 # Modified to support user defined entry point address.
21 # Added support for make targets with different names
22 #
23
24 LOADADDR := 0x80001000
25 BZ_TEXT_START := 0x80300000
26 BZ_STARTUP_ORG := 0
27 LOADER := loader
28
29 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
30
31 CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
32 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
33 -ffunction-sections -pipe -mlong-calls -fno-common \
34 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
35 CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_IN_CB
36
37 ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_STARTUP_ORG=$(BZ_STARTUP_ORG)
38
39 LDFLAGS = -static --gc-sections -no-warn-mismatch
40 LDFLAGS += -e startup -Ttext $(BZ_TEXT_START) -T loader.lds.in
41
42 OBJECTS := $(LOADER)-head.o decompress.o LzmaDecode.o
43
44 all: $(LOADER).gz $(LOADER).elf
45
46 # Don't build dependencies, this may die if $(CC) isn't gcc
47 dep:
48
49 install:
50
51 decompress.o:
52 $(CC) $(CFLAGS) -c decompress.c -o $@
53
54 $(LOADER)-head.o:
55 $(CC) $(ASFLAGS) -c head.S -o $@
56
57 $(LOADER).gz: $(LOADER).bin
58 gzip -nc9 $< > $@
59
60 $(LOADER).elf: $(LOADER).o
61 cp $< $@
62
63 $(LOADER).bin: $(LOADER).o
64 $(OBJCOPY) -O binary $< $@
65
66 $(LOADER).o: $(OBJECTS)
67 $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
68
69 mrproper: clean
70
71 clean:
72 rm -f *.gz *.elf *.bin *.o