ramips: update mips multi-machine stuff
[openwrt.git] / target / linux / adm5120 / 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 at openwrt.org>
20 # Modified to support user defined entry point address.
21 # Added support for make targets with different names
22 #
23
24 LOADADDR := 0x80001000
25 LZMA_TEXT_START := 0x80500000
26 LZMA_STARTUP_ORG:= 0
27 LOADER_DATA :=
28 CONFIG_PASS_KARGS :=
29 CONFIG_BOARD :=
30
31 CC := $(CROSS_COMPILE)gcc
32 LD := $(CROSS_COMPILE)ld
33 OBJCOPY := $(CROSS_COMPILE)objcopy
34 OBJDUMP := $(CROSS_COMPILE)objdump
35
36 BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
37
38 CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
39 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
40 -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding \
41 -fhonour-copts \
42 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
43 CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_PROB32
44
45 ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
46
47 LDFLAGS = -static --gc-sections -no-warn-mismatch
48 LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
49
50 O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
51
52 OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o
53
54 ifneq ($(strip $(LOADER_DATA)),)
55 OBJECTS += data.o
56 CFLAGS += -DLZMA_WRAPPER=1
57 else
58 CFLAGS += -D_LZMA_IN_CB
59 endif
60
61 ifneq ($(strip $(CONFIG_PASS_KARGS)),)
62 CFLAGS += -DCONFIG_PASS_KARGS
63 endif
64
65 BOARD_DEF := $(strip $(CONFIG_BOARD))
66 BOARD_DEF := $(shell echo $(BOARD_DEF) | tr a-z A-Z | tr -d -)
67 ifneq ($(BOARD_DEF),)
68 CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF)
69 endif
70
71 all: loader.bin
72
73 # Don't build dependencies, this may die if $(CC) isn't gcc
74 dep:
75
76 install:
77
78 %.o : %.c
79 $(CC) $(CFLAGS) -c -o $@ $<
80
81 %.o : %.S
82 $(CC) $(ASFLAGS) -c -o $@ $<
83
84 data.o: $(LOADER_DATA)
85 $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
86
87 loader.bin: loader.elf
88 $(OBJCOPY) $(BIN_FLAGS) $< $@
89
90 loader.elf: $(OBJECTS)
91 $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
92
93 mrproper: clean
94
95 clean:
96 rm -f *.elf *.bin *.o
97
98
99
This page took 0.040947 seconds and 5 git commands to generate.