2 # Makefile for Broadcom BCM947XX boards
4 # Copyright (C) 2008, 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 # $Id: Makefile,v 1.6 2008/04/03 03:48:38 Exp $
16 # Link at 3 MB offset in RAM
17 TEXT_START ?
= 0x80300000
19 LOADADDR
:= 0x80001000
20 CROSS_COMPILE ?
= mipsel-linux-
22 OBJCOPY
:= $(CROSS_COMPILE
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
23 OBJCOPYSREC
:= $(CROSS_COMPILE
)objcopy
-O srec
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
25 vpath
%.c
$(SRCBASE
)/shared
26 vpath
%.S
$(SRCBASE
)/shared
27 vpath
%.lds.in
$(SRCBASE
)/shared
29 ASFLAGS
+= -D__ASSEMBLY__
-DLOADADDR
=$(LOADADDR
) -march
=mips32
-Wa
,-mips32
-Wa
,--trap
30 CFLAGS
+= -DLOADADDR
=$(LOADADDR
) -march
=mips32
-Wa
,-mips32
-Wa
,--trap
31 # The self-decompresor is standalone, get rid of the linux flags
32 CFLAGS
:= $(subst -Dlinux
,,$(CFLAGS
))
33 CFLAGS
+= -Ulinux
-D_MINOSL_
-ffreestanding
35 CFLAGS
:= $(subst -pg
,,$(CFLAGS
))
37 CFLAGS
+= -ffunction-sections
$(call check_gcc
, -fvtable-gc
, )
39 SYSTEM ?
= $(LINUXDIR
)/vmlinux
40 OBJECTS
:= boot.o sisdram.o sbsdram.o aisdram.o load.o sflash.o \
41 hndmips.o hndchipc.o \
42 sbutils.o aiutils.o siutils.o hndpmu.o nicpci.o \
43 min_osl.o bcmutils.o sromstubs.o nvramstubs.o bcmstdlib.o
45 CFLAGS
+= -G
0 -mno-abicalls
-fno-pic
-pipe
-msoft-float
46 ASFLAGS
+= -G
0 -mno-abicalls
-fno-pic
-pipe
51 ifneq ($(findstring gzip
,$(COMPRESS
)),)
54 ifneq ($(findstring bzip2
,$(COMPRESS
)),)
61 CFLAGS
+= -I
$(SRCBASE
)/include -DBCMDRIVER
62 ASFLAGS
+= -I
$(SRCBASE
)/include
66 # Don't build dependencies, this may die if $(CC) isn't gcc
72 # Link the loader and the kernel binary together
73 vmlinux
: vmlinux.lds
$(OBJECTS
) piggy.o
74 $(LD
) -static
--gc-sections
-no-warn-mismatch
-T vmlinux.lds
-o
$@
$(OBJECTS
) piggy.o
76 vmlinux.lds
: hndrte.lds.in Makefile
77 @sed
-e s
/TEXT_START
/$(TEXT_START
)/ \
78 -e s
/TARGET_ARCH
/mips
/ < $< > $@
80 # Create a linkable version of the (possibly compressed) kernel binary
81 piggy.o
: piggz piggy.lds
82 $(LD
) -no-warn-mismatch
-T piggy.lds
-r
-o
$@
-b binary piggz
-b elf32-tradlittlemips
85 @echo
"SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@
87 # Always create a gzipped version named vmlinuz for compatibility
89 $(MAKE
) -C
$(SRCBASE
)/lzma
/CPP
/7zip
/Compress
/LZMA_Alone
-f makefile.gcc
90 cat piggy |
$(SRCBASE
)/lzma
/CPP
/7zip
/Compress
/LZMA_Alone
/lzma e
-si
-so
-lc1
-lp2
-pb2
> vmlinuz
102 $(Q
)rm -f vmlinux vmlinuz zImage piggz piggy
*.lds
*.o