Add support for YunCore AP90Q (QCA9531 based)
[oweals/u-boot_mod.git] / u-boot / Makefile
1 #
2 # Copyright (C) 2016 Piotr Dymacz <piotr@dymacz.pl>
3 #
4 # (C) Copyright 2000-2006 Wolfgang Denk,
5 # DENX Software Engineering, wd@denx.de.
6 #
7 # SPDX-License-Identifier: GPL-2.0
8 #
9
10 VERSION      = 1
11 PATCHLEVEL   = 1
12 SUBLEVEL     = 4
13 EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD)
14 ISREPODIRTY  = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi)
15 VERSION_FILE = include/version_autogenerated.h
16
17 MKCONFIG = $(BUILD_TOPDIR)/u-boot/mkconfig
18 MKIMAGE  = $(BUILD_TOPDIR)/u-boot/tools/mkimage
19 LZMA     = $(BUILD_TOPDIR)/host_util/lzma/lzma
20
21 # Show in version string if we are not building from clean repository
22 ifeq ($(ISREPODIRTY),1)
23   U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty"
24 else
25   U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean"
26 endif
27
28 # ===============================================================
29
30 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
31 export TOPDIR
32
33 # Some variables passed as arguments in cmd
34 ifneq ($(IMG_SIZE),)
35   CONFIG_MAX_UBOOT_SIZE = $(IMG_SIZE)
36   export CONFIG_MAX_UBOOT_SIZE
37 endif
38
39 ifeq ($(IMG_LZMA),1)
40   COMPRESSED_UBOOT = 1
41   export COMPRESSED_UBOOT
42 endif
43
44 ifeq ($(IMG_RAM),1)
45   CONFIG_SKIP_LOWLEVEL_INIT = 1
46   export CONFIG_SKIP_LOWLEVEL_INIT
47 endif
48
49 ifneq ($(DEVICE_VENDOR),)
50   DEVICE_VENDOR = $(DEVICE_VENDOR)
51   export DEVICE_VENDOR
52 endif
53
54 # Never use LZMA compression
55 # for a RAM version of image
56 ifdef CONFIG_SKIP_LOWLEVEL_INIT
57   unexport COMPRESSED_UBOOT
58   COMPRESSED_UBOOT =
59 endif
60
61 ifndef CROSS_COMPILE
62   $(error "CROSS_COMPILE is not defined!")
63 endif
64 export CROSS_COMPILE
65
66 ifndef STAGING_DIR
67   $(error "STAGING_DIR is not defined!")
68 endif
69 export STAGING_DIR
70
71 # Endianness
72 ifndef ENDIANNESS
73   ENDIANNESS=-EB
74 endif
75 export ENDIANNESS
76
77 # =======================
78 # CUSTOM HELPER FUNCTIONS
79 # =======================
80
81 define echo_green
82   echo -e "\e[92m$(1)\e[0m"
83 endef
84
85 define echo_red
86   echo -e "\e[91m$(1)\e[0m"
87 endef
88
89 define echo_yellow
90   echo -e "\e[93m$(1)\e[0m"
91 endef
92
93 define ih_name
94 u-boot_mod $(if $(filter $(IMG_RAM),1),RAM,$(if $(filter $(IMG_LZMA),1),LZMA FLASH,FLASH)) image
95 endef
96
97 # $(1): name
98 # $(2): path
99 define echo_size
100 @echo "$(1): `wc -c < $(strip $(2))` Bytes"
101 endef
102
103 # $(1): define name
104 # $(2): define value
105 define define_add
106   len=$$((5 - ($$(expr length $(1))/8))); \
107   tab=`printf '%*s' "$$len" | tr ' ' "\t"`; \
108   echo -ne "#define $(strip $(1))$${tab}" >> include/config.h; \
109   echo -e  '$(strip $(2))' >> include/config.h
110 endef
111
112 # $(1): define name
113 define undef_add
114   echo -e '#undef $(strip $(1))' >> include/config.h
115 endef
116
117 # $(1): path
118 define include_add
119   echo -e '#include <$(strip $(1))>' >> include/config.h
120 endef
121
122 # $(1): name
123 define board_name
124 $(if $(1),$(strip $(1)),OEM/Unknown)
125 endef
126
127 # $(1): size
128 define flash_size
129 $(if $(1),$(strip $(1)),4)
130 endef
131
132 # $(1): vendor, board name/model
133 # $(2): hostname
134 # $(3): default FLASH size in MB
135 # $(4): reset button GPIO number
136 # $(5): 1 if reset button is active low
137 # $(6): SOC_TYPE
138 define config_init
139   $(call echo_green,Preparing configuration for target: $@)
140   echo
141
142   $(call echo_yellow,  Device vendor/model:\t$(call board_name,$(1)))
143   $(if $(DEVICE_VENDOR), \
144     $(call echo_yellow,  Custom recovery web:\tyes ($(DEVICE_VENDOR))), \
145     $(call echo_yellow,  Custom recovery web:\tno) \
146   )
147
148   $(if $(CONFIG_MAX_UBOOT_SIZE), \
149     $(call echo_yellow,  Image size limit:\t$$(($(CONFIG_MAX_UBOOT_SIZE) / 1024)) KB),
150     $(call echo_yellow,  Image size limit:\tnot specified)
151   )
152
153   $(call echo_yellow,  Default FLASH size:\t$(call flash_size,$(3)) MB)
154
155   $(if $(4),
156     $(call echo_yellow,  GPIO reset button:\t$(strip $(4))), \
157     $(call echo_yellow,  GPIO reset button:\tnot specified) \
158   )
159
160   $(if $(filter $(5),1),
161     $(call echo_yellow,  Button active low:\tyes), \
162     $(call echo_yellow,  Button active low:\tno) \
163   )
164
165   $(if $(filter $(COMPRESSED_UBOOT),1), \
166     $(call echo_yellow,  LZMA compression:\tyes), \
167     $(call echo_yellow,  LZMA compression:\tno) \
168   )
169
170   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
171     $(call echo_yellow,  RAM-loadable only:\tyes), \
172     $(call echo_yellow,  RAM-loadable only:\tno) \
173   )
174
175   $(if $(2),$(call define_add,CONFIG_HOSTNAME,u-boot_$(strip $(2))))
176
177   $(if $(4),$(call define_add,CONFIG_GPIO_RESET_BTN,$(strip $(4))))
178   $(if $(filter $(5),1),$(call define_add,CONFIG_GPIO_RESET_BTN_ACTIVE_LOW,1))
179   $(if $(CONFIG_MAX_UBOOT_SIZE), \
180     $(call define_add,CONFIG_MAX_UBOOT_SIZE,$(CONFIG_MAX_UBOOT_SIZE))
181     $(call define_add,CONFIG_MAX_UBOOT_SIZE_HEX,$(shell printf '0x%X' $(CONFIG_MAX_UBOOT_SIZE)))
182   )
183
184   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
185     $(call define_add,CONFIG_SKIP_LOWLEVEL_INIT,1) \
186   )
187   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
188     $(call undef_add,COMPRESSED_UBOOT) \
189   )
190
191   $(if $(6), \
192     $(call define_add,SOC_TYPE,$(6)) \
193   )
194
195   $(call define_add,CONFIG_BOARD_CUSTOM_STRING,$(call board_name,$(1)))
196   $(call define_add,CONFIG_DEFAULT_FLASH_SIZE_IN_MB,$(call flash_size,$(3)))
197
198   echo
199 endef
200
201 # ===============================================================
202
203 # First, check if configuration was done
204 ifneq (include/config.mk, $(wildcard include/config.mk))
205 all install u-boot u-boot.srec depend dep:
206         $(error "System was not configured!")
207 else
208 # Load ARCH, BOARD, and CPU configuration
209 include include/config.mk
210 export ARCH CPU BOARD VENDOR SOC
211
212 # Load other configuration
213 include $(TOPDIR)/config.mk
214
215 # ===============================================================
216 # U-Boot objects....order is important (i.e. start must be first)
217 OBJS = cpu/$(CPU)/start.o
218
219 LIBS  = lib_generic/libgeneric.a
220 LIBS += common/libcommon.a
221
222 LIBS += lib_$(ARCH)/lib$(ARCH).a
223 LIBS += drivers/libdrivers.a
224 LIBS += net/libnet.a
225 LIBS += rtc/librtc.a
226 LIBS += httpd/libhttpd.a
227 LIBS += $(BOARDLIBS)
228
229 LIBS_SHARED = board/$(BOARDDIR)/lib$(BOARD).a
230 ifdef SOC
231   LIBS_SHARED += cpu/$(CPU)/$(SOC)/lib$(SOC).a
232 endif
233 LIBS_SHARED += cpu/$(CPU)/lib$(CPU).a
234
235 ifdef COMPRESSED_UBOOT
236   OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o
237   LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
238   PHONY_LIBS = $(LIBS_BOOTSTRAP) $(LIBS_SHARED)
239 else
240   PHONY_LIBS = $(LIBS) $(LIBS_SHARED)
241 endif
242 .PHONY: $(PHONY_LIBS)
243
244 # Add GCC lib
245 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
246
247 # The "tools" are needed early, so put this first
248 # Don't include stuff already done in $(LIBS)
249 SUBDIRS = tools
250
251 .PHONY: $(SUBDIRS)
252
253 # ===============================================================
254
255 ALL = u-boot.srec u-boot.bin System.map
256
257 ifdef COMPRESSED_UBOOT
258 all: $(ALL) tuboot.bin
259 else
260 all: $(ALL) u-boot.img
261 endif
262
263 u-boot.hex: u-boot
264         $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
265
266 u-boot.srec: u-boot
267         $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
268
269 u-boot.bin: u-boot
270         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
271
272 u-boot.img: u-boot.bin
273         @echo
274         $(call echo_green,Preparing regular U-Boot image $@...)
275         $(MKIMAGE) -A $(ARCH) -T firmware -C none -a $(TEXT_BASE) \
276                    -e 0 -n '$(call ih_name)' -d $< $@
277
278 u-boot.dis: u-boot
279         $(OBJDUMP) -d $< > $@
280
281 u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LIBS_SHARED) $(LDSCRIPT)
282         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) $(LIBS_SHARED) | \
283                    sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \
284                    sort | uniq`; \
285         $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
286               --start-group $(LIBS) $(LIBS_SHARED) \
287               --end-group $(PLATFORM_LIBS) \
288               -Map u-boot.map -o u-boot
289
290 $(LIBS_SHARED):
291         $(MAKE) -C `dirname $@`
292
293 $(LIBS):
294         $(MAKE) -C `dirname $@`
295
296 $(SUBDIRS):
297         $(MAKE) -C $@ all
298
299 # For LZMA compressed image
300 ifdef COMPRESSED_UBOOT
301 tuboot.bin: System.map bootstrap.bin u-boot.lzimg
302         @echo
303         $(call echo_green,Merging bootstrap.bin with u-boot.lzimg...)
304         $(call echo_size,    Bootstrap size,bootstrap.bin)
305         $(call echo_size,   LZMA image size,u-boot.lzimg)
306         @cat bootstrap.bin > $@
307         @cat u-boot.lzimg >> $@
308         $(call echo_size,  Total image size,$@)
309
310 u-boot.lzimg: lzma_host $(obj)u-boot.bin System.map
311         @echo
312         @rm -rf u-boot.bin.lzma
313         @$(call echo_green,Compressing U-Boot image $<...)
314         @$(LZMA) --best --keep $(obj)u-boot.bin
315         $(call echo_green,Preparing LZMA compressed U-Boot image $@...)
316         $(MKIMAGE) -A $(ARCH) -T firmware -C lzma \
317                    -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | \
318                     awk '{ printf "%s", $$1 }') \
319                    -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | \
320                     awk '{ printf "%s", $$1 }') \
321                    -n '$(call ih_name)' -d $(obj)u-boot.bin.lzma $@
322
323 bootstrap.bin: bootstrap
324         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
325
326 bootstrap: depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LIBS_SHARED) $(LDSCRIPT_BOOTSTRAP)
327         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) | \
328                    sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \
329                    sort | uniq`; \
330         $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
331               --start-group $(LIBS_BOOTSTRAP) $(LIBS_SHARED) \
332               --end-group $(PLATFORM_LIBS) \
333               -Map bootstrap.map -o bootstrap
334
335 $(LIBS_BOOTSTRAP):
336         $(MAKE) -C `dirname $@`
337
338 lzma_host:
339         @echo
340         $(call echo_green,Building lzma host utility...)
341         $(MAKE) -C $(BUILD_TOPDIR)/host_util/lzma -f makefile.gcc all
342 endif # ifdef COMPRESSED_UBOOT
343
344 version:
345         @echo -n "#define U_BOOT_VERSION \"U-Boot $(U_BOOT_VERSION)\"" > $(VERSION_FILE)
346
347 depend dep:
348         @for dir in $(SUBDIRS); do $(MAKE) -C $$dir .depend; done
349
350 System.map: u-boot
351         @$(NM) $< | \
352                grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
353                sort > System.map
354 endif # include/config.mk
355
356 # =====================
357 # COMMON/SHARED TARGETS
358 # =====================
359
360 unconfig:
361         @$(call echo_green,Removing configuration...)
362         @rm -f include/config.h include/config.mk board/*/config.tmp
363
364 config_common:
365         @ >include/config.h
366         @$(call include_add,soc/soc_list.h)
367
368 ar933x_common: unconfig config_common
369         @$(call define_add,CFG_AG7240_NMACS,2)
370         @$(call define_add,CFG_ATHRS26_PHY,1)
371         @$(call define_add,CONFIG_MACH_HORNET,1)
372
373 ar934x_common: unconfig config_common
374         @$(call define_add,CONFIG_WASP,1)
375         @$(call define_add,CONFIG_WASP_SUPPORT,1)
376
377 qca953x_common: unconfig config_common
378         @$(call define_add,CONFIG_ATHEROS,1)
379         @$(call define_add,CONFIG_MACH_QCA953x,1)
380
381 # =============================
382 # TARGETS IN ALPHABETICAL ORDER
383 # =============================
384
385 8devices_carambola2: ar933x_common
386         @$(call config_init,8devices Carambola 2,carambola-v2,16,11,1,QCA_AR933X_SOC)
387         @$(call define_add,CONFIG_FOR_8DEVICES_CARAMBOLA2,1)
388         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
389
390 comfast_cf-e314n: qca953x_common
391         @$(call config_init,Comfast CF-E314N,cf-e314n,16,17,1,QCA_QCA953X_SOC)
392         @$(call define_add,CONFIG_FOR_COMFAST_CF_E314N,1)
393         @$(call define_add,CFG_ATHRS27_PHY,1)
394         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
395         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
396
397 comfast_cf-e320n_v2: qca953x_common
398         @$(call config_init,Comfast CF-E320N v2,cf-e320n-v2,16,17,1,QCA_QCA953X_SOC)
399         @$(call define_add,CONFIG_FOR_COMFAST_CF_E320N_V2,1)
400         @$(call define_add,CFG_ATHRS27_PHY,1)
401         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
402         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
403
404 comfast_cf-e520n_cf-e530n: qca953x_common
405         @$(call config_init,Comfast CF-E520N/CF-E530N,cf-e520n_cf-e530n,8,17,1,QCA_QCA953X_SOC)
406         @$(call define_add,CONFIG_FOR_COMFAST_CF_E520N_CF_E530N,1)
407         @$(call define_add,CFG_ATHRS27_PHY,1)
408         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
409         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
410
411 d-link_dir-505: ar933x_common
412         @$(call config_init,D-Link DIR-505,dir-505,8,11,1,QCA_AR933X_SOC)
413         @$(call define_add,CONFIG_FOR_DLINK_DIR505_A1,1)
414         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
415
416 dragino_v2_ms14: ar933x_common
417         @$(call config_init,Dragino v2 (MS14),dragino-v2,16,11,1,QCA_AR933X_SOC)
418         @$(call define_add,CONFIG_FOR_DRAGINO_V2,1)
419         @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1)
420         @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1)
421         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
422
423 gainstrong_oolite_v1_dev: ar933x_common
424         @$(call config_init,Gainstrong Oolite v1 (dev board),oolite-v1,16,11,,QCA_AR933X_SOC)
425         @$(call define_add,CONFIG_FOR_GS_OOLITE_V1_DEV,1)
426         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
427
428 gl-innovations_gl-inet-6416: ar933x_common
429         @$(call config_init,GL-Innovations GL.iNet 6416,glinet-6416,8,11,,QCA_AR933X_SOC)
430         @$(call define_add,CONFIG_FOR_GL_INET,1)
431         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
432
433 tp-link_tl-mr10u: ar933x_common
434         @$(call config_init,TP-Link TL-MR10U,tl-mr10u,4,11,,QCA_AR933X_SOC)
435         @$(call define_add,CONFIG_FOR_TPLINK_MR10U_V1,1)
436         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
437
438 tp-link_tl-mr13u: ar933x_common
439         @$(call config_init,TP-Link TL-MR13U,tl-mr13u,4,11,,QCA_AR933X_SOC)
440         @$(call define_add,CONFIG_FOR_TPLINK_MR13U_V1,1)
441         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
442
443 tp-link_tl-mr3020: ar933x_common
444         @$(call config_init,TP-Link TL-MR3020,tl-mr3020,4,11,,QCA_AR933X_SOC)
445         @$(call define_add,CONFIG_FOR_TPLINK_MR3020_V1,1)
446         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
447
448 tp-link_tl-mr3040: ar933x_common
449         @$(call config_init,TP-Link TL-MR3040,tl-mr3040,4,11,,QCA_AR933X_SOC)
450         @$(call define_add,CONFIG_FOR_TPLINK_MR3040_V1V2,1)
451         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
452
453 tp-link_tl-mr3220_v2: ar933x_common
454         @$(call config_init,TP-Link TL-MR3220 v2,tl-mr3220-v2,4,11,,QCA_AR933X_SOC)
455         @$(call define_add,CONFIG_FOR_TPLINK_MR3220_V2,1)
456         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
457
458 tp-link_tl-mr3420_v2: ar934x_common
459         @$(call config_init,TP-Link TL-MR3420 v2,tl-mr3420-v2,4,17,1,QCA_AR9341_SOC)
460         @$(call define_add,CONFIG_FOR_TPLINK_MR3420_V2,1)
461         @$(call define_add,CFG_ATHRS27_PHY,1)
462         @$(call define_add,CFG_AG7240_NMACS,2)
463         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
464
465 tp-link_tl-wa830re_v2_tl-wa801nd_v2: ar934x_common
466         @$(call config_init,TP-Link TL-WA830RE/TL-WA801ND v2,tl-wa830re-801nd-v2,4,17,1,QCA_AR9341_SOC)
467         @$(call define_add,CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2,1)
468         @$(call define_add,CFG_ATHRS27_PHY,1)
469         @$(call define_add,CFG_AG7240_NMACS,2)
470         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
471
472 tp-link_tl-wdr3500: ar934x_common
473         @$(call config_init,TP-Link TL-WDR3500,tl-wdr3500,8,16,1,QCA_AR9344_SOC)
474         @$(call define_add,CONFIG_FOR_TPLINK_WDR3500_V1,1)
475         @$(call define_add,CFG_ATHRS27_PHY,1)
476         @$(call define_add,CFG_AG7240_NMACS,2)
477         @$(call define_add,CONFIG_PCI,1)
478         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
479
480 tp-link_tl-wdr3600_tl-43x0: ar934x_common
481         @$(call config_init,TP-Link TL-WDR3600/43x0,tl-wdr3600-43x0,8,16,1,QCA_AR9344_SOC)
482         @$(call define_add,CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1,1)
483         @$(call define_add,CFG_ATHRS17_PHY,1)
484         @$(call define_add,CFG_AG7240_NMACS,1)
485         @$(call define_add,CONFIG_PCI,1)
486         @$(call define_add,CFG_DUAL_PHY_SUPPORT,1)
487         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
488
489 tp-link_tl-wr703n: ar933x_common
490         @$(call config_init,TP-Link TL-WR703N,tl-wr703n,4,11,,QCA_AR933X_SOC)
491         @$(call define_add,CONFIG_FOR_TPLINK_WR703N_V1,1)
492         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
493
494 tp-link_tl-wr710n: ar933x_common
495         @$(call config_init,TP-Link TL-WR710N,tl-wr710n,8,11,,QCA_AR933X_SOC)
496         @$(call define_add,CONFIG_FOR_TPLINK_WR710N_V1,1)
497         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
498
499 tp-link_tl-wr720n_v3_CN: ar933x_common
500         @$(call config_init,TP-Link TL-WR720N v3 CN,tl-wr720n-v3,4,11,,QCA_AR933X_SOC)
501         @$(call define_add,CONFIG_FOR_TPLINK_WR720N_V3,1)
502         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
503
504 tp-link_tl-wr740n_v4: ar933x_common
505         @$(call config_init,TP-Link TL-WR74xN/D v4,tl-wr74xnd-v4,4,11,,QCA_AR933X_SOC)
506         @$(call define_add,CONFIG_FOR_TPLINK_WR740N_V4,1)
507         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
508
509 tp-link_tl-wr802n: qca953x_common
510         @$(call config_init,TP-Link TL-WR802N,tl-wr802n,4,12,1,QCA_QCA953X_SOC)
511         @$(call define_add,CONFIG_FOR_TPLINK_WR802N,1)
512         @$(call define_add,CFG_ATHRS27_PHY,1)
513         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
514         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
515
516 tp-link_tl-wr820n_CN: qca953x_common
517         @$(call config_init,TP-Link TL-WR820N CN,tl-wr820n,4,12,1,QCA_QCA953X_SOC)
518         @$(call define_add,CONFIG_FOR_TPLINK_WR820N_CN,1)
519         @$(call define_add,CFG_ATHRS27_PHY,1)
520         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
521         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
522
523 tp-link_tl-wr841n_v8: ar934x_common
524         @$(call config_init,TP-Link TL-WR841N/D v8,tl-wr841nd-v8,4,17,1,QCA_AR9341_SOC)
525         @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V8,1)
526         @$(call define_add,CFG_ATHRS27_PHY,1)
527         @$(call define_add,CFG_AG7240_NMACS,2)
528         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
529
530 tp-link_tl-wr841n_v9: qca953x_common
531         @$(call config_init,TP-Link TL-WR841N/D v9,tl-wr841nd-v9,4,12,1,QCA_QCA953X_SOC)
532         @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V9,1)
533         @$(call define_add,CFG_ATHRS27_PHY,1)
534         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
535         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
536
537 unwireddevices_unwired-one: ar933x_common
538         @$(call config_init,Black Swift aka Unwired One,black-swift,16,11,1,QCA_AR933X_SOC)
539         @$(call define_add,CONFIG_FOR_BLACK_SWIFT_BOARD,1)
540         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
541
542 village-telco_mesh-potato_v2: ar933x_common
543         @$(call config_init,Village Telco Mesh Potato 2,mesh-potato-v2,16,11,1,QCA_AR933X_SOC)
544         @$(call define_add,CONFIG_FOR_MESH_POTATO_V2,1)
545         @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1)
546         @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1)
547         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
548
549 wallys_dr531: qca953x_common
550         @$(call config_init,Wallys DR531,dr531,8,17,1,QCA_QCA953X_SOC)
551         @$(call define_add,CONFIG_FOR_WALLYS_DR531,1)
552         @$(call define_add,CFG_ATHRS27_PHY,1)
553         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
554         @$(call define_add,CONFIG_PCI,1)
555         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
556
557 yuncore_ap90q: qca953x_common
558         @$(call config_init,YunCore AP90Q,ap90q,16,17,1,QCA_QCA953X_SOC)
559         @$(call define_add,CONFIG_FOR_YUNCORE_AP90Q,1)
560         @$(call define_add,CFG_ATHRS27_PHY,1)
561         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
562         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
563
564 zbtlink_zbt-we1526: qca953x_common
565         @$(call config_init,Zbtlink ZBT-WE1526,zbt-we1526,16,17,1,QCA_QCA953X_SOC)
566         @$(call define_add,CONFIG_FOR_ZBTLINK_ZBT_WE1526,1)
567         @$(call define_add,CFG_ATHRS27_PHY,1)
568         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
569         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
570
571 # =============
572 # CLEAN TARGETS
573 # =============
574
575 clean:
576         @$(call echo_green,Making $@...)
577         @find . -type f \
578                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
579                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
580                 | xargs rm -f
581         @rm -f tools/mkimage tools/envcrc
582         @rm -f lib_bootstrap/*.o
583         @rm -f lib_bootstrap/*.a
584         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
585
586 lzma_host_clean:
587         @$(call echo_green,Removing lzma host utility...)
588         @$(MAKE) -C $(BUILD_TOPDIR)/host_util/lzma -f makefile.gcc clean
589
590 clobber: clean
591         @$(call echo_green,Making $@...)
592         @find . -type f \( -name .depend \
593                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
594                 -print0 \
595                 | xargs -0 rm -f
596         @rm -f $(OBJS) *.bak include/version_autogenerated.h
597         @rm -fr *.*~
598         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
599         @rm -f tools/crc32.c tools/environment.c
600         @rm -f include/asm/proc include/asm/arch include/asm
601
602 distclean: clobber unconfig