2 # Makefile for compressed self-booting CFE on Broadcom BCM947XX boards
4 # Copyright (C) 2012, Broadcom Corporation
7 # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 # the contents of this file may not be disclosed to third parties, copied
9 # or duplicated in any form, in whole or in part, without the prior
10 # written permission of Broadcom Corporation.
12 # $Id: Makefile 367718 2012-11-09 03:57:10Z $
15 CROSS_COMPILE
:= $(TOOLPREFIX
)
18 LOADADDR
:= $(CFG_TEXT_START
)
20 # The self-decompresor uses the minimal OSL, get rid of _CFE_ and vxworks
21 CFLAGS
:= $(subst -D_CFE_
,,$(CFLAGS
)) -fdata-sections
22 CFLAGS
+= -D_CFEZ_
-D_MINOSL_
-DBCMBUSTYPE
=SI_BUS
-Uvxworks
-U__vxworks
29 OBJCOPY
:= $(CROSS_COMPILE
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
30 OBJCOPYSREC
:= $(CROSS_COMPILE
)objcopy
-O srec
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
34 vpath
%.c
$(SRCBASE
)/shared
$(SRCBASE
)/cfe
/cfe
/arch
/arm
/board
/bcm947xx
/src
35 vpath
%.S
$(SRCBASE
)/shared
36 vpath
%.lds.in
$(SRCBASE
)/shared
$(SRCBASE
)/tools
/misc
/lzma_src
/C
38 CFLAGS
+= -DLOADADDR
=$(LOADADDR
)
39 CFLAGS
+= -ffunction-sections
$(call check_gcc
, -fvtable-gc
, )
41 # Note: siutils.o appeared seperately on purpose to solve post reference problem of GCC
42 OBJS-mips
= boot.o sisdram.o siutils.o hndmips.o hndpmu.o
43 OBJS-arm
= bootarm.o aisdram_ca9.o siutils.o hndarm_ca9.o \
44 pcieinit_ca9.o aiutils.o
46 ifeq ($(strip $(CFG_SHMOO
)), 1)
47 OBJS-arm
+= aisdram-ca9.o hndsoc.o \
48 ddr40_phy_init.o platform.o shmoo_DDR3.o tinymt32.o
51 OBJECTS
:= $(OBJS-
$(ARCH
))
52 OBJECTS
+= load.o hndchipc.o min_osl.o bcmutils.o \
53 bcmstdlib.o sromstubs.o nvramstubs.o
56 ELF32_LITTLE
:= elf32-littlearm
57 ELF32_BIG
:= elf32-bigarm
58 CFLAGS
+= -DBCMCHIPTYPE
=3
59 ifeq ($(strip $(CFG_SHMOO
)), 1)
60 TEXT_START
:= 0xc0000000
61 CFLAGS
+= -DCFG_SHMOO
=1
62 CFEZ_LDS_IN
:= cfez_arm_shmoo.lds.in
64 TEXT_START
:= 0x00001000
65 CFEZ_LDS_IN
:= cfez_arm.lds.in
68 CFEZ_LDS_IN
:= hndrte.lds.in
69 ELF32_LITTLE
:= elf32-tradlittlemips
70 ELF32_BIG
:= elf32-bigmips
72 ifeq ($(strip $(CFG_MINIMAL_SIZE
)), 1)
73 ifeq ($(strip $(CFG_GMAC
)), 0)
74 CFLAGS
+= -DBCMCHIPTYPE
=0
75 OBJECTS
+= sbsdram.o sbutils.o
77 CFLAGS
+= -DBCMCHIPTYPE
=1
78 OBJECTS
+= aisdram.o aiutils.o
81 OBJECTS
+= aisdram.o aiutils.o sbsdram.o sbutils.o
84 # Link at 3 MB offset in RAM
85 TEXT_START
:= 0x80001000
88 ifeq ($(strip $(CFG_NFLASH
)), 1)
95 ifneq ($(findstring lzma_4k
,$(COMPRESS
)),)
96 CFLAGS
+= -DUSE_LZMA
-DBCMLZMA
103 # Don't build dependencies, this may die if $(CC) isn't gcc
108 $(OBJCOPYSREC
) $< cfez.srec
110 ..
/..
/..
/..
/..
/ctools
/nvserial
-i cfez.bin
-o cfe_rt-ac68u.bin
-s
00 rt-ac68u_nvram.txt
111 cp cfe_rt-ac68u.bin ..
/..
/..
/..
113 ifeq ($(RTN18UHP
), 1)
114 ..
/..
/..
/..
/..
/ctools
/nvserial
-i cfez.bin
-o cfe_rt-n18uhp.bin
-s
00 rt-n18uhp_nvram.txt
115 cp cfe_rt-n18uhp.bin ..
/..
/..
/..
117 ..
/..
/..
/..
/..
/ctools
/nvserial
-i cfez.bin
-o cfe_rt-ac56u.bin
-s
00 rt-ac56u_nvram.txt
118 cp cfe_rt-ac56u.bin ..
/..
/..
/..
122 @if
[ "$(CFEZ_MAXSIZE)" != "" ]; then \
123 if
[ "`wc -c < cfe_rt-ac68u.bin`" -gt
"$(CFEZ_MAXSIZE)" ]; then \
124 echo
"*** ERROR *** : cfe_rt-ac68u.bin bootrom image size: `wc -c < cfe_rt-ac68u.bin` exceeds limit: $(CFEZ_MAXSIZE)"; \
128 ifeq ($(RTN18UHP
), 1)
129 @if
[ "$(CFEZ_MAXSIZE)" != "" ]; then \
130 if
[ "`wc -c < cfe_rt-n18uhp.bin`" -gt
"$(CFEZ_MAXSIZE)" ]; then \
131 echo
"*** ERROR *** : cfe_rt-n18uhp.bin bootrom image size: `wc -c < cfe_rt-n18uhp.bin` exceeds limit: $(CFEZ_MAXSIZE)"; \
135 @if
[ "$(CFEZ_MAXSIZE)" != "" ]; then \
136 if
[ "`wc -c < cfe_rt-ac56u.bin`" -gt
"$(CFEZ_MAXSIZE)" ]; then \
137 echo
"*** ERROR *** : cfe_rt-ac56u.bin bootrom image size: `wc -c < cfe_rt-ac56u.bin` exceeds limit: $(CFEZ_MAXSIZE)"; \
143 # Link the loader and the kernel binary together
144 cfez
: cfez.lds
$(OBJECTS
) piggy.o
145 $(LD
) -static
-Map cfez.map
--gc-sections
-no-warn-mismatch
-T cfez.lds
-o
$@
$(OBJECTS
) $(LDLIBS
) piggy.o
147 cfez.lds
: $(CFEZ_LDS_IN
) Makefile
148 sed
-e s
/TEXT_START
/$(TEXT_START
)/ \
149 -e s
/TARGET_ARCH
/$(ARCH
)/ < $< > $@
151 # Create a linkable version of the (possibly compressed) kernel binary
152 piggy.o
: piggz piggy.lds
154 ifeq ($(CFG_LITTLE
), 1)
155 $(LD
) -no-warn-mismatch
-T piggy.lds
-r
-o
$@
-b binary piggz
-b
$(ELF32_LITTLE
)
157 $(LD
) -no-warn-mismatch
-T piggy.lds
-r
-o
$@
-b binary piggz
-b
$(ELF32_BIG
)
161 @echo
"SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@
164 ifneq ($(findstring lzma_4k
,$(COMPRESS
)),)
176 rm -f cfez cfez.bin cfez.srec piggz piggy
*.lds
*.o
*.map
179 $(GCC
) $(ASFLAGS
) $(CFLAGS
) -o
$@
$<