2007-03-19 17:34:37 +00:00
|
|
|
#
|
|
|
|
# Makefile for Broadcom BCM947XX boards
|
|
|
|
#
|
|
|
|
# Copyright 2001-2003, Broadcom Corporation
|
|
|
|
# All Rights Reserved.
|
2007-04-02 17:14:23 +00:00
|
|
|
#
|
2007-03-19 17:34:37 +00:00
|
|
|
# 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
|
|
|
|
#
|
2007-08-29 17:27:11 +00:00
|
|
|
# Copyright 2007 Gabor Juhos <juhosg at openwrt.org>
|
2007-04-02 17:14:23 +00:00
|
|
|
# Modified to support user defined entry point address.
|
|
|
|
# Added support for make targets with different names
|
|
|
|
#
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-04-02 17:14:23 +00:00
|
|
|
LOADADDR := 0x80001000
|
2007-05-30 10:35:27 +00:00
|
|
|
LZMA_TEXT_START := 0x80500000
|
|
|
|
LZMA_STARTUP_ORG:= 0
|
|
|
|
LOADER_DATA :=
|
2007-06-25 08:47:10 +00:00
|
|
|
CONFIG_PASS_KARGS :=
|
|
|
|
CONFIG_BOARD :=
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
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
|
2007-03-19 17:34:37 +00:00
|
|
|
|
|
|
|
CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
|
|
|
|
-fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
|
2008-01-30 08:23:36 +00:00
|
|
|
-ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding \
|
|
|
|
-fhonour-copts \
|
2007-03-19 17:34:37 +00:00
|
|
|
-mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
|
2007-12-14 20:35:22 +00:00
|
|
|
CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_PROB32
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-04-02 17:14:23 +00:00
|
|
|
LDFLAGS = -static --gc-sections -no-warn-mismatch
|
2007-05-30 10:35:27 +00:00
|
|
|
LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
|
|
|
|
|
|
|
|
O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-07-15 15:02:38 +00:00
|
|
|
OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
ifneq ($(strip $(LOADER_DATA)),)
|
|
|
|
OBJECTS += data.o
|
|
|
|
CFLAGS += -DLZMA_WRAPPER=1
|
|
|
|
else
|
|
|
|
CFLAGS += -D_LZMA_IN_CB
|
|
|
|
endif
|
|
|
|
|
2007-06-25 08:47:10 +00:00
|
|
|
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
|
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
all: loader.bin
|
2007-03-19 17:34:37 +00:00
|
|
|
|
|
|
|
# Don't build dependencies, this may die if $(CC) isn't gcc
|
|
|
|
dep:
|
|
|
|
|
|
|
|
install:
|
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
%.o : %.S
|
|
|
|
$(CC) $(ASFLAGS) -c -o $@ $<
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
data.o: $(LOADER_DATA)
|
|
|
|
$(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
loader.bin: loader.elf
|
|
|
|
$(OBJCOPY) $(BIN_FLAGS) $< $@
|
2007-03-19 17:34:37 +00:00
|
|
|
|
2007-05-30 10:35:27 +00:00
|
|
|
loader.elf: $(OBJECTS)
|
2007-04-02 17:14:23 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $(OBJECTS)
|
2007-03-19 17:34:37 +00:00
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
|
|
|
|
clean:
|
2007-06-25 08:47:10 +00:00
|
|
|
rm -f *.elf *.bin *.o
|
2007-05-30 10:35:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|