0c52208121a7c009eaf2669f19ea0f5c39915d9c
[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    = -$(shell git rev-parse --short=8 HEAD)
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         @echo "/* Temporary solution */"             >> include/config.h
288         @echo "/* AR933x */"                         >> include/config.h
289         @echo "#define QCA_AR9330_SOC           0x00001" >> include/config.h
290         @echo "#define QCA_AR9331_SOC           0x00002" >> include/config.h
291         @echo "#define QCA_AR933X_SOC           (QCA_AR9330_SOC | QCA_AR9331_SOC)" >> include/config.h
292         @echo "/* AR934x */"                         >> include/config.h
293         @echo "#define QCA_AR9341_SOC           0x00010" >> include/config.h
294         @echo "#define QCA_AR9342_SOC           0x00020" >> include/config.h
295         @echo "#define QCA_AR9344_SOC           0x00040" >> include/config.h
296         @echo "#define QCA_AR934X_SOC           (QCA_AR9341_SOC | QCA_AR9342_SOC | QCA_AR9344_SOC)" >> include/config.h
297         @echo "/* QCA953x */"                        >> include/config.h
298         @echo "#define QCA_QCA9531_SOC          0x00100" >> include/config.h
299         @echo "#define QCA_QCA9533_SOC          0x00200" >> include/config.h
300         @echo "#define QCA_QCA953X_SOC          (QCA_QCA9531_SOC | QCA_QCA9533_SOC)" >> include/config.h
301         @echo "/* QCA956x */"                        >> include/config.h
302         @echo "#define QCA_QCA9561_SOC          0x01000" >> include/config.h
303         @echo "#define QCA_QCA9563_SOC          0x02000" >> include/config.h
304         @echo "#define QCA_QCA956X_SOC          (QCA_QCA9561_SOC | QCA_QCA9563_SOC)" >> include/config.h
305         @echo "/* QCA955x */"                        >> include/config.h
306         @echo "#define QCA_QCA9557_SOC          0x10000" >> include/config.h
307         @echo "#define QCA_QCA9558_SOC          0x20000" >> include/config.h
308         @echo "#define QCA_QCA955X_SOC          (QCA_QCA9557_SOC | QCA_QCA9558_SOC)" >> include/config.h
309         @echo ""                                     >> include/config.h
310
311 ifdef CONFIG_BOOTDELAY
312         @echo "#define CONFIG_BOOTDELAY "$(CONFIG_BOOTDELAY)   >> include/config.h
313 endif
314
315 ifdef CONFIG_MAX_UBOOT_SIZE_KB
316         @echo "#define CONFIG_MAX_UBOOT_SIZE_KB "$(CONFIG_MAX_UBOOT_SIZE_KB) >> include/config.h
317 endif
318
319 ifdef CFG_PLL_FREQ
320         @echo "#define CFG_PLL_FREQ "$(CFG_PLL_FREQ)           >> include/config.h
321 endif
322
323 ifdef DISABLE_CONSOLE_OUTPUT
324         @echo "#define CONFIG_SILENT_CONSOLE                1" >> include/config.h
325 endif
326
327 ifdef CONFIG_SKIP_LOWLEVEL_INIT
328         @echo "#define CONFIG_SKIP_LOWLEVEL_INIT            1" >> include/config.h
329         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
330 endif
331
332         @echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD        3" >> include/config.h
333         @echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE      5" >> include/config.h
334         @echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE   7" >> include/config.h
335
336         # max delay time for button pressing
337         @echo "#define CONFIG_MAX_BUTTON_PRESSING          10" >> include/config.h
338
339         # don't show info about console (in, out, err...)
340         @echo "#define CFG_CONSOLE_INFO_QUIET"                 >> include/config.h
341
342 hornet_common_config : common_config
343         @echo "#define SOC_TYPE                QCA_AR933X_SOC" >> include/config.h
344         @echo "#define CONFIG_MACH_HORNET                   1" >> include/config.h
345
346 wr703n_config : unconfig hornet_common_config
347         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
348         @echo "#define CONFIG_FOR_TPLINK_WR703N_V1          1" >> include/config.h
349         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
350         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
351         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR703N\"" >> include/config.h
352         
353         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
354
355 wr720n_v3_CH_config : unconfig hornet_common_config
356         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CH at:' `date` '\e[0m'
357         @echo "#define CONFIG_FOR_TPLINK_WR720N_V3          1" >> include/config.h
358         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
359         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
360         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR720N v3 CH\"" >> include/config.h
361         
362         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
363
364 wr710n_config : unconfig hornet_common_config
365         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
366         @echo "#define CONFIG_FOR_TPLINK_WR710N_V1          1" >> include/config.h
367         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
368         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
369         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR710N\"" >> include/config.h
370         
371         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
372
373 mr3020_config : unconfig hornet_common_config
374         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
375         @echo "#define CONFIG_FOR_TPLINK_MR3020_V1          1" >> include/config.h
376         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
377         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
378         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR3020\"" >> include/config.h
379         
380         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
381
382 mr3040_config : unconfig hornet_common_config
383         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
384         @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2        1" >> include/config.h
385         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
386         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
387         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR3040\"" >> include/config.h
388         
389         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
390
391 mr10u_config : unconfig hornet_common_config
392         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
393         @echo "#define CONFIG_FOR_TPLINK_MR10U_V1           1" >> include/config.h
394         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
395         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
396         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR10U\"" >> include/config.h
397         
398         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
399
400 mr13u_config : unconfig hornet_common_config
401         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
402         @echo "#define CONFIG_FOR_TPLINK_MR13U_V1           1" >> include/config.h
403         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
404         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
405         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR13U\"" >> include/config.h
406         
407         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
408
409 wr740n_v4_config : unconfig hornet_common_config
410         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
411         @echo "#define CONFIG_FOR_TPLINK_WR740N_V4          1" >> include/config.h
412         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
413         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
414         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR74xN/D v4\"" >> include/config.h
415         
416         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
417
418 mr3220_v2_config : unconfig hornet_common_config
419         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
420         @echo "#define CONFIG_FOR_TPLINK_MR3220_V2          1" >> include/config.h
421         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
422         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
423         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR3220 v2\"" >> include/config.h
424         
425         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
426
427 dir505_config : unconfig hornet_common_config
428         @/bin/echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m'
429         @echo "#define CONFIG_FOR_DLINK_DIR505_A1           1" >> include/config.h
430
431         # we will use WPS button instead of reset
432         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
433         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
434         
435         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
436         @echo "#define BOARD_CUSTOM_STRING                  \"D-Link DIR-505\"" >> include/config.h
437         
438         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
439
440 gs_oolite_v1_dev_config : unconfig hornet_common_config
441         @/bin/echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
442         @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV          1" >> include/config.h
443         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
444         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
445         @echo "#define BOARD_CUSTOM_STRING                  \"Gainstrong GS-Oolite v1\"" >> include/config.h
446         
447         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
448
449 black_swift_board_config : unconfig hornet_common_config
450         @echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '======='
451         @echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD         1" >> include/config.h
452         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
453         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
454         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
455         @echo "#define BOARD_CUSTOM_STRING                  \"Black Swift board\"" >> include/config.h
456
457         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
458
459 carambola2_config : unconfig hornet_common_config
460         @/bin/echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m'
461         @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2       1" >> include/config.h
462
463         # Carambola 2 uses uncompressed version
464         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
465
466         # Carambola 2 uses 40 MHz oscillator
467         @echo "#define CONFIG_40MHZ_XTAL_SUPPORT            1" >> include/config.h
468
469         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
470         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
471
472         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
473         @echo "#define BOARD_CUSTOM_STRING                  \"8devices Carambola2 v1\"" >> include/config.h
474         
475         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
476
477 dragino_v2_ms14_config : unconfig hornet_common_config
478         @/bin/echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m'
479         @echo "#define CONFIG_FOR_DRAGINO_V2                1" >> include/config.h
480         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
481         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
482         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
483         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
484         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
485         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
486         @echo "#define BOARD_CUSTOM_STRING                  \"Dragino v2 MS14\"" >> include/config.h
487         
488         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
489
490 villagetelco_mp2_config : unconfig hornet_common_config
491         @/bin/echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
492         @echo "#define CONFIG_FOR_MESH_POTATO_V2            1" >> include/config.h
493         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
494         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
495         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
496         @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
497         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
498         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
499         @echo "#define BOARD_CUSTOM_STRING                  \"Village Telco Mesh Potato 2\"" >> include/config.h
500         
501         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
502
503 gl-inet_config : unconfig hornet_common_config
504         @/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
505         @echo "#define CONFIG_FOR_GL_INET                   1" >> include/config.h
506         @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
507         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
508         @echo "#define BOARD_CUSTOM_STRING                  \"GL.iNet\"" >> include/config.h
509
510         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
511
512 wasp_common_config : common_config
513         @echo "#define CONFIG_WASP                          1" >> include/config.h
514         @echo "#define CONFIG_WASP_SUPPORT                  1" >> include/config.h
515
516 wdr3600_43x0_config : unconfig wasp_common_config
517         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3600/43x0 at:' `date` '\e[0m'
518         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
519         @echo "#define CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1 1" >> include/config.h
520         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
521         @echo "#define CFG_ATHRS17_PHY                      1" >> include/config.h
522         @echo "#define CFG_AG7240_NMACS                     1" >> include/config.h
523         @echo "#define CFG_DUAL_PHY_SUPPORT                 1" >> include/config.h
524         @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
525         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
526         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
527         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WDR3600/43x0\"" >> include/config.h
528
529         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
530
531 wdr3500_config : unconfig wasp_common_config
532         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3500 at:' `date` '\e[0m'
533         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
534         @echo "#define CONFIG_FOR_TPLINK_WDR3500_V1         1" >> include/config.h
535         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
536         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
537         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
538         @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
539         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
540         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
541         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WDR3500\"" >> include/config.h
542
543         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
544
545 mr3420_v2_config : unconfig wasp_common_config
546         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3420 v2 at:' `date` '\e[0m'
547         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
548         @echo "#define CONFIG_FOR_TPLINK_MR3420_V2          1" >> include/config.h
549         @echo "#define CONFIG_AP123                         1" >> include/config.h
550         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
551         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
552         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
553         @echo "#define GPIO_RST_BUTTON_BIT                 17" >> include/config.h
554         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
555         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
556         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-MR3420 v2\"" >> include/config.h
557
558         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
559
560 wr841n_v8_config : unconfig wasp_common_config
561         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v8 at:' `date` '\e[0m'
562         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
563         @echo "#define CONFIG_FOR_TPLINK_WR841N_V8          1" >> include/config.h
564         @echo "#define CONFIG_AP123                         1" >> include/config.h
565         @echo "#define DDR2_32BIT_SUPPORT                   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 GPIO_RST_BUTTON_BIT                 17" >> include/config.h
569         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
570         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
571         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR841N/D v8\"" >> include/config.h
572
573         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
574
575 wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config
576         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WA830RE/TL-WA801ND v2 at:' `date` '\e[0m'
577         @echo "#define SOC_TYPE                   QCA_AR9341_SOC" >> include/config.h
578         @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2 1" >> include/config.h
579         @echo "#define CONFIG_AP123                            1" >> include/config.h
580         @echo "#define DDR2_32BIT_SUPPORT                      1" >> include/config.h
581         @echo "#define CFG_ATHRS27_PHY                         1" >> include/config.h
582         @echo "#define CFG_AG7240_NMACS                        2" >> include/config.h
583         @echo "#define GPIO_RST_BUTTON_BIT                    17" >> include/config.h
584         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW           1" >> include/config.h
585         @echo "#define DEFAULT_FLASH_SIZE_IN_MB                4" >> include/config.h
586         @echo "#define BOARD_CUSTOM_STRING                     \"TP-Link TL-WA830RE/TL-WA801ND v2\"" >> include/config.h
587
588         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
589
590 ap143_common_config : common_config
591         @echo "#define CONFIG_ATHEROS                       1" >> include/config.h
592         @echo "#define CONFIG_MACH_QCA953x                  1" >> include/config.h
593
594 tplink_wr820n_CH_config : unconfig ap143_common_config
595         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR820N CH at:' `date` '\e[0m'
596         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
597         @echo "#define CONFIG_FOR_TPLINK_WR820N_CH          1" >> include/config.h
598         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
599         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
600         @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
601         @echo "#define GPIO_RST_BUTTON_BIT                 12" >> include/config.h
602         @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
603         @echo "#define BOARD_CUSTOM_STRING                  \"TP-Link TL-WR820N CH\"" >> include/config.h
604         @echo "#define CFG_PLL_FREQ       CFG_PLL_400_400_200" >> include/config.h
605
606         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
607
608 #########################################################################
609 #########################################################################
610 #########################################################################
611
612 clean:
613         @/bin/echo -e "\e[32m> Making $@...\e[0m"
614         @find . -type f \
615                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
616                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
617                 | xargs rm -f
618         @rm -f tools/mkimage tools/envcrc
619         @rm -f lib_bootstrap/*.o
620         @rm -f lib_bootstrap/*.a
621         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
622
623 clobber:        clean
624         @/bin/echo -e "\e[32m> Making $@...\e[0m"
625         @find . -type f \( -name .depend \
626                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
627                 -print0 \
628                 | xargs -0 rm -f
629         @rm -f $(OBJS) *.bak tags TAGS include/version_autogenerated.h
630         @rm -fr *.*~
631         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
632         @rm -f tools/crc32.c tools/environment.c
633         @rm -f cpu/mpc824x/bedbug_603e.c
634         @rm -f include/asm/proc include/asm/arch include/asm
635
636 mrproper \
637 distclean:      clobber unconfig
638
639 backup:
640         F=`basename $(TOPDIR)` ; cd .. ; \
641         gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
642
643 #########################################################################