d8cfae25a7165e793ed2dfadb2699157e35de8b8
[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 SHELL = bash
24
25 VERSION                 = 1
26 PATCHLEVEL              = 1
27 SUBLEVEL                = 4
28 EXTRAVERSION    = -$(shell git rev-parse --short=8 HEAD)
29 ISREPODIRTY             = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi)
30 VERSION_FILE    = include/version_autogenerated.h
31
32 # Show in version string if we are not building from clean repository
33 ifeq ($(ISREPODIRTY), 1)
34 U_BOOT_VERSION  = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty"
35 else
36 U_BOOT_VERSION  = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean"
37 endif
38
39 HOSTARCH := $(shell uname -m | \
40         sed -e s/i.86/i386/ \
41             -e s/sun4u/sparc64/ \
42             -e s/arm.*/arm/ \
43             -e s/sa110/arm/ \
44             -e s/powerpc/ppc/ \
45             -e s/macppc/ppc/)
46
47 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
48             sed -e 's/\(cygwin\).*/cygwin/')
49
50 export  HOSTARCH HOSTOS
51
52 # Deal with colliding definitions from tcsh etc.
53 VENDOR=
54
55 #########################################################################
56
57 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
58 export  TOPDIR
59
60 ifdef COMPRESSED_UBOOT
61         ifndef CONFIG_SKIP_LOWLEVEL_INIT
62 COMPRESSED_UBOOT = 1
63 export export COMPRESSED_UBOOT
64         endif
65 endif
66
67 ifeq (include/config.mk,$(wildcard include/config.mk))
68 # load ARCH, BOARD, and CPU configuration
69 include include/config.mk
70 export  ARCH CPU BOARD VENDOR SOC
71 ifndef CROSS_COMPILE
72 ifeq ($(HOSTARCH),ppc)
73 CROSS_COMPILE =
74 else
75 ifeq ($(ARCH),ppc)
76 CROSS_COMPILE = powerpc-linux-
77 endif
78 ifeq ($(ARCH),arm)
79 CROSS_COMPILE = arm-linux-
80 endif
81 ifeq ($(ARCH),i386)
82 ifeq ($(HOSTARCH),i386)
83 CROSS_COMPILE =
84 else
85 CROSS_COMPILE = i386-linux-
86 endif
87 endif
88 ifeq ($(ARCH),mips)
89 CROSS_COMPILE = mips-linux-
90 endif
91 ifeq ($(ARCH),nios)
92 CROSS_COMPILE = nios-elf-
93 endif
94 ifeq ($(ARCH),nios2)
95 CROSS_COMPILE = nios2-elf-
96 endif
97 ifeq ($(ARCH),m68k)
98 CROSS_COMPILE = m68k-elf-
99 endif
100 ifeq ($(ARCH),microblaze)
101 CROSS_COMPILE = mb-
102 endif
103 ifeq ($(ARCH),blackfin)
104 CROSS_COMPILE = bfin-elf-
105 endif
106 endif
107 endif
108
109 export  CROSS_COMPILE
110
111 # load other configuration
112 include $(TOPDIR)/config.mk
113
114
115 #########################################################################
116 # U-Boot objects....order is important (i.e. start must be first)
117 OBJS  = cpu/$(CPU)/start.o
118
119 ifdef COMPRESSED_UBOOT
120         ifndef CONFIG_SKIP_LOWLEVEL_INIT
121 OBJS_BOOTSTRAP  = cpu/$(CPU)/start_bootstrap.o
122         endif
123 endif
124
125 LIBS  = lib_generic/libgeneric.a
126 LIBS += common/libcommon.a
127 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
128 LIBS += cpu/$(CPU)/lib$(CPU).a
129
130 ifdef SOC
131 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
132 endif
133
134 LIBS += lib_$(ARCH)/lib$(ARCH).a
135 LIBS += drivers/libdrivers.a
136 LIBS += net/libnet.a
137 LIBS += rtc/librtc.a
138 LIBS += httpd/libhttpd.a
139 LIBS += $(BOARDLIBS)
140
141 ifdef COMPRESSED_UBOOT
142         ifndef CONFIG_SKIP_LOWLEVEL_INIT
143 LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a 
144 LIBS_BOOTSTRAP += board/$(BOARDDIR)/lib$(BOARD).a 
145 LIBS_BOOTSTRAP += cpu/$(CPU)/lib$(CPU).a
146 LIBS_BOOTSTRAP += cpu/$(CPU)/$(SOC)/lib$(SOC).a
147         endif
148 endif
149
150 .PHONY : $(LIBS)
151
152 ifdef COMPRESSED_UBOOT
153         ifndef CONFIG_SKIP_LOWLEVEL_INIT
154 .PHONY : $(LIBS_BOOTSTRAP)
155         endif
156 endif
157
158 # Add GCC lib
159 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
160
161 # The "tools" are needed early, so put this first
162 # Don't include stuff already done in $(LIBS)
163 SUBDIRS = tools
164
165 .PHONY : $(SUBDIRS)
166
167 #########################################################################
168 #########################################################################
169
170 ALL = u-boot.srec u-boot.bin System.map
171
172 ifdef COMPRESSED_UBOOT
173 ifndef CONFIG_SKIP_LOWLEVEL_INIT
174 all:    $(ALL) tuboot.bin
175 else
176 all:    $(ALL) u-boot.img
177 endif
178 else
179 all:    $(ALL) u-boot.img
180 endif
181
182 u-boot.hex:     u-boot
183         $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
184
185 u-boot.srec:    u-boot
186         $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
187
188 u-boot.bin:     u-boot
189         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
190
191 u-boot.img:     u-boot.bin
192         @echo -e "\e[32m> Preparing U-Boot image \"u-boot.img\"...\e[0m"
193         ./tools/mkimage -A $(ARCH) -T firmware -C none \
194                 -a $(TEXT_BASE) -e 0 \
195                 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
196                 sed -e 's/"[     ]*$$/ for $(BOARD) board"/') \
197                 -d $< $@
198
199 u-boot.dis:     u-boot
200         $(OBJDUMP) -d $< > $@
201
202 u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
203         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
204                 $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
205                 --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
206                 -Map u-boot.map -o u-boot
207
208 $(LIBS):
209         $(MAKE) -C `dirname $@`
210
211 $(SUBDIRS):
212         $(MAKE) -C $@ all
213
214 ifdef COMPRESSED_UBOOT
215 ifndef CONFIG_SKIP_LOWLEVEL_INIT
216 LZMA = $(BUILD_TOPDIR)/host_util/lzma
217
218 tuboot.bin:     System.map bootstrap.bin u-boot.lzimg   
219         @cat bootstrap.bin > $@
220         @cat u-boot.lzimg >> $@
221
222 u-boot.lzimg: $(obj)u-boot.bin System.map
223         @rm -rf u-boot.bin.lzma
224         $(LZMA) --best --keep $(obj)u-boot.bin
225         @echo -e "\e[32m> Preparing compressed U-Boot image \"u-boot.lzimg\"...\e[0m"
226         ./tools/mkimage -A mips -T firmware -C lzma \
227                 -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
228                 -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
229                 -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@
230
231 bootstrap.bin:  bootstrap
232         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
233
234 bootstrap:      depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
235         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
236                 $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
237                 --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
238                 -Map bootstrap.map -o bootstrap
239
240 $(LIBS_BOOTSTRAP):
241         $(MAKE) -C `dirname $@`
242 endif
243 endif
244
245 version:
246         @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
247                 echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
248                 echo "\"" >> $(VERSION_FILE)
249
250 gdbtools:
251         $(MAKE) -C tools/gdb || exit 1
252
253 depend dep:
254         @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
255
256 tags:
257         ctags -w `find $(SUBDIRS) include \
258                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
259                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
260                 net disk rtc dtt drivers drivers/sk98lin common \
261                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
262
263 etags:
264         etags -a `find $(SUBDIRS) include \
265                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
266                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
267                 net disk rtc dtt drivers drivers/sk98lin common \
268                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
269
270 System.map:     u-boot
271         @$(NM) $< | \
272                 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
273                 sort > System.map
274
275 #########################################################################
276 else
277 all install u-boot u-boot.srec depend dep:
278         @echo "System not configured - see README" >&2
279         @ exit 1
280 endif
281
282 #########################################################################
283
284 unconfig:
285         @rm -f include/config.h include/config.mk board/*/config.tmp
286
287 #========================================================================
288 # MIPS
289 #========================================================================
290 #########################################################################
291 ## MIPS32 AR7100 (24K)
292 #########################################################################
293 common_config :
294         @ >include/config.h
295         @echo "/* Temporary solution */"             >> include/config.h
296         @echo "/* AR933x */"                         >> include/config.h
297         @echo "#define QCA_AR9330_SOC           0x00001" >> include/config.h
298         @echo "#define QCA_AR9331_SOC           0x00002" >> include/config.h
299         @echo "#define QCA_AR933X_SOC           (QCA_AR9330_SOC | QCA_AR9331_SOC)" >> include/config.h
300         @echo "/* AR934x */"                         >> include/config.h
301         @echo "#define QCA_AR9341_SOC           0x00010" >> include/config.h
302         @echo "#define QCA_AR9342_SOC           0x00020" >> include/config.h
303         @echo "#define QCA_AR9344_SOC           0x00040" >> include/config.h
304         @echo "#define QCA_AR934X_SOC           (QCA_AR9341_SOC | QCA_AR9342_SOC | QCA_AR9344_SOC)" >> include/config.h
305         @echo "/* QCA953x */"                        >> include/config.h
306         @echo "#define QCA_QCA9531_SOC          0x00100" >> include/config.h
307         @echo "#define QCA_QCA9533_SOC          0x00200" >> include/config.h
308         @echo "#define QCA_QCA953X_SOC          (QCA_QCA9531_SOC | QCA_QCA9533_SOC)" >> include/config.h
309         @echo "/* QCA956x */"                        >> include/config.h
310         @echo "#define QCA_QCA9561_SOC          0x01000" >> include/config.h
311         @echo "#define QCA_QCA9563_SOC          0x02000" >> include/config.h
312         @echo "#define QCA_QCA956X_SOC          (QCA_QCA9561_SOC | QCA_QCA9563_SOC)" >> include/config.h
313         @echo "/* QCA955x */"                        >> include/config.h
314         @echo "#define QCA_QCA9557_SOC          0x10000" >> include/config.h
315         @echo "#define QCA_QCA9558_SOC          0x20000" >> include/config.h
316         @echo "#define QCA_QCA955X_SOC          (QCA_QCA9557_SOC | QCA_QCA9558_SOC)" >> include/config.h
317         @echo ""                                     >> include/config.h
318
319 ifdef CONFIG_BOOTDELAY
320         @echo "#define CONFIG_BOOTDELAY "$(CONFIG_BOOTDELAY)   >> include/config.h
321 endif
322
323 ifdef CONFIG_MAX_UBOOT_SIZE_KB
324         @echo "#define CONFIG_MAX_UBOOT_SIZE_KB "$(CONFIG_MAX_UBOOT_SIZE_KB) >> include/config.h
325 endif
326
327 ifdef DISABLE_CONSOLE_OUTPUT
328         @echo "#define CONFIG_SILENT_CONSOLE                1" >> include/config.h
329 endif
330
331 ifdef CONFIG_SKIP_LOWLEVEL_INIT
332         @echo "#define CONFIG_SKIP_LOWLEVEL_INIT            1" >> include/config.h
333         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
334 endif
335
336         @echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD        3" >> include/config.h
337         @echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE      5" >> include/config.h
338         @echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE   7" >> include/config.h
339
340         # max delay time for button pressing
341         @echo "#define CONFIG_MAX_BUTTON_PRESSING          10" >> include/config.h
342
343         # don't show info about console (in, out, err...)
344         @echo "#define CFG_CONSOLE_INFO_QUIET"                 >> include/config.h
345
346 hornet_common_config : common_config
347         @echo "#define SOC_TYPE                QCA_AR933X_SOC" >> include/config.h
348         @echo "#define CONFIG_MACH_HORNET                   1" >> include/config.h
349
350 wr703n_config : unconfig hornet_common_config
351         @echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
352         @echo "#define CONFIG_FOR_TPLINK_WR703N_V1          1" >> include/config.h
353         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
354         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
355         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR703N\"" >> include/config.h
356
357         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
358
359 wr720n_v3_CN_config : unconfig hornet_common_config
360         @echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CN at:' `date` '\e[0m'
361         @echo "#define CONFIG_FOR_TPLINK_WR720N_V3          1" >> include/config.h
362         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
363         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
364         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR720N v3 CN\"" >> include/config.h
365
366         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
367
368 wr710n_config : unconfig hornet_common_config
369         @echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
370         @echo "#define CONFIG_FOR_TPLINK_WR710N_V1          1" >> include/config.h
371         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
372         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
373         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR710N\"" >> include/config.h
374
375         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
376
377 mr3020_config : unconfig hornet_common_config
378         @echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
379         @echo "#define CONFIG_FOR_TPLINK_MR3020_V1          1" >> include/config.h
380         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
381         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
382         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3020\"" >> include/config.h
383
384         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
385
386 mr3040_config : unconfig hornet_common_config
387         @echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
388         @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2        1" >> include/config.h
389         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
390         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
391         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3040\"" >> include/config.h
392
393         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
394
395 mr10u_config : unconfig hornet_common_config
396         @echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
397         @echo "#define CONFIG_FOR_TPLINK_MR10U_V1           1" >> include/config.h
398         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
399         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
400         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR10U\"" >> include/config.h
401
402         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
403
404 mr13u_config : unconfig hornet_common_config
405         @echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
406         @echo "#define CONFIG_FOR_TPLINK_MR13U_V1           1" >> include/config.h
407         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
408         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
409         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR13U\"" >> include/config.h
410
411         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
412
413 wr740n_v4_config : unconfig hornet_common_config
414         @echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
415         @echo "#define CONFIG_FOR_TPLINK_WR740N_V4          1" >> include/config.h
416         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
417         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
418         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR74xN/D v4\"" >> include/config.h
419
420         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
421
422 mr3220_v2_config : unconfig hornet_common_config
423         @echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
424         @echo "#define CONFIG_FOR_TPLINK_MR3220_V2          1" >> include/config.h
425         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
426         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
427         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3220 v2\"" >> include/config.h
428
429         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
430
431 dir505_config : unconfig hornet_common_config
432         @echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m'
433         @echo "#define CONFIG_FOR_DLINK_DIR505_A1           1" >> include/config.h
434         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
435         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
436         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
437         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"D-Link DIR-505\"" >> include/config.h
438
439         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
440
441 gs_oolite_v1_dev_config : unconfig hornet_common_config
442         @echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
443         @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV          1" >> include/config.h
444         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
445         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
446         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Gainstrong GS-Oolite v1\"" >> include/config.h
447
448         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
449
450 black_swift_board_config : unconfig hornet_common_config
451         @echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '======='
452         @echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD         1" >> include/config.h
453         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
454         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
455         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
456         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Black Swift board\"" >> include/config.h
457
458         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
459
460 carambola2_config : unconfig hornet_common_config
461         @echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m'
462         @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2       1" >> include/config.h
463         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
464         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
465         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
466         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"8devices Carambola2 v1\"" >> include/config.h
467
468         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
469
470 dragino_v2_ms14_config : unconfig hornet_common_config
471         @echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m'
472         @echo "#define CONFIG_FOR_DRAGINO_V2                1" >> include/config.h
473         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
474         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
475         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
476         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
477         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
478         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Dragino v2 MS14\"" >> include/config.h
479
480         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
481
482 villagetelco_mp2_config : unconfig hornet_common_config
483         @echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
484         @echo "#define CONFIG_FOR_MESH_POTATO_V2            1" >> include/config.h
485         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
486         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
487         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
488         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
489         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
490         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Village Telco Mesh Potato 2\"" >> include/config.h
491
492         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
493
494 gl-inet_config : unconfig hornet_common_config
495         @echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
496         @echo "#define CONFIG_FOR_GL_INET                   1" >> include/config.h
497         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
498         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
499         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"GL.iNet\"" >> include/config.h
500
501         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
502
503 wasp_common_config : common_config
504         @echo "#define CONFIG_WASP                          1" >> include/config.h
505         @echo "#define CONFIG_WASP_SUPPORT                  1" >> include/config.h
506
507 wdr3600_43x0_config : unconfig wasp_common_config
508         @echo -e '\e[32m> Configuring for TP-Link TL-WDR3600/43x0 at:' `date` '\e[0m'
509         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
510         @echo "#define CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1 1" >> include/config.h
511         @echo "#define CFG_ATHRS17_PHY                      1" >> include/config.h
512         @echo "#define CFG_AG7240_NMACS                     1" >> include/config.h
513         @echo "#define CONFIG_PCI                           1" >> include/config.h
514         @echo "#define CFG_DUAL_PHY_SUPPORT                 1" >> include/config.h
515         @echo "#define CONFIG_GPIO_RESET_BTN               16" >> include/config.h
516         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
517         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
518         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3600/43x0\"" >> include/config.h
519
520         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
521
522 wdr3500_config : unconfig wasp_common_config
523         @echo -e '\e[32m> Configuring for TP-Link TL-WDR3500 at:' `date` '\e[0m'
524         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
525         @echo "#define CONFIG_FOR_TPLINK_WDR3500_V1         1" >> include/config.h
526         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
527         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
528         @echo "#define CONFIG_PCI                           1" >> include/config.h
529         @echo "#define CONFIG_GPIO_RESET_BTN               16" >> include/config.h
530         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
531         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
532         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3500\"" >> include/config.h
533
534         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
535
536 mr3420_v2_config : unconfig wasp_common_config
537         @echo -e '\e[32m> Configuring for TP-Link TL-MR3420 v2 at:' `date` '\e[0m'
538         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
539         @echo "#define CONFIG_FOR_TPLINK_MR3420_V2          1" >> include/config.h
540         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
541         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
542         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
543         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
544         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
545         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3420 v2\"" >> include/config.h
546
547         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
548
549 wr841n_v8_config : unconfig wasp_common_config
550         @echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v8 at:' `date` '\e[0m'
551         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
552         @echo "#define CONFIG_FOR_TPLINK_WR841N_V8          1" >> include/config.h
553         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
554         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
555         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
556         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
557         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
558         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR841N/D v8\"" >> include/config.h
559
560         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
561
562 wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config
563         @echo -e '\e[32m> Configuring for TP-Link TL-WA830RE/TL-WA801ND v2 at:' `date` '\e[0m'
564         @echo "#define SOC_TYPE                   QCA_AR9341_SOC" >> include/config.h
565         @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2 1" >> include/config.h
566         @echo "#define CFG_ATHRS27_PHY                         1" >> include/config.h
567         @echo "#define CFG_AG7240_NMACS                        2" >> include/config.h
568         @echo "#define CONFIG_GPIO_RESET_BTN                  17" >> include/config.h
569         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW        1" >> include/config.h
570         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB         4" >> include/config.h
571         @echo "#define CONFIG_BOARD_CUSTOM_STRING              \"TP-Link TL-WA830RE/TL-WA801ND v2\"" >> include/config.h
572
573         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
574
575 ap143_common_config : common_config
576         @echo "#define CONFIG_ATHEROS                       1" >> include/config.h
577         @echo "#define CONFIG_MACH_QCA953x                  1" >> include/config.h
578
579 dr531_config : unconfig ap143_common_config
580         @echo -e '\e[32m> Configuring for Wallys DR531 at:' `date` '\e[0m'
581         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
582         @echo "#define CONFIG_FOR_WALLYS_DR531              1" >> include/config.h
583         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
584         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
585         @echo "#define CONFIG_PCI                           1" >> include/config.h
586         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
587         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
588         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
589         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Wallys DR531\"" >> include/config.h
590
591         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
592
593 wr820n_CN_config : unconfig ap143_common_config
594         @echo -e '\e[32m> Configuring for TP-Link TL-WR820N CN at:' `date` '\e[0m'
595         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
596         @echo "#define CONFIG_FOR_TPLINK_WR820N_CN          1" >> include/config.h
597         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
598         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
599         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
600         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
601         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
602         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR820N CN\"" >> include/config.h
603
604         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
605
606 wr802n_config : unconfig ap143_common_config
607         @echo -e '\e[32m> Configuring for TP-Link TL-WR802N at:' `date` '\e[0m'
608         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
609         @echo "#define CONFIG_FOR_TPLINK_WR802N             1" >> include/config.h
610         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
611         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
612         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
613         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
614         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
615         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR802N\"" >> include/config.h
616
617         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
618
619 wr841n_v9_config : unconfig ap143_common_config
620         @echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v9 at:' `date` '\e[0m'
621         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
622         @echo "#define CONFIG_FOR_TPLINK_WR841N_V9          1" >> include/config.h
623         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
624         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
625         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
626         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
627         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
628         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR841N/D v9\"" >> include/config.h
629
630         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
631
632 #########################################################################
633 #########################################################################
634 #########################################################################
635
636 clean:
637         @echo -e "\e[32m> Making $@...\e[0m"
638         @find . -type f \
639                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
640                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
641                 | xargs rm -f
642         @rm -f tools/mkimage tools/envcrc
643         @rm -f lib_bootstrap/*.o
644         @rm -f lib_bootstrap/*.a
645         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
646
647 clobber:        clean
648         @echo -e "\e[32m> Making $@...\e[0m"
649         @find . -type f \( -name .depend \
650                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
651                 -print0 \
652                 | xargs -0 rm -f
653         @rm -f $(OBJS) *.bak tags TAGS include/version_autogenerated.h
654         @rm -fr *.*~
655         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
656         @rm -f tools/crc32.c tools/environment.c
657         @rm -f cpu/mpc824x/bedbug_603e.c
658         @rm -f include/asm/proc include/asm/arch include/asm
659
660 mrproper \
661 distclean:      clobber unconfig
662
663 backup:
664         F=`basename $(TOPDIR)` ; cd .. ; \
665         gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
666
667 #########################################################################