2 # Makefile for Broadcom BCM947XX boards
4 # Copyright 2001-2003, Broadcom Corporation
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.
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.
16 # Copyright 2005 Oleg I. Vdovikin <oleg@cs.msu.su>
17 # Cleaned up, modified for lzma support, removed from kernel
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
24 LOADADDR := 0x80001000
25 LZMA_TEXT_START := 0x80500000
29 CC := $(CROSS_COMPILE)gcc
30 LD := $(CROSS_COMPILE)ld
31 OBJCOPY := $(CROSS_COMPILE)objcopy
32 OBJDUMP := $(CROSS_COMPILE)objdump
34 BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
36 CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
37 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
38 -ffunction-sections -pipe -mlong-calls -fno-common \
39 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
40 CFLAGS += -DLOADADDR=$(LOADADDR)
42 ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
44 LDFLAGS = -static --gc-sections -no-warn-mismatch
45 LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
47 O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
49 OBJECTS := head.o decompress.o board.o LzmaDecode.o
51 ifneq ($(strip $(LOADER_DATA)),)
53 CFLAGS += -DLZMA_WRAPPER=1
55 CFLAGS += -D_LZMA_IN_CB
60 # Don't build dependencies, this may die if $(CC) isn't gcc
66 $(CC) $(CFLAGS) -c -o $@ $<
69 $(CC) $(ASFLAGS) -c -o $@ $<
71 data.o: $(LOADER_DATA)
72 $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
74 loader.bin: loader.elf
75 $(OBJCOPY) $(BIN_FLAGS) $< $@
77 loader.elf: $(OBJECTS)
78 $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
83 rm -f *.gz *.elf *.bin *.o