Merge branch 'Toastman-RT' into Toastman-RT-N
[tomato/davidwu.git] / release / src / Makefile
blobb77d3e617d3cb22368da0e9c7d7731f897ab6b3f
3 # Toplevel Makefile for the BCM947xx Linux Router release
5 # Copyright 2005, Broadcom Corporation
6 # All Rights Reserved.
8 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
13 # $Id: Makefile,v 1.53 2005/04/25 03:54:37 tallest Exp $
16 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
18 # To rebuild everything and all configurations:
19 # make distclean
20 # make V1=whatever V2=sub-whatever VPN=vpn3.6 a b c d m
21 # The 1st "whatever" would be the build number, the sub-whatever would
22 # be the update to the version.
24 # Example:
25 # make V1=8516 V2="-jffs.1" a b c d m s
27 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 export SRCBASE := $(shell pwd)
32 RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
33 PATH := $(RELEASEDIR)/tools:$(PATH)
34 export TPROFILE := N
36 include ./target.mak
38 # Normally you'd do something like "make V1=8516 V2=-sub-ver a b c d"
39 # But if you don't give anything for "V1", it'll get a default from tomato_version.
40 current_TOMATO_V1 ?= "--def"
41 VPN ?= "VPN"
42 NC ?="NOCAT"
43 ifeq ($(CONFIG_LINUX26),y)
44 ND = "K26"
45 else
46 ND = "ND"
47 endif
48 SNMP ?= "n"
49 VLAN ?= "n"
50 USERPPTP ?= "n"
51 PPTPD ?= "n"
52 TCPDUMP ?= "n"
54 ifeq ($(NVRAM_SIZE),)
55 NVRAM_SIZE = 0
56 endif
58 ifeq ($(VLAN),y)
59 EXTRA_PREDESC = 'VLAN-'
60 else
61 EXTRA_PREDESC = ''
62 endif
64 ifeq ($(NVRAM_64K),y)
65 EXTRA_POSTDESC = ' -64K'
66 EXTRA_64KCFLAG = '-DTCONFIG_NVRAM_64K'
67 else
68 EXTRA_POSTDESC = ''
69 EXTRA_64KCFLAG = ''
70 endif
72 ifeq ($(WNR3500LV2),)
73 WNR3500LV2 = 0
74 else
75 WNRTOOL=$(SRCBASE)/wnrtool
76 BOARD_FILE=$(WNRTOOL)/compatible_WNR3500Lv2.txt
77 fw_cfg_file := $(WNRTOOL)/ambitCfg.h
78 endif
80 -include tomato_profile.mak
82 # This could be simpler by just using $(TOMATO_PROFILE_NAME) like it used to be,
83 # but that's fragile. If you make one certain innocuous change elsewhere in the
84 # makefile(s), the build will silently be wrong. This way it works properly every time.
85 current_BUILD_NAME = $(strip $(shell grep "^TOMATO_BUILD_NAME" tomato_profile.mak | cut -d"=" -f2))
86 current_BUILD_DESC = $(strip $(shell grep "^TOMATO_BUILD_DESC" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g"))
87 current_BUILD_USB = $(strip $(shell grep "^TOMATO_BUILD_USB" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g"))
88 current_TOMATO_VER = $(strip $(shell grep "TOMATO_MAJOR" router/shared/tomato_version.h | cut -d"\"" -f2)).$(strip $(shell grep "TOMATO_MINOR" router/shared/tomato_version.h | cut -d"\"" -f2))
89 current_TOMATO_MIPS32 = $(strip $(shell grep "^TOMATO_BUILD_MIPS32" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g" | sed -e "s/\"//g" ))
90 current_TOMATO_V1 = $(strip $(shell grep "^TOMATO_BUILD_V1" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g" | sed -e "s/\"//g" ))
91 current_TOMATO_V2 = $(strip $(shell grep "^TOMATO_BUILD_V2" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g" | sed -e "s/\"//g" ))
92 current_TOMATO_B = $(strip $(shell grep "^TOMATO_BUILD_NAME" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g" | sed -e "s/\"//g" ))
93 current_TOMATO_N = $(strip $(shell grep "^TOMATO_PROFILE_NAME" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g" | sed -e "s/\"//g" ))
94 N=$(current_TOMATO_N)
95 B=$(current_TOMATO_B)
97 uppercase_N = $(shell echo $(N) | tr a-z A-Z)
98 lowercase_N = $(shell echo $(N) | tr A-Z a-z)
99 uppercase_B = $(shell echo $(B) | tr a-z A-Z)
100 lowercase_B = $(shell echo $(B) | tr A-Z a-z)
102 ifeq ($(CONFIG_LINUX26),y)
103 mips_rev = $(if $(filter $(current_TOMATO_MIPS32),r2),MIPSR2,MIPSR1)
105 KERN_SIZE_OPT ?= n
106 else
107 mips_rev =
108 KERN_SIZE_OPT ?= y
109 endif
111 beta = $(if $(filter $(TOMATO_EXPERIMENTAL),1),-beta,)
113 tomato_ver:
114 @echo ""
115 @btools/uversion.pl --gen $(current_TOMATO_V1) $(mips_rev)$(beta)$(current_TOMATO_V2) $(ND) $(current_BUILD_USB) $(current_BUILD_DESC)
117 ifeq ($(TOMATO_BUILD),)
119 all:
120 $(MAKE) a
122 else
124 all: tomato_ver
125 @echo ""
126 @echo "Building Tomato $(ND) $(current_BUILD_USB) $(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2) $(current_BUILD_DESC) $(current_BUILD_NAME) with $(TOMATO_PROFILE_NAME) Profile"
128 @echo ""
129 @echo ""
131 @-mkdir image
132 @$(MAKE) -C router all
133 @$(MAKE) -C router install
134 @$(MAKE) -C btools
136 @rm -f image/tomato-$(ND)$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).trx
137 @rm -f image/tomato-$(ND)$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
139 ifeq ($(WNR3500LV2),y)
140 @echo "Creating Firmware for Netgear WNR3500L v2 .... "
141 mipsel-uclibc-objcopy -O binary -g $(LINUXDIR)/vmlinux image/vmlinux.bin
142 $(WNRTOOL)/lzma e image/vmlinux.bin image/vmlinux.lzma
143 $(WNRTOOL)/trx -o image/tomato-wnr3500lv2.trx image/vmlinux.lzma $(SRCBASE)/router/mipsel-uclibc/target.image
144 rm -f image/vmlinux.bin image/vmlinux.lzma
145 cd image && touch rootfs
146 cd image && $(WNRTOOL)/packet -k tomato-wnr3500lv2.trx -f rootfs -b $(BOARD_FILE) -ok kernel_image -oall kernel_rootfs_image -or rootfs_image -i $(fw_cfg_file) && rm -f rootfs && \
147 cp kernel_rootfs_image.chk tomato-Netgear-3500Lv2-$(ND)$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(current_TOMATO_V2)-$(current_BUILD_DESC).chk
148 @echo "Cleanup ...."
149 rm -f image/*image.chk image/*.trx
150 endif
152 ifeq ($(WRT54),y)
153 ifneq ($(current_TOMATO_MIPS32),r2)
154 @rm -f image/tomato-WRT54*$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
155 @rm -f image/tomato-WRTSL54*$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
156 @rm -f image/tomato-WR850G$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
157 endif
158 endif
159 ifeq ($(LINKSYS_E),y)
160 @rm -f image/tomato-E??????$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin
161 endif
162 ifeq ($(LINKSYS_E_64k),y)
163 @rm -f image/tomato-E??????$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin
164 endif
165 ifeq ($(LINKSYS_E1200v1),y)
166 @rm -f image/tomato-E1200v1$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin
167 endif
168 ifeq ($(LINKSYS_E1000v2),y)
169 @rm -f image/tomato-E1000v2-v21$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin
170 @rm -f image/tomato-Cisco-M10v2$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin
171 endif
172 ifeq ($(BELKIN),y)
173 ifneq ($(NVRAM_SIZE),60)
174 @rm -f image/tomato-F7D????$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
175 @rm -f image/tomato-F5D8235v3$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin
176 endif
177 endif
178 @echo "" >>fpkg.log
179 @echo "***********************" `date` "************************" >>fpkg.log
180 @cat router/shared/tomato_version >>fpkg.log
181 @echo "" >>fpkg.log
182 @cat router/target.info >>fpkg.log
183 ifeq ($(WRT54),y)
184 ifneq ($(current_TOMATO_MIPS32),r2)
185 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
186 -l W54G,image/tomato-WRT54G_WRT54GL$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
187 -l W54S,image/tomato-WRT54GS$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
188 -l W54s,image/tomato-WRT54GSv4$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
189 -l W54U,image/tomato-WRTSL54GS$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
190 -m 0x10577050,image/tomato-WR850G$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
191 | tee -a fpkg.log
192 endif
193 endif
194 ifeq ($(LINKSYS_E),y)
195 # Linksys E-series(60k Nvram) images
196 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
197 -l 1550,image/tomato-E1550$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
198 -l E25X,image/tomato-E2500$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
199 -l 3200,image/tomato-E3200$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
200 -l 4200,image/tomato-E4200$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
201 -l 61XN,image/tomato-E3000$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
202 -l 32XN,image/tomato-E2000$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
203 | tee -a fpkg.log
204 endif
205 ifeq ($(LINKSYS_E_64),y)
206 # Linksys E-series(64k Nvram) images
207 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
208 -l E900,image/tomato-E900$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
209 -l E122,image/tomato-E1200v2$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
210 -l E150,image/tomato-E1500$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
211 | tee -a fpkg.log
212 endif
213 ifeq ($(LINKSYS_E1000v2),y)
214 # Linksys E1000v2/v2.1 images
215 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
216 -l E100,image/tomato-E1000v2-v21$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
217 -l M010,image/tomato-Cisco-M10v2$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
218 | tee -a fpkg.log
219 endif
220 ifeq ($(LINKSYS_E1200v1),y)
221 # Linksys E1200v1 images
222 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
223 -l E120,image/tomato-E1200v1$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2)-$(current_BUILD_DESC).bin \
224 | tee -a fpkg.log
225 endif
226 ifeq ($(BELKIN),y)
227 ifneq ($(NVRAM_SIZE),60)
228 # Create Belkin images
229 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
230 -b 0x20100322,image/tomato-F7D3301$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
231 -b 0x20090928,image/tomato-F7D3302$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
232 -b 0x20091006,image/tomato-F7D4302$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
233 -b 0x00017116,image/tomato-F5D8235v3$(current_BUILD_USB)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).bin \
234 | tee -a fpkg.log
235 endif
236 endif
237 # Create generic TRX image
238 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
239 -t image/tomato-$(ND)$(current_BUILD_USB)$(if $(filter $(NVRAM_SIZE),0),,-NVRAM$(NVRAM_SIZE)K)-$(current_TOMATO_VER).$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2)-$(current_BUILD_DESC).trx \
240 | tee -a fpkg.log
242 @cp fpkg.log image/fpkg-$(current_TOMATO_V1)$(mips_rev)$(beta)$(current_TOMATO_V2).log
243 @echo ""
244 @echo "-----------------"
245 @echo `cat router/shared/tomato_version` " ready"
246 @echo "-----------------"
247 ifneq ($(NOVERSION),1)
248 @cp router/shared/tomato_version router/shared/tomato_version_last
249 @btools/uversion.pl --bump
250 endif
251 endif
255 clean:
256 @touch router/.config
257 @rm -f router/config_[a-z]
258 @rm -f router/busybox/config_[a-z]
259 @$(MAKE) -C router $@
260 @-rmdir router/mipsel-uclibc
262 cleanimage:
263 @rm -f fpkg.log
264 @rm -fr image/*
265 @rm -f router/.config
266 @touch router/.config
267 @-mkdir image
269 cleantools:
270 @$(MAKE) -C $(LINUXDIR)/scripts/squashfs clean
271 @$(MAKE) -C btools clean
273 cleankernel:
274 @cd $(LINUXDIR) && \
275 mv .config save-config && \
276 $(MAKE) distclean || true; \
277 cp -p save-config .config || true
279 kernel:
280 @$(MAKE) -C router kernel
281 @ls -l $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/zImage
283 distclean: clean cleanimage cleankernel cleantools
284 ifneq ($(INSIDE_MAK),1)
285 @$(MAKE) -C router $@ INSIDE_MAK=1
286 endif
287 mv router/busybox/.config busybox-saved-config || true
288 @$(MAKE) -C router/busybox distclean
289 @rm -f router/busybox/config_current
290 @cp -p busybox-saved-config router/busybox/.config || true
291 @cp -p router/busybox/.config router/busybox/config_current || true
292 @rm -f router/config_current
293 @rm -f router/.config.cmd router/.config.old router/.config
294 @rm -f router/libfoo_xref.txt
295 @rm -f tomato_profile.mak router/shared/tomato_profile.h
296 @touch tomato_profile.mak
297 @touch router/shared/tomato_profile.h
300 prepk:
301 @cd $(LINUXDIR) ; \
302 rm -f config_current ; \
303 ln -s config_base config_current ; \
304 cp -f config_current .config
305 $(MAKE) -C $(LINUXDIR) oldconfig
306 ifneq ($(CONFIG_LINUX26),y)
307 $(MAKE) -C $(LINUXDIR) dep
308 endif
310 what:
311 @echo ""
312 @echo "$(current_BUILD_DESC)-$(current_BUILD_NAME)-$(TOMATO_PROFILE_NAME) Profile"
313 @echo ""
316 # The methodology for making the different builds is to
317 # copy the "base" config file to the "target" config file in
318 # the appropriate directory, and then edit it by removing and
319 # inserting the desired configuration lines.
320 # You can't just delete the "whatever=y" line, you must have
321 # a "...is not set" line, or the make oldconfig will stop and ask
322 # what to do.
324 # Options for "make bin" :
325 # BUILD_DESC (Std|Lite|Ext|...)
326 # MIPS32 (r2|r1)
327 # WNR3500LV2 (0|1)
328 # KERN_SIZE_OPT
329 # USB ("USB"|"")
330 # JFFSv1 | NO_JFFS
331 # NO_CIFS, NO_SSH, NO_ZEBRA, NO_SAMBA, NO_HTTPS, NO_XXTP, NO_LIBOPT, NO_FTP
332 # SAMBA3, OPENVPN, IPV6SUPP, EBTABLES, NTFS, MEDIASRV, BBEXTRAS, USBEXTRAS, BCM57, SLIM
333 # NOCAT
334 # SNMP
335 # HFS
336 # USERPPTP
337 # VLAN
339 define RouterOptions
340 @( \
341 if [ "$(CONFIG_LINUX26)" = "y" ] || [ "$(SAMBA3)" = "y" ]; then \
342 sed -i "/TCONFIG_SAMBA3/d" $(1); \
343 echo "TCONFIG_SAMBA3=y" >>$(1); \
344 fi; \
345 sed -i "/TCONFIG_EMF/d" $(1); \
346 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
347 if [ "$(SLIM)" = "y" ]; then \
348 echo "# TCONFIG_EMF is not set" >>$(1); \
349 else \
350 echo "TCONFIG_EMF=y" >>$(1); \
351 fi; \
352 else \
353 echo "# TCONFIG_EMF is not set" >>$(1); \
354 fi; \
355 sed -i "/TCONFIG_JFFSV1/d" $(1); \
356 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
357 if [ "$(JFFSv1)" = "y" ]; then \
358 echo "TCONFIG_JFFSV1=y" >>$(1); \
359 else \
360 echo "# TCONFIG_JFFSV1 is not set" >>$(1); \
361 fi; \
362 else \
363 echo "TCONFIG_JFFSV1=y" >>$(1); \
364 fi; \
365 if [ "$(USB)" = "USB" ]; then \
366 sed -i "/TCONFIG_USB is not set/d" $(1); \
367 echo "TCONFIG_USB=y" >>$(1); \
368 if [ "$(USBEXTRAS)" = "y" ]; then \
369 sed -i "/TCONFIG_USB_EXTRAS/d" $(1); \
370 echo "TCONFIG_USB_EXTRAS=y" >>$(1); \
371 fi; \
372 if [ "$(NTFS)" = "y" ]; then \
373 sed -i "/TCONFIG_NTFS/d" $(1); \
374 echo "TCONFIG_NTFS=y" >>$(1); \
375 fi; \
376 if [ "$(MEDIASRV)" = "y" ]; then \
377 sed -i "/TCONFIG_MEDIA_SERVER/d" $(1); \
378 echo "TCONFIG_MEDIA_SERVER=y" >>$(1); \
379 fi; \
380 else \
381 sed -i "/TCONFIG_USB=y/d" $(1); \
382 echo "# TCONFIG_USB is not set" >>$(1); \
383 fi; \
384 if [ "$(NO_SAMBA)" = "y" ]; then \
385 sed -i "/TCONFIG_SAMBASRV/d" $(1); \
386 echo "# TCONFIG_SAMBASRV is not set" >>$(1); \
387 fi; \
388 if [ "$(NO_ZEBRA)" = "y" ]; then \
389 sed -i "/TCONFIG_ZEBRA/d" $(1); \
390 echo "# TCONFIG_ZEBRA is not set" >>$(1); \
391 fi; \
392 if [ "$(NO_JFFS)" = "y" ]; then \
393 sed -i "/TCONFIG_JFFS2/d" $(1); \
394 echo "# TCONFIG_JFFS2 is not set" >>$(1); \
395 sed -i "/TCONFIG_JFFSV1/d" $(1); \
396 echo "# TCONFIG_JFFSV1 is not set" >>$(1); \
397 fi; \
398 if [ "$(NO_CIFS)" = "y" ]; then \
399 sed -i "/TCONFIG_CIFS/d" $(1); \
400 echo "# TCONFIG_CIFS is not set" >>$(1); \
401 fi; \
402 if [ "$(NO_FTP)" = "y" ]; then \
403 sed -i "/TCONFIG_FTP/d" $(1); \
404 echo "# TCONFIG_FTP is not set" >>$(1); \
405 fi; \
406 if [ "$(NO_SSH)" = "y" ]; then \
407 sed -i "/TCONFIG_SSH/d" $(1); \
408 echo "# TCONFIG_SSH is not set" >>$(1); \
409 fi; \
410 if [ "$(NO_HTTPS)" = "y" ]; then \
411 sed -i "/TCONFIG_HTTPS/d" $(1); \
412 echo "# TCONFIG_HTTPS is not set" >>$(1); \
413 fi; \
414 if [ "$(NO_XXTP)" = "y" ]; then \
415 sed -i "/TCONFIG_L2TP/d" $(1); \
416 echo "# TCONFIG_L2TP is not set" >>$(1); \
417 sed -i "/TCONFIG_PPTP/d" $(1); \
418 echo "# TCONFIG_PPTP is not set" >>$(1); \
419 fi; \
420 if [ "$(NO_LIBOPT)" = "y" ]; then \
421 sed -i "/TCONFIG_OPTIMIZE_SHARED_LIBS/d" $(1); \
422 echo "# TCONFIG_OPTIMIZE_SHARED_LIBS is not set" >>$(1); \
423 fi; \
424 if [ "$(EBTABLES)" = "y" ]; then \
425 sed -i "/TCONFIG_EBTABLES/d" $(1); \
426 echo "TCONFIG_EBTABLES=y" >>$(1); \
427 fi; \
428 if [ "$(IPV6SUPP)" = "y" ]; then \
429 sed -i "/TCONFIG_IPV6/d" $(1); \
430 echo "TCONFIG_IPV6=y" >>$(1); \
431 fi; \
432 if [ "$(NOCAT)" = "y" ]; then \
433 sed -i "/TCONFIG_NOCAT/d" $(1); \
434 echo "TCONFIG_NOCAT=y" >>$(1); \
435 fi; \
436 if [ "$(OPENVPN)" = "y" ]; then \
437 sed -i "/TCONFIG_LZO/d" $(1); \
438 echo "TCONFIG_LZO=y" >>$(1); \
439 sed -i "/TCONFIG_OPENVPN/d" $(1); \
440 echo "TCONFIG_OPENVPN=y" >>$(1); \
441 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
442 sed -i "/TCONFIG_FTP_SSL/d" $(1); \
443 echo "TCONFIG_FTP_SSL=y" >>$(1); \
444 fi; \
445 fi; \
446 if [ "$(HFS)" = "y" ]; then \
447 sed -i "/TCONFIG_HFS/d" $(1); \
448 echo "TCONFIG_HFS=y" >>$(1); \
449 fi; \
450 if [ "$(SNMP)" = "y" ]; then \
451 sed -i "/TCONFIG_SNMP/d" $(1); \
452 echo "TCONFIG_SNMP=y" >>$(1); \
453 fi; \
454 if [ "$(USERPPTP)" = "y" ]; then \
455 sed -i "/TCONFIG_USERPPTP/d" $(1); \
456 echo "TCONFIG_USERPPTP=y" >>$(1); \
457 fi; \
458 if [ "$(VLAN)" = "y" ]; then \
459 sed -i "/TCONFIG_VLAN/d" $(1); \
460 echo "TCONFIG_VLAN=y" >>$(1); \
461 fi; \
462 if [ "$(PPTPD)" = "y" ]; then \
463 sed -i "/TCONFIG_PPTPD/d" $(1); \
464 echo "TCONFIG_PPTPD=y" >>$(1); \
465 fi; \
466 if [ "$(NVRAM_64K)" = "y" ]; then \
467 sed -i "/TCONFIG_NVRAM_64K/d" $(1); \
468 echo "TCONFIG_NVRAM_64K=y" >>$(1); \
469 fi; \
470 if [ "$(TCPDUMP)" = "y" ]; then \
471 sed -i "/TCONFIG_TCPDUMP/d" $(1); \
472 echo "TCONFIG_TCPDUMP=y" >>$(1); \
473 fi; \
475 endef
477 define BusyboxOptions
478 @( \
479 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
480 sed -i "/CONFIG_FEATURE_2_4_MODULES/d" $(1); \
481 echo "# CONFIG_FEATURE_2_4_MODULES is not set" >>$(1); \
482 sed -i "/CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT/d" $(1); \
483 echo "CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y" >>$(1); \
484 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
485 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
486 sed -i "/CONFIG_MKNOD/d" $(1); \
487 echo "CONFIG_MKNOD=y" >>$(1); \
488 sed -i "/CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE/d" $(1); \
489 echo "CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=512" >>$(1); \
490 fi; \
491 if [ "$(NO_CIFS)" = "y" ]; then \
492 sed -i "/CONFIG_FEATURE_MOUNT_CIFS/d" $(1); \
493 echo "# CONFIG_FEATURE_MOUNT_CIFS is not set" >>$(1); \
494 fi; \
495 if [ "$(BBEXTRAS)" = "y" ]; then \
496 sed -i "/CONFIG_SENDMAIL/d" $(1); \
497 echo "CONFIG_SENDMAIL=y" >>$(1); \
498 sed -i "/CONFIG_FEATURE_SORT_BIG/d" $(1); \
499 echo "CONFIG_FEATURE_SORT_BIG=y" >>$(1); \
500 sed -i "/CONFIG_FTPPUT/d" $(1); \
501 echo "CONFIG_FTPPUT=y" >>$(1); \
502 sed -i "/CONFIG_FTPGET/d" $(1); \
503 echo "CONFIG_FTPGET=y" >>$(1); \
504 sed -i "/CONFIG_CLEAR/d" $(1); \
505 echo "CONFIG_CLEAR=y" >>$(1); \
506 sed -i "/CONFIG_NICE/d" $(1); \
507 echo "CONFIG_NICE=y" >>$(1); \
508 sed -i "/CONFIG_SETCONSOLE/d" $(1); \
509 echo "CONFIG_SETCONSOLE=y" >>$(1); \
510 sed -i "/CONFIG_MKFIFO/d" $(1); \
511 echo "CONFIG_MKFIFO=y" >>$(1); \
512 fi; \
513 if [ "$(USB)" = "USB" ]; then \
514 if [ "$(USBEXTRAS)" = "y" ]; then \
515 sed -i "/CONFIG_E2FSCK/d" $(1); \
516 echo "CONFIG_E2FSCK=y" >>$(1); \
517 sed -i "/CONFIG_MKE2FS/d" $(1); \
518 echo "CONFIG_MKE2FS=y" >>$(1); \
519 sed -i "/CONFIG_FDISK/d" $(1); \
520 echo "CONFIG_FDISK=y" >>$(1); \
521 sed -i "/CONFIG_FEATURE_FDISK_WRITABLE/d" $(1); \
522 echo "CONFIG_FEATURE_FDISK_WRITABLE=y" >>$(1); \
523 sed -i "/CONFIG_MKFS_VFAT/d" $(1); \
524 echo "CONFIG_MKFS_VFAT=y" >>$(1); \
525 sed -i "/CONFIG_MKSWAP/d" $(1); \
526 echo "CONFIG_MKSWAP=y" >>$(1); \
527 sed -i "/CONFIG_FLOCK/d" $(1); \
528 echo "CONFIG_FLOCK=y" >>$(1); \
529 sed -i "/CONFIG_FSYNC/d" $(1); \
530 echo "CONFIG_FSYNC=y" >>$(1); \
531 sed -i "/CONFIG_TUNE2FS/d" $(1); \
532 echo "CONFIG_TUNE2FS=y" >>$(1); \
533 sed -i "/CONFIG_E2LABEL/d" $(1); \
534 echo "CONFIG_E2LABEL=y" >>$(1); \
535 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
536 sed -i "/CONFIG_LSUSB/d" $(1); \
537 echo "CONFIG_LSUSB=y" >>$(1); \
538 sed -i "/CONFIG_FEATURE_WGET_STATUSBAR/d" $(1); \
539 echo "CONFIG_FEATURE_WGET_STATUSBAR=y" >>$(1); \
540 sed -i "/CONFIG_FEATURE_VERBOSE_USAGE/d" $(1); \
541 echo "CONFIG_FEATURE_VERBOSE_USAGE=y" >>$(1); \
542 fi; \
543 fi; \
544 else \
545 sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" $(1); \
546 echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1); \
547 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
548 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
549 sed -i "/CONFIG_FEATURE_MOUNT_LABEL/d" $(1); \
550 echo "# CONFIG_FEATURE_MOUNT_LABEL is not set" >>$(1); \
551 sed -i "/CONFIG_FEATURE_MOUNT_FSTAB/d" $(1); \
552 echo "# CONFIG_FEATURE_MOUNT_FSTAB is not set" >>$(1); \
553 sed -i "/CONFIG_VOLUMEID/d" $(1); \
554 echo "# CONFIG_VOLUMEID is not set" >>$(1); \
555 sed -i "/CONFIG_BLKID/d" $(1); \
556 echo "# CONFIG_BLKID is not set" >>$(1); \
557 sed -i "/CONFIG_SWAPONOFF/d" $(1); \
558 echo "# CONFIG_SWAPONOFF is not set" >>$(1); \
559 sed -i "/CONFIG_CHROOT/d" $(1); \
560 echo "# CONFIG_CHROOT is not set" >>$(1); \
561 sed -i "/CONFIG_PIVOT_ROOT/d" $(1); \
562 echo "# CONFIG_PIVOT_ROOT is not set" >>$(1); \
563 sed -i "/CONFIG_TRUE/d" $(1); \
564 echo "# CONFIG_TRUE is not set" >>$(1); \
565 fi; \
566 if [ "$(IPV6SUPP)" = "y" ]; then \
567 sed -i "/CONFIG_FEATURE_IPV6/d" $(1); \
568 echo "CONFIG_FEATURE_IPV6=y" >>$(1); \
569 sed -i "/CONFIG_PING6/d" $(1); \
570 echo "CONFIG_PING6=y" >>$(1); \
571 sed -i "/CONFIG_TRACEROUTE6/d" $(1); \
572 echo "CONFIG_TRACEROUTE6=y" >>$(1); \
573 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
574 sed -i "/CONFIG_FEATURE_UDHCP_RFC5969/d" $(1); \
575 echo "CONFIG_FEATURE_UDHCP_RFC5969=y" >>$(1); \
576 fi; \
577 fi; \
578 if [ "$(SLIM)" = "y" ]; then \
579 sed -i "/CONFIG_AWK/d" $(1); \
580 echo "# CONFIG_AWK is not set" >>$(1); \
581 sed -i "/CONFIG_BASENAME/d" $(1); \
582 echo "# CONFIG_BASENAME is not set" >>$(1); \
583 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
584 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
585 sed -i "/CONFIG_BLKID/d" $(1); \
586 echo "# CONFIG_BLKID is not set" >>$(1); \
587 sed -i "/CONFIG_TELNET=y/d" $(1); \
588 echo "# CONFIG_TELNET is not set" >>$(1); \
589 sed -i "/CONFIG_ARPING/d" $(1); \
590 echo "# CONFIG_ARPING is not set" >>$(1); \
591 sed -i "/CONFIG_FEATURE_LS_COLOR/d" $(1); \
592 echo "# CONFIG_FEATURE_LS_COLOR is not set" >>$(1); \
593 sed -i "/CONFIG_CHOWN/d" $(1); \
594 echo "# CONFIG_CHOWN is not set" >>$(1); \
595 else \
596 sed -i "/CONFIG_FEATURE_LS_COLOR/d" $(1); \
597 echo "CONFIG_FEATURE_LS_COLOR=y" >>$(1); \
598 sed -i "/CONFIG_FEATURE_LS_COLOR_IS_DEFAULT/d" $(1); \
599 echo "CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y" >>$(1); \
600 fi; \
602 endef
604 define KernelConfig
605 @( \
606 sed -i "/CONFIG_NVRAM_SIZE/d" $(1); \
607 echo "CONFIG_NVRAM_SIZE="$(NVRAM_SIZE) >>$(1); \
608 sed -i "/CONFIG_CC_OPTIMIZE_FOR_SIZE/d" $(1); \
609 if [ "$(KERN_SIZE_OPT)" = "y" ]; then \
610 echo "CONFIG_CC_OPTIMIZE_FOR_SIZE=y" >>$(1); \
611 else \
612 echo "# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set" >>$(1); \
613 fi; \
614 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(MIPS32)" = "r2" ]; then \
615 sed -i "/CONFIG_CPU_MIPS32_R1/d" $(1); \
616 echo "# CONFIG_CPU_MIPS32_R1 is not set" >>$(1); \
617 sed -i "/CONFIG_CPU_MIPS32_R2/d" $(1); \
618 echo "CONFIG_CPU_MIPS32_R2=y" >>$(1); \
619 sed -i "/CONFIG_CPU_MIPSR1/d" $(1); \
620 echo "CONFIG_CPU_MIPSR2=y" >>$(1); \
621 if [ "$(WNR3500LV2)" = "y" ]; then \
622 sed -i "/CONFIG_MTD_NFLASH/d" $(1); \
623 echo "CONFIG_MTD_NFLASH=y" >>$(1); \
624 fi; \
625 fi; \
626 if [ "$(USB)" = "" ]; then \
627 sed -i "/CONFIG_EFI_PARTITION/d" $(1); \
628 echo "# CONFIG_EFI_PARTITION is not set" >>$(1); \
629 fi; \
630 if [ "$(IPV6SUPP)" = "y" ]; then \
631 sed -i "/CONFIG_IPV6 is not set/d" $(1); \
632 echo "CONFIG_IPV6=y" >>$(1); \
633 sed -i "/CONFIG_IP6_NF_IPTABLES/d" $(1); \
634 echo "CONFIG_IP6_NF_IPTABLES=y" >>$(1); \
635 sed -i "/CONFIG_IP6_NF_MATCH_RT/d" $(1); \
636 echo "CONFIG_IP6_NF_MATCH_RT=y" >>$(1); \
637 sed -i "/CONFIG_IP6_NF_FILTER/d" $(1); \
638 echo "CONFIG_IP6_NF_FILTER=m" >>$(1); \
639 sed -i "/CONFIG_IP6_NF_TARGET_LOG/d" $(1); \
640 echo "CONFIG_IP6_NF_TARGET_LOG=m" >>$(1); \
641 sed -i "/CONFIG_IP6_NF_TARGET_REJECT/d" $(1); \
642 echo "CONFIG_IP6_NF_TARGET_REJECT=m" >>$(1); \
643 sed -i "/CONFIG_IP6_NF_MANGLE/d" $(1); \
644 echo "CONFIG_IP6_NF_MANGLE=m" >>$(1); \
645 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
646 sed -i "/CONFIG_NF_CONNTRACK_IPV6/d" $(1); \
647 echo "CONFIG_NF_CONNTRACK_IPV6=m" >>$(1); \
648 sed -i "/CONFIG_NETFILTER_XT_MATCH_HL/d" $(1); \
649 echo "CONFIG_NETFILTER_XT_MATCH_HL=m" >>$(1); \
650 sed -i "/CONFIG_IPV6_ROUTER_PREF/d" $(1); \
651 echo "CONFIG_IPV6_ROUTER_PREF=y" >>$(1); \
652 sed -i "/CONFIG_IPV6_SIT/d" $(1); \
653 echo "CONFIG_IPV6_SIT=m" >>$(1); \
654 sed -i "/CONFIG_IPV6_SIT_6RD/d" $(1); \
655 echo "CONFIG_IPV6_SIT_6RD=y" >>$(1); \
656 sed -i "/CONFIG_IPV6_MULTIPLE_TABLES/d" $(1); \
657 echo "CONFIG_IPV6_MULTIPLE_TABLES=y" >>$(1); \
658 sed -i "/CONFIG_IP6_NF_RAW/d" $(1); \
659 echo "CONFIG_IP6_NF_RAW=m" >>$(1); \
660 sed -i "/CONFIG_IPV6_OPTIMISTIC_DAD/d" $(1); \
661 echo "CONFIG_IPV6_OPTIMISTIC_DAD=y" >>$(1); \
662 sed -i "/CONFIG_IPV6_MROUTE/d" $(1); \
663 echo "CONFIG_IPV6_MROUTE=y" >>$(1); \
664 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
665 echo "CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
666 else \
667 sed -i "/CONFIG_IP6_NF_CONNTRACK/d" $(1); \
668 echo "CONFIG_IP6_NF_CONNTRACK=m" >>$(1); \
669 sed -i "/CONFIG_IP6_NF_MATCH_HL/d" $(1); \
670 echo "CONFIG_IP6_NF_MATCH_HL=m" >>$(1); \
671 sed -i "/CONFIG_IP6_NF_FTP/d" $(1); \
672 echo "CONFIG_IP6_NF_FTP=m" >>$(1); \
673 sed -i "/CONFIG_IP6_NF_MATCH_LIMIT/d" $(1); \
674 echo "CONFIG_IP6_NF_MATCH_LIMIT=m" >>$(1); \
675 sed -i "/CONFIG_IP6_NF_MATCH_CONDITION/d" $(1); \
676 echo "CONFIG_IP6_NF_MATCH_CONDITION=m" >>$(1); \
677 sed -i "/CONFIG_IP6_NF_MATCH_MAC/d" $(1); \
678 echo "CONFIG_IP6_NF_MATCH_MAC=m" >>$(1); \
679 sed -i "/CONFIG_IP6_NF_MATCH_MULTIPORT/d" $(1); \
680 echo "CONFIG_IP6_NF_MATCH_MULTIPORT=m" >>$(1); \
681 sed -i "/CONFIG_IP6_NF_MATCH_MARK/d" $(1); \
682 echo "CONFIG_IP6_NF_MATCH_MARK=m" >>$(1); \
683 sed -i "/CONFIG_IP6_NF_MATCH_LENGTH/d" $(1); \
684 echo "CONFIG_IP6_NF_MATCH_LENGTH=m" >>$(1); \
685 sed -i "/CONFIG_IP6_NF_MATCH_STATE/d" $(1); \
686 echo "CONFIG_IP6_NF_MATCH_STATE=m" >>$(1); \
687 sed -i "/CONFIG_IP6_NF_TARGET_MARK/d" $(1); \
688 echo "CONFIG_IP6_NF_TARGET_MARK=m" >>$(1); \
689 sed -i "/CONFIG_IP6_NF_TARGET_TCPMSS/d" $(1); \
690 echo "CONFIG_IP6_NF_TARGET_TCPMSS=m" >>$(1); \
691 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
692 echo "CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
693 fi; \
694 fi; \
695 sed -i "/CONFIG_BCM57XX/d" $(1); \
696 if [ "$(BCM57)" = "y" ]; then \
697 echo "CONFIG_BCM57XX=m" >>$(1); \
698 else \
699 echo "# CONFIG_BCM57XX is not set" >>$(1); \
700 fi; \
701 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(EBTABLES)" = "y" ]; then \
702 sed -i "/CONFIG_BRIDGE_NF_EBTABLES/d" $(1); \
703 echo "CONFIG_BRIDGE_NF_EBTABLES=m" >>$(1); \
704 if [ "$(IPV6SUPP)" = "y" ]; then \
705 sed -i "/CONFIG_BRIDGE_EBT_IP6/d" $(1); \
706 echo "CONFIG_BRIDGE_EBT_IP6=m" >>$(1); \
707 fi; \
708 fi; \
709 sed -i "/CONFIG_NVRAM_64K/d" $(1); \
710 if [ "$(NVRAM_64K)" = "y" ]; then \
711 echo "CONFIG_NVRAM_64K=y" >>$(1); \
712 else \
713 echo "# CONFIG_NVRAM_64K is not set" >>$(1); \
714 fi \
716 endef
719 bin:
720 ifeq ($(B),)
721 @echo $@" is not a valid target!"
722 @false
723 endif
724 @cp router/config_base router/config_$(lowercase_B)
725 @cp router/busybox/config_base router/busybox/config_$(lowercase_B)
726 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$(lowercase_B)
728 $(call RouterOptions, router/config_$(lowercase_B))
729 $(call KernelConfig, $(LINUXDIR)/config_$(lowercase_B))
730 $(call BusyboxOptions, router/busybox/config_$(lowercase_B))
732 @$(MAKE) setprofile N=$(TPROFILE) B=$(B) DESC="$(BUILD_DESC)" USB="$(USB)" MIPS32="${MIPS32}" V1="${V1}" V2="${V2}"
733 @$(MAKE) all
735 ## Make the "normal" build
737 @$(MAKE) bin B=A BUILD_DESC="Std" USB="USB" VLAN="$(VLAN)" SNMP=y
739 ## Make the "normal but without SSH" build
741 @$(MAKE) bin NO_SSH=y B=B BUILD_DESC="No SSH" USB="USB" VLAN="$(VLAN)" SNMP=y
743 ## Make the "normal but without CIFS" build
745 @$(MAKE) bin NO_CIFS=y B=C BUILD_DESC="No CIFS" USB="USB" VLAN="$(VLAN)" SNMP=y
747 ## Make the "normal but without SAMBA" (Lite) build
749 ifeq ($(CONFIG_LINUX26),y)
750 @$(MAKE) bin NO_SAMBA=y SLIM=y NO_CIFS=y NO_JFFS=y NO_ZEBRA=y B=D BUILD_DESC="Lite" USB="USB" VLAN="$(VLAN)" SNMP="$(SNMP)"
751 else
752 @$(MAKE) bin NO_SAMBA=y SLIM=y B=D BUILD_DESC="Lite" USB="USB" VLAN="$(VLAN)" SNMP="$(SNMP)"
753 endif
755 ## Make the "normal (with NTFS support) + VPN" build
757 ifeq ($(CONFIG_LINUX26),y)
758 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y IPV6SUPP=y B=E BUILD_DESC="$(VPN)" USB="USB" VLAN="$(VLAN)" SNMP=y TCPDUMP="$(TCPDUMP)"
759 else
760 # @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NTFS=y B=E BUILD_DESC="$(VPN)" USB="USB" VLAN="$(VLAN)"
761 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y BBEXTRAS=y USBEXTRAS=y NTFS=y B=E BUILD_DESC="$(VPN)" USB="USB" SNMP=y VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)"
762 endif
764 ## Make the "Mini: no USB, no CIFS, no Zebra" build - targeted for Netgear routers
766 @$(MAKE) bin JFFSv1=y NO_CIFS=y NO_SSH=y NO_ZEBRA=y SLIM=y B=F BUILD_DESC="Mini" USB="" VLAN="$(VLAN)"
768 ## Make the "Tiny: no JFFS, no USB, no CIFS, no Zebra" build - targeted for cheapskate routers
770 @$(MAKE) bin NO_CIFS=y NO_SSH=y NO_JFFS=y NO_ZEBRA=y SLIM=y B=FS BUILD_DESC="Tiny" USB="" VLAN="$(VLAN)"
772 ## Make the "No USB with IPv6, no Zebra" build - for 4MB routers
774 @$(MAKE) bin JFFSv1=y NO_CIFS=y NO_SSH=y NO_ZEBRA=y IPV6SUPP=y B=I BUILD_DESC="MiniIPv6" USB="" VLAN="$(VLAN)"
776 ## Make the "No USB with IPv6, no Zebra, with VPN" build - for 4MB routers
777 ifeq ($(CONFIG_LINUX26),y)
779 @$(MAKE) bin JFFSv1=y NO_CIFS=y NO_SSH=y NO_XXTP=y SLIM=y NO_SAMBA=y NO_ZEBRA=y IPV6SUPP=y OPENVPN=y USERPPTP=y NO_LIBOPT=y B=J BUILD_DESC="MiniIPv6-VPN" USB="" VLAN="$(VLAN)" SNMP="$(SNMP)"
780 endif
782 ## Make the "normal with Extras and NTFS" build
784 ifeq ($(CONFIG_LINUX26),y)
785 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y IPV6SUPP=y B=M BUILD_DESC="Ext" USB="USB" VLAN="$(VLAN)" SNMP=y USERPPTP=y PPTPD=y TCPDUMP="$(TCPDUMP)"
786 else
787 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y B=M BUILD_DESC="Ext" USB="USB" VLAN="$(VLAN)" SNMP=y USERPPTP=y PPTPD=y TCPDUMP="$(TCPDUMP)"
788 endif
790 ## Roadkill
791 ## Make the "normal (with NTFS support) + VPN + NOCAT" build
793 ifeq ($(CONFIG_LINUX26),y)
794 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y IPV6SUPP=y B=NC BUILD_DESC="$(VPN)" USB="USB" SNMP=y VLAN="$(VLAN)" NOCAT=y TCPDUMP="$(TCPDUMP)" BUILD_DESC+="-$(NC)"
795 else
796 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NTFS=y B=NC BUILD_DESC="$(VPN)" USB="USB" VLAN="$(VLAN)" NOCAT=y TCPDUMP="$(TCPDUMP)" BUILD_DESC+=" $(NC)"
797 endif
799 ## Toastman
800 ## Make the "Mini: no USB, + NOCAT" build - for 4MB routers
801 ncm:
802 @$(MAKE) bin JFFSv1=y NOCAT=y B=NCM BUILD_DESC="Mini-NOCAT" USB="" VLAN="$(VLAN)"
804 ## Toastman
805 ## Make the "normal" build + NOCAT
806 ncs:
807 @$(MAKE) bin NOCAT=y B=NCS BUILD_DESC="Std-NOCAT" USB="USB" SNMP=y VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)"
810 ## Make the "No USB" build
812 ifeq ($(CONFIG_LINUX26),y)
813 @$(MAKE) bin JFFSv1=y $(if $(filter r2, $(MIPS32)),,BCM57=y) B=S BUILD_DESC="Std" USB="" VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)"
814 else
815 @$(MAKE) bin BBEXTRAS=y BCM57=y B=S BUILD_DESC="Std" USB="" VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)"
816 endif
819 ## Make the "No USB with Extras" build (K26 only, for 8MB flash)
820 ifeq ($(CONFIG_LINUX26),y)
822 @$(MAKE) bin B=T USB="" BBEXTRAS=y EBTABLES=y NO_LIBOPT=y $(if $(filter r2, $(MIPS32)),,BCM57=y) IPV6SUPP=y BUILD_DESC="Std" SNMP=y VLAN="$(VLAN)"
823 ## Make the "No USB with OpenVPN and Extras" build (K26 only, for 8MB flash)
825 @$(MAKE) bin B=U USB="" BBEXTRAS=y EBTABLES=y NO_LIBOPT=y $(if $(filter r2, $(MIPS32)),,BCM57=y) IPV6SUPP=y OPENVPN=y USERPPTP=y BUILD_DESC="$(VPN)" SNMP=y VLAN="$(VLAN)"
826 endif
828 ## Make the "VPN with no USB support" build
830 ifeq ($(CONFIG_LINUX26),y)
831 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NO_JFFS=y BCM57=y B=V BUILD_DESC="$(VPN)" USB="" VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)" TCPDUMP="$(TCPDUMP)"
832 else
833 @$(MAKE) bin OPENVPN=y PPTPD=y BBEXTRAS=y B=V BUILD_DESC="$(VPN)" USB="" SNMP=y VLAN="$(VLAN)" TCPDUMP="$(TCPDUMP)" TCPDUMP="$(TCPDUMP)"
834 endif
836 ## Make the "Small VPN with no USB support" build
838 ifeq ($(CONFIG_LINUX26),y)
839 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NO_JFFS=y NO_CIFS=y B=VS BUILD_DESC="SmallVPN" USB=""
840 else
841 @$(MAKE) bin OPENVPN=y USERPPTP=y PPTPD=y NO_JFFS=y NO_CIFS=y BCM57=y B=VS BUILD_DESC="SmallVPN" USB=""
842 endif
845 ## Make Mips32r2 builds
847 r2a:
848 @$(MAKE) a MIPS32=r2
850 r2b:
851 @$(MAKE) b MIPS32=r2
853 r2c:
854 @$(MAKE) c MIPS32=r2
856 r2d:
857 @$(MAKE) d MIPS32=r2
859 r2e:
860 @$(MAKE) e MIPS32=r2
862 r2f:
863 @$(MAKE) f MIPS32=r2
865 r2fb:
866 @$(MAKE) f MIPS32=r2 BELKIN=y
868 r2fs:
869 @$(MAKE) fs MIPS32=r2
871 r2i:
872 @$(MAKE) i MIPS32=r2
874 r2j:
875 @$(MAKE) j MIPS32=r2
877 r2m:
878 @$(MAKE) m MIPS32=r2
880 r2n:
881 @$(MAKE) n MIPS32=r2
883 r2nc:
884 @$(MAKE) nc MIPS32=r2
886 r2r:
887 @$(MAKE) r MIPS32=r2
889 r2s:
890 @$(MAKE) s MIPS32=r2
892 r2t:
893 @$(MAKE) t MIPS32=r2
895 r2u:
896 @$(MAKE) t MIPS32=r2
898 r2v:
899 @$(MAKE) v MIPS32=r2
901 r2vs:
902 @$(MAKE) vs MIPS32=r2
904 #Linksys E-Series with 60K Nvram Builds
906 n60a:
907 @$(MAKE) r2a NVRAM_SIZE=60 LINKSYS_E=y
909 n60b:
910 @$(MAKE) r2b NVRAM_SIZE=60 LINKSYS_E=y
912 n60c:
913 @$(MAKE) r2c NVRAM_SIZE=60 LINKSYS_E=y
915 n60e:
916 @$(MAKE) r2e NVRAM_SIZE=60 LINKSYS_E=y
918 n60m:
919 @$(MAKE) r2m NVRAM_SIZE=60 LINKSYS_E=y
921 n60n:
922 @$(MAKE) r2n NVRAM_SIZE=60 LINKSYS_E=y
924 n60nc:
925 @$(MAKE) r2nc NVRAM_SIZE=60 LINKSYS_E=y
927 n60o:
928 @$(MAKE) r2o NVRAM_SIZE=60 LINKSYS_E=y
930 n60r:
931 @$(MAKE) r2r NVRAM_SIZE=60 LINKSYS_E=y
933 n60s:
934 @$(MAKE) bin MIPS32=r2 B=S USB="" NVRAM_SIZE=60 LINKSYS_E=y BBEXTRAS=y EBTABLES=y NO_LIBOPT=y IPV6SUPP=y BUILD_DESC="Std"
936 n60v:
937 @$(MAKE) r2v NVRAM_SIZE=60 LINKSYS_E=y
940 #Linksys E-Series with 64K Nvram Builds
942 n64a:
943 @$(MAKE) r2a NVRAM_SIZE=64 LINKSYS_E_64=y
945 n64b:
946 @$(MAKE) r2b NVRAM_SIZE=64 LINKSYS_E_64=y
948 n64c:
949 @$(MAKE) r2c NVRAM_SIZE=64 LINKSYS_E_64=y
951 n64e:
952 @$(MAKE) r2e NVRAM_SIZE=64 LINKSYS_E_64=y
954 n64m:
955 @$(MAKE) r2m NVRAM_SIZE=64 LINKSYS_E_64=y
957 n64n:
958 @$(MAKE) r2n NVRAM_SIZE=64 LINKSYS_E_64=y
960 n64nc:
961 @$(MAKE) r2nc NVRAM_SIZE=64 LINKSYS_E_64=y
963 n64o:
964 @$(MAKE) r2o NVRAM_SIZE=64 LINKSYS_E_64=y
966 n64r:
967 @$(MAKE) r2r NVRAM_SIZE=64 LINKSYS_E_64=y
969 n64s:
970 @$(MAKE) bin MIPS32=r2 B=S USB="" NVRAM_SIZE=64 LINKSYS_E_64=y BBEXTRAS=y EBTABLES=y NO_LIBOPT=y IPV6SUPP=y BUILD_DESC="Std"
972 n64v:
973 @$(MAKE) r2v NVRAM_SIZE=64 LINKSYS_E_64=y
976 #Linksys E-Series with 4MB Flash
978 e1000v2i:
979 @$(MAKE) r2i NVRAM_SIZE=32 LINKSYS_E1000v2=y
981 e1000v2f:
982 @$(MAKE) r2f NVRAM_SIZE=32 LINKSYS_E1000v2=y
984 e1200v1i:
985 @$(MAKE) r2i NVRAM_SIZE=64 LINKSYS_E1200v1=y
987 e1200v1f:
988 @$(MAKE) r2f NVRAM_SIZE=64 LINKSYS_E1200v1=y
991 #Builds for WNR3500L v2
993 v2e:
994 @$(MAKE) e MIPS32=r2 WNR3500LV2=y NO_JFFS=y
997 setprofile:
998 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
999 echo '#define TOMATO_$(N) 1' >> router/shared/tomato_profile.h
1000 echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
1001 echo '#define PROFILE_N 2' >> router/shared/tomato_profile.h
1002 echo '#define TOMATO_PROFILE PROFILE_$(N)' >> router/shared/tomato_profile.h
1003 echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
1004 echo '#define TOMATO_BUILD_NAME "$(B)"' >> router/shared/tomato_profile.h
1005 echo '#define TOMATO_BUILD_DESC "$(EXTRA_PREDESC)$(DESC)$(EXTRA_POSTDESC)"' >> router/shared/tomato_profile.h
1006 echo '#ifndef CONFIG_NVRAM_SIZE' >> router/shared/tomato_profile.h
1007 echo '#define CONFIG_NVRAM_SIZE $(NVRAM_SIZE)' >> router/shared/tomato_profile.h
1008 echo '#endif' >> router/shared/tomato_profile.h
1009 echo '#endif' >> router/shared/tomato_profile.h
1011 echo 'TOMATO_$(N) = 1' > tomato_profile.mak
1012 echo 'PROFILE_G = 1' >> tomato_profile.mak
1013 echo 'PROFILE_N = 2' >> tomato_profile.mak
1014 echo 'TOMATO_PROFILE = $$(PROFILE_$(N))' >> tomato_profile.mak
1015 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
1016 echo 'TOMATO_BUILD = "$(B)"' >> tomato_profile.mak
1017 echo 'TOMATO_BUILD_NAME = "$(B)"' >> tomato_profile.mak
1018 echo 'TOMATO_BUILD_DESC = "$(EXTRA_PREDESC)$(DESC)$(EXTRA_POSTDESC)"' >> tomato_profile.mak
1019 echo 'TOMATO_PROFILE_L = $(lowercase_N)' >> tomato_profile.mak
1020 echo 'TOMATO_PROFILE_U = $(uppercase_N)' >> tomato_profile.mak
1021 echo 'TOMATO_BUILD_USB = "$(USB)"' >> tomato_profile.mak
1022 echo 'TOMATO_BUILD_MIPS32 = "${MIPS32}"' >> tomato_profile.mak
1023 echo 'TOMATO_BUILD_V1 = "${V1}"' >> tomato_profile.mak
1024 echo 'TOMATO_BUILD_V2 = "${V2}"' >> tomato_profile.mak
1026 echo 'export EXTRACFLAGS := $(EXTRA_CFLAGS) -DBCMWPA2 -funit-at-a-time -Wno-pointer-sign -mtune=mips32 -mips32 $(if $(filter $(NVRAM_SIZE),0),,-DCONFIG_NVRAM_SIZE=$(NVRAM_SIZE)) $(EXTRA_64KCFLAG)' >> tomato_profile.mak
1028 # Note that changes to variables in tomato_profile.mak don't
1029 # get propogated to this invocation of make!
1030 @echo ""
1031 @echo "Using $(N) profile, $(B) build config."
1032 @echo ""
1034 @cd $(LINUXDIR) ; \
1035 rm -f config_current ; \
1036 ln -s config_$(lowercase_B) config_current ; \
1037 cp -f config_current .config
1039 @cd router/busybox && \
1040 rm -f config_current ; \
1041 ln -s config_$(lowercase_B) config_current ; \
1042 cp config_current .config
1044 @cd router ; \
1045 rm -f config_current ; \
1046 ln -s config_$(lowercase_B) config_current ; \
1047 cp config_current .config
1049 @$(MAKE) -C router oldconfig
1051 help:
1052 @echo "a A build (standard)"
1053 @echo "b B build (standard minus SSH)"
1054 @echo "c C build (standard minus CIFS)"
1055 @echo "d D build (standard minus Samba server)"
1056 @echo "m M build (standard plus extra utilities and NTFS support)"
1057 @echo "nc NC build (standard plus VPN, extra utilities, NTFS support and NOCAT)"
1058 @echo "ncm NCS build (no USB support, NOCAT)"
1059 @echo "ncs NCS build (std + NOCAT)"
1060 @echo "m Ext - (standard plus extra utilities and NTFS support)"
1062 ifeq ($(CONFIG_LINUX26),y)
1063 @echo "e E build (standard plus VPN, extra utilities and NTFS support)"
1064 @echo "i I build (IPv6 with no USB support minus CIFS and RIPv1/2)"
1065 else
1066 @echo "e E build (standard plus VPN and NTFS support)"
1067 endif
1068 @echo "s S build (no USB support)"
1069 @echo "f F build (no USB support minus CIFS and RIPv1/2)"
1070 @echo "fs FS build (no USB support minus CIFS, JFFS, Zebra and RIPv1/2)"
1071 @echo "v V build (VPN with no USB support)"
1072 @echo "vs VS build (Small VPN with no USB support)"
1074 ifeq ($(CONFIG_LINUX26),y)
1075 @echo "r2a MIPS Release 2 A build (standard)"
1076 @echo "r2b MIPS Release 2 B build (standard minus SSH)"
1077 @echo "r2c MIPS Release 2 C build (standard minus CIFS)"
1078 @echo "r2d MIPS Release 2 D build (standard minus Samba server)"
1079 @echo "r2e MIPS Release 2 E build (standard plus VPN and extras)"
1080 @echo "r2f MIPS Release 2 F build (no USB support minus CIFS, RIPv1/2)"
1081 @echo "r2fs MIPS Release 2 FS build (no USB support minus JFFS, CIFS, RIPv1/2, Zebra)"
1082 @echo "r2i MIPS Release 2 I build (IPv6 with no USB support minus CIFS and RIPv1/2)"
1083 @echo "r2m MIPS Release 2 M build (standard plus extras)"
1084 @echo "r2nc MIPS Release 2 NC build (standard plus VPN, extras and NOCAT)"
1085 @echo "r2ncm MIPS Release 2 NCM build (no USB support, plus NOCAT)"
1086 @echo "r2ncs MIPS Release 2 NCS build (standard plus NOCAT)"
1087 @echo "r2s MIPS Release 2 S build (no USB support)"
1088 @echo "r2t MIPS Release 2 T build (no USB support with extras)"
1089 @echo "r2u MIPS Release 2 U build (no USB support plus VPN with extras)"
1090 @echo "r2v MIPS Release 2 V build (VPN with no USB support)"
1091 @echo "r2vs MIPS Release 2 VS build (Small VPN with no USB support)"
1093 @echo " Linksys E-Series with 60k Nvram"
1094 @echo "n60m Linksys E-series build (60KB NVRAM, standard plus extras)"
1095 @echo "n60e Linksys E-series build (60KB NVRAM, standard plus VPN and extras)"
1096 @echo "n60nc Linksys E-series build (60KB NVRAM, standard plus extras, plus VPN, plus NOCAT)"
1097 @echo "n60s Linksys E-series build (60KB NVRAM, no USB support)"
1098 @echo "n60v Linksys E-series build (60KB NVRAM, VPN with no USB support)"
1100 @echo " Linksys E-Series with 64k Nvram/8MB Flash(E900/E1200v2/E1500)"
1101 @echo "n64m Linksys E-series build (64KB NVRAM, standard plus extras)"
1102 @echo "n64e Linksys E-series build (64KB NVRAM, standard plus VPN and extras)"
1103 @echo "n64nc Linksys E-series build (64KB NVRAM, standard plus extras, plus VPN, plus NOCAT)"
1104 @echo "n64s Linksys E-series build (64KB NVRAM, no USB support)"
1105 @echo "n64v Linksys E-series build (64KB NVRAM, VPN with no USB support)"
1107 @echo " Linksys E-Series with 4MB Flash(E1000v2/v2.1/E1200v1)"
1108 @echo "e1000v2i Linksys E1000v2-v2.1/Cisco M10v2 MiniIPv6"
1109 @echo "e1000v2f Linksys E1000v2-v2.1/Cisco M10v2 Mini"
1110 @echo "e1200v1i Linksys E1200v1 MiniIPv6"
1111 @echo "e1200v1f Linksys E1200v1 Mini"
1113 @echo " Netgear WNR3500L v2 builds (128MB Flash)"
1114 @echo "v2e Netgear WNR3500Lv2 build"
1116 endif
1117 @echo "..etc.. other build configs"
1118 @echo "clean -C router clean"
1119 @echo "cleanimage rm -rf image"
1120 @echo "cleantools clean btools, mksquashfs"
1121 @echo "cleankernel -C Linux distclean (but preserves .config)"
1122 @echo "distclean distclean of Linux & busybox (but preserve .configs)"
1123 @echo "prepk -C Linux oldconfig dep"
1125 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile help
1126 .PHONY: a b c d m Makefile allversions tomato_profile.mak