2 # Toplevel Makefile for the BCM947xx Linux Router release
4 # Copyright 2005, 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.53 2005/04/25 03:54:37 tallest Exp $
15 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
17 # To rebuild everything and all configurations:
19 # make V1=whatever V2=sub-whatever VPN=vpn3.6 a b c d m
20 # The 1st "whatever" would be the build number, the sub-whatever would
21 # be the update to the version.
24 # make V1=8516 V2="-jffs.1" a b c d m s
26 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30 export SRCBASE
:= $(shell pwd
)
31 RELEASEDIR
:= $(shell (cd
$(SRCBASE
)/..
&& pwd
-P
))
32 PATH
:= $(RELEASEDIR
)/tools
:$(PATH
)
37 # Normally you'd do something like "make V1=8516 V2=-sub-ver a b c d"
38 # But if you don't give anything for "V1", it'll get a default from tomato_version.
41 ifeq ($(CONFIG_LINUX26
),y
)
51 -include tomato_profile.mak
53 # This could be simpler by just using $(TOMATO_PROFILE_NAME) like it used to be,
54 # but that's fragile. If you make one certain innocuous change elsewhere in the
55 # makefile(s), the build will silently be wrong. This way it works properly every time.
56 current_BUILD_NAME
= $(strip $(shell grep
"^TOMATO_BUILD_NAME" tomato_profile.mak | cut
-d
"=" -f2
))
57 current_BUILD_DESC
= $(strip $(shell grep
"^TOMATO_BUILD_DESC" tomato_profile.mak | cut
-d
"=" -f2 | sed
-e
"s/ //g"))
58 current_BUILD_USB
= $(strip $(shell grep
"^TOMATO_BUILD_USB" tomato_profile.mak | cut
-d
"=" -f2 | sed
-e
"s/ //g"))
59 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
))
61 uppercase_N
= $(shell echo
$(N
) | tr a-z A-Z
)
62 lowercase_N
= $(shell echo
$(N
) | tr A-Z a-z
)
63 uppercase_B
= $(shell echo
$(B
) | tr a-z A-Z
)
64 lowercase_B
= $(shell echo
$(B
) | tr A-Z a-z
)
66 ifeq ($(CONFIG_LINUX26
),y
)
67 mips_rev
= $(if
$(filter $(MIPS32
),r2
),MIPSR2
,MIPSR1
)
74 beta
= $(if
$(filter $(TOMATO_EXPERIMENTAL
),1),-beta
,)
78 @btools
/uversion.pl
--gen
$(V1
) $(mips_rev
)$(beta
)$(V2
) $(ND
) $(current_BUILD_USB
) $(current_BUILD_DESC
)
80 ifeq ($(TOMATO_BUILD
),)
89 @echo
"Building Tomato $(ND) $(current_BUILD_USB) $(current_TOMATO_VER).$(V1)$(mips_rev)$(beta)$(V2) $(current_BUILD_DESC) $(current_BUILD_NAME) with $(TOMATO_PROFILE_NAME) Profile"
95 @
$(MAKE
) -C router
all
96 @
$(MAKE
) -C router
install
99 @
rm -f image
/tomato-
$(ND
)$(current_BUILD_USB
)-$(current_TOMATO_VER
).
$(V1
)$(mips_rev
)$(beta
)$(V2
)-$(current_BUILD_DESC
).trx
100 @
rm -f image
/tomato-
$(ND
)$(current_BUILD_USB
)-$(current_TOMATO_VER
).
$(V1
)$(mips_rev
)$(beta
)$(V2
)-$(current_BUILD_DESC
).bin
102 @echo
"***********************" `date` "************************" >>fpkg.log
103 @cat router
/shared
/tomato_version
>>fpkg.log
105 @cat router
/target.
info >>fpkg.log
106 ifeq ($(wildcard include/bcm20xx.h
),)
107 @btools
/fpkg
-i lzma-loader
/loader.gz
-i
$(LINUXDIR
)/arch
/mips
/brcm-boards
/bcm947xx
/compressed
/vmlinuz
-a
1024 -i router
/mipsel-uclibc
/target.image \
108 -t image
/tomato.trx \
109 -l W54G
,image
/WRT54G_WRT54GL.bin \
110 -l W54S
,image
/WRT54GS.bin \
111 -l W54s
,image
/WRT54GSv4.bin \
112 -l W54U
,image
/WRTSL54GS.bin \
113 -m
0x10577050,image
/WR850G.bin \
116 ifeq ($(NVRAM_SIZE
),60)
118 # Linksys E3000 build
119 @btools
/fpkg
-i lzma-loader
/loader.gz
-i
$(LINUXDIR
)/arch
/mips
/brcm-boards
/bcm947xx
/compressed
/vmlinuz
-a
1024 -i router
/mipsel-uclibc
/target.image \
120 -l
61XN
,image
/tomato-
$(ND
)$(current_BUILD_USB
)-$(current_TOMATO_VER
).
$(V1
)$(mips_rev
)$(beta
)$(V2
)-$(current_BUILD_DESC
).bin \
123 # Linksys E2000 build
124 @btools
/fpkg
-i lzma-loader
/loader.gz
-i
$(LINUXDIR
)/arch
/mips
/brcm-boards
/bcm947xx
/compressed
/vmlinuz
-a
1024 -i router
/mipsel-uclibc
/target.image \
125 -l
32XN
,image
/tomato-
$(ND
)$(current_BUILD_USB
)-$(current_TOMATO_VER
).
$(V1
)$(mips_rev
)$(beta
)$(V2
)-$(current_BUILD_DESC
).bin \
129 # Create generic TRX image
130 @btools
/fpkg
-i lzma-loader
/loader.gz
-i
$(LINUXDIR
)/arch
/mips
/brcm-boards
/bcm947xx
/compressed
/vmlinuz
-a
1024 -i router
/mipsel-uclibc
/target.image \
131 -t image
/tomato-
$(ND
)$(current_BUILD_USB
)-$(current_TOMATO_VER
).
$(V1
)$(mips_rev
)$(beta
)$(V2
)-$(current_BUILD_DESC
).trx \
136 @cp fpkg.log image
/fpkg-
$(V1
)$(mips_rev
)$(beta
)$(V2
).log
138 @echo
"-----------------"
139 @echo
`cat router/shared/tomato_version` " ready"
140 @echo
"-----------------"
141 ifneq ($(NOVERSION
),1)
142 @cp router
/shared
/tomato_version router
/shared
/tomato_version_last
143 @btools
/uversion.pl
--bump
150 @touch router
/.config
151 @
rm -f router
/config_
[a-z
]
152 @
rm -f router
/busybox
/config_
[a-z
]
153 @
$(MAKE
) -C router
$@
154 @
-rmdir router
/mipsel-uclibc
159 @
rm -f router
/.config
160 @touch router
/.config
164 @
$(MAKE
) -C
$(LINUXDIR
)/scripts
/squashfs
clean
165 @
$(MAKE
) -C btools
clean
169 mv .config save-config
&& \
170 $(MAKE
) distclean || true
; \
171 cp
-p save-config .config || true
174 @
$(MAKE
) -C router kernel
175 @ls
-l
$(LINUXDIR
)/arch
/mips
/brcm-boards
/bcm947xx
/compressed
/zImage
177 distclean: clean cleanimage cleankernel cleantools
178 ifneq ($(INSIDE_MAK
),1)
179 @
$(MAKE
) -C router
$@ INSIDE_MAK
=1
181 mv router
/busybox
/.config busybox-saved-config || true
182 @
$(MAKE
) -C router
/busybox
distclean
183 @
rm -f router
/busybox
/config_current
184 @cp
-p busybox-saved-config router
/busybox
/.config || true
185 @cp
-p router
/busybox
/.config router
/busybox
/config_current || true
186 @
rm -f router
/config_current
187 @
rm -f router
/.config.cmd router
/.config.old router
/.config
188 @
rm -f router
/libfoo_xref.txt
189 @
rm -f tomato_profile.mak router
/shared
/tomato_profile.h
190 @touch tomato_profile.mak
191 @touch router
/shared
/tomato_profile.h
196 rm -f config_current
; \
197 ln
-s config_base config_current
; \
198 cp
-f config_current .config
199 $(MAKE
) -C
$(LINUXDIR
) oldconfig dep
203 @echo
"$(current_BUILD_DESC)-$(current_BUILD_NAME)-$(TOMATO_PROFILE_NAME) Profile"
207 # The methodology for making the different builds is to
208 # copy the "base" config file to the "target" config file in
209 # the appropriate directory, and then edit it by removing and
210 # inserting the desired configuration lines.
211 # You can't just delete the "whatever=y" line, you must have
212 # a "...is not set" line, or the make oldconfig will stop and ask
215 # Options for "make bin" :
216 # BUILD_DESC (Std|Lite|Ext|...)
221 # NO_CIFS, NO_SSH, NO_ZEBRA, NO_SAMBA, NO_HTTPS, NO_XXTP, NO_LIBOPT
222 # SAMBA3, OPENVPN, IPV6SUPP, EBTABLES, NTFS, MEDIASRV, BBEXTRAS, USBEXTRAS, BCM57, SLIM
226 if
[ "$(CONFIG_LINUX26)" = "y" ] ||
[ "$(SAMBA3)" = "y" ]; then \
227 sed
-i
"/TCONFIG_SAMBA3/d" $(1); \
228 echo
"TCONFIG_SAMBA3=y" >>$(1); \
230 sed
-i
"/TCONFIG_EMF/d" $(1); \
231 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
232 if
[ "$(SLIM)" = "y" ]; then \
233 echo
"# TCONFIG_EMF is not set" >>$(1); \
235 echo
"TCONFIG_EMF=y" >>$(1); \
238 echo
"# TCONFIG_EMF is not set" >>$(1); \
240 sed
-i
"/TCONFIG_JFFSV1/d" $(1); \
241 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
242 if
[ "$(JFFSv1)" = "y" ]; then \
243 echo
"TCONFIG_JFFSV1=y" >>$(1); \
245 echo
"# TCONFIG_JFFSV1 is not set" >>$(1); \
248 echo
"TCONFIG_JFFSV1=y" >>$(1); \
250 if
[ "$(USB)" = "USB" ]; then \
251 sed
-i
"/TCONFIG_USB is not set/d" $(1); \
252 echo
"TCONFIG_USB=y" >>$(1); \
253 if
[ "$(USBEXTRAS)" = "y" ]; then \
254 sed
-i
"/TCONFIG_USB_EXTRAS/d" $(1); \
255 echo
"TCONFIG_USB_EXTRAS=y" >>$(1); \
257 if
[ "$(NTFS)" = "y" ]; then \
258 sed
-i
"/TCONFIG_NTFS/d" $(1); \
259 echo
"TCONFIG_NTFS=y" >>$(1); \
261 if
[ "$(MEDIASRV)" = "y" ]; then \
262 sed
-i
"/TCONFIG_MEDIA_SERVER/d" $(1); \
263 echo
"TCONFIG_MEDIA_SERVER=y" >>$(1); \
266 sed
-i
"/TCONFIG_USB=y/d" $(1); \
267 echo
"# TCONFIG_USB is not set" >>$(1); \
269 if
[ "$(NO_SAMBA)" = "y" ]; then \
270 sed
-i
"/TCONFIG_SAMBASRV/d" $(1); \
271 echo
"# TCONFIG_SAMBASRV is not set" >>$(1); \
273 if
[ "$(NO_ZEBRA)" = "y" ]; then \
274 sed
-i
"/TCONFIG_ZEBRA/d" $(1); \
275 echo
"# TCONFIG_ZEBRA is not set" >>$(1); \
277 if
[ "$(NO_JFFS)" = "y" ]; then \
278 sed
-i
"/TCONFIG_JFFS2/d" $(1); \
279 echo
"# TCONFIG_JFFS2 is not set" >>$(1); \
280 sed
-i
"/TCONFIG_JFFSV1/d" $(1); \
281 echo
"# TCONFIG_JFFSV1 is not set" >>$(1); \
283 if
[ "$(NO_CIFS)" = "y" ]; then \
284 sed
-i
"/TCONFIG_CIFS/d" $(1); \
285 echo
"# TCONFIG_CIFS is not set" >>$(1); \
287 if
[ "$(NO_SSH)" = "y" ]; then \
288 sed
-i
"/TCONFIG_SSH/d" $(1); \
289 echo
"# TCONFIG_SSH is not set" >>$(1); \
291 if
[ "$(NO_HTTPS)" = "y" ]; then \
292 sed
-i
"/TCONFIG_HTTPS/d" $(1); \
293 echo
"# TCONFIG_HTTPS is not set" >>$(1); \
295 if
[ "$(NO_XXTP)" = "y" ]; then \
296 sed
-i
"/TCONFIG_L2TP/d" $(1); \
297 echo
"# TCONFIG_L2TP is not set" >>$(1); \
298 sed
-i
"/TCONFIG_PPTP/d" $(1); \
299 echo
"# TCONFIG_PPTP is not set" >>$(1); \
301 if
[ "$(NO_LIBOPT)" = "y" ]; then \
302 sed
-i
"/TCONFIG_OPTIMIZE_SHARED_LIBS/d" $(1); \
303 echo
"# TCONFIG_OPTIMIZE_SHARED_LIBS is not set" >>$(1); \
305 if
[ "$(EBTABLES)" = "y" ]; then \
306 sed
-i
"/TCONFIG_EBTABLES/d" $(1); \
307 echo
"TCONFIG_EBTABLES=y" >>$(1); \
309 if
[ "$(IPV6SUPP)" = "y" ]; then \
310 sed
-i
"/TCONFIG_IPV6/d" $(1); \
311 echo
"TCONFIG_IPV6=y" >>$(1); \
313 if
[ "$(OPENVPN)" = "y" ]; then \
314 sed
-i
"/TCONFIG_LZO/d" $(1); \
315 echo
"TCONFIG_LZO=y" >>$(1); \
316 sed
-i
"/TCONFIG_OPENVPN/d" $(1); \
317 echo
"TCONFIG_OPENVPN=y" >>$(1); \
318 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
319 sed
-i
"/TCONFIG_FTP_SSL/d" $(1); \
320 echo
"TCONFIG_FTP_SSL=y" >>$(1); \
326 define BusyboxOptions
328 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
329 sed
-i
"/CONFIG_FEATURE_2_4_MODULES/d" $(1); \
330 echo
"# CONFIG_FEATURE_2_4_MODULES is not set" >>$(1); \
331 sed
-i
"/CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT/d" $(1); \
332 echo
"CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y" >>$(1); \
333 sed
-i
"/CONFIG_FEATURE_DEVFS/d" $(1); \
334 echo
"# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
335 sed
-i
"/CONFIG_MKNOD/d" $(1); \
336 echo
"CONFIG_MKNOD=y" >>$(1); \
337 sed
-i
"/CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE/d" $(1); \
338 echo
"CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=512" >>$(1); \
340 if
[ "$(NO_CIFS)" = "y" ]; then \
341 sed
-i
"/CONFIG_FEATURE_MOUNT_CIFS/d" $(1); \
342 echo
"# CONFIG_FEATURE_MOUNT_CIFS is not set" >>$(1); \
344 if
[ "$(BBEXTRAS)" = "y" ]; then \
345 sed
-i
"/CONFIG_SENDMAIL/d" $(1); \
346 echo
"CONFIG_SENDMAIL=y" >>$(1); \
347 sed
-i
"/CONFIG_FEATURE_SORT_BIG/d" $(1); \
348 echo
"CONFIG_FEATURE_SORT_BIG=y" >>$(1); \
349 sed
-i
"/CONFIG_FTPPUT/d" $(1); \
350 echo
"CONFIG_FTPPUT=y" >>$(1); \
351 sed
-i
"/CONFIG_FTPGET/d" $(1); \
352 echo
"CONFIG_FTPGET=y" >>$(1); \
353 sed
-i
"/CONFIG_CLEAR/d" $(1); \
354 echo
"CONFIG_CLEAR=y" >>$(1); \
355 sed
-i
"/CONFIG_NICE/d" $(1); \
356 echo
"CONFIG_NICE=y" >>$(1); \
357 sed
-i
"/CONFIG_SETCONSOLE/d" $(1); \
358 echo
"CONFIG_SETCONSOLE=y" >>$(1); \
360 if
[ "$(USB)" = "USB" ]; then \
361 if
[ "$(USBEXTRAS)" = "y" ]; then \
362 sed
-i
"/CONFIG_E2FSCK/d" $(1); \
363 echo
"CONFIG_E2FSCK=y" >>$(1); \
364 sed
-i
"/CONFIG_MKE2FS/d" $(1); \
365 echo
"CONFIG_MKE2FS=y" >>$(1); \
366 sed
-i
"/CONFIG_FDISK/d" $(1); \
367 echo
"CONFIG_FDISK=y" >>$(1); \
368 sed
-i
"/CONFIG_FEATURE_FDISK_WRITABLE/d" $(1); \
369 echo
"CONFIG_FEATURE_FDISK_WRITABLE=y" >>$(1); \
370 sed
-i
"/CONFIG_MKFS_VFAT/d" $(1); \
371 echo
"CONFIG_MKFS_VFAT=y" >>$(1); \
372 sed
-i
"/CONFIG_MKSWAP/d" $(1); \
373 echo
"CONFIG_MKSWAP=y" >>$(1); \
374 sed
-i
"/CONFIG_FLOCK/d" $(1); \
375 echo
"CONFIG_FLOCK=y" >>$(1); \
376 sed
-i
"/CONFIG_FSYNC/d" $(1); \
377 echo
"CONFIG_FSYNC=y" >>$(1); \
378 sed
-i
"/CONFIG_UNZIP/d" $(1); \
379 echo
"CONFIG_UNZIP=y" >>$(1); \
380 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
381 sed
-i
"/CONFIG_LSUSB/d" $(1); \
382 echo
"CONFIG_LSUSB=y" >>$(1); \
383 sed
-i
"/CONFIG_FEATURE_WGET_STATUSBAR/d" $(1); \
384 echo
"CONFIG_FEATURE_WGET_STATUSBAR=y" >>$(1); \
385 sed
-i
"/CONFIG_FEATURE_VERBOSE_USAGE/d" $(1); \
386 echo
"CONFIG_FEATURE_VERBOSE_USAGE=y" >>$(1); \
390 sed
-i
"/CONFIG_FEATURE_MOUNT_LOOP/d" $(1); \
391 echo
"# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1); \
392 sed
-i
"/CONFIG_FEATURE_DEVFS/d" $(1); \
393 echo
"# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
394 sed
-i
"/CONFIG_FEATURE_MOUNT_LABEL/d" $(1); \
395 echo
"# CONFIG_FEATURE_MOUNT_LABEL is not set" >>$(1); \
396 sed
-i
"/CONFIG_FEATURE_MOUNT_FSTAB/d" $(1); \
397 echo
"# CONFIG_FEATURE_MOUNT_FSTAB is not set" >>$(1); \
398 sed
-i
"/CONFIG_VOLUMEID/d" $(1); \
399 echo
"# CONFIG_VOLUMEID is not set" >>$(1); \
400 sed
-i
"/CONFIG_BLKID/d" $(1); \
401 echo
"# CONFIG_BLKID is not set" >>$(1); \
402 sed
-i
"/CONFIG_SWAPONOFF/d" $(1); \
403 echo
"# CONFIG_SWAPONOFF is not set" >>$(1); \
404 sed
-i
"/CONFIG_CHROOT/d" $(1); \
405 echo
"# CONFIG_CHROOT is not set" >>$(1); \
406 sed
-i
"/CONFIG_PIVOT_ROOT/d" $(1); \
407 echo
"# CONFIG_PIVOT_ROOT is not set" >>$(1); \
408 sed
-i
"/CONFIG_TRUE/d" $(1); \
409 echo
"# CONFIG_TRUE is not set" >>$(1); \
411 if
[ "$(IPV6SUPP)" = "y" ]; then \
412 sed
-i
"/CONFIG_FEATURE_IPV6/d" $(1); \
413 echo
"CONFIG_FEATURE_IPV6=y" >>$(1); \
414 sed
-i
"/CONFIG_PING6/d" $(1); \
415 echo
"CONFIG_PING6=y" >>$(1); \
416 sed
-i
"/CONFIG_TRACEROUTE6/d" $(1); \
417 echo
"CONFIG_TRACEROUTE6=y" >>$(1); \
418 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
419 sed
-i
"/CONFIG_FEATURE_UDHCP_RFC5969/d" $(1); \
420 echo
"CONFIG_FEATURE_UDHCP_RFC5969=y" >>$(1); \
423 if
[ "$(SLIM)" = "y" ]; then \
424 sed
-i
"/CONFIG_AWK/d" $(1); \
425 echo
"# CONFIG_AWK is not set" >>$(1); \
426 sed
-i
"/CONFIG_BASENAME/d" $(1); \
427 echo
"# CONFIG_BASENAME is not set" >>$(1); \
428 sed
-i
"/CONFIG_FEATURE_DEVFS/d" $(1); \
429 echo
"# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
430 sed
-i
"/CONFIG_BLKID/d" $(1); \
431 echo
"# CONFIG_BLKID is not set" >>$(1); \
432 sed
-i
"/CONFIG_TELNET=y/d" $(1); \
433 echo
"# CONFIG_TELNET is not set" >>$(1); \
434 sed
-i
"/CONFIG_ARPING/d" $(1); \
435 echo
"# CONFIG_ARPING is not set" >>$(1); \
436 sed
-i
"/CONFIG_FEATURE_LS_COLOR/d" $(1); \
437 echo
"# CONFIG_FEATURE_LS_COLOR is not set" >>$(1); \
439 sed
-i
"/CONFIG_FEATURE_LS_COLOR/d" $(1); \
440 echo
"CONFIG_FEATURE_LS_COLOR=y" >>$(1); \
441 sed
-i
"/CONFIG_FEATURE_LS_COLOR_IS_DEFAULT/d" $(1); \
442 echo
"CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y" >>$(1); \
449 sed
-i
"/CONFIG_NVRAM_SIZE/d" $(1); \
450 echo
"CONFIG_NVRAM_SIZE="$(NVRAM_SIZE
) >>$(1); \
451 sed
-i
"/CONFIG_CC_OPTIMIZE_FOR_SIZE/d" $(1); \
452 if
[ "$(KERN_SIZE_OPT)" = "y" ]; then \
453 echo
"CONFIG_CC_OPTIMIZE_FOR_SIZE=y" >>$(1); \
455 echo
"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set" >>$(1); \
457 if
[ "$(CONFIG_LINUX26)" = "y" ] && [ "$(MIPS32)" = "r2" ]; then \
458 sed
-i
"/CONFIG_CPU_MIPS32_R1/d" $(1); \
459 echo
"# CONFIG_CPU_MIPS32_R1 is not set" >>$(1); \
460 sed
-i
"/CONFIG_CPU_MIPS32_R2/d" $(1); \
461 echo
"CONFIG_CPU_MIPS32_R2=y" >>$(1); \
462 sed
-i
"/CONFIG_CPU_MIPSR1/d" $(1); \
463 echo
"CONFIG_CPU_MIPSR2=y" >>$(1); \
465 if
[ "$(USB)" = "" ]; then \
466 sed
-i
"/CONFIG_EFI_PARTITION/d" $(1); \
467 echo
"# CONFIG_EFI_PARTITION is not set" >>$(1); \
469 if
[ "$(IPV6SUPP)" = "y" ]; then \
470 sed
-i
"/CONFIG_IPV6 is not set/d" $(1); \
471 echo
"CONFIG_IPV6=y" >>$(1); \
472 sed
-i
"/CONFIG_IP6_NF_IPTABLES/d" $(1); \
473 echo
"CONFIG_IP6_NF_IPTABLES=y" >>$(1); \
474 sed
-i
"/CONFIG_IP6_NF_MATCH_RT/d" $(1); \
475 echo
"CONFIG_IP6_NF_MATCH_RT=y" >>$(1); \
476 sed
-i
"/CONFIG_IP6_NF_FILTER/d" $(1); \
477 echo
"CONFIG_IP6_NF_FILTER=m" >>$(1); \
478 sed
-i
"/CONFIG_IP6_NF_TARGET_LOG/d" $(1); \
479 echo
"CONFIG_IP6_NF_TARGET_LOG=m" >>$(1); \
480 sed
-i
"/CONFIG_IP6_NF_TARGET_REJECT/d" $(1); \
481 echo
"CONFIG_IP6_NF_TARGET_REJECT=m" >>$(1); \
482 sed
-i
"/CONFIG_IP6_NF_MANGLE/d" $(1); \
483 echo
"CONFIG_IP6_NF_MANGLE=m" >>$(1); \
484 if
[ "$(CONFIG_LINUX26)" = "y" ]; then \
485 sed
-i
"/CONFIG_NF_CONNTRACK_IPV6/d" $(1); \
486 echo
"CONFIG_NF_CONNTRACK_IPV6=m" >>$(1); \
487 sed
-i
"/CONFIG_NETFILTER_XT_MATCH_HL/d" $(1); \
488 echo
"CONFIG_NETFILTER_XT_MATCH_HL=m" >>$(1); \
489 sed
-i
"/CONFIG_IPV6_ROUTER_PREF/d" $(1); \
490 echo
"CONFIG_IPV6_ROUTER_PREF=y" >>$(1); \
491 sed
-i
"/CONFIG_IPV6_SIT/d" $(1); \
492 echo
"CONFIG_IPV6_SIT=m" >>$(1); \
493 sed
-i
"/CONFIG_IPV6_SIT_6RD/d" $(1); \
494 echo
"CONFIG_IPV6_SIT_6RD=y" >>$(1); \
495 sed
-i
"/CONFIG_IPV6_MULTIPLE_TABLES/d" $(1); \
496 echo
"CONFIG_IPV6_MULTIPLE_TABLES=y" >>$(1); \
497 sed
-i
"/CONFIG_IP6_NF_RAW/d" $(1); \
498 echo
"CONFIG_IP6_NF_RAW=m" >>$(1); \
499 sed
-i
"/CONFIG_IPV6_MROUTE/d" $(1); \
500 echo
"CONFIG_IPV6_MROUTE=y" >>$(1); \
501 sed
-i
"/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
502 echo
"CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
504 sed
-i
"/CONFIG_IP6_NF_CONNTRACK/d" $(1); \
505 echo
"CONFIG_IP6_NF_CONNTRACK=m" >>$(1); \
506 sed
-i
"/CONFIG_IP6_NF_MATCH_HL/d" $(1); \
507 echo
"CONFIG_IP6_NF_MATCH_HL=m" >>$(1); \
508 sed
-i
"/CONFIG_IP6_NF_FTP/d" $(1); \
509 echo
"CONFIG_IP6_NF_FTP=m" >>$(1); \
510 sed
-i
"/CONFIG_IP6_NF_MATCH_LIMIT/d" $(1); \
511 echo
"CONFIG_IP6_NF_MATCH_LIMIT=m" >>$(1); \
512 sed
-i
"/CONFIG_IP6_NF_MATCH_CONDITION/d" $(1); \
513 echo
"CONFIG_IP6_NF_MATCH_CONDITION=m" >>$(1); \
514 sed
-i
"/CONFIG_IP6_NF_MATCH_MAC/d" $(1); \
515 echo
"CONFIG_IP6_NF_MATCH_MAC=m" >>$(1); \
516 sed
-i
"/CONFIG_IP6_NF_MATCH_MULTIPORT/d" $(1); \
517 echo
"CONFIG_IP6_NF_MATCH_MULTIPORT=m" >>$(1); \
518 sed
-i
"/CONFIG_IP6_NF_MATCH_MARK/d" $(1); \
519 echo
"CONFIG_IP6_NF_MATCH_MARK=m" >>$(1); \
520 sed
-i
"/CONFIG_IP6_NF_MATCH_LENGTH/d" $(1); \
521 echo
"CONFIG_IP6_NF_MATCH_LENGTH=m" >>$(1); \
522 sed
-i
"/CONFIG_IP6_NF_MATCH_STATE/d" $(1); \
523 echo
"CONFIG_IP6_NF_MATCH_STATE=m" >>$(1); \
524 sed
-i
"/CONFIG_IP6_NF_TARGET_MARK/d" $(1); \
525 echo
"CONFIG_IP6_NF_TARGET_MARK=m" >>$(1); \
526 sed
-i
"/CONFIG_IP6_NF_TARGET_TCPMSS/d" $(1); \
527 echo
"CONFIG_IP6_NF_TARGET_TCPMSS=m" >>$(1); \
528 sed
-i
"/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
529 echo
"CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
532 sed
-i
"/CONFIG_BCM57XX/d" $(1); \
533 if
[ "$(BCM57)" = "y" ]; then \
534 echo
"CONFIG_BCM57XX=m" >>$(1); \
536 echo
"# CONFIG_BCM57XX is not set" >>$(1); \
538 if
[ "$(CONFIG_LINUX26)" = "y" ] && [ "$(EBTABLES)" = "y" ]; then \
539 sed
-i
"/CONFIG_BRIDGE_NF_EBTABLES/d" $(1); \
540 echo
"CONFIG_BRIDGE_NF_EBTABLES=m" >>$(1); \
541 if
[ "$(IPV6SUPP)" = "y" ]; then \
542 sed
-i
"/CONFIG_BRIDGE_EBT_IP6/d" $(1); \
543 echo
"CONFIG_BRIDGE_EBT_IP6=m" >>$(1); \
552 @echo
$@
" is not a valid target!"
555 @cp router
/config_base router
/config_
$(lowercase_B
)
556 @cp router
/busybox
/config_base router
/busybox
/config_
$(lowercase_B
)
557 @cp
$(LINUXDIR
)/config_base
$(LINUXDIR
)/config_
$(lowercase_B
)
559 $(call RouterOptions
, router
/config_
$(lowercase_B
))
560 $(call KernelConfig
, $(LINUXDIR
)/config_
$(lowercase_B
))
561 $(call BusyboxOptions
, router
/busybox
/config_
$(lowercase_B
))
563 @
$(MAKE
) setprofile N
=$(TPROFILE
) B
=$(B
) DESC
="$(BUILD_DESC)" USB
="$(USB)"
566 ## Make the "normal" build
568 @
$(MAKE
) bin B
=A BUILD_DESC
="Std" USB
="USB"
570 ## Make the "normal but without SSH" build
572 @
$(MAKE
) bin NO_SSH
=y B
=B BUILD_DESC
="No SSH" USB
="USB"
574 ## Make the "normal but without CIFS" build
576 @
$(MAKE
) bin NO_CIFS
=y B
=C BUILD_DESC
="No CIFS" USB
="USB"
578 ## Make the "normal but without SAMBA" (Lite) build
580 ifeq ($(CONFIG_LINUX26
),y
)
581 @
$(MAKE
) bin NO_SAMBA
=y SLIM
=y NO_CIFS
=y NO_JFFS
=y NO_ZEBRA
=y B
=D BUILD_DESC
="Lite" USB
="USB"
583 @
$(MAKE
) bin NO_SAMBA
=y SLIM
=y B
=D BUILD_DESC
="Lite" USB
="USB"
586 ## Make the "normal (with NTFS support) + VPN" build
588 ifeq ($(CONFIG_LINUX26
),y
)
589 @
$(MAKE
) bin OPENVPN
=y NTFS
=y BBEXTRAS
=y USBEXTRAS
=y EBTABLES
=y NO_LIBOPT
=y MEDIASRV
=y IPV6SUPP
=y B
=E BUILD_DESC
="$(VPN)" USB
="USB"
591 @
$(MAKE
) bin OPENVPN
=y NTFS
=y B
=E BUILD_DESC
="$(VPN)" USB
="USB"
594 ## Make the "normal with Extras and NTFS" build
596 ifeq ($(CONFIG_LINUX26
),y
)
597 @
$(MAKE
) bin NTFS
=y BBEXTRAS
=y USBEXTRAS
=y EBTABLES
=y NO_LIBOPT
=y MEDIASRV
=y IPV6SUPP
=y B
=M BUILD_DESC
="Ext" USB
="USB"
599 @
$(MAKE
) bin NTFS
=y BBEXTRAS
=y USBEXTRAS
=y B
=M BUILD_DESC
="Ext" USB
="USB"
602 ## Make the "No USB" build
604 ifeq ($(CONFIG_LINUX26
),y
)
605 @
$(MAKE
) bin JFFSv1
=y
$(if
$(filter r2
, $(MIPS32
)),,BCM57
=y
) B
=S BUILD_DESC
="Std" USB
=""
607 @
$(MAKE
) bin BBEXTRAS
=y BCM57
=y B
=S BUILD_DESC
="Std" USB
=""
610 ## Make the "Mini: no USB, no CIFS, no Zebra" build - targeted for Netgear routers
612 @
$(MAKE
) bin JFFSv1
=y NO_CIFS
=y NO_ZEBRA
=y SLIM
=y B
=F BUILD_DESC
="Mini" USB
=""
614 ifeq ($(CONFIG_LINUX26
),y
)
615 ## Make the "No USB with IPv6, no Zebra" build - for 4MB routers
617 @
$(MAKE
) bin JFFSv1
=y NO_CIFS
=y NO_ZEBRA
=y IPV6SUPP
=y B
=I BUILD_DESC
="MiniIPv6" USB
=""
620 ## Make the "VPN witn no USB support" build
622 ifeq ($(CONFIG_LINUX26
),y
)
623 @
$(MAKE
) bin OPENVPN
=y NO_JFFS
=y B
=V BUILD_DESC
="$(VPN)" USB
=""
625 @
$(MAKE
) bin OPENVPN
=y BBEXTRAS
=y BCM57
=y B
=V BUILD_DESC
="$(VPN)" USB
=""
628 ## Make Mips32r2 builds
651 @
$(MAKE
) r2m ND
=E3000 NVRAM_SIZE
=60
654 @
$(MAKE
) r2e ND
=E3000 NVRAM_SIZE
=60
657 @
$(MAKE
) bin MIPS32
=r2 B
=S USB
="" ND
=E2000 NVRAM_SIZE
=60 BBEXTRAS
=y EBTABLES
=y NO_LIBOPT
=y IPV6SUPP
=y BUILD_DESC
="Std"
660 @
$(MAKE
) bin MIPS32
=r2 B
=V USB
="" ND
=E2000 NVRAM_SIZE
=60 BBEXTRAS
=y EBTABLES
=y NO_LIBOPT
=y IPV6SUPP
=y OPENVPN
=y BUILD_DESC
="$(VPN)"
663 echo
'#ifndef TOMATO_PROFILE' > router
/shared
/tomato_profile.h
664 echo
'#define TOMATO_$(N) 1' >> router
/shared
/tomato_profile.h
665 echo
'#define PROFILE_G 1' >> router
/shared
/tomato_profile.h
666 echo
'#define PROFILE_N 2' >> router
/shared
/tomato_profile.h
667 echo
'#define TOMATO_PROFILE PROFILE_$(N)' >> router
/shared
/tomato_profile.h
668 echo
'#define TOMATO_PROFILE_NAME "$(N)"' >> router
/shared
/tomato_profile.h
669 echo
'#define TOMATO_BUILD_NAME "$(B)"' >> router
/shared
/tomato_profile.h
670 echo
'#define TOMATO_BUILD_DESC "$(DESC)"' >> router
/shared
/tomato_profile.h
671 echo
'#ifndef CONFIG_NVRAM_SIZE' >> router
/shared
/tomato_profile.h
672 echo
'#define CONFIG_NVRAM_SIZE $(NVRAM_SIZE)' >> router
/shared
/tomato_profile.h
673 echo
'#endif' >> router
/shared
/tomato_profile.h
674 echo
'#endif' >> router
/shared
/tomato_profile.h
676 echo
'TOMATO_$(N) = 1' > tomato_profile.mak
677 echo
'PROFILE_G = 1' >> tomato_profile.mak
678 echo
'PROFILE_N = 2' >> tomato_profile.mak
679 echo
'TOMATO_PROFILE = $$(PROFILE_$(N))' >> tomato_profile.mak
680 echo
'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
681 echo
'TOMATO_BUILD = "$(B)"' >> tomato_profile.mak
682 echo
'TOMATO_BUILD_NAME = "$(B)"' >> tomato_profile.mak
683 echo
'TOMATO_BUILD_DESC = "$(DESC)"' >> tomato_profile.mak
684 echo
'TOMATO_PROFILE_L = $(lowercase_N)' >> tomato_profile.mak
685 echo
'TOMATO_PROFILE_U = $(uppercase_N)' >> tomato_profile.mak
686 echo
'TOMATO_BUILD_USB = "$(USB)"' >> tomato_profile.mak
688 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))' >> tomato_profile.mak
690 # Note that changes to variables in tomato_profile.mak don't
691 # get propogated to this invocation of make!
693 @echo
"Using $(N) profile, $(B) build config."
697 rm -f config_current
; \
698 ln
-s config_
$(lowercase_B
) config_current
; \
699 cp
-f config_current .config
701 @cd router
/busybox
&& \
702 rm -f config_current
; \
703 ln
-s config_
$(lowercase_B
) config_current
; \
704 cp config_current .config
707 rm -f config_current
; \
708 ln
-s config_
$(lowercase_B
) config_current
; \
709 cp config_current .config
711 @
$(MAKE
) -C router oldconfig
714 @echo
"a A build (standard)"
715 @echo
"b B build (standard minus SSH)"
716 @echo
"c C build (standard minus CIFS)"
717 @echo
"d D build (standard minus Samba server)"
718 @echo
"m M build (standard plus extra utilities and NTFS support)"
719 ifeq ($(CONFIG_LINUX26
),y
)
720 @echo
"e E build (standard plus VPN, extra utilities and NTFS support)"
721 @echo
"i I build (IPv6 with no USB support minus CIFS and RIPv1/2)"
723 @echo
"e E build (standard plus VPN and NTFS support)"
725 @echo
"s S build (no USB support)"
726 @echo
"f F build (no USB support minus CIFS and RIPv1/2)"
727 @echo
"v V build (VPN with no USB support)"
728 ifeq ($(CONFIG_LINUX26
),y
)
729 @echo
"r2m MIPS Release 2 M build (standard plus extras)"
730 @echo
"r2e MIPS Release 2 E build (standard plus VPN and extras)"
731 @echo
"r2v MIPS Release 2 V build (VPN with no USB support)"
732 @echo
"r2s MIPS Release 2 S build (no USB support)"
733 @echo
"r2i MIPS Release 2 I build (IPv6 with no USB support minus CIFS and RIPv1/2)"
734 @echo
"r2f MIPS Release 2 F build (no USB support minus CIFS and RIPv1/2)"
735 @echo
"e3000 Linksys E3000 build (standard plus extras)"
736 @echo
"e3000v Linksys E3000 build (standard plus VPN and extras)"
737 @echo
"e2000 Linksys E2000 build (no USB support)"
738 @echo
"e2000v Linksys E2000 build (VPN with no USB support)"
740 @echo
"..etc.. other build configs"
741 @echo
"clean -C router clean"
742 @echo
"cleanimage rm -rf image"
743 @echo
"cleantools clean btools, mksquashfs"
744 @echo
"cleankernel -C Linux distclean (but preserves .config)"
745 @echo
"distclean distclean of Linux & busybox (but preserve .configs)"
746 @echo
"prepk -C Linux oldconfig dep"
748 .PHONY
: all clean distclean cleanimage cleantools cleankernel prepk what setprofile help
749 .PHONY
: a b c d m Makefile allversions tomato_profile.mak