GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / build / broadcom / bcm947xx / compressed / Makefile
blob6d6f71d06642154ad812b1b1e1910a0ef57c9618
2 # Makefile for compressed self-booting CFE on Broadcom BCM947XX boards
4 # Copyright (C) 2012, Broadcom Corporation
5 # All Rights Reserved.
6 #
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)
16 CC := $(GCC)
17 LD := $(GLD)
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
24 # Default mips
25 ifeq ($(ARCH),)
26 ARCH := mips
27 endif
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
32 SYSTEM := ../cfe
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
49 endif
51 OBJECTS := $(OBJS-$(ARCH))
52 OBJECTS += load.o hndchipc.o min_osl.o bcmutils.o \
53 bcmstdlib.o sromstubs.o nvramstubs.o
55 ifeq ($(ARCH), arm)
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
63 else
64 TEXT_START := 0x00001000
65 CFEZ_LDS_IN := cfez_arm.lds.in
66 endif
67 else
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
76 else
77 CFLAGS += -DBCMCHIPTYPE=1
78 OBJECTS += aisdram.o aiutils.o
79 endif
80 else
81 OBJECTS += aisdram.o aiutils.o sbsdram.o sbutils.o
82 endif
84 # Link at 3 MB offset in RAM
85 TEXT_START := 0x80001000
86 endif
88 ifeq ($(strip $(CFG_NFLASH)), 1)
89 OBJECTS += nflash.o
90 endif
92 # Default to lzma_4k
93 COMPRESS := lzma_4k e
95 ifneq ($(findstring lzma_4k,$(COMPRESS)),)
96 CFLAGS += -DUSE_LZMA -DBCMLZMA
97 else
98 COMPRESS := cat
99 endif
101 all: cfez.bin
103 # Don't build dependencies, this may die if $(CC) isn't gcc
104 dep:
106 cfez.bin: cfez
107 $(OBJCOPY) $< $@
108 $(OBJCOPYSREC) $< cfez.srec
109 ifeq ($(RTAC68U), 1)
110 ../../../../../ctools/nvserial -i cfez.bin -o cfe_rt-ac68u.bin -s 00 rt-ac68u_nvram.txt
111 cp cfe_rt-ac68u.bin ../../../..
112 else
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 ../../../..
116 else
117 ../../../../../ctools/nvserial -i cfez.bin -o cfe_rt-ac56u.bin -s 00 rt-ac56u_nvram.txt
118 cp cfe_rt-ac56u.bin ../../../..
119 endif
120 endif
121 ifeq ($(RTAC68U), 1)
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)"; \
125 fi ; \
127 else
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)"; \
132 fi ; \
134 else
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)"; \
138 fi ; \
140 endif
141 endif
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)
156 else
157 $(LD) -no-warn-mismatch -T piggy.lds -r -o $@ -b binary piggz -b $(ELF32_BIG)
158 endif
160 piggy.lds:
161 @echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@
163 piggz: piggy
164 ifneq ($(findstring lzma_4k,$(COMPRESS)),)
165 $(COMPRESS) $< $@
166 else
167 $(COMPRESS) $< > $@
168 endif
170 piggy: $(SYSTEM)
171 $(OBJCOPY) $< $@
173 mrproper: clean
175 clean:
176 rm -f cfez cfez.bin cfez.srec piggz piggy *.lds *.o *.map
178 %.o : %.S
179 $(GCC) $(ASFLAGS) $(CFLAGS) -o $@ $<