Support for Village Telco Mesh Potato 2 (which is based on Dragino 2 hardware)
[oweals/u-boot_mod.git] / u-boot / Makefile
1 #
2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # See file CREDITS for list of people who contributed to this
6 # project.
7 #
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 # MA 02111-1307 USA
22 #
23
24 VERSION                 = 1
25 PATCHLEVEL              = 1
26 SUBLEVEL                = 4
27 EXTRAVERSION    =
28 U_BOOT_VERSION  = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
29 VERSION_FILE    = include/version_autogenerated.h
30
31 HOSTARCH := $(shell uname -m | \
32         sed -e s/i.86/i386/ \
33             -e s/sun4u/sparc64/ \
34             -e s/arm.*/arm/ \
35             -e s/sa110/arm/ \
36             -e s/powerpc/ppc/ \
37             -e s/macppc/ppc/)
38
39 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
40             sed -e 's/\(cygwin\).*/cygwin/')
41
42 export  HOSTARCH HOSTOS
43
44 # Deal with colliding definitions from tcsh etc.
45 VENDOR=
46
47 #########################################################################
48
49 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
50 export  TOPDIR
51
52 ifdef COMPRESSED_UBOOT
53         ifndef CONFIG_SKIP_LOWLEVEL_INIT
54 COMPRESSED_UBOOT = 1
55 export export COMPRESSED_UBOOT
56         endif
57 endif
58
59 ifeq (include/config.mk,$(wildcard include/config.mk))
60 # load ARCH, BOARD, and CPU configuration
61 include include/config.mk
62 export  ARCH CPU BOARD VENDOR SOC
63 ifndef CROSS_COMPILE
64 ifeq ($(HOSTARCH),ppc)
65 CROSS_COMPILE =
66 else
67 ifeq ($(ARCH),ppc)
68 CROSS_COMPILE = powerpc-linux-
69 endif
70 ifeq ($(ARCH),arm)
71 CROSS_COMPILE = arm-linux-
72 endif
73 ifeq ($(ARCH),i386)
74 ifeq ($(HOSTARCH),i386)
75 CROSS_COMPILE =
76 else
77 CROSS_COMPILE = i386-linux-
78 endif
79 endif
80 ifeq ($(ARCH),mips)
81 CROSS_COMPILE = mips-linux-
82 endif
83 ifeq ($(ARCH),nios)
84 CROSS_COMPILE = nios-elf-
85 endif
86 ifeq ($(ARCH),nios2)
87 CROSS_COMPILE = nios2-elf-
88 endif
89 ifeq ($(ARCH),m68k)
90 CROSS_COMPILE = m68k-elf-
91 endif
92 ifeq ($(ARCH),microblaze)
93 CROSS_COMPILE = mb-
94 endif
95 ifeq ($(ARCH),blackfin)
96 CROSS_COMPILE = bfin-elf-
97 endif
98 endif
99 endif
100
101 export  CROSS_COMPILE
102
103 # load other configuration
104 include $(TOPDIR)/config.mk
105
106
107 #########################################################################
108 # U-Boot objects....order is important (i.e. start must be first)
109 OBJS  = cpu/$(CPU)/start.o
110
111 ifdef COMPRESSED_UBOOT
112         ifndef CONFIG_SKIP_LOWLEVEL_INIT
113 OBJS_BOOTSTRAP  = cpu/$(CPU)/start_bootstrap.o
114         endif
115 endif
116
117 LIBS  = lib_generic/libgeneric.a
118 LIBS += common/libcommon.a
119 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
120 LIBS += cpu/$(CPU)/lib$(CPU).a
121
122 ifdef SOC
123 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
124 endif
125
126 LIBS += lib_$(ARCH)/lib$(ARCH).a
127 LIBS += drivers/libdrivers.a
128 LIBS += net/libnet.a
129 LIBS += rtc/librtc.a
130 LIBS += httpd/libhttpd.a
131 LIBS += $(BOARDLIBS)
132
133 ifdef COMPRESSED_UBOOT
134         ifndef CONFIG_SKIP_LOWLEVEL_INIT
135 LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a 
136 LIBS_BOOTSTRAP += board/$(BOARDDIR)/lib$(BOARD).a 
137 LIBS_BOOTSTRAP += cpu/$(CPU)/lib$(CPU).a
138 LIBS_BOOTSTRAP += cpu/$(CPU)/$(SOC)/lib$(SOC).a
139         endif
140 endif
141
142 .PHONY : $(LIBS)
143
144 ifdef COMPRESSED_UBOOT
145         ifndef CONFIG_SKIP_LOWLEVEL_INIT
146 .PHONY : $(LIBS_BOOTSTRAP)
147         endif
148 endif
149
150 # Add GCC lib
151 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
152
153 # The "tools" are needed early, so put this first
154 # Don't include stuff already done in $(LIBS)
155 SUBDIRS = tools
156
157 .PHONY : $(SUBDIRS)
158
159 #########################################################################
160 #########################################################################
161
162 ALL = u-boot.srec u-boot.bin System.map
163
164 ifdef COMPRESSED_UBOOT
165 ifndef CONFIG_SKIP_LOWLEVEL_INIT
166 all:    $(ALL) tuboot.bin
167 else
168 all:    $(ALL) u-boot.img
169 endif
170 else
171 all:    $(ALL) u-boot.img
172 endif
173
174 u-boot.hex:     u-boot
175         $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
176
177 u-boot.srec:    u-boot
178         $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
179
180 u-boot.bin:     u-boot
181         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
182
183 u-boot.img:     u-boot.bin
184         @/bin/echo -e "\e[32m> Preparing U-Boot image \"u-boot.img\"...\e[0m"
185         ./tools/mkimage -A $(ARCH) -T firmware -C none \
186                 -a $(TEXT_BASE) -e 0 \
187                 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
188                 sed -e 's/"[     ]*$$/ for $(BOARD) board"/') \
189                 -d $< $@
190
191 u-boot.dis:     u-boot
192         $(OBJDUMP) -d $< > $@
193
194 u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
195         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
196                 $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
197                 --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
198                 -Map u-boot.map -o u-boot
199
200 $(LIBS):
201         $(MAKE) -C `dirname $@`
202
203 $(SUBDIRS):
204         $(MAKE) -C $@ all
205
206 ifdef COMPRESSED_UBOOT
207 ifndef CONFIG_SKIP_LOWLEVEL_INIT
208 LZMA = $(BUILD_TOPDIR)/host_util/lzma
209
210 tuboot.bin:     System.map bootstrap.bin u-boot.lzimg   
211         @cat bootstrap.bin > $@
212         @cat u-boot.lzimg >> $@
213
214 u-boot.lzimg: $(obj)u-boot.bin System.map
215         @rm -rf u-boot.bin.lzma
216         $(LZMA) --best --keep $(obj)u-boot.bin
217         @/bin/echo -e "\e[32m> Preparing compressed U-Boot image \"u-boot.lzimg\"...\e[0m"
218         ./tools/mkimage -A mips -T firmware -C lzma \
219                 -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
220                 -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
221                 -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@
222
223 bootstrap.bin:  bootstrap
224         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
225
226 bootstrap:      depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
227         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
228                 $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
229                 --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
230                 -Map bootstrap.map -o bootstrap
231
232 $(LIBS_BOOTSTRAP):
233         $(MAKE) -C `dirname $@`
234 endif
235 endif
236
237 version:
238         @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
239                 echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
240                 echo "\"" >> $(VERSION_FILE)
241
242 gdbtools:
243         $(MAKE) -C tools/gdb || exit 1
244
245 depend dep:
246         @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
247
248 tags:
249         ctags -w `find $(SUBDIRS) include \
250                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
251                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
252                 net disk rtc dtt drivers drivers/sk98lin common \
253                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
254
255 etags:
256         etags -a `find $(SUBDIRS) include \
257                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
258                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
259                 net disk rtc dtt drivers drivers/sk98lin common \
260                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
261
262 System.map:     u-boot
263         @$(NM) $< | \
264                 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
265                 sort > System.map
266
267 #########################################################################
268 else
269 all install u-boot u-boot.srec depend dep:
270         @echo "System not configured - see README" >&2
271         @ exit 1
272 endif
273
274 #########################################################################
275
276 unconfig:
277         @rm -f include/config.h include/config.mk board/*/config.tmp
278
279 #========================================================================
280 # MIPS
281 #========================================================================
282 #########################################################################
283 ## MIPS32 AR7100 (24K)
284 #########################################################################
285 common_config :
286         @ >include/config.h
287
288 ifdef CONFIG_BOOTDELAY
289         @echo "#define CONFIG_BOOTDELAY "$(CONFIG_BOOTDELAY)   >> include/config.h
290 endif
291
292 ifdef CFG_PLL_FREQ
293         @echo "#define CFG_PLL_FREQ "$(CFG_PLL_FREQ)           >> include/config.h
294 endif
295
296 ifdef DISABLE_CONSOLE_OUTPUT
297         @echo "#define CONFIG_SILENT_CONSOLE                1" >> include/config.h
298 endif
299
300 ifdef CONFIG_SKIP_LOWLEVEL_INIT
301         @echo "#define CONFIG_SKIP_LOWLEVEL_INIT            1" >> include/config.h
302         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
303 endif
304
305         @echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD        3" >> include/config.h
306         @echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE      5" >> include/config.h
307         @echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE   7" >> include/config.h
308
309         # max delay time for button pressing
310         @echo "#define CONFIG_MAX_BUTTON_PRESSING          10" >> include/config.h
311
312         # don't show info about console (in, out, err...)
313         @echo "#define CFG_CONSOLE_INFO_QUIET"                 >> include/config.h
314
315 hornet_common_config : common_config
316         @echo "#define CONFIG_AR7240                        1" >> include/config.h
317         @echo "#define CONFIG_MACH_HORNET                   1" >> include/config.h
318         @echo "#define CONFIG_HORNET_1_1_WAR                1" >> include/config.h
319
320 wr703n_config : unconfig hornet_common_config
321         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
322         @echo "#define CONFIG_FOR_TPLINK_WR703N_V1          1" >> include/config.h
323         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
324         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
325         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
326         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
327         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-WR703N\"" >> include/config.h
328         
329         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
330
331 wr720n_v3_CH_config : unconfig hornet_common_config
332         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CH at:' `date` '\e[0m'
333         @echo "#define CONFIG_FOR_TPLINK_WR720N_V3          1" >> include/config.h
334         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
335         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
336         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
337         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
338         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-WR720N v3 CH\"" >> include/config.h
339         
340         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
341
342 wr710n_config : unconfig hornet_common_config
343         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
344         @echo "#define CONFIG_FOR_TPLINK_WR710N_V1          1" >> include/config.h
345         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
346         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
347         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
348         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
349         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-WR710N\"" >> include/config.h
350         
351         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
352
353 mr3020_config : unconfig hornet_common_config
354         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
355         @echo "#define CONFIG_FOR_TPLINK_MR3020_V1          1" >> include/config.h
356         @echo "#define GPIO_INTERNET_LED_BIT               27" >> include/config.h
357         @echo "#define GPIO_INTERNET_LED_ON                 0" >> include/config.h
358         @echo "#define GPIO_WPS_LED_BIT                    26" >> include/config.h
359         @echo "#define GPIO_WPS_LED_ON                      0" >> include/config.h
360         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
361         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
362         @echo "#define GPIO_ETH_LED_BIT                    17" >> include/config.h
363         @echo "#define GPIO_ETH_LED_ON                      0" >> include/config.h
364         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
365         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
366         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-MR3020\"" >> include/config.h
367         
368         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
369
370 mr3040_config : unconfig hornet_common_config
371         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
372         @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2        1" >> include/config.h
373         @echo "#define GPIO_INTERNET_LED_BIT               27" >> include/config.h
374         @echo "#define GPIO_INTERNET_LED_ON                 0" >> include/config.h
375         @echo "#define GPIO_WLAN_LED_BIT                   26" >> include/config.h
376         @echo "#define GPIO_WLAN_LED_ON                     0" >> include/config.h
377         @echo "#define GPIO_ETH_LED_BIT                    17" >> include/config.h
378         @echo "#define GPIO_ETH_LED_ON                      0" >> include/config.h
379         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
380         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
381         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-MR3040\"" >> include/config.h
382         
383         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
384
385 mr10u_config : unconfig hornet_common_config
386         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
387         @echo "#define CONFIG_FOR_TPLINK_MR10U_V1           1" >> include/config.h
388         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
389         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
390         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
391         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
392         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-MR10U\"" >> include/config.h
393         
394         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
395
396 mr13u_config : unconfig hornet_common_config
397         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
398         @echo "#define CONFIG_FOR_TPLINK_MR13U_V1           1" >> include/config.h
399         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
400         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
401         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
402         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
403         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-MR13U\"" >> include/config.h
404         
405         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
406
407 wr740n_v4_config : unconfig hornet_common_config
408         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
409         @echo "#define CONFIG_FOR_TPLINK_WR740N_V4          1" >> include/config.h
410         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
411         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
412         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
413         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
414         @echo "#define GPIO_LAN1_LED_BIT                   14" >> include/config.h
415         @echo "#define GPIO_LAN1_LED_ON                     1" >> include/config.h
416         @echo "#define GPIO_LAN2_LED_BIT                   15" >> include/config.h
417         @echo "#define GPIO_LAN2_LED_ON                     1" >> include/config.h
418         @echo "#define GPIO_LAN3_LED_BIT                   16" >> include/config.h
419         @echo "#define GPIO_LAN3_LED_ON                     1" >> include/config.h
420         @echo "#define GPIO_LAN4_LED_BIT                   17" >> include/config.h
421         @echo "#define GPIO_LAN4_LED_ON                     0" >> include/config.h
422         @echo "#define GPIO_INTERNET_LED_BIT               13" >> include/config.h
423         @echo "#define GPIO_INTERNET_LED_ON                 1" >> include/config.h
424         @echo "#define GPIO_QSS_LED_BIT                     1" >> include/config.h
425         @echo "#define GPIO_QSS_LED_ON                      1" >> include/config.h
426         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
427         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
428         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-WR74xN/D v4\"" >> include/config.h
429         
430         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
431
432 mr3220_v2_config : unconfig hornet_common_config
433         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
434         @echo "#define CONFIG_FOR_TPLINK_MR3220_V2          1" >> include/config.h
435         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
436         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
437         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
438         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
439         @echo "#define GPIO_LAN1_LED_BIT                   14" >> include/config.h
440         @echo "#define GPIO_LAN1_LED_ON                     1" >> include/config.h
441         @echo "#define GPIO_LAN2_LED_BIT                   15" >> include/config.h
442         @echo "#define GPIO_LAN2_LED_ON                     1" >> include/config.h
443         @echo "#define GPIO_LAN3_LED_BIT                   16" >> include/config.h
444         @echo "#define GPIO_LAN3_LED_ON                     1" >> include/config.h
445         @echo "#define GPIO_LAN4_LED_BIT                   17" >> include/config.h
446         @echo "#define GPIO_LAN4_LED_ON                     0" >> include/config.h
447         @echo "#define GPIO_INTERNET_LED_BIT               13" >> include/config.h
448         @echo "#define GPIO_INTERNET_LED_ON                 1" >> include/config.h
449         @echo "#define GPIO_QSS_LED_BIT                     1" >> include/config.h
450         @echo "#define GPIO_QSS_LED_ON                      1" >> include/config.h
451         @echo "#define GPIO_USB_LED_BIT                    26" >> include/config.h
452         @echo "#define GPIO_USB_LED_ON                      1" >> include/config.h
453         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
454         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
455         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for TL-MR3220 v2\"" >> include/config.h
456         
457         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
458
459 dir505_config : unconfig hornet_common_config
460         @/bin/echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m'
461         @echo "#define CONFIG_FOR_DLINK_DIR505_A1           1" >> include/config.h
462         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
463         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
464
465         # we will use WPS button instead of reset
466         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
467         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
468         
469         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
470         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for DIR-505\"" >> include/config.h
471         
472         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
473
474 gs_oolite_v1_dev_config : unconfig hornet_common_config
475         @/bin/echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
476         @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV          1" >> include/config.h
477         @echo "#define GPIO_SYS_LED_BIT                    27" >> include/config.h
478         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
479         @echo "#define GPIO_WAN_LED_BIT                    17" >> include/config.h
480         @echo "#define GPIO_WAN_LED_ON                      0" >> include/config.h
481         @echo "#define GPIO_LAN1_LED_BIT                   13" >> include/config.h
482         @echo "#define GPIO_LAN1_LED_ON                     0" >> include/config.h
483         @echo "#define GPIO_LAN2_LED_BIT                   15" >> include/config.h
484         @echo "#define GPIO_LAN2_LED_ON                     0" >> include/config.h
485         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
486         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
487         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for GS-Oolite v1\"" >> include/config.h
488         
489         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
490
491 carambola2_config : unconfig hornet_common_config
492         @/bin/echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m'
493         @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2       1" >> include/config.h
494
495         # Carambola 2 uses uncompressed version
496         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
497
498         # Carambola 2 uses 40 MHz oscillator
499         @echo "#define CONFIG_40MHZ_XTAL_SUPPORT            1" >> include/config.h
500
501         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
502         @echo "#define GPIO_WLAN_LED_ON                     0" >> include/config.h
503         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
504
505         # Carambola 2 development board has RST button pulled up, so it is active at low
506         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
507
508         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
509         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for CARAMBOLA2 v1\"" >> include/config.h
510         
511         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
512
513 dragino_v2_ms14_config : unconfig hornet_common_config
514         @/bin/echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m'
515         @echo "#define CONFIG_FOR_DRAGINO_V2                1" >> include/config.h
516         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
517         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
518         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
519         @echo "#define GPIO_WAN_LED_BIT                    17" >> include/config.h
520         @echo "#define GPIO_WAN_LED_ON                      0" >> include/config.h
521         @echo "#define GPIO_LAN_LED_BIT                    13" >> include/config.h
522         @echo "#define GPIO_LAN_LED_ON                      0" >> include/config.h
523         @echo "#define GPIO_INTERNET_LED_BIT               28" >> include/config.h
524         @echo "#define GPIO_INTERNET_LED_ON                 1" >> include/config.h
525         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
526         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
527         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
528         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
529         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
530         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for Dragino v2 MS14\"" >> include/config.h
531         
532         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
533
534 villagetelco_mp2_config : unconfig hornet_common_config
535         @/bin/echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
536         @echo "#define CONFIG_FOR_MESH_POTATO_V2            1" >> include/config.h
537         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
538         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
539         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
540         @echo "#define GPIO_WAN_LED_BIT                    17" >> include/config.h
541         @echo "#define GPIO_WAN_LED_ON                      0" >> include/config.h
542         @echo "#define GPIO_LAN_LED_BIT                    13" >> include/config.h
543         @echo "#define GPIO_LAN_LED_ON                      0" >> include/config.h
544         @echo "#define GPIO_INTERNET_LED_BIT               28" >> include/config.h
545         @echo "#define GPIO_INTERNET_LED_ON                 1" >> include/config.h
546         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
547         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
548         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
549         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
550         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
551         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for Village Telco Mesh Potato 2\"" >> include/config.h
552         
553         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
554
555 gl-inet_config : unconfig hornet_common_config
556         @/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
557         @echo "#define CONFIG_FOR_GL_INET                   1" >> include/config.h
558         @echo "#define GPIO_WLAN_LED_BIT                    0" >> include/config.h
559         @echo "#define GPIO_WLAN_LED_ON                     1" >> include/config.h
560         @echo "#define GPIO_LAN_LED_BIT                    13" >> include/config.h
561         @echo "#define GPIO_LAN_LED_ON                      1" >> include/config.h
562         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
563         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
564         @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for GL.iNet\"" >> include/config.h
565
566         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
567
568 wasp_common_config : common_config
569         @echo "#define CONFIG_AR7240                        1" >> include/config.h
570         @echo "#define CONFIG_WASP                          1" >> include/config.h
571         @echo "#define CONFIG_WASP_SUPPORT                  1" >> include/config.h
572
573 wdr3600_43x0_config : unconfig wasp_common_config
574         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3600/43x0 at:' `date` '\e[0m'
575         @echo "#define CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1 1" >> include/config.h
576         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
577         @echo "#define CFG_ATHRS17_PHY                      1" >> include/config.h
578         @echo "#define CFG_AG7240_NMACS                     1" >> include/config.h
579         @echo "#define CFG_DUAL_PHY_SUPPORT                 1" >> include/config.h
580         @echo "#define GPIO_SYS_LED_BIT                    14" >> include/config.h
581         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
582         @echo "#define GPIO_WLAN_2G_LED_BIT                13" >> include/config.h
583         @echo "#define GPIO_WLAN_2G_LED_ON                  0" >> include/config.h
584         @echo "#define GPIO_USB1_LED_BIT                   11" >> include/config.h
585         @echo "#define GPIO_USB1_LED_ON                     0" >> include/config.h
586         @echo "#define GPIO_USB2_LED_BIT                   12" >> include/config.h
587         @echo "#define GPIO_USB2_LED_ON                     0" >> include/config.h
588         @echo "#define GPIO_QSS_LED_BIT                    15" >> include/config.h
589         @echo "#define GPIO_QSS_LED_ON                      0" >> include/config.h
590         @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
591         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
592         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
593         @echo "#define BOARD_CUSTOM_STRING                  \"DB120 (AR9344) U-Boot for TL-WDR3600/43x0\"" >> include/config.h
594
595         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
596
597 wdr3500_config : unconfig wasp_common_config
598         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3500 at:' `date` '\e[0m'
599         @echo "#define CONFIG_FOR_TPLINK_WDR3500_V1         1" >> include/config.h
600         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
601         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
602         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
603         @echo "#define GPIO_SYS_LED_BIT                    14" >> include/config.h
604         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
605         @echo "#define GPIO_WLAN_2G_LED_BIT                13" >> include/config.h
606         @echo "#define GPIO_WLAN_2G_LED_ON                  0" >> include/config.h
607         @echo "#define GPIO_LAN1_LED_BIT                   19" >> include/config.h
608         @echo "#define GPIO_LAN1_LED_ON                     0" >> include/config.h
609         @echo "#define GPIO_LAN2_LED_BIT                   20" >> include/config.h
610         @echo "#define GPIO_LAN2_LED_ON                     0" >> include/config.h
611         @echo "#define GPIO_LAN3_LED_BIT                   21" >> include/config.h
612         @echo "#define GPIO_LAN3_LED_ON                     0" >> include/config.h
613         @echo "#define GPIO_LAN4_LED_BIT                   22" >> include/config.h
614         @echo "#define GPIO_LAN4_LED_ON                     0" >> include/config.h
615         @echo "#define GPIO_INTERNET_LED_BIT               18" >> include/config.h
616         @echo "#define GPIO_INTERNET_LED_ON                 0" >> include/config.h
617         @echo "#define GPIO_QSS_LED_BIT                    15" >> include/config.h
618         @echo "#define GPIO_QSS_LED_ON                      0" >> include/config.h
619         @echo "#define GPIO_USB_LED_BIT                    11" >> include/config.h
620         @echo "#define GPIO_USB_LED_ON                      0" >> include/config.h
621         @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
622         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
623         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
624         @echo "#define BOARD_CUSTOM_STRING                  \"DB120 (AR9344) U-Boot for TL-WDR3500\"" >> include/config.h
625
626         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
627
628 mr3420_v2_config : unconfig wasp_common_config
629         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3420 v2 at:' `date` '\e[0m'
630         @echo "#define CONFIG_FOR_TPLINK_MR3420_V2          1" >> include/config.h
631         @echo "#define CONFIG_AP123                         1" >> include/config.h
632         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
633         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
634         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
635         @echo "#define GPIO_SYS_LED_BIT                    14" >> include/config.h
636         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
637         @echo "#define GPIO_WLAN_LED_BIT                   13" >> include/config.h
638         @echo "#define GPIO_WLAN_LED_ON                     0" >> include/config.h
639         @echo "#define GPIO_INTERNET_LED_BIT               18" >> include/config.h
640         @echo "#define GPIO_INTERNET_LED_ON                 0" >> include/config.h
641         @echo "#define GPIO_LAN1_LED_BIT                   19" >> include/config.h
642         @echo "#define GPIO_LAN1_LED_ON                     0" >> include/config.h
643         @echo "#define GPIO_LAN2_LED_BIT                   20" >> include/config.h
644         @echo "#define GPIO_LAN2_LED_ON                     0" >> include/config.h
645         @echo "#define GPIO_LAN3_LED_BIT                   21" >> include/config.h
646         @echo "#define GPIO_LAN3_LED_ON                     0" >> include/config.h
647         @echo "#define GPIO_LAN4_LED_BIT                   12" >> include/config.h
648         @echo "#define GPIO_LAN4_LED_ON                     0" >> include/config.h
649         @echo "#define GPIO_USB_LED_BIT                    11" >> include/config.h
650         @echo "#define GPIO_USB_LED_ON                      0" >> include/config.h
651         @echo "#define GPIO_QSS_LED_BIT                    15" >> include/config.h
652         @echo "#define GPIO_QSS_LED_ON                      0" >> include/config.h
653         @echo "#define GPIO_RST_BUTTON_BIT                 17" >> include/config.h
654         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
655         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
656         @echo "#define BOARD_CUSTOM_STRING                  \"AP123 (AR9341) U-Boot for TL-MR3420 v2\"" >> include/config.h
657
658         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
659
660 wr841n_v8_config : unconfig wasp_common_config
661         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v8 at:' `date` '\e[0m'
662         @echo "#define CONFIG_FOR_TPLINK_WR841N_V8          1" >> include/config.h
663         @echo "#define CONFIG_AP123                         1" >> include/config.h
664         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
665         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
666         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
667         @echo "#define GPIO_SYS_LED_BIT                    14" >> include/config.h
668         @echo "#define GPIO_SYS_LED_ON                      0" >> include/config.h
669         @echo "#define GPIO_WLAN_LED_BIT                   13" >> include/config.h
670         @echo "#define GPIO_WLAN_LED_ON                     0" >> include/config.h
671         @echo "#define GPIO_INTERNET_LED_BIT               18" >> include/config.h
672         @echo "#define GPIO_INTERNET_LED_ON                 0" >> include/config.h
673         @echo "#define GPIO_LAN1_LED_BIT                   19" >> include/config.h
674         @echo "#define GPIO_LAN1_LED_ON                     0" >> include/config.h
675         @echo "#define GPIO_LAN2_LED_BIT                   20" >> include/config.h
676         @echo "#define GPIO_LAN2_LED_ON                     0" >> include/config.h
677         @echo "#define GPIO_LAN3_LED_BIT                   21" >> include/config.h
678         @echo "#define GPIO_LAN3_LED_ON                     0" >> include/config.h
679         @echo "#define GPIO_LAN4_LED_BIT                   12" >> include/config.h
680         @echo "#define GPIO_LAN4_LED_ON                     0" >> include/config.h
681         @echo "#define GPIO_QSS_LED_BIT                    15" >> include/config.h
682         @echo "#define GPIO_QSS_LED_ON                      0" >> include/config.h
683         @echo "#define GPIO_RST_BUTTON_BIT                 17" >> include/config.h
684         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
685         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
686         @echo "#define BOARD_CUSTOM_STRING                  \"AP123 (AR9341) U-Boot for TL-WR841N/D v8\"" >> include/config.h
687
688         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
689
690 wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config
691         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WA830RE/TL-WA801ND v2 at:' `date` '\e[0m'
692         @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2 1" >> include/config.h
693         @echo "#define CONFIG_AP123                            1" >> include/config.h
694         @echo "#define DDR2_32BIT_SUPPORT                      1" >> include/config.h
695         @echo "#define CFG_ATHRS27_PHY                         1" >> include/config.h
696         @echo "#define CFG_AG7240_NMACS                        2" >> include/config.h
697         @echo "#define GPIO_SYS_LED_BIT                       14" >> include/config.h
698         @echo "#define GPIO_SYS_LED_ON                         0" >> include/config.h
699         @echo "#define GPIO_LAN_LED_BIT                       18" >> include/config.h
700         @echo "#define GPIO_LAN_LED_ON                         0" >> include/config.h
701         @echo "#define GPIO_WLAN_LED_BIT                      13" >> include/config.h
702         @echo "#define GPIO_WLAN_LED_ON                        0" >> include/config.h
703         @echo "#define GPIO_QSS_LED_BIT                       15" >> include/config.h
704         @echo "#define GPIO_QSS_LED_ON                         0" >> include/config.h
705         @echo "#define GPIO_RST_BUTTON_BIT                    17" >> include/config.h
706         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW           1" >> include/config.h
707         @echo "#define DEFAULT_FLASH_SIZE_IN_MB                4" >> include/config.h
708         @echo "#define BOARD_CUSTOM_STRING                     \"AP123 (AR9341) U-Boot for TL-WA830RE/TL-WA801ND v2\"" >> include/config.h
709
710         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
711
712 #########################################################################
713 #########################################################################
714 #########################################################################
715
716 clean:
717         @/bin/echo -e "\e[32m> Making $@...\e[0m"
718         @find . -type f \
719                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
720                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
721                 | xargs rm -f
722         @rm -f tools/mkimage tools/envcrc
723         @rm -f lib_bootstrap/*.o
724         @rm -f lib_bootstrap/*.a
725         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
726
727 clobber:        clean
728         @/bin/echo -e "\e[32m> Making $@...\e[0m"
729         @find . -type f \( -name .depend \
730                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
731                 -print0 \
732                 | xargs -0 rm -f
733         @rm -f $(OBJS) *.bak tags TAGS include/version_autogenerated.h
734         @rm -fr *.*~
735         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
736         @rm -f tools/crc32.c tools/environment.c
737         @rm -f cpu/mpc824x/bedbug_603e.c
738         @rm -f include/asm/proc include/asm/arch include/asm
739
740 mrproper \
741 distclean:      clobber unconfig
742
743 backup:
744         F=`basename $(TOPDIR)` ; cd .. ; \
745         gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
746
747 #########################################################################