Advertisement
csulokb

justch

May 24th, 2023
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 134.61 KB | Writing | 0 0
  1. #****************************************************************************
  2. #
  3. #  Copyright(c) 2010-2011 Shenzhen TP-LINK Technologies Co.Ltd.
  4. #  All Rights Reserved
  5. #  YangXv <yangxu@tp-link.com.cn>
  6. #
  7. #***************************************************************************
  8.  
  9. # Top-level Makefile for all linux platforms
  10.  
  11. MODEL=C50V4
  12. REGION=EU
  13. ifndef MODEL
  14. $(error "You have to define MODEL, such as VG3631V1")
  15. endif
  16.  
  17. ifneq ($(REGION), )
  18. include config/$(MODEL)/$(REGION)/$(MODEL).config
  19. else
  20. include config/$(MODEL).config
  21. endif
  22.  
  23. ifeq ($(strip $(INCLUDE_CPU_TC3182)),y)
  24. CPU_TYPE=tc3182
  25. endif
  26.  
  27. ifeq ($(strip $(INCLUDE_CPU_TC3162U)),y)
  28. CPU_TYPE=tc3162u
  29. endif
  30.  
  31. #zl added 2011-10-18
  32. ifeq ($(strip $(INCLUDE_CPU_RTL8672)),y)
  33. CPU_TYPE=rtl8672
  34. endif
  35.  
  36. ifeq ($(strip $(INCLUDE_CPU_VR268)),y)
  37. CPU_TYPE=vr268
  38. include config/config.wifi
  39. endif
  40.  
  41. #wanghao added 2013-10-08 for Archer C2
  42. ifeq ($(strip $(INCLUDE_CPU_MT7620A)),y)
  43. CPU_TYPE=mt7620a
  44. endif
  45. #end--added
  46.  
  47. #yanwei added 2016-09-07 for wr840nv4
  48. ifeq ($(strip $(INCLUDE_CPU_MT7628)),y)
  49. CPU_TYPE=mt7628
  50. endif
  51. #end--added
  52.  
  53. ifeq ($(strip $(INCLUDE_CPU_RT63368)),y)
  54. CPU_TYPE=rt63368
  55. endif
  56.  
  57. ifeq ($(strip $(INCLUDE_CPU_RT63365)),y)
  58. CPU_TYPE=rt63365
  59. endif
  60.  
  61. ifeq ($(strip $(INCLUDE_CPU_88F6550)),y)
  62. CPU_TYPE=88f6550
  63. include config/config.wifi
  64. endif
  65.  
  66. #define basic variable
  67. TOP_PATH = $(shell pwd)/..
  68. BUILD_PATH = $(TOP_PATH)/build
  69. TOOLS_PATH = $(TOP_PATH)/host_tools
  70. FAKEROOT_PATH = $(TOOLS_PATH)/fakeroot
  71.  
  72. #Temporarily
  73. ifeq ($(strip $(INCLUDE_LANGUAGE_EN)),y)
  74. WEBFILE_PATH = $(TOP_PATH)/sysfiles/web/en
  75. CONFFILE_PATH = $(TOP_PATH)/sysfiles/config/en
  76. endif
  77.  
  78. ifeq ($(strip $(INCLUDE_LANGUAGE_CN)),y)
  79. WEBFILE_PATH = $(TOP_PATH)/sysfiles/web/cn
  80. CONFFILE_PATH = $(TOP_PATH)/sysfiles/config/cn
  81. endif
  82.  
  83. ifeq ($(strip $(INCLUDE_NEW_WEBUI)), y)
  84. WEBFILE_PATH_NEW = $(TOP_PATH)/sysfiles/webpages
  85. endif
  86. ifeq ($(REGION), )
  87. MODEL_BUSYBOX_CONFIG = $(BUILD_PATH)/config/$(MODEL)/busybox.config
  88. else
  89. MODEL_BUSYBOX_CONFIG = $(BUILD_PATH)/config/$(MODEL)/$(REGION)/busybox.config
  90. endif
  91. TARGETS_PATH = $(TOP_PATH)/targets
  92. PUBLIC_APPS_PATH = $(TOP_PATH)/apps/public
  93. PRIVATE_APPS_PATH = $(TOP_PATH)/apps/private
  94. OS_LIB_PATH = $(PUBLIC_APPS_PATH)/os_libs
  95. TP_MODULES_PATH = $(TOP_PATH)/modules/private
  96. GCC_PATH = /opt
  97.  
  98.  
  99. #GPL dir
  100. export GPL_DIR=$(TOP_PATH)/$(GPL_PACKAGE_NAME)
  101. ####################################################
  102. #
  103. #Get supplier        
  104. #
  105. ####################################################   
  106. ifeq ($(strip $(CPU_TYPE)),88f6550)
  107. #ChenZhu add 20130402 for bigendian is not supported
  108. export BIGENDIAN = 0
  109. SUPPLIER = environment_marvel88f6560
  110. SUPPLIER_MARVELL = environment_marvel88f6560
  111. export ARCH = arm
  112. export KERNELARCH = arm
  113. TOOLROOTPATH :=/opt/marvell/armv5-marvell-linux-uclibcgnueabi-soft_i686
  114. export CROSS_COMPILE = $(TOOLROOTPATH)/bin/arm-marvell-linux-uclibcgnueabi-
  115. export PATH := $(TOOLROOTPATH)/bin:$(PATH)
  116. TOOLPREFIX = arm-marvell-linux-uclibcgnueabi-
  117. HOST = arm-marvell-linux-uclibcgnueabi
  118. KERNELVERSION = 2.6.32.11
  119. OBJ_DIR = marvell_2.6.25-RC10
  120. export KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/SDK_2.6.25-RC10/Source/Kernel/linux_feroceon-KW2
  121.  
  122. AVANTA_HGU_CFG_DIR = $(TOP_PATH)/$(SUPPLIER)/SDK_2.6.25-RC10/Source/ConfigFiles/Products/AVANTA_HGU
  123. AVANTA_HGU_INITD_DIR = $(AVANTA_HGU_CFG_DIR)/FileSystem/init.d
  124.  
  125. KERNEL_CFG_DIR = $(AVANTA_HGU_CFG_DIR)/Kernel
  126.  
  127. MARVELL_KERNEL_IMAGE_DIR = $(KERNELPATH)/arch/arm/boot
  128. MARVELL_KERNEL_IMAGE_NAME = uImage
  129.  
  130. MARVELL_SQAUSH_FS_DIR = $(TOP_PATH)/$(SUPPLIER)/SDK_2.6.25-RC10/Source
  131. MARVELL_SQAUSH_FS_NAME = rootfs.squashfs
  132. MARVELL_JFFS2_FS_NAME = jffs2.image
  133.  
  134. MARVELL_IMAGE_DIR = $(TOP_PATH)/$(SUPPLIER)/SDK_2.6.25-RC10/Output/Products/AVANTA_HGU/RecoveryImage
  135. MARVELL_IMAGE_NAME = rootfs.squashfs.rcvr.img
  136.  
  137. export MAKEARCH = $(MAKE) ARCH=$(KERNELARCH) CROSS_COMPILE=$(TOOLPREFIX)
  138.  
  139. export HAL = $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/hal
  140. export TARGETARCH = xscale-le-elf
  141. export MODULEPATH = $(TARGETS_PATH)/fs.$(MODEL)/lib/modules
  142. WIRELESSTOOLS = wireless_tools.29
  143. WIFI_TOOL_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_wifi_tool
  144. WIFI_MODULE_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_wifi_modules
  145. INSTALL_WIRELESS = $(WIFI_TOOL_TG_PATH)
  146. FS_WIRELESS_MODULE = $(MODULEPATH)
  147. FS_WIRELESS_TOOLS = $(TARGETS_PATH)/fs.$(MODEL)/usr
  148. WIRELESSTOOLSLIB = iwlib.so
  149.  
  150. export WIFI_MODULE_TG_PATH
  151.  
  152. #export ATH_CARR_DIR = marvel
  153. export PLATFORM = $(TOP_PATH)/environment_marvel88f6560/modules/private/wlan
  154. #export PLATFORM_INC = $(PLATFORM)/carrier/$(ATH_CARR_DIR)/include
  155. export ATHEROSPATH=$(PLATFORM)
  156.  
  157. export MARVELL_SW_DIR = $(TOP_PATH)/$(SUPPLIER)/SDK_2.6.25-RC10/Source/Application/SW_TREE_PUB
  158. #export MARVELL_SW_LIBS_INC = -I$(MARVELL_SW_DIR)/mng/i2c/appl/i2c_app/inc
  159. export MARVELL_SW_LIBS_INC = -I$(MARVELL_SW_DIR)/mng/omci/core/h    #Added by YeZuopou @ 01Apr13
  160. export MARVELL_SW_LIBS_LIB = -L$(MARVELL_SW_DIR)/mipc/obj -lmipc \
  161.                             -L$(MARVELL_SW_DIR)/mipc/api_defs/omci -lomci_mipc_client \
  162.                             -lm
  163. endif
  164.  
  165. ifeq ($(strip $(CPU_TYPE)),tc3182)
  166. TOOLROOTPATH :=/opt/trendchip/mips-linux-uclibc/usr
  167. export PATH :=$(TOOLROOTPATH)/bin:$(PATH)
  168. SUPPLIER = ralink
  169. TOOLPREFIX = mips-linux-uclibc-
  170. HOST = mips-linux-uclibc
  171. KERNELVERSION = 2.6.22.15
  172. OBJ_DIR = ralink_4.3.4
  173. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/Project/lib/mips-linux-uclibc/
  174. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux
  175. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs-lzma
  176.  
  177. ifeq ($(strip $(SUPPLIER)),ralink)
  178.  
  179. unexport TC_CFLAGS
  180. ifeq ($(INCLUDE_VOIP), y)
  181. include voip.mak
  182. TC_CFLAGS += $(VOIP_LOCALE)
  183. ifeq ($(INCLUDE_DSP_SOCKET_OPEN), y)
  184. TC_CFLAGS += -DINCLUDE_DSP_SOCKET_OPEN
  185. endif
  186. endif
  187.  
  188. ifeq ($(strip $(TCSUPPORT_SDRAM_32M)),y)
  189. TC_CFLAGS += -DTCSUPPORT_SDRAM_32M
  190. endif
  191.  
  192. ifeq ($(INCLUDE_WATCHDOG), y)
  193. TC_CFLAGS += -DTCSUPPORT_WATCHDOG
  194. endif
  195.  
  196. ifeq ($(strip $(TCSUPPORT_BRIDGE_FASTPATH)),y)
  197. TC_CFLAGS += -DTCSUPPORT_BRIDGE_FASTPATH
  198. endif
  199. export TC_CFLAGS
  200. endif
  201.  
  202. endif
  203.  
  204. ifeq ($(strip $(CPU_TYPE)),tc3162u)
  205. export PATH :=/opt/trendchip/mips-linux-3.4.6/bin:$(PATH)
  206. SUPPLIER = ralink
  207. TOOLPREFIX = mips-linux-
  208. HOST = mips-linux
  209. KERNELVERSION = 2.6.22.15
  210. OBJ_DIR = ralink_3.4.6
  211. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/Project/lib/mips-linux/
  212. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux
  213. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs-lzma
  214. endif
  215.  
  216. #zl added 2011-10-18
  217. ifeq ($(strip $(CPU_TYPE)),rtl8672)
  218. export PATH :=/opt/rtl/rsdk-1.3.6-5181-EB-2.6.30-0.9.30/bin:$(PATH)
  219. SUPPLIER = realtek
  220. TOOLPREFIX = rsdk-linux-
  221. HOST = rsdk-linux
  222. KERNELVERSION = 2.6.30.9
  223. OBJ_DIR = realtek_1.3.6
  224. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/vendors/rsdk-linux/
  225. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.x
  226. ROOTFSTOOLS = $(KERNELPATH)/mksquashfs
  227. #For lzma when make rootfs
  228. export PATH := $(KERNELPATH)/rtkload/:$(PATH)
  229. endif
  230. #end--added
  231.  
  232. ifeq ($(strip $(CPU_TYPE)),vr268)
  233. SUPPLIER = lantiq
  234. TOOLPREFIX = mips-linux-uclibc-
  235. HOST = mips-linux
  236. KERNELVERSION = 2.6.32.32
  237. OBJ_DIR = lantiq_4.3.3
  238. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/build_dir/target-mips_r2_uClibc-0.9.30.1_2_6_32_LANTIQ/root-ltqcpe/orilib
  239. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/build_dir/linux-ltqcpe_2_6_32_LANTIQ/linux-2.6.32.32
  240. ROOTFSTOOLS = $(TOP_PATH)/$(SUPPLIER)/staging_dir/host/bin/mksquashfs4
  241. TOOLCHAIN_DIR = $(TOP_PATH)/$(SUPPLIER)/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1_2_6_32
  242. export PATH :=$(TOP_PATH)/$(SUPPLIER)/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1_2_6_32/usr/bin:$(PATH)
  243. export PATH :=$(TOP_PATH)/$(SUPPLIER)/staging_dir/host/bin:$(PATH)
  244. export HAL = $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/hal
  245. export KERNELARCH = mips
  246. export MAKEARCH = $(MAKE) ARCH=$(KERNELARCH) CROSS_COMPILE=$(TOOLPREFIX)
  247. export ATH_CARR_DIR = lantiq
  248. export PLATFORM = $(TOP_PATH)/lantiq/modules/private/wlan
  249. export PLATFORM_INC = $(PLATFORM)/carrier/$(ATH_CARR_DIR)/include
  250. export WAVE300_DIR = $(TOP_PATH)/lantiq/modules/wave300
  251. export INSTALL_WIRELESS = $(TOP_PATH)/$(SUPPLIER)/wireless
  252. export MODULEPATH = $(INSTALL_WIRELESS)/lib/modules/
  253. export ATHEROSPATH=$(PLATFORM)
  254. endif
  255.  
  256. #wanghao added 2013-10-8 for Archer C2
  257. ifeq ($(strip $(CPU_TYPE)),mt7620a)
  258. TOOLROOTPATH :=$(GCC_PATH)/buildroot-gcc463/usr
  259. export PATH :=$(TOOLROOTPATH)/bin:$(PATH)
  260. SUPPLIER = mtk_ApSoC_4320
  261. TOOLPREFIX = mipsel-linux-
  262. HOST = mipsel-linux
  263. KERNELVERSION = 2.6.36
  264. OBJ_DIR = mtk_4.6.3
  265. SLIB_PATH = $(GCC_PATH)/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/lib
  266. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x
  267. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs4.2
  268.  
  269. export CROSS_COMPILE=$(TOOLPREFIX)
  270.  
  271. unexport TC_CFLAGS
  272. TC_CFLAGS += -DTCSUPPORT_IGMPSNOOPING_ENHANCE
  273. export TC_CFLAGS
  274.  
  275. export KERNELVERSION
  276. export INSTALL_WIRELESS = $(TOP_PATH)/$(SUPPLIER)/wireless
  277. export MT7610E_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/MT7610_ap
  278. export MT7612E_AP_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/MT7612_ap
  279. export MT7620_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/rt2860v2_ap
  280. export WIRELESSTOOLS =$(TOP_PATH)/$(SUPPLIER)/modules/public/wireless_tools.29
  281. export WIRELESSTOOLSLIB = libiw.so.29
  282. endif
  283. #end--added
  284.  
  285. #yanwei added 2016-09-07 for WR840NV2
  286. ifeq ($(strip $(CPU_TYPE)),mt7628)
  287. TOOLROOTPATH :=$(GCC_PATH)/buildroot-gcc463/usr
  288. export PATH :=$(TOOLROOTPATH)/bin:$(PATH)
  289. SUPPLIER = mtk_ApSoC_4320
  290. TOOLPREFIX = mipsel-linux-
  291. HOST = mipsel-linux
  292. KERNELVERSION = 2.6.36
  293. OBJ_DIR = mtk_4.6.3
  294. SLIB_PATH = $(GCC_PATH)/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/lib
  295. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x
  296. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs4.2
  297.  
  298. export CROSS_COMPILE=$(TOOLPREFIX)
  299.  
  300. unexport TC_CFLAGS
  301. TC_CFLAGS += -DTCSUPPORT_IGMPSNOOPING_ENHANCE
  302. export TC_CFLAGS
  303.  
  304. export KERNELVERSION
  305. export INSTALL_WIRELESS = $(TOP_PATH)/$(SUPPLIER)/wireless
  306. export MT7612E_AP_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/MT7612_ap
  307. export MT7628_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/mt_wifi
  308. export MT7612E_AP_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/MT7612_ap
  309. export MT7610E_DIR = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36.x/drivers/net/wireless/MT7610_ap
  310. export WIRELESSTOOLS =$(TOP_PATH)/$(SUPPLIER)/modules/public/wireless_tools.29
  311. export WIRELESSTOOLSLIB = libiw.so.29
  312. endif
  313. #end--added
  314.  
  315. ifeq ($(strip $(CPU_TYPE)),rt63368)
  316. TOOLROOTPATH :=/opt/trendchip/mips-linux-uclibc/usr
  317. export PATH :=$(TOOLROOTPATH)/bin:$(PATH)
  318. SUPPLIER = mtk
  319. TOOLPREFIX = mips-linux-uclibc-
  320. HOST = mips-linux-uclibc
  321. KERNELVERSION = 2.6.36
  322. OBJ_DIR = mtk_4.3.4
  323. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/Project/lib/mips-linux-uclibc/
  324. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36
  325. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs4
  326.  
  327. unexport TC_CFLAGS
  328.  
  329. ifeq ($(INCLUDE_VOIP), y)
  330. include voip.mak
  331. TC_CFLAGS += -DTCSUPPORT_VOIP $(VOIP_LOCALE)
  332. ifeq ($(INCLUDE_DSP_SOCKET_OPEN), y)
  333. TC_CFLAGS += -DINCLUDE_DSP_SOCKET_OPEN
  334. endif
  335. endif
  336.  
  337. ifeq ($(INCLUDE_WATCHDOG), y)
  338. TC_CFLAGS += -DTCSUPPORT_WATCHDOG
  339. endif
  340.  
  341. export TC_CFLAGS
  342. export KERNELVERSION
  343.  
  344. endif
  345.  
  346. ifeq ($(strip $(CPU_TYPE)),rt63365)
  347. TOOLROOTPATH :=/opt/trendchip/mips-linux-uclibc/usr
  348. export PATH :=$(TOOLROOTPATH)/bin:$(PATH)
  349. SUPPLIER = mtk
  350. TOOLPREFIX = mips-linux-uclibc-
  351. HOST = mips-linux-uclibc
  352. KERNELVERSION = 2.6.36
  353. OBJ_DIR = mtk_4.3.4
  354. SLIB_PATH = $(TOP_PATH)/$(SUPPLIER)/Project/lib/mips-linux-uclibc/
  355. KERNELPATH = $(TOP_PATH)/$(SUPPLIER)/linux-2.6.36
  356. ROOTFSTOOLS = $(SUPPLIER_TOOLS)/mksquashfs4
  357.  
  358.  
  359. unexport TC_CFLAGS
  360. TC_CFLAGS += -DTCSUPPORT_IGMPSNOOPING_ENHANCE
  361. export TC_CFLAGS
  362.  
  363. export KERNELVERSION
  364.  
  365. endif
  366.  
  367. ####################################################
  368. #
  369. #Supplier PATH variable        
  370. #
  371. ####################################################   
  372.  
  373. INSTALL_MOD_PATH = $(KERNELPATH)/../
  374. export MODULES_PATH = $(TOP_PATH)/$(SUPPLIER)/modules/private
  375. SUPPLIER_TOOLS = $(TOP_PATH)/$(SUPPLIER)/tools
  376.  
  377. ifeq ($(strip $(SUPPLIER)),realtek)
  378. ifeq ($(INCLUDE_LAN_WLAN), y)
  379. WIRELESS_TOOLS = iwpriv
  380. endif
  381. endif
  382.  
  383. #TG means target
  384. BOOT_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_boot
  385. ifneq ($(findstring $(CPU_TYPE),mt7620a mt7628), )
  386. KERNEL_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_kernel_$(MODEL)
  387. MODULE_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_modules_$(MODEL)
  388. else
  389. KERNEL_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_kernel
  390. MODULE_TG_PATH = $(TARGETS_PATH)/$(SUPPLIER)_$(CPU_TYPE)_modules
  391. endif
  392. MODEL_FS_PATH = $(TARGETS_PATH)/fs.$(MODEL)
  393.  
  394. PRIVATE_LIB_BIN_PATH = $(PRIVATE_APPS_PATH)/bins/$(OBJ_DIR)/libs/
  395. PRIVATE_APPS_BIN_PATH = $(PRIVATE_APPS_PATH)/bins/$(OBJ_DIR)/apps/
  396.  
  397. ####################################################
  398. #
  399. #Supplier compiler variable        
  400. #
  401. ####################################################   
  402.  
  403. ifeq ($(INCLUDE_VOIP), y)
  404. sinclude voip.mak
  405. endif
  406.  
  407. CC = $(TOOLPREFIX)gcc
  408. LD = $(TOOLPREFIX)ld
  409. AR = $(TOOLPREFIX)ar
  410. STRIP = $(TOOLPREFIX)strip
  411. RANLIB = $(TOOLPREFIX)ranlib
  412.  
  413. ####################################################
  414. #
  415. #PJSIP Variable
  416. #
  417. ####################################################
  418. PJSIP_CONFCACHE_EXIST = $(wildcard $(PUBLIC_APPS_PATH)/pjsip_1.10/config_cache_file)
  419.  
  420. ####################################################
  421. #
  422. #Function conditional compilation        
  423. #
  424. ####################################################   
  425.  
  426. DFLAGS =
  427. WEBFLAGS =
  428. DF_FLAGS =
  429.  
  430. ifeq ($(INCLUDE_CPU_BIG_ENDIAN), y)
  431. DFLAGS += -DINCLUDE_CPU_BIG_ENDIAN
  432. CMM_TARGET_CPU_ENDIAN = 0
  433. export CMM_TARGET_CPU_ENDIAN
  434. endif
  435. ifeq ($(INCLUDE_CPU_LITTLE_ENDIAN), y)
  436. DFLAGS += -DINCLUDE_CPU_LITTLE_ENDIAN
  437. CMM_TARGET_CPU_ENDIAN = 1
  438. export CMM_TARGET_CPU_ENDIAN
  439. endif
  440. ifeq ($(strip $(INCLUDE_SOCKET_LOCK)), y)
  441. DFLAGS += -DINCLUDE_SOCKET_LOCK
  442. export INCLUDE_SOCKET_LOCK=y
  443. endif
  444.  
  445. ifeq ($(INCLUDE_SERBIA), y)
  446. DFLAGS += -DINCLUDE_SERBIA
  447. endif
  448.  
  449. ifeq ($(INCLUDE_WATCHDOG), y)
  450. DFLAGS += -DINCLUDE_WATCHDOG
  451. endif
  452.  
  453. ifeq ($(INCLUDE_PPA_ACCELERATE), y)
  454. DFLAGS += -DINCLUDE_PPA_ACCELERATE
  455. endif
  456.  
  457. ifeq ($(INCLUDE_MTD_TYPE1), y)
  458. DFLAGS += -DINCLUDE_MTD_TYPE1
  459. MTD_PART_TYPE = 1
  460. MTD_FLASH_SIZE = 0x800000
  461. endif
  462.  
  463. ifeq ($(INCLUDE_MTD_TYPE2), y)
  464. DFLAGS += -DINCLUDE_MTD_TYPE2
  465. MTD_PART_TYPE = 2
  466. MTD_FLASH_SIZE = 0x800000
  467. endif
  468.  
  469. ifeq ($(INCLUDE_MTD_TYPE_4M), y)
  470. DFLAGS += -DINCLUDE_MTD_TYPE_4M
  471. ifeq ($(INCLUDE_TINY_UBOOT),y)
  472. DFLAGS += -DINCLUDE_TINY_UBOOT
  473. MTD_PART_TYPE = 5
  474. else
  475. MTD_PART_TYPE = 4
  476. endif
  477. MTD_FLASH_SIZE = 0x400000
  478. export INCLUDE_REDUCE_FS_SIZE=y
  479. endif
  480.  
  481. ifeq ($(INCLUDE_MTD_TYPE_DUAL_UBOOT), y)
  482. DFLAGS += -DINCLUDE_MTD_TYPE_DUAL_UBOOT
  483. MTD_PART_TYPE = 6
  484. MTD_FLASH_SIZE = 0x800000
  485. endif
  486. ifeq ($(INCLUDE_DUAL_UBOOT), y)
  487. DFLAGS += -DINCLUDE_DUAL_UBOOT
  488. TEXT_BASE = $(shell grep -oP '(?<=TEXT_BASE=)[^ ]+' $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config)
  489. FACTORY_UBOOT_SIZE = $(shell grep -oP '(?<=FACTORY_UBOOT_SIZE=)[^ ]+' $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config)
  490. SECOND_UBOOT_SIZE = $(shell grep -oP '(?<=SECOND_UBOOT_SIZE=)[^ ]+' $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config)
  491. DUAL_UBOOT_ARGS_ADDR = $(shell grep -oP '(?<=DUAL_UBOOT_ARGS_ADDR=)[^ ]+' $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config)
  492. SECOND_TEXT_BASE := $(shell awk 'BEGIN{printf("0x%X",'$(FACTORY_UBOOT_SIZE)'+'$(TEXT_BASE)')}')
  493. DFLAGS += -DFACTORY_UBOOT_SIZE=$(FACTORY_UBOOT_SIZE) -DSECOND_UBOOT_SIZE=$(SECOND_UBOOT_SIZE) -DDUAL_UBOOT_ARGS_ADDR=$(DUAL_UBOOT_ARGS_ADDR)
  494. endif
  495. ifeq ($(INCLUDE_MEM_FREE_OPTIMIZE), y)
  496. DFLAGS += -DINCLUDE_MEM_FREE_OPTIMIZE
  497. endif
  498.  
  499. ifeq ($(INCLUDE_REDUCE_FS_SIZE),y)
  500. DFLAGS += -DINCLUDE_REDUCE_FS_SIZE
  501. endif
  502.  
  503. ifeq ($(INCLUDE_CLI_FULL_FEATURE), y)
  504. DFLAGS += -DINCLUDE_CLI_FULL_FEATURE
  505. endif
  506.  
  507. ifeq ($(INCLUDE_USER_ACCOUNT ), y)
  508. DFLAGS += -DINCLUDE_USER_ACCOUNT
  509. endif
  510.  
  511. ifeq ($(INCLUDE_CHGINIT_PWD), y)
  512. DFLAGS += -DINCLUDE_CHGINIT_PWD
  513. endif
  514.  
  515. ifeq ($(INCLUDE_AUTH_PASSWORD), y)
  516. DFLAGS += -DINCLUDE_AUTH_PASSWORD
  517. endif
  518.  
  519. ifeq ($(INCLUDE_TPLOGIN_REDIRECT), y)
  520. DFLAGS += -DINCLUDE_TPLOGIN_REDIRECT
  521. endif
  522. ifeq ($(INCLUDE_NEW_WEBUI), y)
  523. DFLAGS += -DINCLUDE_NEW_WEBUI
  524. WEBFLAGS +=INCLUDE_CHGINIT_PWD=1
  525. WEBFLAGS +=WEB_INCLUDE_HELP=1
  526. endif
  527.  
  528. ifeq ($(INCLUDE_CO_FW), y)
  529. DFLAGS += -DINCLUDE_CO_FW
  530. endif
  531.  
  532. ifeq ($(INCLUDE_MEXICO_SPEC), y)
  533. DFLAGS += -DINCLUDE_MEXICO_SPEC
  534. SPEC_LANG=es_MX
  535. endif
  536.  
  537. ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  538. DFLAGS += -DINCLUDE_MALAYSIA_SPEC
  539. SPEC_LANG=en_US
  540. endif
  541.  
  542. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  543. DFLAGS += -DINCLUDE_RUSSIA_SPEC
  544. SPEC_LANG=ru_RU
  545. endif
  546.  
  547. ifeq ($(INCLUDE_TW_SPEC), y)
  548. DFLAGS += -DINCLUDE_TW_SPEC
  549. SPEC_LANG=zh_TW
  550. endif
  551.  
  552. ifeq ($(INCLUDE_KOREA_SPEC), y)
  553. DFLAGS += -DINCLUDE_KOREA_SPEC
  554. SPEC_LANG=ko_KR
  555. endif
  556.  
  557. ifeq ($(INCLUDE_CANADA_SPEC), y)
  558. DFLAGS += -DINCLUDE_CANADA_SPEC
  559. SPEC_LANG=fr_CA
  560. endif
  561.  
  562. ifeq ($(INCLUDE_BR_SPEC), y)
  563. DFLAGS += -DINCLUDE_BR_SPEC
  564. SPEC_LANG=pt_BR
  565. endif
  566.  
  567. ifeq ($(INCLUDE_ES_SPEC), y)
  568. DFLAGS += -DINCLUDE_ES_SPEC
  569. SPEC_LANG=es_MX
  570. endif
  571.  
  572. ifeq ($(INCLUDE_GERMANY_SPEC), y)
  573. DFLAGS += -DINCLUDE_GERMANY_SPEC
  574. SPEC_LANG=de_DE
  575. endif
  576.  
  577. ifeq ($(INCLUDE_VIETNAM_FPT), y)
  578. DFLAGS += -DINCLUDE_VIETNAM_FPT
  579. SPEC_LANG=vi_VN
  580. endif
  581.  
  582. ifeq ($(INCLUDE_US_SPEC), y)
  583. DFLAGS += -DINCLUDE_US_SPEC
  584. SPEC_LANG=en_US
  585. endif
  586.  
  587. ifeq ($(DEFAULT_NO_SPEC), y)
  588. DFLAGS += -DDEFAULT_NO_SPEC
  589. endif
  590.  
  591. ifeq ($(INCLUDE_JAPAN_SPEC),y)
  592. DFLAGS +=-DINCLUDE_JAPAN_SPEC
  593. SPEC_LANG=jp_JP
  594. endif
  595.  
  596. ifeq ($(INCLUDE_PL_SPEC), y)
  597. DFLAGS +=-DINCLUDE_PL_SPEC
  598. SPEC_LANG=pl_PL
  599. endif
  600.  
  601. ifeq ($(INCLUDE_VN_SPEC),y)
  602. DFLAGS +=-DINCLUDE_VN_SPEC
  603. SPEC_LANG=vi_VN
  604. endif
  605.  
  606. ifeq ($(INCLUDE_ROMANIA_SPEC),y)
  607. DFLAGS +=-DINCLUDE_ROMANIA_SPEC
  608. DFLAGS +=-DINCLUDE_CPUMEM_INFO
  609. SPEC_LANG=ro_RO
  610. endif
  611.  
  612. ifeq ($(SPEC_LANG),)
  613. SPEC_LANG=en_US
  614. endif
  615.  
  616. ifeq ($(INCLUDE_FCC_BORDER_CHANNEL_AVOID),y)
  617. DFLAGS +=-DINCLUDE_FCC_BORDER_CHANNEL_AVOID
  618. endif
  619.  
  620. ifeq ($(INCLUDE_MULTI_LANGUAGE_Q),y)
  621. WEBFLAGS +=INCLUDE_MULTI_LANGUAGE_Q=1
  622. DFLAGS += -DINCLUDE_MULTILANGUAGE
  623. else
  624. WEBFLAGS +=INCLUDE_MULTI_LANGUAGE_Q=0
  625. endif
  626.  
  627. #add by frl,2015-09-14
  628. ifeq ($(INCLUDE_CLOUD), y)
  629. DFLAGS += -DINCLUDE_CLOUD
  630. DFLAGS += -DINCLUDE_CLOUD_V2
  631. CONFIG_TP_CLOUD = 1
  632. else
  633. CONFIG_TP_CLOUD = 0
  634. endif
  635.  
  636. ifeq ($(INCLUDE_WAN_BLOCK), y)
  637. DFLAGS += -DINCLUDE_WAN_BLOCK
  638.  
  639. ifeq ($(INCLUDE_WAN_BLOCK_WAN_ERROR), y)
  640. DFLAGS += -DINCLUDE_WAN_BLOCK_WAN_ERROR
  641. endif
  642.  
  643. ifeq ($(INCLUDE_WAN_BLOCK_FW_UP_INFO), y)
  644. DFLAGS += -DINCLUDE_WAN_BLOCK_FW_UP_INFO
  645. endif
  646. endif
  647. #add end
  648. #################### ETH Type ######################
  649. ifeq ($(INCLUDE_ETH_LTQ), y)
  650. DFLAGS += -DINCLUDE_ETH_LTQ
  651. endif
  652.  
  653. ifeq ($(INCLUDE_ETH_RA), y)
  654. DFLAGS += -DINCLUDE_ETH_RA
  655. endif
  656.  
  657. ifeq ($(INCLUDE_RAETH_EXTERNAL_QCA8337), y)
  658. DFLAGS += -DINCLUDE_RAETH_EXTERNAL_QCA8337
  659. endif
  660.  
  661. ###################### WIFI  ########################
  662. ifeq ($(INCLUDE_LAN_WLAN), y)
  663. DFLAGS += -DINCLUDE_LAN_WLAN
  664. endif
  665.  
  666. ifeq ($(INCLUDE_WLAN_RA), y)
  667. DFLAGS += -DINCLUDE_WLAN_RA
  668. endif
  669.  
  670. ifeq ($(INCLUDE_WLAN_RTL), y)
  671. DFLAGS += -DINCLUDE_WLAN_RTL
  672. endif
  673.  
  674. ifeq ($(INCLUDE_WLAN_ATH), y)
  675. DFLAGS += -DINCLUDE_WLAN_ATH
  676. endif
  677.  
  678. #added by wangbing 2013-10-22
  679. ifeq ($(INCLUDE_WLAN_MTK_AC),y)
  680. DFLAGS += -DINCLUDE_WLAN_MTK_AC
  681. DFLAGS += -DINCLUDE_LAN_WLAN_AC
  682. endif
  683.  
  684. ifeq ($(INCLUDE_LAN_WLAN_MSSID), y)
  685. DFLAGS += -DINCLUDE_LAN_WLAN_MSSID
  686. endif
  687.  
  688. ifeq ($(INCLUDE_LAN_WLAN_GUESTNETWORK), y)
  689. DFLAGS += -DINCLUDE_LAN_WLAN_GUESTNETWORK
  690. endif
  691.  
  692. ifeq ($(INCLUDE_LAN_WLAN_QUICKSAVE), y)
  693. DFLAGS += -DINCLUDE_LAN_WLAN_QUICKSAVE
  694. endif
  695.  
  696. ifeq ($(INCLUDE_LAN_WLAN_WDS), y)
  697. DFLAGS += -DINCLUDE_LAN_WLAN_WDS
  698. endif
  699.  
  700. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  701. DFLAGS += -DINCLUDE_LAN_WLAN_DUALBAND
  702. endif
  703.  
  704. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND_DIF_MAC),y)
  705. DFLAGS += -DINCLUDE_LAN_WLAN_DUALBAND_DIF_MAC
  706. endif
  707.  
  708. ifeq ($(INCLUDE_LAN_WLAN_DIFFERENT_CHIP),y)
  709. DFLAGS += -DINCLUDE_LAN_WLAN_DIFFERENT_CHIP
  710. endif
  711.  
  712. ifeq ($(INCLUDE_LAN_WLAN_8021X), y)
  713. DFLAGS += -DINCLUDE_LAN_WLAN_802_1X
  714. endif
  715.  
  716. ifeq ($(INCLUDE_LAN_WLAN_SCHEDULE), y)
  717. DFLAGS += -DINCLUDE_LAN_WLAN_SCHEDULE
  718. endif
  719.  
  720. ifeq ($(INCLUDE_LAN_WLAN_SCHEDULE_ONLY_FOR_GUEST), y)
  721. DFLAGS += -DINCLUDE_LAN_WLAN_SCHEDULE_ONLY_FOR_GUEST
  722. endif
  723.  
  724. ifeq ($(INCLUDE_LAN_WLAN_GUEST_TIMEOUT), y)
  725. DFLAGS += -DINCLUDE_LAN_WLAN_GUEST_TIMEOUT
  726. endif
  727.  
  728. ifeq ($(INCLUDE_WIFI_CERTIFIED), y)
  729. DFLAGS += -DINCLUDE_WIFI_CERTIFIED
  730. endif
  731.  
  732. ifeq ($(INCLUDE_ISRAEL_SPEC), y)
  733. DFLAGS += -DINCLUDE_ISRAEL_SPEC
  734. endif
  735.  
  736. ifeq ($(INCLUDE_WIFI_5G), y)
  737. DFLAGS += -DINCLUDE_WIFI_5G
  738. endif
  739.  
  740. ifeq ($(INCLUDE_CPU_MT7628),y)
  741. DFLAGS += -DINCLUDE_CPU_MT7628
  742. endif
  743.  
  744. # added by yanglianxiang 2014-7-23
  745. ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7610E), y)
  746. DFLAGS += -DINCLUDE_WIFI_5G_CHIP_MT7610E
  747. else ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7612E), y)
  748. DFLAGS += -DINCLUDE_WIFI_5G_CHIP_MT7612E
  749. # for ated_tp
  750. export WT_FLAGS += -DINCLUDE_WIFI_5G_CHIP_MT7612E
  751. endif
  752.  
  753. ifeq ($(INCLUDE_LAN_AP_GATEWAY), y)
  754. DFLAGS += -DINCLUDE_LAN_AP_GATEWAY
  755. endif
  756. ##################################################
  757. ifeq ($(INCLUDE_BETA), y)
  758. DFLAGS += -DINCLUDE_BETA
  759. endif
  760. #################################################
  761. ###################### PON  ########################
  762.  
  763. ifeq ($(strip $(INCLUDE_CPU_88F6550)),y)
  764. DFLAGS += -DINCLUDE_PON_VG1530_ENV
  765. DFLAGS += -DINCLUDE_PON_MARVELL_SW_LIB
  766. endif
  767.  
  768. ifeq ($(INCLUDE_PON), y)
  769. DFLAGS += -DINCLUDE_PON
  770. endif
  771.  
  772. ifeq ($(INCLUDE_PON_EPON), y)
  773. DFLAGS += -DINCLUDE_PON_EPON
  774. endif
  775.  
  776. ifeq ($(INCLUDE_PON_GPON), y)
  777. DFLAGS += -DINCLUDE_PON_GPON
  778. endif
  779.  
  780. #################### Function ######################
  781.  
  782. ifeq ($(INCLUDE_BRIDGING), y)
  783. DFLAGS += -DINCLUDE_BRIDGING
  784. endif
  785.  
  786. ifeq ($(INCLUDE_ADSLWAN), y)
  787. DFLAGS += -DINCLUDE_ADSLWAN
  788. endif
  789.  
  790. ifeq ($(INCLUDE_ADSL_RA), y)
  791. DFLAGS += -DINCLUDE_ADSL_RA
  792. endif
  793.  
  794. ifeq ($(INCLUDE_ADSL_RTL), y)
  795. DFLAGS += -DINCLUDE_ADSL_RTL
  796. endif
  797.  
  798. ifeq ($(INCLUDE_ADSL_LTQ), y)
  799. DFLAGS += -DINCLUDE_ADSL_LTQ
  800. endif
  801.  
  802. ifeq ($(INCLUDE_ETHERNET_WAN), y)
  803. DFLAGS += -DINCLUDE_ETHERNET_WAN
  804. endif
  805.  
  806. ifeq ($(INCLUDE_IGMP), y)
  807. DFLAGS += -DINCLUDE_IGMP
  808. endif
  809.  
  810. #add by wanghao
  811. ifeq ($(INCLUDE_IGMP_FORCEVERSION), y)
  812. DFLAGS += -DINCLUDE_IGMP_FORCEVERSION
  813. endif
  814. #add end
  815.  
  816. ifeq ($(INCLUDE_IPTV), y)
  817. DFLAGS += -DINCLUDE_IPTV
  818. endif
  819.  
  820. ifeq ($(INCLUDE_AUTO_PVC), y)
  821. DFLAGS += -DINCLUDE_AUTO_PVC
  822. endif
  823.  
  824. ifeq ($(INCLUDE_RIP), y)
  825. DFLAGS += -DINCLUDE_RIP
  826. endif
  827.  
  828. ifeq ($(INCLUDE_SNMP), y)
  829. DFLAGS += -DINCLUDE_SNMP
  830. endif
  831.  
  832. ifeq ($(INCLUDE_IPPING_DIAG), y)
  833. DFLAGS += -DINCLUDE_IPPING_DIAG
  834. endif
  835.  
  836. ifeq ($(INCLUDE_TRACEROUTE_DIAG), y)
  837. DFLAGS += -DINCLUDE_TRACEROUTE_DIAG
  838. endif
  839.  
  840. ifeq ($(INCLUDE_SSL), y)
  841. DFLAGS += -DINCLUDE_SSL
  842. endif
  843.  
  844. ifeq ($(INCLUDE_CWMP), y)
  845. DFLAGS += -DINCLUDE_CWMP
  846. endif
  847.  
  848. ifeq ($(INCLUDE_CWMP_SSL), y)
  849. DFLAGS += -DINCLUDE_CWMP_SSL
  850. export INCLUDE_CWMP_SSL
  851. ifeq ($(INCLUDE_CWMP_SSL_VERIFY_PEER), y)
  852. DFLAGS += -DINCLUDE_CWMP_SSL_VERIFY_PEER
  853. export INCLUDE_CWMP_SSL_VERIFY_PEER
  854. endif
  855. endif
  856.  
  857. ifeq ($(INCLUDE_DIGITAL_SIGNATURE), y)
  858. DFLAGS += -DINCLUDE_DIGITAL_SIGNATURE
  859. endif
  860.  
  861. ifeq ($(INCLUDE_DDNS), y)
  862. DFLAGS += -DINCLUDE_DDNS
  863. endif
  864.  
  865. ifeq ($(INCLUDE_DDNS_PH), y)
  866. DFLAGS += -DINCLUDE_DDNS_PH
  867. endif
  868.  
  869. ifeq ($(INCLUDE_DYNDNS), y)
  870. DFLAGS += -DINCLUDE_DYNDNS
  871. endif
  872.  
  873. ifeq ($(INCLUDE_NOIPDNS), y)
  874. DFLAGS += -DINCLUDE_NOIPDNS
  875. endif
  876.  
  877. ifeq ($(INCLUDE_CMXDNS), y)
  878. DFLAGS += -DINCLUDE_CMXDNS
  879. endif
  880.  
  881. ifeq ($(INCLUDE_ALG), y)
  882. DFLAGS += -DINCLUDE_ALG
  883. endif
  884.  
  885. ifeq ($(INCLUDE_ALG_H323), y)
  886. DFLAGS += -DINCLUDE_ALG_H323
  887. endif
  888.  
  889. ifeq ($(INCLUDE_ALG_SIP), y)
  890. DFLAGS += -DINCLUDE_ALG_SIP
  891. endif
  892.  
  893. ifeq ($(INCLUDE_MIC), y)
  894. DFLAGS += -DINCLUDE_MIC
  895. endif
  896.  
  897. ifeq ($(INCLUDE_TDDP), y)
  898. DFLAGS += -DINCLUDE_TDDP
  899. endif
  900.  
  901. ifeq ($(INCLUDE_ATED_IWPRIV), y)
  902. DFLAGS += -DINCLUDE_ATED_IWPRIV
  903. endif
  904. ifeq ($(INCLUDE_ATED_CALIBRATE), y)
  905. DFLAGS += -DINCLUDE_ATED_CALIBRATE
  906. endif
  907.  
  908. ifeq ($(INCLUDE_ATED_TP_DUAL_SUPPORT), y)
  909. DFLAGS += -DINCLUDE_ATED_TP_DUAL_SUPPORT
  910. endif
  911.  
  912. ifeq ($(INCLUDE_AUTOREBOOT), y)
  913. DFLAGS += -DINCLUDE_AUTOREBOOT
  914. endif
  915.  
  916. ifeq ($(INCLUDE_YANDEX_DNS), y)
  917. DFLAGS += -DINCLUDE_YANDEX_DNS
  918. endif
  919.  
  920. #NOTE:INCLUDE_VOIP in voip.mak
  921. ifeq ($(INCLUDE_VOIP), y)
  922. DFLAGS += $(VOIP_DFLAGS)
  923. DF_FLAGS += $(VOIP_CFLAGS)
  924. endif
  925.  
  926. ifeq ($(INCLUDE_IPV6), y)
  927. DFLAGS += -DINCLUDE_IPV6
  928.  
  929. ifeq ($(INCLUDE_IPV6_MLD), y)
  930. DFLAGS += -DINCLUDE_IPV6_MLD
  931. endif
  932.  
  933. ifeq ($(INCLUDE_IPV6_SLAAC), y)
  934. DFLAGS += -DINCLUDE_IPV6_SLAAC
  935. endif
  936.  
  937. ifeq ($(INCLUDE_IPV6_HTTP), y)
  938. DFLAGS += -DINCLUDE_IPV6_HTTP
  939. endif
  940.  
  941. ifeq ($(INCLUDE_IP6_WAN_NOT_ASSIGN_ADDR), y)
  942. DFLAGS += -DINCLUDE_IP6_WAN_NOT_ASSIGN_ADDR
  943. endif
  944.  
  945. ifeq ($(INCLUDE_IPV6_PASS_THROUGH), y)
  946. DFLAGS += -DINCLUDE_IPV6_PASS_THROUGH
  947. endif
  948.  
  949. endif
  950.  
  951. ifeq ($(INCLUDE_USB), y)
  952. DFLAGS += -DINCLUDE_USB
  953. endif
  954.  
  955. ifeq ($(INCLUDE_USB_OVER_IP), y)
  956. DFLAGS += -DINCLUDE_USB_OVER_IP
  957. endif
  958.  
  959. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  960. DFLAGS += -DINCLUDE_USB_OVER_IP_TPLINK
  961. endif
  962.  
  963. ifeq ($(INCLUDE_USB_OVER_IP_KCODES), y)
  964. DFLAGS += -DINCLUDE_USB_OVER_IP_KCODES
  965. endif
  966.  
  967. ifeq ($(INCLUDE_USB_STORAGE), y)
  968. DFLAGS += -DINCLUDE_USB_STORAGE
  969. endif
  970.  
  971. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  972. DFLAGS += -DINCLUDE_USB_MEDIA_SERVER
  973. endif
  974.  
  975. ifeq ($(INCLUDE_USB_SAMBA_SERVER), y)
  976. DFLAGS += -DINCLUDE_USB_SAMBA_SERVER
  977. ifeq ($(INCLUDE_SAMBA_3_0_14a), y)
  978. DFLAGS += -DINCLUDE_SAMBA_3_0_14a
  979. endif
  980. ifeq ($(INCLUDE_SAMBA_3_6_25), y)
  981. DFLAGS += -DINCLUDE_SAMBA_3_6_25
  982. endif
  983. endif
  984.  
  985. ifeq ($(INCLUDE_USB_FTP_SERVER), y)
  986. DFLAGS += -DINCLUDE_USB_FTP_SERVER
  987. endif
  988.  
  989. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  990. DFLAGS += -DINCLUDE_USB_3G_DONGLE
  991. endif
  992.  
  993. ifeq ($(INCLUDE_IPSEC), y)
  994. DFLAGS += -DINCLUDE_IPSEC
  995. endif
  996.  
  997. ifeq ($(INCLUDE_WAN_MODE), y)
  998. DFLAGS += -DINCLUDE_WAN_MODE
  999. endif
  1000.  
  1001. ifeq ($(INCLUDE_QOS), y)
  1002. DFLAGS += -DINCLUDE_QOS
  1003. endif
  1004. ifeq ($(INCLUDE_FBWIFI), y)
  1005. DFLAGS += -DINCLUDE_FBWIFI
  1006. endif
  1007.  
  1008. ifeq ($(INCLUDE_ANNEXB), y)
  1009. DFLAGS += -DINCLUDE_ANNEXB
  1010. endif
  1011.  
  1012. ifeq ($(INCLUDE_POLICY_ROUTE), y)
  1013. DFLAGS += -DINCLUDE_POLICY_ROUTE
  1014. endif
  1015.  
  1016. ifeq ($(INCLUDE_DUAL_ACCESS), y)
  1017. DFLAGS += -DINCLUDE_DUAL_ACCESS
  1018. endif
  1019.  
  1020. ifeq ($(INCLUDE_L2TP), y)
  1021. DFLAGS += -DINCLUDE_L2TP
  1022. endif
  1023.  
  1024. ifeq ($(INCLUDE_PPTP), y)
  1025. DFLAGS += -DINCLUDE_PPTP
  1026. endif
  1027.  
  1028. ifeq ($(INCLUDE_ACL), y)
  1029. DFLAGS += -DINCLUDE_ACL
  1030. ifeq ($(INCLUDE_ACL_ADVANCE), y)
  1031. DFLAGS += -DINCLUDE_ACL_ADVANCE
  1032. endif
  1033. endif
  1034.  
  1035. ifeq ($(INCLUDE_PORTABLE_APP), y)
  1036. DFLAGS += -DINCLUDE_PORTABLE_APP
  1037. endif
  1038.  
  1039. ifeq ($(INCLUDE_WAN_TYPE_DETECT), y)
  1040. DFLAGS += -DINCLUDE_WAN_TYPE_DETECT
  1041. endif
  1042.  
  1043. ifeq ($(INCLUDE_BPA), y)
  1044. DFLAGS += -DINCLUDE_BPA
  1045. endif
  1046.  
  1047. # new designed VLAN
  1048. ifeq ($(INCLUDE_X_TP_VLAN), y)
  1049. DFLAGS += -DINCLUDE_X_TP_VLAN
  1050. endif
  1051.  
  1052. ifeq ($(INCLUDE_FORBID_WAN_PING), y)
  1053. DFLAGS += -DINCLUDE_FORBID_WAN_PING
  1054. endif
  1055.  
  1056. ifeq ($(INCLUDE_HARDWARE_DEBUG), y)
  1057. DFLAGS += -DINCLUDE_HARDWARE_DEBUG
  1058. endif
  1059. # Smart DHCP
  1060. ifeq ($(INCLUDE_SMART_DHCP), y)
  1061. DFLAGS += -DINCLUDE_SMART_DHCP
  1062. endif
  1063.  
  1064. ifeq ($(INCLUDE_PING_WATCHDOG), y)
  1065. DFLAGS += -DINCLUDE_PING_WATCHDOG
  1066. endif
  1067.  
  1068. ifeq ($(strip $(INCLUDE_MULTIMODE)), y)
  1069. DFLAGS += -DINCLUDE_MULTIMODE
  1070. endif
  1071.  
  1072. ifeq ($(strip $(INCLUDE_MULTIMODE_HWCONTROL)), y)
  1073. DFLAGS += -DINCLUDE_MULTIMODE_HWCONTROL
  1074. endif
  1075.  
  1076. ifeq ($(strip $(INCLUDE_MULTIMODE_ROUTER)), y)
  1077. DFLAGS += -DINCLUDE_MULTIMODE_ROUTER
  1078. endif
  1079.  
  1080. ifeq ($(strip $(INCLUDE_MULTIMODE_RE)), y)
  1081. DFLAGS += -DINCLUDE_MULTIMODE_RE
  1082. WEBFLAGS += INCLUDE_MULTIMODE_RE=1
  1083. endif
  1084.  
  1085. ifeq ($(strip $(INCLUDE_MULTIMODE_AP)), y)
  1086. DFLAGS += -DINCLUDE_MULTIMODE_AP
  1087. endif
  1088.  
  1089. ifeq ($(strip $(INCLUDE_MULTIMODE_CLIENT)), y)
  1090. DFLAGS += -DINCLUDE_MULTIMODE_CLIENT
  1091. endif
  1092.  
  1093. ifeq ($(strip $(INCLUDE_MULTIMODE_MSSID)), y)
  1094. DFLAGS += -DINCLUDE_MULTIMODE_MSSID
  1095. endif
  1096.  
  1097. ifeq ($(strip $(INCLUDE_MULTIMODE_HOTSPOT)), y)
  1098. DFLAGS += -DINCLUDE_MULTIMODE_HOTSPOT
  1099. endif
  1100.  
  1101. ifeq ($(strip $(INCLUDE_MULTIMODE_AP_VLAN)), y)
  1102. DFLAGS += -DINCLUDE_MULTIMODE_AP_VLAN
  1103. endif
  1104.  
  1105. ifeq ($(strip $(INCLUDE_SINGLE_LED_ORANGE_GREEN)), y)
  1106. DFLAGS += -DINCLUDE_SINGLE_LED_ORANGE_GREEN
  1107. endif
  1108.  
  1109. ifeq ($(strip $(INCLUDE_KOREA_SPEC_US_24_G_CHANNEL_1_13)), y)
  1110. DFLAGS += -DINCLUDE_KOREA_SPEC_US_24_G_CHANNEL_1_13
  1111. endif
  1112. ifeq ($(strip $(INCLUDE_MAC_REPEATER)), y)
  1113. DFLAGS += -DINCLUDE_MAC_REPEATER
  1114. endif
  1115.  
  1116. ifeq ($(strip $(INCLUDE_WDS_STATUS)), y)
  1117. DFLAGS += -DINCLUDE_WDS_STATUS
  1118. endif
  1119.  
  1120. ifeq ($(strip $(INCLUDE_WPS_RSSI_STATUS)), y)
  1121. DFLAGS += -DINCLUDE_WPS_RSSI_STATUS
  1122. endif
  1123.  
  1124. ifeq ($(strip $(INCLUDE_RE_BRIDGE_STATUS)), y)
  1125. DFLAGS += -DINCLUDE_RE_BRIDGE_STATUS
  1126. endif
  1127.  
  1128. ifeq ($(strip $(INCLUDE_RE_WPS_CONNECT)), y)
  1129. DFLAGS += -DINCLUDE_RE_WPS_CONNECT
  1130. endif
  1131. DF_FLAGS += $(DFLAGS)
  1132.  
  1133.  
  1134. ifeq ($(PENNYTEL), y)
  1135. DF_FLAGS += -DPENNYTEL
  1136. endif
  1137.  
  1138. ifeq ($(strip $(INCLUDE_HTTPS_SSL)), y)
  1139. DFLAGS += -DINCLUDE_HTTPS_SSL
  1140. endif
  1141.  
  1142. WEBFLAGS += WEB_INCLUDE_TEST=0
  1143.  
  1144. ifeq ($(WEB_INCLUDE_MULTI_EWAN), y)
  1145. WEBFLAGS += WEB_INCLUDE_MULTI_EWAN=1
  1146. else
  1147. WEBFLAGS += WEB_INCLUDE_MULTI_EWAN=0
  1148. endif
  1149.  
  1150. ifeq ($(WEB_INCLUDE_DST), y)
  1151. WEBFLAGS += WEB_INCLUDE_DST=1
  1152. else
  1153. WEBFLAGS += WEB_INCLUDE_DST=0
  1154. endif
  1155.  
  1156. ifeq ($(WEB_QS_CHANGEPASSWORD), y)
  1157. WEBFLAGS += WEB_QS_CHANGEPASSWORD=1
  1158. else
  1159. WEBFLAGS += WEB_QS_CHANGEPASSWORD=0
  1160. endif
  1161.  
  1162. ifeq ($(INCLUDE_IP6_WAN_NOT_ASSIGN_ADDR), y)
  1163. WEBFLAGS += INCLUDE_IP6_WAN_NOT_ASSIGN_ADDR=1
  1164. else
  1165. WEBFLAGS += INCLUDE_IP6_WAN_NOT_ASSIGN_ADDR=0
  1166. endif
  1167.  
  1168. ifeq ($(INCLUDE_UN_IPTV), y)
  1169. WEBFLAGS += INCLUDE_UN_IPTV=1
  1170. DFLAGS += -DINCLUDE_UN_IPTV
  1171. else
  1172. WEBFLAGS += INCLUDE_UN_IPTV=0
  1173. endif
  1174.  
  1175. ifeq ($(INCLUDE_SCHEDULE_NEW), y)
  1176. WEBFLAGS += INCLUDE_SCHEDULE_NEW=1
  1177. DFLAGS += -DINCLUDE_SCHEDULE_NEW
  1178. else
  1179. WEBFLAGS += INCLUDE_SCHEDULE_NEW=0
  1180. endif
  1181. ifeq ($(INCLUDE_HW_NAT), y)
  1182. DFLAGS += -DINCLUDE_HW_NAT
  1183. WEBFLAGS += INCLUDE_HW_NAT=1
  1184. else
  1185. WEBFLAGS += INCLUDE_HW_NAT=0
  1186. endif
  1187. ifeq ($(INCLUDE_SSID_NO_MAC),y)
  1188. DFLAGS += -DINCLUDE_SSID_NO_MAC
  1189. endif
  1190. ifeq ($(INCLUDE_PRESHARED_KEY_STATIC),y)
  1191. DFLAGS += -DINCLUDE_PRESHARED_KEY_STATIC
  1192. endif
  1193.  
  1194. ifeq ($(strip $(INCLUDE_ONLY_ONE_LOGIN)),y)
  1195. DFLAGS += -DINCLUDE_ONLY_ONE_LOGIN
  1196. endif
  1197.  
  1198. ifeq ($(strip $(INCLUDE_SWITCH_MT7628)), y)
  1199. DFLAGS += -DINCLUDE_SWITCH_MT7628
  1200. endif
  1201.  
  1202. ifeq ($(strip $(INCLUDE_SWITCH_MT7620)), y)
  1203. DFLAGS += -DINCLUDE_SWITCH_MT7620
  1204. endif
  1205.  
  1206. ifeq ($(strip $(INCLUDE_HIGH_POWER)), y)
  1207. DFLAGS += -DINCLUDE_HIGH_POWER
  1208. endif
  1209.  
  1210. ifeq ($(INCLUDE_LED_CONTROL), y)
  1211. WEBFLAGS += INCLUDE_LED_CONTROL=1
  1212. DFLAGS += -DINCLUDE_LED_CONTROL
  1213. else
  1214. WEBFLAGS += INCLUDE_LED_CONTROL=0
  1215. endif
  1216. ifeq ($(INCLUDE_MULTILANGUAGE), y)
  1217. WEBFLAGS += INCLUDE_MULTILANGUAGE=1
  1218. DFLAGS += -DINCLUDE_MULTILANGUAGE
  1219. else
  1220. WEBFLAGS += INCLUDE_MULTILANGUAGE=0
  1221. endif
  1222.  
  1223. ifeq ($(INCLUDE_FEEDBACK), y)
  1224. DFLAGS += -DINCLUDE_FEEDBACK
  1225. WEBFLAGS += INCLUDE_FEEDBACK=1
  1226. else
  1227. WEBFLAGS += INCLUDE_FEEDBACK=0
  1228. endif
  1229.  
  1230. ifeq ($(INCLUDE_WEBUI_SUPPORT), y)
  1231. DFLAGS += -DINCLUDE_WEBUI_SUPPORT
  1232. WEBFLAGS += INCLUDE_WEBUI_SUPPORT=1
  1233. else
  1234. WEBFLAGS += INCLUDE_WEBUI_SUPPORT=0
  1235. endif
  1236.  
  1237. ifeq ($(INCLUDE_WANIP_BINDING), y)
  1238. DFLAGS += -DINCLUDE_WANIP_BINDING
  1239. endif
  1240. ifeq ($(INCLUDE_FORCE_TIMEZONE_SELECT), y)
  1241. WEBFLAGS += INCLUDE_FORCE_TIMEZONE_SELECT=1
  1242. DFLAGS += -DINCLUDE_FORCE_TIMEZONE_SELECT
  1243. else
  1244. WEBFLAGS += INCLUDE_FORCE_TIMEZONE_SELECT=0
  1245. endif
  1246. ifeq ($(INCLUDE_FORCE_REGION_SELECT), y)
  1247. WEBFLAGS +=INCLUDE_FORCE_REGION_SELECT=1
  1248. DFLAGS += -DINCLUDE_FORCE_REGION_SELECT
  1249. else
  1250. WEBFLAGS +=INCLUDE_FORCE_REGION_SELECT=0
  1251. endif
  1252. ifeq ($(INCLUDE_WLAN_REGION_LIST), y)
  1253. WEBFLAGS +=INCLUDE_WLAN_REGION_LIST=1
  1254. DFLAGS += -DINCLUDE_WLAN_REGION_LIST
  1255. else
  1256. WEBFLAGS += INCLUDE_WLAN_REGION_LIST=0
  1257. endif
  1258.  
  1259. ifeq ($(INCLUDE_MULTIPLE_LOCALIZATION), y)
  1260. WEBFLAGS +=INCLUDE_MULTIPLE_LOCALIZATION=1
  1261. DFLAGS += -DINCLUDE_MULTIPLE_LOCALIZATION
  1262. ifneq ($(INCLUDE_MIC), y)
  1263. DFLAGS += -DINCLUDE_MIC
  1264. endif
  1265. else
  1266. WEBFLAGS += INCLUDE_MULTIPLE_LOCALIZATION=0
  1267. endif
  1268.  
  1269. ifeq ($(strip $(INCLUDE_5GBAND1_AUTOVHT40)), y)
  1270. DFLAGS += -DINCLUDE_5GBAND1_AUTOVHT40
  1271. endif
  1272.  
  1273. ifeq ($(strip $(INCLUDE_ONLINE_POLLING_CHANNEL)), y)
  1274. DFLAGS += -DINCLUDE_ONLINE_POLLING_CHANNEL
  1275. endif
  1276.  
  1277. ifeq ($(strip $(INCLUDE_FACTORY_STATION_INTEGRATION)), y)
  1278. DFLAGS += -DINCLUDE_FACTORY_STATION_INTEGRATION
  1279. endif
  1280.  
  1281. ifeq ($(strip $(INCLUDE_MT7628N_WATCHDOG)), y)
  1282. DFLAGS += -DINCLUDE_MT7628N_WATCHDOG
  1283. endif
  1284.  
  1285. ifeq ($(strip $(INCLUDE_HT_COEX)), y)
  1286. DFLAGS += -DINCLUDE_HT_COEX
  1287. endif
  1288.  
  1289. ifeq ($(INCLUDE_SCAN_ALL_CHANNELS), y)
  1290. WEBFLAGS +=INCLUDE_SCAN_ALL_CHANNELS=1
  1291. DFLAGS += -DINCLUDE_SCAN_ALL_CHANNELS
  1292. else
  1293. WEBFLAGS +=INCLUDE_SCAN_ALL_CHANNELS=0
  1294. endif
  1295.  
  1296. ifeq ($(INCLUDE_SEND_PADT_BEFORE_PADI), y)
  1297. DFLAGS += -DINCLUDE_SEND_PADT_BEFORE_PADI
  1298. endif
  1299.  
  1300. ifeq ($(INCLUDE_RESTART_PPPD_IF_RECV_IPCP_BEFORE_AUTH), y)
  1301. DFLAGS += -DINCLUDE_RESTART_PPPD_IF_RECV_IPCP_BEFORE_AUTH
  1302. endif
  1303.  
  1304. DFLAGS += -DINCLUDE_$(MODEL)
  1305. ifeq ($(strip $(MODEL)), WR849NV4)
  1306. DFLAGS += -DINCLUDE_WR840NV4
  1307. endif
  1308. ifeq ($(strip $(MODEL)), WR849NV5)
  1309. DFLAGS += -DINCLUDE_WR840NV5
  1310. endif
  1311. ifeq ($(strip $(MODEL)), WR849NV6)
  1312. DFLAGS += -DINCLUDE_WR840NV6
  1313. endif
  1314.  
  1315. ifeq ($(INCLUDE_IMAGE_REGION),"")
  1316. IMAGE_REGION=$(REGION)
  1317. else
  1318. ifeq ($(INCLUDE_IMAGE_REGION),)
  1319. IMAGE_REGION=$(REGION)
  1320. else
  1321. IMAGE_REGION=$(INCLUDE_IMAGE_REGION)
  1322. endif
  1323. endif
  1324. ####################################################
  1325. #
  1326. #Export some variable        
  1327. #
  1328. ####################################################   
  1329.  
  1330. export TOOLPREFIX
  1331. export HOST
  1332. #For modules build & br2684ctl build
  1333. export KERNELPATH
  1334. #For install kernel modules
  1335. export INSTALL_MOD_PATH
  1336. #For code control, placed different target file
  1337. export OBJ_DIR
  1338. #For function conditional compilation
  1339. export DF_FLAGS
  1340.  
  1341. export TOP_PATH
  1342.  
  1343. export OS_LIB_PATH
  1344.  
  1345. export PRIVATE_LIB_BIN_PATH
  1346.  
  1347. export PRIVATE_APPS_BIN_PATH
  1348.  
  1349. export TP_MODULES_PATH
  1350.  
  1351. #For complier
  1352. export CC
  1353. export LD
  1354. export AR
  1355. export STRIP
  1356. export RANLIB
  1357.  
  1358. ####################################################
  1359. #
  1360. #Compilation environment        
  1361. #
  1362. ####################################################
  1363. env_build:
  1364. ifeq ($(strip $(SUPPLIER)),mtk)
  1365. ifneq ($(shell id -u), 0)
  1366.     @echo "This target must be run as root."
  1367. else
  1368.     @mkdir /opt/trendchip/
  1369.     @cp $(TOP_PATH)/$(SUPPLIER)/tools/toolchain/mips-linux-uclibc.tar.bz2 /opt/trendchip/
  1370.     @cd /opt/trendchip/ && tar -jxf mips-linux-uclibc.tar.bz2
  1371. endif
  1372. endif
  1373.  
  1374. ifeq ($(strip $(SUPPLIER)),lantiq)
  1375.     @echo "Lantiq evn_build"
  1376.     cp -f $(TOP_PATH)/$(SUPPLIER)/dl/atm.h $(TOOLCHAIN_DIR)/usr/include/linux/atm.h
  1377. endif
  1378.  
  1379. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1380.     @if test -d /opt/buildroot-gcc463; \
  1381.     then \
  1382.         echo "toolchain buildroot-gcc463 exists." ; \
  1383.     else \
  1384.         echo "Uncompressing toolchain..." ; \
  1385.         cp $(TOP_PATH)/$(SUPPLIER)/tools/toolchain/buildroot-gcc463.tar.bz2 /opt/ ;\
  1386.         cd /opt && tar -jxf buildroot-gcc463.tar.bz2 && rm -f buildroot-gcc463.tar.bz2 ;\
  1387.     fi;
  1388. endif
  1389.  
  1390.     @echo "env_build done!"
  1391.  
  1392. ####################################################
  1393. #
  1394. #Menuconfig        
  1395. #
  1396. ####################################################
  1397. menuconfig:
  1398. ifneq ($(REGION), )
  1399.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL).config $(BUILD_PATH)/.config
  1400. else
  1401.     cp $(BUILD_PATH)/config/$(MODEL).config $(BUILD_PATH)/.config
  1402. endif
  1403.     $(BUILD_PATH)/scripts/config/mconf $(BUILD_PATH)/sysdeps/linux/Config.in
  1404. ifneq ($(REGION), )
  1405.     cp $(BUILD_PATH)/.config $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL).config
  1406. else
  1407.     cp $(BUILD_PATH)/.config $(BUILD_PATH)/config/$(MODEL).config
  1408. endif
  1409.     @if egrep "^INCLUDE_CPU_TC3182=y" .config > /dev/null; then \
  1410.         cd $(TOP_PATH)/ralink && $(MAKE) PROFILE=tc3182 menuconfig; \
  1411.     fi
  1412.     @if egrep "^INCLUDE_CPU_TC3162U=y" .config > /dev/null; then \
  1413.         cd $(TOP_PATH)/ralink && $(MAKE) PROFILE=tc3162u menuconfig; \
  1414.     fi
  1415. # zl added 2011-10-18
  1416.     @if egrep "^INCLUDE_CPU_RTL8672=y" .config > /dev/null; then \
  1417.         cd $(TOP_PATH)/realtek && $(MAKE) preconfig2630_01 && $(MAKE) menuconfig;\
  1418.     fi
  1419. # end--added
  1420.     @if egrep "^INCLUDE_CPU_VR268=y" .config > /dev/null; then \
  1421.         cd $(TOP_PATH)/lantiq && $(MAKE) menuconfig;\
  1422.     fi
  1423. # wanghao added 2013-10-12 for Archer C2
  1424.     @if egrep "^INCLUDE_CPU_MT7620A=y" .config > /dev/null; then \
  1425.         echo "TODO" \
  1426.         #cd $(TOP_PATH)/mtk && $(MAKE) menuconfig; \
  1427.     fi
  1428. # add end
  1429.     @if egrep "^INCLUDE_CPU_RT63368=y" .config > /dev/null; then \
  1430.         cd $(TOP_PATH)/mtk && $(MAKE) PROFILE=rt63368_demo menuconfig; \
  1431.     fi
  1432.     @if egrep "^INCLUDE_CPU_RT63365=y" .config > /dev/null; then \
  1433.         cd $(TOP_PATH)/mtk && $(MAKE) PROFILE=rt63365_demo menuconfig; \
  1434.     fi
  1435.    
  1436. ####################################################
  1437. #
  1438. #Build bootloader          
  1439. #
  1440. ####################################################
  1441. boot_clean:
  1442. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1443.     @if test -f $(TOP_PATH)/$(SUPPLIER)/Uboot/Makefile;then \
  1444.     echo Making uboot clean; \
  1445.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make distclean; \
  1446.     else echo "Do nothing for clean uboot"; \
  1447.     fi
  1448. endif
  1449.    
  1450. boot_menuconfig:
  1451. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1452.     @test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config && \
  1453.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config  || \
  1454.     echo "no $(MODEL)_config file in $(REGION) dir."
  1455.     cp -f $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/.config
  1456.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make menuconfig
  1457.     cp -f $(TOP_PATH)/$(SUPPLIER)/Uboot/.config $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config
  1458.     cp -f $(TOP_PATH)/$(SUPPLIER)/Uboot/autoconf.h $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h
  1459.     @test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config && \
  1460.     cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config || \
  1461.     echo "no $(MODEL)_config file in $(REGION) dir."
  1462.     @test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h && \
  1463.     cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h || \
  1464.     echo "no $(MODEL)_autoconf_h file in $(REGION) dir."
  1465. endif  
  1466.    
  1467. boot_build:
  1468.     @echo "Make Boot Build"
  1469. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1470.     @echo "Should build in Uboot folder with gcc342 by now!"
  1471.     test -d $(GCC_PATH)/buildroot-gcc342 || (cp $(TOP_PATH)/$(SUPPLIER)/Uboot/buildroot-gcc342.tar.bz2 $(GCC_PATH)/ && \
  1472.     cd $(GCC_PATH)/ && tar -jxf buildroot-gcc342.tar.bz2 && rm -f buildroot-gcc342.tar.bz2)
  1473.     test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h && \
  1474.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h || \
  1475.     echo "no $(MODEL)_autoconf_h file in $(REGION) dir."
  1476.     test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config && \
  1477.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config  || \
  1478.     echo "no $(MODEL)_config file in $(REGION) dir."
  1479.     -cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/.config
  1480.     -cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h $(TOP_PATH)/$(SUPPLIER)/Uboot/autoconf.h || \
  1481.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make silentconfig
  1482. ifeq ($(INCLUDE_DUAL_UBOOT), y)
  1483.     sed -i 's/TEXT_BASE=$(TEXT_BASE)/TEXT_BASE=$(SECOND_TEXT_BASE)/g' $(TOP_PATH)/$(SUPPLIER)/Uboot/.config
  1484.     sed -i 's/MINI_WEB_SERVER_SUPPORT=y/# MINI_WEB_SERVER_SUPPORT  is not set/g' $(TOP_PATH)/$(SUPPLIER)/Uboot/.config
  1485.     sed -i '/#define MINI_WEB_SERVER_SUPPORT 1/d' $(TOP_PATH)/$(SUPPLIER)/Uboot/autoconf.h
  1486.     sed -i 's/#define TEXT_BASE $(TEXT_BASE)/#define TEXT_BASE  $(SECOND_TEXT_BASE)/g' $(TOP_PATH)/$(SUPPLIER)/Uboot/autoconf.h
  1487. endif
  1488.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make
  1489.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1490.     cp $(TOP_PATH)/$(SUPPLIER)/Uboot/uboot.bin $(BOOT_TG_PATH)/boot_$(MODEL).bin
  1491. endif
  1492. factory_boot_build:
  1493.     @echo "Make Factory Boot Build"
  1494. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1495.     @echo "Should build in Uboot folder with gcc342 by now!"
  1496.     test -d $(GCC_PATH)/buildroot-gcc342 || (cp $(TOP_PATH)/$(SUPPLIER)/Uboot/buildroot-gcc342.tar.bz2 $(GCC_PATH)/ && \
  1497.     cd $(GCC_PATH)/ && tar -jxf buildroot-gcc342.tar.bz2 && rm -f buildroot-gcc342.tar.bz2)
  1498.     test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h && \
  1499.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_autoconf_h $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h || \
  1500.     echo "no $(MODEL)_autoconf_h file in $(REGION) dir."
  1501.     test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config && \
  1502.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config  || \
  1503.     echo "no $(MODEL)_config file in $(REGION) dir."
  1504.     -cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_config $(TOP_PATH)/$(SUPPLIER)/Uboot/.config
  1505.     -cp $(TOP_PATH)/$(SUPPLIER)/Uboot/$(MODEL)_autoconf_h $(TOP_PATH)/$(SUPPLIER)/Uboot/autoconf.h || \
  1506.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make silentconfig
  1507.     cd $(TOP_PATH)/$(SUPPLIER)/Uboot && make FACTORY_UBOOT=y
  1508.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1509.     cp $(TOP_PATH)/$(SUPPLIER)/Uboot/uboot.bin $(BOOT_TG_PATH)/factory_boot_$(MODEL).bin
  1510. endif
  1511.  
  1512. ifeq ($(strip $(SUPPLIER)),mtk)
  1513.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo bootbase_clean; make PROFILE=$(CPU_TYPE)_demo bootbase
  1514.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1515.     cp $(TOP_PATH)/$(SUPPLIER)/bootrom/tcboot.bin $(BOOT_TG_PATH)/boot.bin
  1516. endif
  1517.  
  1518. ifeq ($(strip $(SUPPLIER)),ralink)
  1519.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) bootbase_clean; make PROFILE=$(CPU_TYPE) bootbase
  1520.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1521.     cp $(TOP_PATH)/$(SUPPLIER)/bootrom/tcboot.bin $(BOOT_TG_PATH)/boot.bin
  1522. endif
  1523.  
  1524. ifeq ($(strip $(SUPPLIER)),realtek)
  1525.     cd $(TOP_PATH)/$(SUPPLIER)/boot72.14e && make cleanall; make  #make menuconfig; make
  1526.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1527.     cp $(TOP_PATH)/$(SUPPLIER)/boot72.14e/boot/boot.bin $(BOOT_TG_PATH)/
  1528. endif
  1529.  
  1530. ifeq ($(strip $(SUPPLIER)),lantiq)
  1531.     cd $(TOP_PATH)/$(SUPPLIER)/build_dir/linux-ltqcpe_2_6_32_LANTIQ/u-boot-2010.06;chmod a+x ./scripts_platform/*;make clean distclean;make vr9_config; grep 'CONFIG_UBOOT_' $(TOP_PATH)/$(SUPPLIER)/.config | sed -e "s,\\(# \)\\?CONFIG_UBOOT_\\(.*\\),\\1\\2,g" > $(TOP_PATH)/$(SUPPLIER)/build_dir/linux-ltqcpe_2_6_32_LANTIQ/u-boot-2010.06/.config; make oldconfig;make clean all CROSS_COMPILE=mips-linux-uclibc-
  1532.     test -d $(BOOT_TG_PATH) || mkdir -p $(BOOT_TG_PATH)
  1533.     cp $(TOP_PATH)/$(SUPPLIER)/build_dir/linux-ltqcpe_2_6_32_LANTIQ/u-boot-2010.06/u-boot.lq $(BOOT_TG_PATH)/boot.bin
  1534. endif
  1535.  
  1536. ####################################################
  1537. #
  1538. #Build linux kernel          
  1539. #
  1540. ####################################################
  1541. kernel_prepare:
  1542. ifneq ($(findstring $(SUPPLIER),mtk_ApSoC_4120 mtk_ApSoC_4320), )
  1543. #Port from RT288x_SDK 4.1.2.0, yuanshang, 2013-10-31
  1544. ifeq ($(REGION),)
  1545. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  1546.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Russia_config $(KERNELPATH)/.config
  1547. else ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  1548.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Malaysia_config $(KERNELPATH)/.config
  1549. else ifeq ($(INCLUDE_TW_SPEC), y)
  1550.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_TW_config $(KERNELPATH)/.config
  1551. else ifeq ($(INCLUDE_KOREA_SPEC), y)
  1552.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Korea_config $(KERNELPATH)/.config
  1553. #else ifeq ($(INCLUDE_UN_IPTV), y)
  1554. #   cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_UN_IPTV_config $(KERNELPATH)/.config
  1555. else
  1556.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_config $(KERNELPATH)/.config
  1557. endif
  1558. else
  1559. ifneq ($(findstring $(MODEL), C50V3 WR902ACV3), )
  1560.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1561. else
  1562. #   cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1563.     cd $(KERNELPATH) && $(MAKE) TP_CONFIG_FILE=$(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(MODEL)_defconfig
  1564. endif
  1565. endif  # REGION
  1566.     $(MAKE) -C $(KERNELPATH) prepare
  1567.     rm -fr $(KERNELPATH)/include/asm
  1568.     rm -fr $(KERNELPATH)/arch/mips/include/asm/rt2880
  1569.     rm -fr $(KERNELPATH)/include/linux/autoconf.h
  1570.    
  1571.     ln -sf ../arch/mips/include/asm $(KERNELPATH)/include/asm
  1572.     ln -sf ./mach-ralink $(KERNELPATH)/arch/mips/include/asm/rt2880
  1573.     ln -sf ../../include/generated/autoconf.h $(KERNELPATH)/include/linux/autoconf.h
  1574. endif
  1575.        
  1576. kernel_build:kernel_prepare
  1577.     @echo "Make Kernel Build"
  1578. ifeq ($(REGION),)
  1579. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  1580.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Russia_config $(KERNELPATH)/.config
  1581. else ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  1582.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Malaysia_config $(KERNELPATH)/.config
  1583. else ifeq ($(INCLUDE_TW_SPEC), y)
  1584.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_TW_config $(KERNELPATH)/.config
  1585. else ifeq ($(INCLUDE_KOREA_SPEC), y)
  1586.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Korea_config $(KERNELPATH)/.config
  1587. #else ifeq ($(INCLUDE_UN_IPTV), y)
  1588. #   cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_UN_IPTV_config $(KERNELPATH)/.config
  1589. else
  1590.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_config $(KERNELPATH)/.config
  1591. endif
  1592. else
  1593. ifneq ($(findstring $(MODEL), C50V3 WR902ACV3), )
  1594.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1595. else
  1596. #   -cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1597.     cd $(KERNELPATH) && $(MAKE) TP_CONFIG_FILE=$(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(MODEL)_defconfig
  1598. endif
  1599. endif  # REGION
  1600.     cd $(KERNELPATH) && $(MAKE) V=2 linux.7z
  1601.     test -d $(KERNEL_TG_PATH) || mkdir -p $(KERNEL_TG_PATH)
  1602.     cp $(KERNELPATH)/linux.7z $(KERNEL_TG_PATH)/
  1603.     cp $(KERNELPATH)/vmlinux $(KERNEL_TG_PATH)/
  1604.  
  1605. kernel_menuconfig:
  1606. ifeq ($(REGION),)
  1607. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  1608.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Russia_config $(KERNELPATH)/.config
  1609. else ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  1610.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Malaysia_config $(KERNELPATH)/.config
  1611. else ifeq ($(INCLUDE_TW_SPEC), y)
  1612.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_TW_config $(KERNELPATH)/.config
  1613. else ifeq ($(INCLUDE_KOREA_SPEC), y)
  1614.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Korea_config $(KERNELPATH)/.config
  1615. #else ifeq ($(INCLUDE_UN_IPTV), y)
  1616. #   cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_UN_IPTV_config $(KERNELPATH)/.config
  1617. else
  1618.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_config $(KERNELPATH)/.config
  1619. endif
  1620. else
  1621. ifneq ($(findstring $(MODEL), C50V3 WR902ACV3), )
  1622.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1623. else
  1624. #   cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1625.     cd $(KERNELPATH) && $(MAKE) TP_CONFIG_FILE=$(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(MODEL)_defconfig
  1626. endif
  1627. endif  # REGION
  1628.     cd $(KERNELPATH) && $(MAKE) menuconfig
  1629. ifeq ($(REGION),)
  1630. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  1631.     cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Russia_config
  1632. else ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  1633.     cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Malaysia_config
  1634. else ifeq ($(INCLUDE_TW_SPEC), y)
  1635.     cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_TW_config
  1636. else ifeq ($(INCLUDE_KOREA_SPEC), y)
  1637.     cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Korea_config
  1638. #else ifeq ($(INCLUDE_UN_IPTV), y)
  1639. #   cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_UN_IPTV_config
  1640. else
  1641.     cp $(KERNELPATH)/.config $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_config
  1642. endif
  1643. else
  1644.     cp $(KERNELPATH)/.config $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config
  1645. endif #REGION
  1646.     @echo "Replace Kernel Config File"
  1647.  
  1648. ####################################################
  1649. #
  1650. #Build all kernel modules
  1651. #
  1652. ####################################################
  1653. modules_build:kernel_modules public_modules misc_modules wlan_modules
  1654.  
  1655. kernel_modules:
  1656.     @echo "Making Kernel Modules"
  1657. ifeq ($(REGION),)
  1658. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  1659.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Russia_config $(KERNELPATH)/.config
  1660. else ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  1661.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Malaysia_config $(KERNELPATH)/.config
  1662. else ifeq ($(INCLUDE_TW_SPEC), y)
  1663.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_TW_config $(KERNELPATH)/.config
  1664. else ifeq ($(INCLUDE_KOREA_SPEC), y)
  1665.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_Korea_config $(KERNELPATH)/.config
  1666. #else ifeq ($(INCLUDE_UN_IPTV), y)
  1667. #   cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_UN_IPTV_config $(KERNELPATH)/.config
  1668. else
  1669.     cp $(KERNELPATH)/$(CPU_TYPE)_$(MODEL)_config $(KERNELPATH)/.config
  1670. endif
  1671. else
  1672. ifneq ($(findstring $(MODEL), C50V3 WR902ACV3), )
  1673.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1674. else
  1675. #   cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(KERNELPATH)/.config
  1676.     cd $(KERNELPATH) && $(MAKE) TP_CONFIG_FILE=$(BUILD_PATH)/config/$(MODEL)/$(REGION)/kernel.config $(MODEL)_defconfig
  1677. endif
  1678. endif  # REGION
  1679.     cd $(KERNELPATH) && $(MAKE) modules
  1680.     cd $(KERNELPATH) && $(MAKE) DEPMOD=true modules_install
  1681.     test -d $(MODULE_TG_PATH) || mkdir -p $(MODULE_TG_PATH) && mkdir -p $(MODULE_TG_PATH)/kmdir/
  1682. ifneq ($(findstring $(CPU_TYPE),mt7620a mt7628), )
  1683.     cp -pR $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVERSION)/kernel $(MODULE_TG_PATH)/kmdir/
  1684. else
  1685.     cp -pR $(INSTALL_MOD_PATH)/lib/modules/$(KERNELVERSION)/* $(MODULE_TG_PATH)/kmdir/
  1686. endif
  1687. # wuguocheng added 21Jan2016 (for UN->EU)
  1688.     #rm -f $(INSTALL_WIRELESS)/lib/firmware/*
  1689. ifeq ($(INCLUDE_WLAN_RA), y)
  1690. ############################### 5G ###############################
  1691. # CONFIG_SECOND_IF_MT7612 can't be used before kernel config is loaded.
  1692. ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7612E), y)
  1693. # WARNING!!! '_' in EEPROM file, not '-' like MT7610E
  1694.     cp -p $(MT7612E_AP_DIR)/MT7612E_EEPROM.bin $(INSTALL_WIRELESS)/lib/firmware/
  1695.     cp -p $(MT7612E_AP_DIR)/RT2860AP5G.dat $(INSTALL_WIRELESS)/lib/firmware/
  1696.     cp -p $(MT7612E_AP_DIR)/SingleSKU_5G_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1697.     cp -p $(MT7612E_AP_DIR)/SingleSKU_5G_CE.dat $(INSTALL_WIRELESS)/lib/firmware/  
  1698. ifeq ($(strip $(MODEL)),C50V1)
  1699.     cp -p $(MT7612E_AP_DIR)/SingleSKU_5G_FCC_KR_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_KR.dat
  1700.     cp -p $(MT7612E_AP_DIR)/SingleSKU_5G_FCC_RU_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_RU.dat
  1701. endif
  1702. else ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7610E), y)
  1703.     cp -p $(MT7610E_DIR)/MT7610E-V10-FEM-1ANT.bin $(INSTALL_WIRELESS)/lib/firmware/
  1704.     cp -p $(MT7610E_DIR)/RT2860AP5G.dat $(INSTALL_WIRELESS)/lib/firmware/
  1705.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1706.     cp -p $(MT7610E_DIR)/SingleSKU_5G_CE.dat $(INSTALL_WIRELESS)/lib/firmware/
  1707. ifeq ($(strip $(MODEL)),C20V1)
  1708.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_KP_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_KR.dat
  1709.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_MY_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_MY.dat
  1710.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_RU_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_RU.dat
  1711.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_JP_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_JP.dat
  1712. else ifeq ($(strip $(MODEL)),C2V1)
  1713.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_KP.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_KR.dat
  1714.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_MY.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_MY.dat
  1715.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_RU.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_RU.dat
  1716.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_VN.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_VN.dat
  1717.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_NZ.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_NZ.dat
  1718.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_CA.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_CA.dat
  1719. else ifeq ($(strip $(MODEL)),C20iV1)
  1720.     cp -p $(MT7610E_DIR)/SingleSKU_5G_FCC_CA.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_CA.dat
  1721. endif
  1722. endif
  1723. ############################### 2.4G ###############################
  1724. ifeq ($(strip $(CPU_TYPE)),mt7620a)
  1725.     cp -p $(MT7620_DIR)/RT2860AP.dat $(INSTALL_WIRELESS)/lib/firmware/
  1726. else ifeq ($(strip $(CPU_TYPE)),mt7628)
  1727.     cp -p $(MT7628_DIR)/RT2860AP.dat $(INSTALL_WIRELESS)/lib/firmware/
  1728. endif
  1729. ifeq ($(strip $(MODEL)),C20V1)
  1730.     cp -p $(MT7620_DIR)/MT7620_AP_2T2R-4L_V15_C20.BIN $(INSTALL_WIRELESS)/lib/firmware/MT7620_AP_2T2R-4L_V15.BIN
  1731.     cp -p $(MT7620_DIR)/SingleSKU_CE_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_CE.dat
  1732.     cp -p $(MT7620_DIR)/SingleSKU_FCC_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_FCC.dat
  1733.     cp -p $(MT7620_DIR)/SingleSKU_CE_KP_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_KR.dat
  1734.     cp -p $(MT7620_DIR)/SingleSKU_CE_MY_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_MY.dat
  1735.     cp -p $(MT7620_DIR)/SingleSKU_CE_RU_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_RU.dat
  1736.     cp -p $(MT7620_DIR)/SingleSKU_CE_JP_C20.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_JP.dat
  1737. else ifeq ($(strip $(MODEL)),C50V1)
  1738.     cp -p $(MT7620_DIR)/MT7620_AP_2T2R-4L_V15_C50.BIN $(INSTALL_WIRELESS)/lib/firmware/MT7620_AP_2T2R-4L_V15.BIN
  1739.     cp -p $(MT7620_DIR)/SingleSKU_CE_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_CE.dat 
  1740.     cp -p $(MT7620_DIR)/SingleSKU_FCC_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_FCC.dat
  1741.     cp -p $(MT7620_DIR)/SingleSKU_CE_KR_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_KR.dat
  1742.     cp -p $(MT7620_DIR)/SingleSKU_CE_RU_C50.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_RU.dat
  1743. else ifeq ($(strip $(MODEL)),C2V1)
  1744.     cp -p $(MT7620_DIR)/MT7620_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1745.     cp -p $(MT7620_DIR)/SingleSKU_CE.dat $(INSTALL_WIRELESS)/lib/firmware/ 
  1746.     cp -p $(MT7620_DIR)/SingleSKU_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1747.     cp -p $(MT7620_DIR)/SingleSKU_CE_KP.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_KR.dat
  1748.     cp -p $(MT7620_DIR)/SingleSKU_CE_MY.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_MY.dat
  1749.     cp -p $(MT7620_DIR)/SingleSKU_CE_RU.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_RU.dat
  1750.     cp -p $(MT7620_DIR)/SingleSKU_CE_NZ.dat $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_NZ.dat
  1751. else ifneq ($(findstring $(MODEL),C2V5 C55V1), )
  1752.     cp -p $(MT7620_DIR)/MT7620_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1753.     cp -p $(MT7620_DIR)/SingleSKU_CE.dat $(INSTALL_WIRELESS)/lib/firmware/
  1754.     cp -p $(MT7620_DIR)/SingleSKU_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1755.     mkdir -p $(MODULE_TG_PATH)/kmdir/kernel/drivers/net/wireless/mt_wifi_ap
  1756.     cp -p $(MODULE_TG_PATH)/kmdir/kernel/drivers/net/wireless/rt2860v2_ap/rt2860v2_ap.ko $(MODULE_TG_PATH)/kmdir/kernel/drivers/net/wireless/mt_wifi_ap/mt_wifi.ko
  1757.     rm -r $(MODULE_TG_PATH)/kmdir/kernel/drivers/net/wireless/rt2860v2_ap
  1758. else ifeq ($(strip $(MODEL)),C20iV1)
  1759.     cp -p $(MT7620_DIR)/MT7620_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1760.     cp -p $(MT7620_DIR)/SingleSKU_CE.dat $(INSTALL_WIRELESS)/lib/firmware/ 
  1761.     cp -p $(MT7620_DIR)/SingleSKU_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1762. else ifeq ($(strip $(MODEL)), WR841HPV5)
  1763.     cp -p $(MT7628_DIR)/MT7628_EEPROM_20140317.bin $(INSTALL_WIRELESS)/lib/firmware/
  1764.     cp -p $(MT7628_DIR)/MT7628_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1765.     cp -p $(MT7628_DIR)/RT2860AP.dat $(INSTALL_WIRELESS)/lib/firmware/
  1766. else ifneq ($(findstring $(MODEL),WR840NV4 WR840NV5 WR840NV6 WR841NV13 WR841NV14 WR845NV3 C50V3 C50V4 C50V5 C20V4 C20V5 WA801NDV5 WR802NV4 WR849NV4 WR810NV4 WR902ACV3 WR849NV5 WR845NV4 WR849NV6), )
  1767.     cp -p $(MT7628_DIR)/MT7628_EEPROM_20140317.bin $(INSTALL_WIRELESS)/lib/firmware/
  1768.     cp -p $(MT7628_DIR)/MT7628_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1769.     cp -p $(MT7628_DIR)/SingleSKU_CE.dat $(INSTALL_WIRELESS)/lib/firmware/ 
  1770.     cp -p $(MT7628_DIR)/SingleSKU_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1771.     cp -p $(MT7628_DIR)/RT2860AP.dat $(INSTALL_WIRELESS)/lib/firmware/
  1772. else ifeq ($(strip $(MODEL)),WR840NV4RU)
  1773.     cp -p $(MT7628_DIR)/MT7628_EEPROM_20140317.bin $(INSTALL_WIRELESS)/lib/firmware/
  1774.     cp -p $(MT7628_DIR)/MT7628_AP_2T2R-4L_V15.BIN $(INSTALL_WIRELESS)/lib/firmware/
  1775.     cp -p $(MT7628_DIR)/SingleSKU_CE.dat $(INSTALL_WIRELESS)/lib/firmware/ 
  1776.     cp -p $(MT7628_DIR)/SingleSKU_FCC.dat $(INSTALL_WIRELESS)/lib/firmware/
  1777.     cp -p $(MT7628_DIR)/RT2860AP.dat $(INSTALL_WIRELESS)/lib/firmware/
  1778. endif
  1779. endif
  1780. # end--added
  1781.  
  1782. public_modules:
  1783.     @echo "Making public modules"
  1784.  
  1785. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  1786.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/usbip-0.1.7 && $(MAKE)  
  1787. endif
  1788.  
  1789. ifeq ($(INCLUDE_PPTP), y)
  1790.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/accel-pptp-0.8.5 && $(MAKE)  
  1791. endif
  1792.  
  1793. ifeq ($(INCLUDE_L2TP), y)
  1794. ifeq ($(KERNELVERSION), 2.6.22.15)
  1795.     @echo "Kernel version is lower than 2.6.23, use pppol2tp-kmod-0.17"
  1796.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/pppol2tp-kmod-0.17 && $(MAKE)  
  1797. else
  1798.     @echo "Kernel version is not lower than 2.6.23, use pppol2tp v1.0 driver in kernel"
  1799. endif
  1800. endif
  1801.  
  1802.  
  1803. misc_modules:
  1804.     @echo "Making Other Modules"
  1805.  
  1806. ifeq ($(strip $(SUPPLIER)),mtk)
  1807.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo drivers
  1808.     cp -pR $(TOP_PATH)/$(SUPPLIER)/filesystem/lib/modules/* $(MODULE_TG_PATH)
  1809. endif   #SUPPLIER
  1810.  
  1811. ifneq ($(strip $(INCLUDE_VOIP)),)
  1812.     cd $(TP_MODULES_PATH)/voip/ && $(MAKE)  
  1813. endif
  1814.  
  1815. ipt_modules:
  1816.     @echo "Making ipt_STAT Modules"
  1817.     cd $(MODULES_PATH)/ipt_STAT && $(MAKE)
  1818.     cd $(MODULES_PATH)/ipt_STAT && cp ipt_STAT.ko $(MODULE_TG_PATH)/
  1819.  
  1820. tp_domain:
  1821.     @echo "Making tp_domain Modules"
  1822.     cd $(MODULES_PATH)/tp_domain && $(MAKE)
  1823.     cd $(MODULES_PATH)/tp_domain && cp tp_domain.ko $(MODULE_TG_PATH)/
  1824.  
  1825. wlan_modules:
  1826.     @echo "Making WLAN Modules"
  1827.    
  1828. ifeq ($(strip $(SUPPLIER)),mtk)
  1829.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo wlan
  1830.     cp -pR $(TOP_PATH)/$(SUPPLIER)/filesystem/lib/modules/* $(MODULE_TG_PATH)
  1831. endif   #SUPPLIER
  1832.  
  1833. .PHONY: ipv6PassThrough_modules
  1834. ipv6PassThrough_modules:   
  1835. ifeq ($(INCLUDE_IPV6_PASS_THROUGH), y)
  1836.     @echo "Making ipv6_pass_through Modules"
  1837.     cd $(MODULES_PATH)/ipv6_pass_through && $(MAKE)
  1838.     cd $(MODULES_PATH)/ipv6_pass_through && cp ipv6_pass_through.ko $(MODULE_TG_PATH)  
  1839. else
  1840.     @echo "build no IPv6 passthrough"
  1841. endif  
  1842.  
  1843. .PHONY: apVlan_modules
  1844. apVlan_modules:
  1845. ifeq ($(INCLUDE_MULTIMODE_MSSID), y)
  1846.     @echo "Making ap_vlan Modules"
  1847.     cd $(MODULES_PATH)/ap_vlan/forWard && $(MAKE)
  1848.     cd $(MODULES_PATH)/ap_vlan/forWard && cp br_MultiSsidVlan_InputForward.ko $(MODULE_TG_PATH)
  1849.     cd $(MODULES_PATH)/ap_vlan/passUp && $(MAKE)
  1850.     cd $(MODULES_PATH)/ap_vlan/passUp && cp br_MultiSsidVlan_PassUpToRouter.ko $(MODULE_TG_PATH)
  1851. else
  1852.     @echo "build no ap_vlan"
  1853. endif  
  1854.  
  1855. ####################################################
  1856. #
  1857. #Build libs
  1858. #
  1859. ####################################################
  1860.  
  1861.  
  1862. ####################################################
  1863. #
  1864. #Build wireless, include driver and tools
  1865. #
  1866. ####################################################
  1867. hal_build:
  1868.     @echo making Atheros HAL
  1869.     if test -n "$(TARGETARCH)"; then \
  1870.     cd $(HAL)/linux && make TARGET=$(TARGETARCH) clean && \
  1871.     make TARGET=$(TARGETARCH) && make TARGET=$(TARGETARCH) release; \
  1872.     fi
  1873.  
  1874. wireless_driver:hal_build
  1875.     @echo making Atheros UMAC
  1876.     cd $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/os/linux && \
  1877.     $(MAKEARCH) TARGET=$(TARGETARCH) clean \
  1878.     && $(MAKEARCH) TARGET=$(TARGETARCH) && \
  1879.     $(MAKEARCH)  TARGET=$(TARGETARCH) install
  1880.  
  1881. wireless_tools:
  1882.     @echo making wireless_tools
  1883.     if test -n "$(WIRELESSTOOLS)"; then \
  1884.     cd $(TOP_PATH)/$(SUPPLIER)/modules/$(WIRELESSTOOLS); make clean; make; \
  1885.     cp -f $(WIRELESSTOOLSLIB) $(INSTALL_WIRELESS)/lib; \
  1886.     cp -f iwpriv $(INSTALL_WIRELESS)/sbin; \
  1887.     cp -f iwconfig $(INSTALL_WIRELESS)/sbin; \
  1888.     cp -f iwlist $(INSTALL_WIRELESS)/sbin; \
  1889.     cd $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/os/linux/tools && \
  1890.     make clean; \
  1891.     make wlanconfig BUILD_STATIC=$(BUILD_STATIC); \
  1892.     cp -f wlanconfig $(INSTALL_WIRELESS)/sbin; \
  1893.     fi
  1894.  
  1895. art_mod:
  1896.     @echo making art modules
  1897.     cd $(TOP_PATH)/$(SUPPLIER)/modules/art && make all
  1898.  
  1899. reg:
  1900.     cd $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/os/linux/tools && \
  1901.     make reg;
  1902. sar:
  1903.     @echo making sar
  1904.     cd ../apps/public/sysstat-6.0.1/ && rm -f sysstat.cron.daily && rm -f sysstat.cron.hourly && $(MAKE) CC=$(TOOLPREFIX)gcc
  1905.     cd ../apps/public/sysstat-6.0.1/ && cp sar $(INSTALL_WIRELESS)/sbin
  1906.     cd ../apps/public/sysstat-6.0.1/ && cp sadc $(INSTALL_WIRELESS)/sbin
  1907.  
  1908. wpa2:wpa2_clean
  1909.     @echo Making wpa2 at 'date'
  1910.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2 && $(MAKE) \
  1911.         CC=$(TOOLPREFIX)gcc AR=$(TOOLPREFIX)ar LD=$(TOOLPREFIX)ld
  1912.     @echo End Making wpa2 at 'date'
  1913.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2/common && \
  1914.     $(STRIP) *.so && cp *.so $(INSTALL_WIRELESS)/lib
  1915.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2/hostapd && \
  1916.     $(STRIP) hostapd && cp hostapd $(INSTALL_WIRELESS)/sbin
  1917.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2/wpa_supplicant && \
  1918.     $(STRIP) wpa_supplicant && cp wpa_supplicant $(INSTALL_WIRELESS)/sbin
  1919.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2/wpatalk && \
  1920.     $(STRIP) wpatalk && cp wpatalk $(INSTALL_WIRELESS)/sbin
  1921.  
  1922. wpa2_clean:
  1923.     cd $(TOP_PATH)/$(SUPPLIER)/modules/wpa2 && $(MAKE) clean
  1924.  
  1925. ifeq ($(strip $(SUPPLIER)),lantiq)
  1926. wlan_build: wireless_driver wireless_tools wpa2
  1927. endif
  1928.  
  1929. wlan_clean:wpa2_clean
  1930.     cd $(HAL)/linux && make TARGET=$(TARGETARCH) clean
  1931.     cd $(TOP_PATH)/$(SUPPLIER)/modules/private/wlan/os/linux && $(MAKEARCH) TARGET=$(TARGETARCH) clean
  1932.     make -C $(TOP_PATH)/$(SUPPLIER)/modules/art clean
  1933.     make -C $(TOP_PATH)/$(SUPPLIER)/modules/$(WIRELESSTOOLS) clean
  1934.  
  1935. ####################################################
  1936. #
  1937. #Build apps
  1938. #
  1939. ####################################################
  1940.  
  1941. #openssl should before pjsip case pjsip need it
  1942. #libusb&libcompat should before handle_card&usb_modeswitch
  1943. .PHONY: apps_build
  1944. apps_build: public_apps_build
  1945.  
  1946. ####################################################
  1947. #
  1948. #Build private apps
  1949. #
  1950. ####################################################
  1951.  
  1952. .PHONY: private_apps_build
  1953. private_apps_build: cmm tcci voip wirelesstool sarctl adslctrl ethctrl wl_tools \
  1954.                 hotplug usbp dsl_app handle_card wirelesstool mtk_tools
  1955.  
  1956. .PHONY: cmm
  1957. cmm:
  1958.     cd $(PRIVATE_APPS_PATH)/user/ && $(MAKE) apps_build xmode
  1959.  
  1960. .PHONY: mtk_tools
  1961. mtk_tools:
  1962. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4120)
  1963.     @echo Build MTK APP port from MTK_APSOC_4120
  1964.     @echo Builg reg
  1965.     cd $(TOP_PATH)/$(SUPPLIER)/apps/reg && $(MAKE)
  1966.     @echo Build hw_nat
  1967.     cd $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat && $(MAKE)
  1968. else ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4320)
  1969.     @echo Build MTK APP port from MTK_APSOC_4320
  1970.     @echo Builg reg
  1971.     cd $(TOP_PATH)/$(SUPPLIER)/apps/reg && $(MAKE) 
  1972. ifeq ($(strip $(CPU_TYPE)),mt7620a)
  1973.     @echo Build hw_nat
  1974.     cd $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat && $(MAKE)
  1975. endif
  1976. endif
  1977.  
  1978. .PHONY: qca8337_switch
  1979. qca8337_switch:
  1980.     cd $(TOP_PATH)/$(SUPPLIER)/apps/qca8337_switch && $(MAKE)
  1981.  
  1982. .PHONY: switch
  1983. switch:
  1984.     cd $(TOP_PATH)/$(SUPPLIER)/apps/switch && $(MAKE)
  1985.  
  1986. .PHONY: hotplug
  1987. hotplug:
  1988. ifeq ($(INCLUDE_USB_STORAGE), y)
  1989.     cd $(PRIVATE_APPS_PATH)/hotplug/ && $(MAKE)
  1990. else
  1991.  
  1992. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  1993.     cd $(PRIVATE_APPS_PATH)/hotplug/ && $(MAKE)
  1994. endif
  1995.  
  1996. endif
  1997.    
  1998. .PHONY: usbp
  1999. usbp:
  2000. ifeq ($(INCLUDE_USB_STORAGE), y)
  2001.     cd $(PRIVATE_APPS_PATH)/usbp/ && $(MAKE)
  2002. endif  
  2003.  
  2004. .PHONY: tcci
  2005. tcci:
  2006. ifeq ($(strip $(SUPPLIER)),ralink)
  2007.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) tcci
  2008. endif
  2009.  
  2010. .PHONY: ated
  2011. ated:
  2012.     @echo "build ated for QA"
  2013.     cd $(WIRELESSTOOLS)/../ated &&  make clean && make all;\
  2014.     cp -f ated $(INSTALL_WIRELESS)/sbin
  2015.  
  2016. .PHONY: wirelesstool
  2017. wirelesstool:
  2018. ifeq ($(INCLUDE_LAN_WLAN), y)
  2019. ifeq ($(strip $(SUPPLIER)),mtk)
  2020.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo wirelesstool
  2021. endif
  2022. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4120)
  2023.     @echo "build wireless tools"
  2024.     cd $(WIRELESSTOOLS) &&  make realclean && make all;\
  2025.     cp -f ated_tp $(INSTALL_WIRELESS)/sbin;\
  2026.     cp -f $(WIRELESSTOOLSLIB) $(INSTALL_WIRELESS)/lib;\
  2027.     cp -f iwpriv $(INSTALL_WIRELESS)/sbin;\
  2028.         cp -f wlNetlinkTool $(INSTALL_WIRELESS)/sbin
  2029.    
  2030.     #@echo "build wireless tools"
  2031.     #cd $(WIRELESSTOOLS)/../sysstat-9.0.6 &&  make clean && make mpstat;\
  2032.     #cp -f mpstat $(INSTALL_WIRELESS)/sbin
  2033.    
  2034.     @echo "build ated for QA"
  2035.     cd $(WIRELESSTOOLS)/../ated &&  make clean && make all;\
  2036.     cp -f ated $(INSTALL_WIRELESS)/sbin
  2037.  
  2038.     echo "Build the rt2860apd for 802.1x"
  2039.     cd $(WIRELESSTOOLS)/../8021x &&  make clean && make all;\
  2040.     cp -f rt2860apd $(INSTALL_WIRELESS)/sbin/;\
  2041.     ln -sf rt2860apd $(INSTALL_WIRELESS)/sbin/rtinicapd
  2042.  
  2043.     echo "Build wscd for wps while coexist of dual-band"
  2044.     cd $(WIRELESSTOOLS)/../wsc_upnp/wsc_upnp && chmod -R +rx ./ && make clean && make all;\
  2045.     cp -f wscd $(INSTALL_WIRELESS)/sbin/;\
  2046.     ln -sf wscd $(INSTALL_WIRELESS)/sbin/wscd_5G
  2047. endif
  2048. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4320)
  2049.     @echo "build wireless tools"
  2050.     cd $(WIRELESSTOOLS) &&  make realclean && make all;\
  2051.     cp -f ated_tp $(INSTALL_WIRELESS)/sbin;\
  2052.     cp -f $(WIRELESSTOOLSLIB) $(INSTALL_WIRELESS)/lib;\
  2053.     cp -f iwpriv $(INSTALL_WIRELESS)/sbin;\
  2054.     cp -f iwconfig $(INSTALL_WIRELESS)/sbin;\
  2055.     cp -f iwlist $(INSTALL_WIRELESS)/sbin;\
  2056.     cp -f wlNetlinkTool $(INSTALL_WIRELESS)/sbin
  2057.    
  2058.     #@echo "build wireless tools"
  2059.     #cd $(WIRELESSTOOLS)/../sysstat-9.0.6 &&  make clean && make mpstat;\
  2060.     #cp -f mpstat $(INSTALL_WIRELESS)/sbin
  2061. ifeq ($(INCLUDE_ATED_IWPRIV), y)
  2062.     @echo "use ated_iwpriv instead of ated_tp"
  2063.     cd $(WIRELESSTOOLS) && cp -f ated_iwpriv $(INSTALL_WIRELESS)/sbin/ated_tp
  2064. endif
  2065.    
  2066. ifeq ($(INCLUDE_HARDWARE_DEBUG),y)
  2067.     @echo "build ated for QA"
  2068.     cd $(WIRELESSTOOLS)/../ated &&  make clean && make all;\
  2069.     cp -f ated $(INSTALL_WIRELESS)/sbin
  2070. endif
  2071.  
  2072.     echo "Build the rt2860apd for 802.1x"
  2073.     cd $(WIRELESSTOOLS)/../8021x &&  make clean && make all;\
  2074.     cp -f rt2860apd $(INSTALL_WIRELESS)/sbin/;\
  2075.     ln -sf rt2860apd $(INSTALL_WIRELESS)/sbin/rtinicapd
  2076.  
  2077.     echo "Build wscd for wps while coexist of dual-band"
  2078.     cd $(WIRELESSTOOLS)/../wsc_upnp/wsc_upnp && chmod -R +rx ./ && make clean && make all;\
  2079.     cp -f wscd $(INSTALL_WIRELESS)/sbin/;\
  2080.     ln -sf wscd $(INSTALL_WIRELESS)/sbin/wscd_5G
  2081. endif
  2082.  
  2083. else    #INCLUDE_LAN_WLAN
  2084.     @echo no wifi
  2085. endif   #INCLUDE_LAN_WLAN
  2086.  
  2087. .PHONY: voip
  2088. voip:
  2089. ifneq ($(strip $(INCLUDE_VOIP)),)
  2090.     cd $(PRIVATE_APPS_PATH)/voip / && $(MAKE)
  2091. else
  2092.     @echo no voip
  2093. endif
  2094.  
  2095. # zl added 2011-10-19
  2096. .PHONY:sarctl
  2097. sarctl:
  2098. ifeq ($(strip $(SUPPLIER)),realtek)
  2099.     cd $(TOP_PATH)/$(SUPPLIER) && make user/sarctl_only
  2100. else
  2101.     @echo no sarctl
  2102. endif
  2103.  
  2104. .PHONY:adslctrl
  2105. adslctrl:
  2106. ifeq ($(strip $(SUPPLIER)),realtek)
  2107.     cd $(TOP_PATH)/$(SUPPLIER) && make user/adslctrl_by_tp_only
  2108. else
  2109.     @echo no adslctrl
  2110. endif
  2111.  
  2112. .PHONY:ethctrl
  2113. ethctrl:
  2114. ifeq ($(strip $(SUPPLIER)),realtek)
  2115.     cd $(TOP_PATH)/$(SUPPLIER) && make user/ethctrl_by_tp_only
  2116. else
  2117.     @echo no ethctrl
  2118. endif
  2119.  
  2120. .PHONY:wl_tools
  2121. wl_tools:
  2122. ifeq ($(strip $(SUPPLIER)),realtek)
  2123. ifeq ($(INCLUDE_LAN_WLAN), y)
  2124.     cd $(TOP_PATH)/$(SUPPLIER) && make user/wireless_tools_only
  2125.     cd $(TOP_PATH)/$(SUPPLIER) && make user/mini_upnp_only
  2126.     cd $(TOP_PATH)/$(SUPPLIER) && make user/wsc_only
  2127.     cd $(TOP_PATH)/$(SUPPLIER) && make user/auth_only
  2128.     cd $(TOP_PATH)/$(SUPPLIER) && make user/ated_only
  2129. endif
  2130. else
  2131.     @echo no wl_tools
  2132. endif
  2133.  
  2134. #end--added
  2135.  
  2136. ifeq ($(INCLUDE_ADSLWAN), y)
  2137. .PHONY:dsl_app
  2138. dsl_app:
  2139. ifeq ($(strip $(SUPPLIER)),lantiq)
  2140.     #cd $(TOP_PATH)/$(SUPPLIER) && make V=99 package/feeds/feed_opensource_apps/linux-atm/compile
  2141.     #cd $(TOP_PATH)/$(SUPPLIER) && make V=99 package/feeds/feed_opensource_apps/br2684ctl/compile
  2142.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_common/lib-dti/compile
  2143.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-mei-vrx/compile
  2144.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-api-vrx/compile
  2145.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-control-vrx/compile
  2146.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-vr9-firmware-xdsl/compile
  2147. endif
  2148.  
  2149. else    #INCLUDE_ADSLWAN
  2150. .PHONY:dsl_app
  2151. dsl_app:
  2152.     @echo no dsl_app
  2153. endif   #INCLUDE_ADSLWAN
  2154.  
  2155. .PHONY: handle_card
  2156. handle_card:
  2157. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  2158.     @echo "Building handle_card"
  2159.     $(MAKE) -C $(PRIVATE_APPS_PATH)/handle_card
  2160. else
  2161.     @echo no handle_card
  2162. endif #INCLUDE_USB_3G_DONGLE
  2163.  
  2164. ####################################################
  2165. #
  2166. #Build public apps
  2167. #
  2168. ####################################################
  2169.  
  2170. .PHONY: public_apps_build
  2171. public_apps_build: oslibs dhcp libusb libcompat openssl pjsip \
  2172.                     br2684ctl busybox tc iptables ebtables pppd ripd \
  2173.                     upnplib upnp flex radvd dhcpv6 samba ntfs-3g arpd \
  2174.                     usbip vsftp ffmpeg libdlna ushare ip ipsectools \
  2175.                     chat usb_modeswitch xl2tpd bigpond ipping traceroute dropbear
  2176.  
  2177. .PHONY:oslibs
  2178. oslibs:
  2179.     cd $(PUBLIC_APPS_PATH)/os_libs && $(MAKE)
  2180.                    
  2181. .PHONY: dhcp
  2182. dhcp:
  2183.     cd $(PUBLIC_APPS_PATH)/dhcp && $(MAKE)
  2184. .PHONY: busybox
  2185. busybox:
  2186.     @if [ -f $(MODEL_BUSYBOX_CONFIG) ]; then cp $(MODEL_BUSYBOX_CONFIG) $(PUBLIC_APPS_PATH)/busybox-1.19.2/.config; fi
  2187. ifeq ($(INCLUDE_HARDWARE_DEBUG), y)
  2188.     @sed -i 's/^# CONFIG_TELNETD is not set/CONFIG_TELNETD=y/g' $(PUBLIC_APPS_PATH)/busybox-1.19.2/.config
  2189.     @sed -i 's/^# CONFIG_FEATURE_TELNETD_STANDALONE is not set/CONFIG_FEATURE_TELNETD_STANDALONE=y/g' $(PUBLIC_APPS_PATH)/busybox-1.19.2/.config
  2190.     @sed -i 's/^# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set/CONFIG_FEATURE_TELNETD_INETD_WAIT=y/g' $(PUBLIC_APPS_PATH)/busybox-1.19.2/.config
  2191. endif
  2192.     cd $(PUBLIC_APPS_PATH)/busybox-1.19.2 && $(MAKE)
  2193.    
  2194. .PHONY: tc
  2195. tc:
  2196.     cd $(PUBLIC_APPS_PATH)/iproute2-2.6.24-rc7 && $(MAKE)
  2197.  
  2198. .PHONY: iptables
  2199. iptables:
  2200.     cd $(PUBLIC_APPS_PATH)/iptables-1.4.17 && test -e Makefile || ./configure --host=mips-linux-uclibc --enable-static --disable-shared  
  2201.     cd $(PUBLIC_APPS_PATH)/iptables-1.4.17 && $(MAKE) AR=$(TOOLPREFIX)ar
  2202.     $(STRIP) $(PUBLIC_APPS_PATH)/iptables-1.4.17/iptables/xtables-multi
  2203.  
  2204. .PHONY: ebtables
  2205. ebtables:
  2206.     cd $(PUBLIC_APPS_PATH)/ebtables-v2.0.10-4 && $(MAKE) static
  2207.    
  2208. .PHONY: pppd
  2209. pppd:
  2210.     cd $(PUBLIC_APPS_PATH)/ppp-2.4.5/pppd && $(MAKE) INCLUDE_RUSSIA_SPEC=$(INCLUDE_RUSSIA_SPEC) #INCLUDE_IPV6_PPPV6=$(INCLUDE_IPV6_PPPV6)
  2211.    
  2212. .PHONY: br2684ctl
  2213. br2684ctl:
  2214. ifeq ($(INCLUDE_ADSLWAN), y)
  2215.     cd $(PUBLIC_APPS_PATH)/br2684ctl && $(MAKE)
  2216. endif
  2217.    
  2218. .PHONY: arpd
  2219. arpd:
  2220. ifeq ($(INCLUDE_ADSLWAN), y)
  2221.     cd $(PUBLIC_APPS_PATH)/linux-atm && $(MAKE)
  2222. endif
  2223.    
  2224. .PHONY: upnplib
  2225. upnplib:
  2226.     $(MAKE) -C $(PUBLIC_APPS_PATH)/upnp_libs
  2227.    
  2228. .PHONY: upnp
  2229. upnp:
  2230.     $(MAKE) -C $(PUBLIC_APPS_PATH)/IGD
  2231.  
  2232. .PHONY: ripd
  2233. ripd:
  2234. ifeq ($(INCLUDE_RIP), y)
  2235.     $(MAKE) -C $(PUBLIC_APPS_PATH)/zebra-0.95a
  2236. else
  2237.     @echo no ripd
  2238. endif
  2239.  
  2240. .PHONY: pjsip
  2241. pjsip:
  2242. ifneq ($(strip $(INCLUDE_VOIP)),)
  2243. ifneq ($(strip $(PJSIP_CONFCACHE_EXIST)),)
  2244.     cd $(PUBLIC_APPS_PATH)/pjsip_1.10 && $(MAKE)
  2245. else
  2246.     cd $(PUBLIC_APPS_PATH)/pjsip_1.10 && ./configure --cache-file=./config_cache_file --srcdir=./ --prefix=$(TOOLROOTPATH) --exec-prefix=$(TOOLROOTPATH) --host=mipsel-linux --target=mipsel-linux --disable-speex-aec --disable-l16-codec --disable-gsm-codec --disable-speex-codec --disable-ilbc-codec --disable-g7221-codec --disable-ssl --disable-oss --disable-sound && $(MAKE)
  2247. endif
  2248. else
  2249.     @echo no pjsip
  2250. endif
  2251.  
  2252. .PHONY: usbip
  2253. usbip:
  2254. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  2255.     $(MAKE) -C $(PUBLIC_APPS_PATH)/usbip-0.1.7 clean
  2256.     cd $(PUBLIC_APPS_PATH)/usbip-0.1.7 && $(MAKE)
  2257. endif
  2258.  
  2259. .PHONY: vsftp
  2260. vsftp:
  2261. ifeq ($(INCLUDE_USB_FTP_SERVER), y)
  2262.     cd $(PUBLIC_APPS_PATH)/vsftpd-2.3.2 && $(MAKE)
  2263. else
  2264.     @echo no vsftp
  2265. endif
  2266.  
  2267. .PHONY: flex
  2268. flex:
  2269. ifeq ($(INCLUDE_IPV6), y)
  2270.     cd $(PUBLIC_APPS_PATH)/flex-2.5.35 && test -e Makefile || ./configure --host=mips-linux
  2271.     cd $(PUBLIC_APPS_PATH)/flex-2.5.35 && $(MAKE)
  2272.     mkdir -p $(PUBLIC_APPS_PATH)/lib
  2273.     cp -p $(PUBLIC_APPS_PATH)/flex-2.5.35/libfl.a $(PUBLIC_APPS_PATH)/lib
  2274. else
  2275.     @echo no ipv6 flex
  2276. endif
  2277.  
  2278. .PHONY: radvd
  2279. radvd:
  2280. ifeq ($(INCLUDE_IPV6), y)
  2281.     cd $(PUBLIC_APPS_PATH)/radvd-1.5 && $(MAKE)
  2282. else
  2283.     @echo no ipv6 radvd
  2284. endif
  2285.  
  2286. .PHONY: dhcpv6
  2287. dhcpv6:
  2288. ifeq ($(INCLUDE_IPV6), y)
  2289.     cd $(PUBLIC_APPS_PATH)/wide-dhcpv6-20080615 && $(MAKE)
  2290. else
  2291.     @echo no ipv6 dhcpv6
  2292. endif
  2293.  
  2294. .PHONY: ip
  2295. ip:
  2296. ifeq ($(INCLUDE_IPV6), y)
  2297.     cd $(PUBLIC_APPS_PATH)/iproute2-2.6.39 && $(MAKE)
  2298. else
  2299.     @echo no ipv6 ip
  2300. endif
  2301.  
  2302. #for samba and ntfs-3g, zjj, 20111129
  2303. .PHONY: samba
  2304. samba:
  2305. ifeq ($(INCLUDE_USB_SAMBA_SERVER), y)
  2306. ifeq ($(INCLUDE_SAMBA_3_6_25), y)
  2307.     cd $(PUBLIC_APPS_PATH)/samba-3.6.25/ && $(MAKE) samba
  2308. endif
  2309. ifeq ($(INCLUDE_SAMBA_3_0_14a), y)
  2310.     cd $(PUBLIC_APPS_PATH)/samba-3.0.14a/source && $(MAKE)
  2311.     $(STRIP) $(PUBLIC_APPS_PATH)/samba-3.0.14a/source/bin/*
  2312. endif
  2313. else
  2314.     @echo no samba
  2315. endif
  2316.    
  2317. .PHONY: ntfs-3g
  2318. ntfs-3g:
  2319. ifeq ($(INCLUDE_USB_STORAGE), y)
  2320.     cd $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15 && test -e Makefile || ./configure --build=i686-linux --host=$(HOST) --disable-nfconv
  2321.     cd $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15 && $(MAKE)
  2322.     $(STRIP) $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/.libs/libntfs-3g.so.83.0.0
  2323.     $(STRIP) $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15/src/.libs/ntfs-3g
  2324.     $(STRIP) $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15/src/.libs/lowntfs-3g
  2325. else
  2326.     @echo no ntfs-3g+ntfsprogs
  2327. endif
  2328. #end by zjj
  2329.  
  2330. #for dlna, LI CHENGLONG
  2331. .PHONY: ffmpeg
  2332. ffmpeg:
  2333. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  2334.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ffmpeg-0.6/
  2335. endif
  2336.  
  2337. .PHONY: libdlna
  2338. libdlna:
  2339. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  2340.     $(MAKE) -C $(PUBLIC_APPS_PATH)/libdlna-0.2.3/
  2341. endif
  2342.  
  2343. .PHONY: ushare
  2344. ushare:
  2345. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  2346.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ushare-1.1a/
  2347. endif
  2348. #end by LI CHENGLONG
  2349.  
  2350. .PHONY: openssl
  2351. openssl:
  2352. ifeq ($(INCLUDE_SSL), y)
  2353.     cd $(PUBLIC_APPS_PATH)/openssl && test -e Makefile || ./Configure shared \
  2354.         no-threads no-zlib no-asm no-gmp no-krb5 no-hw no-cipher no-rfc3779 no-sse2 no-speed \
  2355.         no-md2 no-md4 no-mdc2 no-ripemd no-rc5 no-idea no-bf no-cast no-camellia \
  2356.         no-ec no-dsa no-ecdsa no-store linux-mips \
  2357.     && sed -i 's/-O3/-Os -DGNU/g' Makefile
  2358.    
  2359.     cd $(PUBLIC_APPS_PATH)/openssl \
  2360.     && $(MAKE) CC=$(CC) LD=$(LD) SHARED_LDFLAGS="-s"\
  2361.     && mkdir -p ./lib \
  2362.     && cp -p ./libcrypto.so.0.9.7 ./lib/ \
  2363.     && cp -p ./libssl.so.0.9.7 ./lib/ \
  2364.     && cd ./lib/ \
  2365.     && ln -sf libcrypto.so.0.9.7 libcrypto.so.0 \
  2366.     && ln -sf libcrypto.so.0.9.7 libcrypto.so \
  2367.     && ln -sf libssl.so.0.9.7 libssl.so.0 \
  2368.     && ln -sf libssl.so.0.9.7 libssl.so
  2369. endif
  2370.  
  2371. .PHONY: ipsectools
  2372. ipsectools:
  2373. ifeq ($(INCLUDE_IPSEC), y)
  2374.     cd $(PUBLIC_APPS_PATH)/ipsectools && test -e Makefile || ./configure --host=mips-linux --with-kernel-headers=$(KERNELPATH)/include \
  2375.     --with-openssl=$(PUBLIC_APPS_PATH)/openssl/ --enable-security-context=no --enable-shared=yes \
  2376.     --enable-dpd=yes CFLAGS="-Os -DGNU"
  2377.     cd $(PUBLIC_APPS_PATH)/ipsectools && $(MAKE)
  2378.     $(STRIP) $(PUBLIC_APPS_PATH)/ipsectools/src/racoon/.libs/racoon
  2379.     $(STRIP) $(PUBLIC_APPS_PATH)/ipsectools/src/setkey/.libs/setkey
  2380.     $(STRIP) $(PUBLIC_APPS_PATH)/ipsectools/src/racoon/.libs/libracoon.so.0.0.0
  2381.     $(STRIP) $(PUBLIC_APPS_PATH)/ipsectools/src/libipsec/.libs/libipsec.so.0.0.1
  2382. endif
  2383.  
  2384. .PHONY: chat
  2385. chat:
  2386. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  2387.     @echo building chat...
  2388.     cd $(PUBLIC_APPS_PATH)/ppp-2.4.5/chat && $(MAKE)
  2389.     $(STRIP) $(PUBLIC_APPS_PATH)/ppp-2.4.5/chat/chat
  2390. else
  2391.     @echo no chat
  2392. endif
  2393.  
  2394. .PHONY: libusb
  2395. libusb:
  2396. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  2397.     echo "Building usb library"
  2398.     cd $(PUBLIC_APPS_PATH)/libusb-1.0.8 && test -e Makefile || ./configure --build=i686-linux --host=$(HOST) --prefix=$(PUBLIC_APPS_PATH)/libusb-1.0.8/install
  2399.     cd $(PUBLIC_APPS_PATH)/libusb-1.0.8 && $(MAKE) install
  2400. else
  2401.     @echo no libusb
  2402. endif
  2403.  
  2404. .PHONY: libcompat
  2405. libcompat:
  2406. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  2407.     echo "Building usb compat"
  2408.     cd $(PUBLIC_APPS_PATH)/libusb-compat-0.1.3 && test -e Makefile || ./configure --build=i686-linux --host=$(HOST) --prefix=$(PUBLIC_APPS_PATH)/libusb-compat-0.1.3/install LIBUSB_1_0_CFLAGS=-I$(PUBLIC_APPS_PATH)/libusb-1.0.8/install/include/libusb-1.0 LIBUSB_1_0_LIBS=-L$(PUBLIC_APPS_PATH)/libusb-1.0.8/install/lib\ -lusb-1.0
  2409.     cd $(PUBLIC_APPS_PATH)/libusb-compat-0.1.3 && $(MAKE) install
  2410. else
  2411.     @echo no libcompat
  2412. endif
  2413.  
  2414. .PHONY: usb_modeswitch
  2415. usb_modeswitch:
  2416. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  2417.     echo "Building usb_modeswitch"
  2418.     cd $(PUBLIC_APPS_PATH)/usb-modeswitch-1.2.3 && $(MAKE)
  2419.     $(STRIP) $(PUBLIC_APPS_PATH)/usb-modeswitch-1.2.3/usb_modeswitch
  2420. else
  2421.     @echo no usb_modeswitch
  2422. endif
  2423.  
  2424. .PHONY: xl2tpd
  2425. xl2tpd:
  2426. ifeq ($(INCLUDE_L2TP), y)
  2427.     cd $(PUBLIC_APPS_PATH)/xl2tpd-1.1.12 && $(MAKE)
  2428. endif
  2429.  
  2430. .PHONY: bigpond
  2431. bigpond:
  2432. ifeq ($(INCLUDE_BPA), y)
  2433.     cd $(PUBLIC_APPS_PATH)/bpalogin-2.0.2 && $(MAKE)
  2434. endif
  2435.  
  2436. .PHONY: ipping
  2437. ipping:
  2438. ifeq ($(INCLUDE_IPPING_DIAG), y)
  2439.     cd $(PUBLIC_APPS_PATH)/ipping && $(MAKE)
  2440. endif
  2441.  
  2442. .PHONY: traceroute
  2443. traceroute:
  2444. ifeq ($(INCLUDE_TRACEROUTE_DIAG), y)
  2445.     cd $(PUBLIC_APPS_PATH)/traceroute-2.0.3 && $(MAKE)
  2446. endif
  2447.  
  2448. .PHONY: dropbear
  2449. dropbear:
  2450. ifeq ($(INCLUDE_PORTABLE_APP), y)
  2451.     cd $(PUBLIC_APPS_PATH)/dropbear && $(MAKE) MULTI=1 SCPPROGRESS=1
  2452. else
  2453.     @echo no dropbear
  2454. endif
  2455.  
  2456. ####################################################
  2457. #
  2458. #Build filesystem, prepare basic fs first
  2459. #
  2460. ####################################################
  2461. .PHONY: fs_build
  2462. fs_build: fs_clean fs_create fs_lib fs_dev fs_bin fs_modules  fs_rootfs
  2463.  
  2464. fs_clean:
  2465.     rm -rf $(MODEL_FS_PATH)/../rootfs.$(MODEL)
  2466.     rm -rf $(MODEL_FS_PATH)
  2467.     rm -rf $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml
  2468.     -rm -rf $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml
  2469.    
  2470. fakeroot_clean:    
  2471.     if [ -e $(FAKEROOT_PATH)/Makefile ];  then make -C $(FAKEROOT_PATH) distclean; fi
  2472.     rm -f $(FAKEROOT_PATH)/fakeroot
  2473.     rm -f $(FAKEROOT_PATH)/.configured
  2474.    
  2475. .PHONY: fs_create
  2476. fs_create:
  2477.     cp -pR $(TOP_PATH)/targets/fs.dir $(MODEL_FS_PATH)
  2478.     find  $(MODEL_FS_PATH) -name ".svn" | xargs rm -rf
  2479. ifneq ($(INCLUDE_CWMP_SSL_VERIFY_PEER), y)
  2480.     @rm -fr $(MODEL_FS_PATH)/etc/cert
  2481. endif
  2482.  
  2483.     #for rcS, yuanshang, 20111026
  2484.     rm -fr $(MODEL_FS_PATH)/etc/init.d/*
  2485.     test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/rcS && \
  2486.     cp $(BUILD_PATH)/config/$(MODEL)/$(REGION)/rcS $(MODEL_FS_PATH)/etc/init.d/rcS || \
  2487.     cp $(TOP_PATH)/targets/fs.dir/etc/init.d/rcS_$(MODEL) $(MODEL_FS_PATH)/etc/init.d/rcS
  2488.  
  2489. .PHONY: fs_lib
  2490. fs_lib:
  2491.     cp -d $(SLIB_PATH)/* $(MODEL_FS_PATH)/lib/
  2492.     -cp $(PRIVATE_LIB_BIN_PATH)/* $(MODEL_FS_PATH)/lib/
  2493.     cp $(PUBLIC_APPS_PATH)/upnp_libs/*.so $(MODEL_FS_PATH)/lib/
  2494.     cp $(OS_LIB_PATH)/libos.so $(MODEL_FS_PATH)/lib
  2495.  
  2496. ifeq ($(INCLUDE_SSL), y)
  2497.     cp -p $(PUBLIC_APPS_PATH)/openssl/libcrypto.so.0.9.7 $(MODEL_FS_PATH)/lib/
  2498.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libcrypto.so.0.9.7 libcrypto.so
  2499.     cp -p $(PUBLIC_APPS_PATH)/openssl/libssl.so.0.9.7 $(MODEL_FS_PATH)/lib/
  2500.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libssl.so.0.9.7 libssl.so
  2501. endif
  2502.    
  2503. ifneq ($(strip $(INCLUDE_USB_VOICEMAIL)),)
  2504.     cp $(APP_PJSIP_DIR)/usbvm/lib/libusbvmcommon.so $(MODEL_FS_PATH)/lib/
  2505. endif
  2506.  
  2507.     #for the libs of samba and ntfs-3g, zjj, 20111129
  2508. ifeq ($(INCLUDE_USB_STORAGE), y)
  2509.     cp -p $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/.libs/libntfs-3g.so.83.0.0 $(MODEL_FS_PATH)/lib/
  2510.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libntfs-3g.so.83.0.0 libntfs-3g.so.83
  2511.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libntfs-3g.so.83.0.0 libntfs-3g.so
  2512. ifeq ($(INCLUDE_USB_SAMBA_SERVER), y)
  2513.     cp -p $(PUBLIC_APPS_PATH)/samba-3.0.14a/source/bin/libbigballofmud.so $(MODEL_FS_PATH)/lib/
  2514.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libbigballofmud.so libbigballofmud.so.0
  2515. endif
  2516. endif
  2517.     #end by zjj
  2518.  
  2519. ifeq ($(INCLUDE_USB_3G_DONGLE),y)
  2520.     cp --no-dereference -p $(PUBLIC_APPS_PATH)/libusb-1.0.8/install/lib/libusb-1.0.so* $(MODEL_FS_PATH)/lib/
  2521.     cp --no-dereference -p $(PUBLIC_APPS_PATH)/libusb-compat-0.1.3/install/lib/libusb-0.1.so* $(MODEL_FS_PATH)/lib/
  2522.     cp --no-dereference -p $(PUBLIC_APPS_PATH)/libusb-compat-0.1.3/install/lib/libusb.so $(MODEL_FS_PATH)/lib/
  2523. endif #INCLUDE_USB_3G_DONGLE
  2524.  
  2525. ifeq ($(INCLUDE_IPSEC), y) 
  2526.     cp -p $(PUBLIC_APPS_PATH)/ipsectools/src/racoon/.libs/libracoon.so.0.0.0 $(MODEL_FS_PATH)/lib/
  2527.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libracoon.so.0.0.0 libracoon.so.0
  2528.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libracoon.so.0.0.0 libracoon.so
  2529.     cp -p $(PUBLIC_APPS_PATH)/ipsectools/src/libipsec/.libs/libipsec.so.0.0.1 $(MODEL_FS_PATH)/lib/
  2530.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libipsec.so.0.0.1 libipsec.so.0
  2531.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libipsec.so.0.0.1 libipsec.so
  2532. endif
  2533.  
  2534. .PHONY: fs_dev
  2535. fs_dev:
  2536. #   $(TOOLS_PATH)/makedevlinks $(MODEL_FS_PATH)/   
  2537.  
  2538.  
  2539. .PHONY:fs_bin
  2540. fs_bin:
  2541.     -cp $(PRIVATE_APPS_BIN_PATH)/* $(MODEL_FS_PATH)/usr/bin
  2542.    
  2543.     cd $(PUBLIC_APPS_PATH)/busybox-1.19.2 && $(MAKE) install CONFIG_PREFIX=$(MODEL_FS_PATH)
  2544.     cp -p $(PUBLIC_APPS_PATH)/iproute2-2.6.24-rc7/tc/tc $(MODEL_FS_PATH)/usr/bin
  2545.    
  2546.     cp -p $(PUBLIC_APPS_PATH)/iptables-1.4.17/iptables/xtables-multi $(MODEL_FS_PATH)/usr/bin
  2547.     cd $(MODEL_FS_PATH)/usr/bin && ln -s xtables-multi iptables
  2548.    
  2549. ifeq ($(INCLUDE_IPV6), y)
  2550.     cd $(MODEL_FS_PATH)/usr/bin && ln -s xtables-multi ip6tables
  2551. endif
  2552.  
  2553. ifeq ($(INCLUDE_ADSLWAN), y)
  2554.     cp -p $(PUBLIC_APPS_PATH)/br2684ctl/br2684ctl $(MODEL_FS_PATH)/usr/bin
  2555. endif
  2556.     cp -p $(PUBLIC_APPS_PATH)/ppp-2.4.5/pppd/pppd $(MODEL_FS_PATH)/usr/sbin
  2557.     cp -p $(PUBLIC_APPS_PATH)/ebtables-v2.0.10-4/ebtables $(MODEL_FS_PATH)/usr/bin
  2558.     cp -p $(PUBLIC_APPS_PATH)/IGD/upnpd $(MODEL_FS_PATH)/usr/bin
  2559.     cp -p $(PUBLIC_APPS_PATH)/dhcp/dhcpd $(MODEL_FS_PATH)/usr/bin
  2560.     cp -p $(PUBLIC_APPS_PATH)/dhcp/dhcpc $(MODEL_FS_PATH)/usr/bin
  2561. ifeq ($(INCLUDE_ADSLWAN), y)
  2562.     cp -p $(PUBLIC_APPS_PATH)/linux-atm/arpd/atmarp $(MODEL_FS_PATH)/usr/sbin
  2563.     cp -p $(PUBLIC_APPS_PATH)/linux-atm/arpd/atmarpd $(MODEL_FS_PATH)/usr/sbin
  2564. endif
  2565.    
  2566. ifeq ($(INCLUDE_PORTABLE_APP), y)      
  2567.     cp -p $(PUBLIC_APPS_PATH)/dropbear/dropbearmulti $(MODEL_FS_PATH)/usr/bin
  2568.     cd $(MODEL_FS_PATH)/usr/bin && ln -s dropbearmulti dropbear
  2569.     cd $(MODEL_FS_PATH)/usr/bin && ln -s dropbearmulti dropbearkey
  2570.     cd $(MODEL_FS_PATH)/usr/bin && ln -s dropbearmulti scp
  2571. endif
  2572.    
  2573. ifeq ($(INCLUDE_L2TP), y)
  2574.     cp -p $(PUBLIC_APPS_PATH)/xl2tpd-1.1.12/xl2tpd $(MODEL_FS_PATH)/usr/sbin
  2575. endif
  2576.  
  2577. ifeq ($(INCLUDE_BPA), y)
  2578.     cp -p $(PUBLIC_APPS_PATH)/bpalogin-2.0.2/bpalogin $(MODEL_FS_PATH)/usr/sbin
  2579. endif
  2580.  
  2581. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  2582.     cp -p $(PUBLIC_APPS_PATH)/usbip-0.1.7/usbipd $(MODEL_FS_PATH)/usr/bin
  2583. endif
  2584.  
  2585. ifeq ($(INCLUDE_USB_FTP_SERVER), y)
  2586.     cp -p $(PUBLIC_APPS_PATH)/vsftpd-2.3.2/vsftpd $(MODEL_FS_PATH)/usr/bin
  2587.     cp -p $(PUBLIC_APPS_PATH)/vsftpd-2.3.2/vsftpd.conf $(MODEL_FS_PATH)/etc
  2588.     cp -p $(PUBLIC_APPS_PATH)/vsftpd-2.3.2/passwd $(MODEL_FS_PATH)/etc/vsftpd_passwd
  2589. endif
  2590.    
  2591. ifeq ($(INCLUDE_RIP), y)
  2592.     cp -p $(PUBLIC_APPS_PATH)/zebra-0.95a/ripd/ripd $(MODEL_FS_PATH)/usr/sbin
  2593.     cp -p $(PUBLIC_APPS_PATH)/zebra-0.95a/zebra/zebra $(MODEL_FS_PATH)/usr/sbin
  2594. endif
  2595.  
  2596. ifneq ($(strip $(INCLUDE_VOIP)),)
  2597.     cp $(APP_VOIP_DIR)/bin/$(MODEL)/* $(MODEL_FS_PATH)/usr/bin
  2598.     cp $(APP_PJSIP_DIR)/pjsip-apps/bin/pjsua $(MODEL_FS_PATH)/usr/bin
  2599. endif  
  2600.  
  2601. ifeq ($(INCLUDE_IPV6), y)
  2602.     cp -p $(PUBLIC_APPS_PATH)/radvd-1.5/radvd $(MODEL_FS_PATH)/usr/sbin
  2603. endif
  2604.  
  2605. ifeq ($(INCLUDE_IPV6), y)
  2606.     cp -p $(PUBLIC_APPS_PATH)/wide-dhcpv6-20080615/dhcp6s $(MODEL_FS_PATH)/usr/sbin
  2607.     cp -p $(PUBLIC_APPS_PATH)/wide-dhcpv6-20080615/dhcp6c $(MODEL_FS_PATH)/usr/sbin
  2608. endif  
  2609.    
  2610. ifeq ($(INCLUDE_IPV6), y)
  2611.     cp -p $(PUBLIC_APPS_PATH)/iproute2-2.6.39/ip/ip $(MODEL_FS_PATH)/usr/bin
  2612. endif  
  2613.    
  2614. ifeq ($(INCLUDE_USB_STORAGE),y)
  2615.     #for the bins of hotplug, zjj, 20111129
  2616.     #cp $(PRIVATE_APPS_PATH)/usbp/usbp $(MODEL_FS_PATH)/sbin
  2617.     #cp $(PRIVATE_APPS_PATH)/hotplug/hotplug $(MODEL_FS_PATH)/sbin
  2618.     #end by zjj
  2619.     #for the bins of samba and ntfs-3g, zjj, 20111129
  2620.     cp -p $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15/src/.libs/ntfs-3g $(MODEL_FS_PATH)/usr/bin/ntfs-3g
  2621. ifeq ($(INCLUDE_USB_SAMBA_SERVER), y)
  2622. ifeq ($(INCLUDE_SAMBA_3_6_25), y)
  2623.     cp -p $(PUBLIC_APPS_PATH)/samba-3.6.25/source3/bin/samba_multicall $(MODEL_FS_PATH)/usr/bin
  2624.     cd $(MODEL_FS_PATH)/usr/bin/ && ln -sf samba_multicall $(MODEL_FS_PATH)/usr/bin/smbd
  2625.     cd $(MODEL_FS_PATH)/usr/bin/ && ln -sf samba_multicall $(MODEL_FS_PATH)/usr/bin/nmbd
  2626.     cd $(MODEL_FS_PATH)/usr/bin/ && ln -sf samba_multicall $(MODEL_FS_PATH)/usr/bin/smbpasswd
  2627.     cd $(MODEL_FS_PATH)/usr/bin/ && ln -sf samba_multicall $(MODEL_FS_PATH)/usr/bin/smbcontrol
  2628. endif
  2629. ifeq ($(INCLUDE_SAMBA_3_0_14a), y)
  2630.     cp -p $(PUBLIC_APPS_PATH)/samba-3.0.14a/source/bin/smbd $(MODEL_FS_PATH)/usr/bin
  2631.     cp -p $(PUBLIC_APPS_PATH)/samba-3.0.14a/source/bin/smbpasswd $(MODEL_FS_PATH)/usr/bin
  2632.     cp -p $(PUBLIC_APPS_PATH)/samba-3.0.14a/source/bin/smbcontrol $(MODEL_FS_PATH)/usr/bin
  2633. endif
  2634. endif #INCLUDE_USB_SAMBA_SERVER
  2635.     #end by zjj
  2636.  
  2637. #for dlna ,LI CHENGLONG
  2638. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  2639.     cp -p $(PUBLIC_APPS_PATH)/ushare-1.1a/src/ushare $(MODEL_FS_PATH)/usr/bin
  2640.     cp -p $(PUBLIC_APPS_PATH)/ushare-1.1a/scripts/ushare.conf $(MODEL_FS_PATH)/etc/ushare.conf
  2641. endif #INCLUDE_USB_MEDIA_SERVER
  2642. #end by LI CHENGLONG
  2643. #end by Zhu Haiming
  2644. else
  2645. ifeq ($(INCLUDE_USB_3G_DONGLE),y)
  2646.     #cp $(PRIVATE_APPS_PATH)/hotplug/hotplug $(MODEL_FS_PATH)/sbin
  2647. endif #INCLUDE_USB_3G_DONGLE
  2648. endif #INCLUDE_USB_STORAGE
  2649.    
  2650. ifeq ($(INCLUDE_USB_3G_DONGLE),y)
  2651.     #cp $(PRIVATE_APPS_PATH)/handle_card/modswitch_conf/support_3g_list $(MODEL_FS_PATH)/etc
  2652.     cp $(PUBLIC_APPS_PATH)/usb-modeswitch-1.2.3/usb_modeswitch $(MODEL_FS_PATH)/usr/bin
  2653.     cp $(PUBLIC_APPS_PATH)/ppp-2.4.5/chat/chat $(MODEL_FS_PATH)/usr/bin
  2654.     #cp -pR $(PRIVATE_APPS_PATH)/handle_card/source/handle_card $(MODEL_FS_PATH)/usr/sbin/
  2655.     #cp -pR $(PRIVATE_APPS_PATH)/handle_card/modem_scan/modem_scan $(MODEL_FS_PATH)/usr/sbin/
  2656.     #cp -pR $(PRIVATE_APPS_PATH)/handle_card/chat_script/* $(MODEL_FS_PATH)/etc/ppp/
  2657.     #cp -pR $(PRIVATE_APPS_PATH)/handle_card/modswitch_conf/mode_switch.conf.bin $(MODEL_FS_PATH)/etc/
  2658. endif #INCLUDE_USB_3G_DONGLE
  2659.  
  2660. #for ipping and traceroute, Zhu Haiming
  2661. ifeq ($(INCLUDE_IPPING_DIAG), y)
  2662.     cp -p $(PUBLIC_APPS_PATH)/ipping/ipping $(MODEL_FS_PATH)/usr/bin
  2663. endif #INCLUDE_IPPING_DIAG
  2664. ifeq ($(INCLUDE_TRACEROUTE_DIAG), y)
  2665.     cp -p $(PUBLIC_APPS_PATH)/traceroute-2.0.3/traceroute/traceroute $(MODEL_FS_PATH)/usr/bin
  2666. endif #INCLUDE_TRACEROUTE_DIAG
  2667.    
  2668. ifeq ($(INCLUDE_IPSEC),y)
  2669.     cp -p $(PUBLIC_APPS_PATH)/ipsectools/src/racoon/.libs/racoon $(MODEL_FS_PATH)/usr/bin
  2670.     cp -p $(PUBLIC_APPS_PATH)/ipsectools/src/setkey/.libs/setkey $(MODEL_FS_PATH)/usr/bin
  2671.     #copy ipsecVpn in user cmm Makefile
  2672.     #cp -p $(PRIVATE_APPS_PATH)/user/ipsecVpn/ipsecVpn $(MODEL_FS_PATH)/usr/sbin
  2673. endif
  2674.  
  2675. ifeq ($(strip $(SUPPLIER)),mtk)
  2676.     #cp $(TOP_PATH)/$(SUPPLIER)/apps/private/tcci/tcci $(MODEL_FS_PATH)/usr/bin
  2677.     rm -f $(MODEL_FS_PATH)/usr/bin/tce
  2678.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/tce
  2679.     rm -f $(MODEL_FS_PATH)/usr/bin/sys
  2680.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/sys
  2681.     rm -f $(MODEL_FS_PATH)/usr/bin/wan
  2682.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/wan
  2683.     rm -f $(MODEL_FS_PATH)/usr/bin/w
  2684.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/w
  2685. ifeq ($(INCLUDE_LAN_WLAN), y)
  2686.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/usr/etc/RT30xxEEPROM.bin $(MODEL_FS_PATH)/etc
  2687.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/iwpriv $(MODEL_FS_PATH)/usr/bin
  2688.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/iwconfig $(MODEL_FS_PATH)/usr/bin
  2689.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/iwlist $(MODEL_FS_PATH)/usr/bin
  2690.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/lib/libiw.so.28 $(MODEL_FS_PATH)/lib
  2691.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/wlNetlinkTool $(MODEL_FS_PATH)/usr/bin
  2692.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/ated $(MODEL_FS_PATH)/usr/bin
  2693.     cp $(TOP_PATH)/$(SUPPLIER)/filesystem/userfs/bin/rt2860apd $(MODEL_FS_PATH)/usr/bin
  2694.     #cp -p $(INSTALL_WIRELESS)/sbin/rt2860apd   $(MODEL_FS_PATH)/usr/bin
  2695. #Build wscd with wifi modules
  2696.     #cp $(TOP_PATH)/$(SUPPLIER)/filesystem/usr/bin/wscd $(MODEL_FS_PATH)/usr/bin
  2697.     chmod +x $(MODEL_FS_PATH)/usr/bin/*
  2698. else    #INCLUDE_LAN_WLAN
  2699.     @echo no wifi
  2700. endif   #INCLUDE_LAN_WLAN
  2701.    
  2702. endif   #SUPPLIER-ralink
  2703.  
  2704. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4120)
  2705.     cp $(TOP_PATH)/$(SUPPLIER)/apps/reg/reg $(MODEL_FS_PATH)/usr/bin
  2706.     cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/hw_nat $(MODEL_FS_PATH)/usr/bin
  2707.     cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/mtr $(MODEL_FS_PATH)/usr/bin
  2708.     cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/acl $(MODEL_FS_PATH)/usr/bin
  2709.     cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/ac $(MODEL_FS_PATH)/usr/bin
  2710.  
  2711. ifeq ($(INCLUDE_LAN_WLAN), y)
  2712.     cp $(INSTALL_WIRELESS)/sbin/iwpriv $(MODEL_FS_PATH)/usr/bin
  2713.     cp $(INSTALL_WIRELESS)/sbin/wlNetlinkTool $(MODEL_FS_PATH)/usr/bin
  2714.     cp $(INSTALL_WIRELESS)/lib/libiw.so.29 $(MODEL_FS_PATH)/lib
  2715.     cp $(INSTALL_WIRELESS)/sbin/ated_tp $(MODEL_FS_PATH)/usr/bin
  2716.     #cp $(INSTALL_WIRELESS)/sbin/ated $(MODEL_FS_PATH)/usr/bin
  2717.     #cp $(INSTALL_WIRELESS)/sbin/mpstat $(MODEL_FS_PATH)/usr/bin
  2718.     cp $(INSTALL_WIRELESS)/sbin/rt2860apd $(MODEL_FS_PATH)/usr/bin
  2719.     cp $(INSTALL_WIRELESS)/sbin/rtinicapd $(MODEL_FS_PATH)/usr/bin
  2720.     cp $(INSTALL_WIRELESS)/sbin/wscd $(MODEL_FS_PATH)/usr/bin
  2721.     cp $(INSTALL_WIRELESS)/sbin/wscd_5G $(MODEL_FS_PATH)/usr/bin
  2722. ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7612E), y)
  2723. # WARNING!!! '_' in EEPROM file name, not '-' like MT7610E
  2724.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7612E_EEPROM.bin $(MODEL_FS_PATH)/etc/
  2725. else ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7610E), y)
  2726.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7610E-V10-FEM-1ANT.bin $(MODEL_FS_PATH)/etc/
  2727. else
  2728.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7610E-V10-FEM-1ANT.bin $(MODEL_FS_PATH)/etc/
  2729. endif
  2730.     cp $(INSTALL_WIRELESS)/lib/firmware/RT2860AP5G.dat $(MODEL_FS_PATH)/etc/
  2731.     #cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_FCC.dat $(MODEL_FS_PATH)/etc/
  2732.     #cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_5G_CE.dat $(MODEL_FS_PATH)/etc/
  2733.     cp $(INSTALL_WIRELESS)/lib/firmware/RT2860AP.dat $(MODEL_FS_PATH)/etc/
  2734.     #cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_FCC.dat $(MODEL_FS_PATH)/etc/
  2735.     #cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU_CE.dat $(MODEL_FS_PATH)/etc/
  2736.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7620_AP_2T2R-4L_V15.BIN $(MODEL_FS_PATH)/etc/
  2737. # wuguocheng added, 11Jan2016, for copying all SingleSKU files (for UN->EU)
  2738.     cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU* $(MODEL_FS_PATH)/etc/
  2739. # end--added
  2740.     #cp -p $(INSTALL_WIRELESS)/sbin/rt2860apd   $(MODEL_FS_PATH)/usr/bin
  2741. #Build wscd with wifi modules
  2742.     #cp $(TOP_PATH)/$(SUPPLIER)/filesystem/usr/bin/wscd $(MODEL_FS_PATH)/usr/bin
  2743.     chmod +x $(MODEL_FS_PATH)/usr/bin/*
  2744. else    #INCLUDE_LAN_WLAN
  2745.     @echo no wifi
  2746. endif   #INCLUDE_LAN_WLAN
  2747.  
  2748. endif   #SUPPLIER-mtk_ApSoC_4120
  2749.  
  2750. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4320)
  2751.     cp $(TOP_PATH)/$(SUPPLIER)/apps/reg/reg $(MODEL_FS_PATH)/usr/bin
  2752.  
  2753. ifeq ($(INCLUDE_LAN_WLAN), y)
  2754.     cp $(INSTALL_WIRELESS)/sbin/iwpriv $(MODEL_FS_PATH)/usr/bin
  2755.     cp $(INSTALL_WIRELESS)/sbin/iwconfig $(MODEL_FS_PATH)/usr/bin
  2756.     cp $(INSTALL_WIRELESS)/sbin/iwlist $(MODEL_FS_PATH)/usr/bin
  2757.     cp $(INSTALL_WIRELESS)/sbin/wlNetlinkTool $(MODEL_FS_PATH)/usr/bin
  2758.     cp $(INSTALL_WIRELESS)/lib/libiw.so.29 $(MODEL_FS_PATH)/lib
  2759. ifeq ($(INCLUDE_ATED_CALIBRATE),y)
  2760.     mv $(MODEL_FS_PATH)/usr/bin/ated_calibrate $(MODEL_FS_PATH)/usr/bin/ated_tp
  2761. else
  2762.     cp $(INSTALL_WIRELESS)/sbin/ated_tp $(MODEL_FS_PATH)/usr/bin
  2763. endif
  2764. ifeq ($(INCLUDE_HARDWARE_DEBUG),y)
  2765.     cp $(INSTALL_WIRELESS)/sbin/ated $(MODEL_FS_PATH)/usr/bin
  2766. endif
  2767.     #cp $(INSTALL_WIRELESS)/sbin/mpstat $(MODEL_FS_PATH)/usr/bin
  2768.     cp $(INSTALL_WIRELESS)/sbin/rt2860apd $(MODEL_FS_PATH)/usr/bin
  2769.     cp $(INSTALL_WIRELESS)/sbin/rtinicapd $(MODEL_FS_PATH)/usr/bin
  2770.     cp $(INSTALL_WIRELESS)/sbin/wscd $(MODEL_FS_PATH)/usr/bin
  2771. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND), y)
  2772.     cp $(INSTALL_WIRELESS)/sbin/wscd_5G $(MODEL_FS_PATH)/usr/bin
  2773. endif
  2774.  
  2775. ifneq ($(strip $(CPU_TYPE)),mt7620a)
  2776.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7628_EEPROM_20140317.bin $(MODEL_FS_PATH)/etc/
  2777. endif
  2778.     -cp $(INSTALL_WIRELESS)/lib/firmware/RT2860AP.dat $(MODEL_FS_PATH)/etc/
  2779. ifeq ($(strip $(CPU_TYPE)),mt7620a)
  2780. ifeq ($(MODEL), C2V5)
  2781.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/qca8337_switch/qca8337_switch $(MODEL_FS_PATH)/bin/
  2782. endif
  2783.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/switch/switch $(MODEL_FS_PATH)/sbin/
  2784.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7620_AP_2T2R-4L_V15.BIN $(MODEL_FS_PATH)/etc/
  2785.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/hw_nat $(MODEL_FS_PATH)/usr/bin
  2786.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/mtr $(MODEL_FS_PATH)/usr/bin
  2787.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/acl $(MODEL_FS_PATH)/usr/bin
  2788.     -cp $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat/ac $(MODEL_FS_PATH)/usr/bin
  2789. else
  2790.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7628_AP_2T2R-4L_V15.BIN $(MODEL_FS_PATH)/etc/
  2791. endif
  2792.  
  2793. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND), y)
  2794.     cp $(INSTALL_WIRELESS)/lib/firmware/RT2860AP5G.dat $(MODEL_FS_PATH)/etc/
  2795.     cp $(INSTALL_WIRELESS)/lib/firmware/SingleSKU* $(MODEL_FS_PATH)/etc/
  2796. ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7610E), y)
  2797.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7610E-V10-FEM-1ANT.bin $(MODEL_FS_PATH)/etc/
  2798.     -cp $(INSTALL_WIRELESS)/lib/firmware/MT7610E_EEPROM.bin $(MODEL_FS_PATH)/etc/
  2799. endif
  2800. ifeq ($(INCLUDE_WIFI_5G_CHIP_MT7612E), y)
  2801.     cp $(INSTALL_WIRELESS)/lib/firmware/MT7612E_EEPROM.bin $(MODEL_FS_PATH)/etc/
  2802. endif
  2803. endif
  2804. ifeq ($(INCLUDE_CO_FW), y)
  2805.     cp -pR $(BUILD_PATH)/config/$(MODEL)/MT7628_EEPROM_20140317.bin $(MODEL_FS_PATH)/etc/
  2806. endif
  2807. ifneq ($(REGION),)
  2808.     -cp -pRL $(BUILD_PATH)/config/$(MODEL)/$(REGION)/MT*.* $(MODEL_FS_PATH)/etc/
  2809.     -cp -pRL $(BUILD_PATH)/config/$(MODEL)/$(REGION)/SingleSKU_* $(MODEL_FS_PATH)/etc/
  2810. endif
  2811.  
  2812. #Build wscd with wifi modules
  2813.     #cp $(TOP_PATH)/$(SUPPLIER)/filesystem/usr/bin/wscd $(MODEL_FS_PATH)/usr/bin
  2814.     chmod +x $(MODEL_FS_PATH)/usr/bin/*
  2815. else    #INCLUDE_LAN_WLAN
  2816.     @echo no wifi
  2817. endif   #INCLUDE_LAN_WLAN
  2818.  
  2819. endif   #SUPPLIER-mtk_ApSoC_4320
  2820.  
  2821. # xcl add, 20130315
  2822. ifeq ($(strip $(SUPPLIER)),mtk)
  2823.     cp $(TOP_PATH)/$(SUPPLIER)/apps/private/tcci/tcci $(MODEL_FS_PATH)/usr/bin
  2824.     rm -f $(MODEL_FS_PATH)/usr/bin/tce
  2825.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/tce
  2826.     rm -f $(MODEL_FS_PATH)/usr/bin/sys
  2827.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/sys
  2828.     rm -f $(MODEL_FS_PATH)/usr/bin/wan
  2829.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/wan
  2830.     rm -f $(MODEL_FS_PATH)/usr/bin/w
  2831.     ln -s tcci $(MODEL_FS_PATH)/usr/bin/w
  2832.    
  2833.     cp $(TOP_PATH)/$(SUPPLIER)/apps/private/lib/libtcapi.so.1 $(MODEL_FS_PATH)/lib
  2834. endif
  2835.  
  2836. # zl added 2011-10-19 sarctl adslctrl wlan_daemon usbctl
  2837. ifeq ($(strip $(SUPPLIER)),realtek)
  2838.     cp $(TOP_PATH)/$(SUPPLIER)/user/sarctl/sarctl $(MODEL_FS_PATH)/usr/bin
  2839.     cp $(TOP_PATH)/$(SUPPLIER)/user/adslctrl_by_tp/adslctrl $(MODEL_FS_PATH)/usr/bin
  2840.     cp $(TOP_PATH)/$(SUPPLIER)/user/ethctrl_by_tp/ethctrl $(MODEL_FS_PATH)/usr/bin
  2841. ifeq ($(INCLUDE_LAN_WLAN), y)
  2842.     cp $(TOP_PATH)/$(SUPPLIER)/user/ated/ated $(MODEL_FS_PATH)/bin
  2843.     cp $(TOP_PATH)/$(SUPPLIER)/user/wsc/src/wscd $(MODEL_FS_PATH)/usr/bin
  2844.     cp $(TOP_PATH)/$(SUPPLIER)/user/auth/src/dlisten/iwcontrol $(MODEL_FS_PATH)/bin
  2845.     cp $(TOP_PATH)/$(SUPPLIER)/user/mini_upnp/libmini_upnp.so $(MODEL_FS_PATH)/lib
  2846.  
  2847.     for wireless_tool in $(WIRELESS_TOOLS) ; do cp $(TOP_PATH)/$(SUPPLIER)/user/wireless_tools/$$wireless_tool $(MODEL_FS_PATH)/usr/bin || exit 1 ; done
  2848. endif
  2849. endif
  2850. # end--added
  2851.  
  2852. ifeq ($(strip $(SUPPLIER)),lantiq)
  2853. ifeq ($(INCLUDE_LAN_WLAN), y)
  2854.     cp $(INSTALL_WIRELESS)/lib/libiw.so.28 $(MODEL_FS_PATH)/lib/
  2855.     cp -p $(INSTALL_WIRELESS)/sbin/* $(MODEL_FS_PATH)/sbin
  2856.     cp -p $(INSTALL_WIRELESS)/lib/modules/*.ko $(MODEL_FS_PATH)/lib/modules
  2857.     cp -p $(INSTALL_WIRELESS)/lib/*.so $(MODEL_FS_PATH)/lib/
  2858. endif   #INCLUDE_LAN_WLAN
  2859.  
  2860. ifeq ($(INCLUDE_ADSLWAN), y)
  2861. #prepare
  2862.     mkdir $(MODEL_FS_PATH)/firmware
  2863.     mkdir $(MODEL_FS_PATH)/tmp
  2864.     mkdir $(MODEL_FS_PATH)/tmp/pipe
  2865.     echo "ramfs /tmp ramfs defaults 0 0" >> $(MODEL_FS_PATH)/etc/fstab
  2866.     echo "none /sys sysfs defaults 0 0" >> $(MODEL_FS_PATH)/etc/fstab
  2867. #ko
  2868.     cp $(SLIB_PATH)/../opt/lantiq/bin/drv_dsl_cpe_api.ko $(MODEL_FS_PATH)/lib/modules
  2869.     cp $(SLIB_PATH)/../opt/lantiq/bin/drv_ifxos.ko $(MODEL_FS_PATH)/lib/modules
  2870. #lib
  2871.     cp $(SLIB_PATH)/../usr/lib/libdti_agent.so.0.0.0 $(MODEL_FS_PATH)/lib
  2872.     cd $(MODEL_FS_PATH)/lib/ && ln -sf libdti_agent.so.0.0.0 libdti_agent.so.0
  2873. #app bin
  2874.     cp $(SLIB_PATH)/../usr/sbin/br2684ctl $(MODEL_FS_PATH)/usr/sbin
  2875.     cp $(SLIB_PATH)/../usr/sbin/br2684ctld $(MODEL_FS_PATH)/usr/sbin
  2876.     cp $(SLIB_PATH)/../opt/lantiq/bin/dsl_cpe_control $(MODEL_FS_PATH)/usr/sbin
  2877.     cp $(SLIB_PATH)/../sbin/ppacmd $(MODEL_FS_PATH)/usr/sbin
  2878.     cp $(SLIB_PATH)/../usr/bin/switch_utility $(MODEL_FS_PATH)/usr/sbin
  2879. #firmware
  2880.     cp $(SLIB_PATH)/../opt/lantiq/bin/adsl.scr $(MODEL_FS_PATH)/firmware
  2881.     cp $(SLIB_PATH)/../opt/lantiq/bin/vdsl.scr $(MODEL_FS_PATH)/firmware
  2882.     cp $(SLIB_PATH)/../firmware/dsl_wan_setting.sh $(MODEL_FS_PATH)/firmware
  2883.     cp $(SLIB_PATH)/../firmware/eth_wan_setting.sh $(MODEL_FS_PATH)/firmware
  2884.     cp $(SLIB_PATH)/../opt/lantiq/bin/dsl_cpe_pipe.sh $(MODEL_FS_PATH)/firmware
  2885. #   cp -d $(SLIB_PATH)/../firmware/*.bin $(MODEL_FS_PATH)/firmware
  2886. ifeq ($(INCLUDE_ANNEXB), y)
  2887.     cp -d $(SLIB_PATH)/../firmware/xcpe_533D06_535902_AnnexB.bin $(MODEL_FS_PATH)/firmware
  2888.     cd $(MODEL_FS_PATH)/firmware/ && ln -s xcpe_533D06_535902_AnnexB.bin xcpe_hw.bin
  2889. else
  2890.     cp -d $(SLIB_PATH)/../firmware/dsl_vr9_firmware_xdsl-05.04.08.00.00.06_05.04.04.04.00.01.bin $(MODEL_FS_PATH)/firmware
  2891.     cd $(MODEL_FS_PATH)/firmware/ && ln -s dsl_vr9_firmware_xdsl-05.04.08.00.00.06_05.04.04.04.00.01.bin xcpe_hw.bin
  2892. endif
  2893.     cp -d $(SLIB_PATH)/../firmware/xdslled.sh $(MODEL_FS_PATH)/firmware
  2894. endif   #INCLUDE_ADSLWAN
  2895.  
  2896. endif   #SUPPLIER-lantiq
  2897.  
  2898. .PHONY:fs_modules
  2899. fs_modules:
  2900.     cp -pR $(MODULE_TG_PATH)/* $(MODEL_FS_PATH)/lib/modules
  2901.     #test -e $(TP_MODULES_PATH)/ko && cp -pR $(TP_MODULES_PATH)/ko/*.ko $(MODEL_FS_PATH)/lib/modules
  2902.  
  2903. ifeq ($(INCLUDE_USB_OVER_IP), y)
  2904. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  2905.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/public/usbip-0.1.7/usbip.ko $(MODEL_FS_PATH)/lib/modules
  2906.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/public/usbip-0.1.7/usbip_common_mod.ko $(MODEL_FS_PATH)/lib/modules
  2907. else   # INCLUDE_USB_OVER_IP_TPLINK
  2908. ifeq ($(INCLUDE_VOIP), y)
  2909. ifeq ($(strip $(CONFIG_NR_CPUS)), 2)
  2910.     cp -p $(TP_MODULES_PATH)/ko/kcode/NetUSB2_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/NetUSB.ko
  2911.     -cp -p $(TP_MODULES_PATH)/ko/kcode/GPL_NetUSB2_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/GPL_NetUSB.ko
  2912. else   # CONFIG_NR_CPUS
  2913.     cp -p $(TP_MODULES_PATH)/ko/kcode/NetUSB_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/NetUSB.ko
  2914.     -cp -p $(TP_MODULES_PATH)/ko/kcode/GPL_NetUSB_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/GPL_NetUSB.ko
  2915. endif  # CONFIG_NR_CPUS
  2916. else   # INCLUDE_VOIP
  2917.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/private/kcode/NetUSB_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/NetUSB.ko
  2918.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/private/kcode/GPL_NetUSB_$(MODEL).ko $(MODEL_FS_PATH)/lib/modules/GPL_NetUSB.ko
  2919. endif  # INCLUDE_VOIP  
  2920. endif  # INCLUDE_USB_OVER_IP_TPLINK
  2921. endif  # INCLUDE_USB_OVER_IP
  2922.  
  2923. ifeq ($(INCLUDE_PPTP), y)
  2924.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/public/accel-pptp-0.8.5/pptp.ko $(MODEL_FS_PATH)/lib/modules
  2925. endif
  2926.  
  2927. ifeq ($(INCLUDE_L2TP), y)
  2928. ifeq ($(KERNELVERSION), 2.6.22.15)
  2929.     cp -p $(TOP_PATH)/$(SUPPLIER)/modules/public/pppol2tp-kmod-0.17/pppol2tp.ko $(MODEL_FS_PATH)/lib/modules
  2930. else
  2931. ifeq ($(KERNELVERSION), 2.6.36)
  2932.     cp -p $(KERNELPATH)/net/l2tp/l2tp_core.ko $(MODEL_FS_PATH)/lib/modules/pppol2tp.ko
  2933.     cp -p $(KERNELPATH)/net/l2tp/l2tp_ppp.ko $(MODEL_FS_PATH)/lib/modules/l2tp_ppp.ko
  2934.     rm $(MODEL_FS_PATH)/lib/modules/kmdir/kernel/net/l2tp/*.ko
  2935. else
  2936.     cp -p $(KERNELPATH)/drivers/net/pppol2tp.ko $(MODEL_FS_PATH)/lib/modules
  2937. endif
  2938. endif
  2939. endif
  2940.  
  2941. .PHONY:fs_sysfiles
  2942. fs_sysfiles:
  2943. ifeq ($(MODEL), WR841HPV5)
  2944.     rm  -fr $(MODEL_FS_PATH)/web/main/*.htm
  2945. endif
  2946. ifneq ($(INCLUDE_NEW_WEBUI), y)  # it is not include NEW webui
  2947.     cp -pR $(WEBFILE_PATH)/common/* $(MODEL_FS_PATH)/web/
  2948.     cp -pR $(WEBFILE_PATH)/multilang/$(SPEC_LANG)/* $(MODEL_FS_PATH)/web/js/
  2949. ifeq ($(strip $(INCLUDE_RAETH_EXTERNAL_QCA8337)), y)
  2950.     mv -f $(MODEL_FS_PATH)/web/js/vlancfg_qca8337.js $(MODEL_FS_PATH)/web/js/vlancfg.js
  2951. else
  2952.     rm -f $(MODEL_FS_PATH)/web/js/vlancfg_*.js
  2953. endif
  2954. ifeq ($(INCLUDE_VOIP), y)
  2955.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2956.     cp -pR $(WEBFILE_PATH)/common_voice/* $(MODEL_FS_PATH)/web/
  2957. endif
  2958. ifeq ($(INCLUDE_USB), y)
  2959.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2960.     cp -pR $(WEBFILE_PATH)/common_usb/* $(MODEL_FS_PATH)/web/
  2961. endif
  2962. ifeq ($(INCLUDE_IPV6), y)
  2963.     find $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2964.     cp -pR $(WEBFILE_PATH)/common_ipv6/* $(MODEL_FS_PATH)/web/
  2965. endif
  2966. ifeq ($(INCLUDE_WIFI_CERTIFIED), y)
  2967.     find $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2968.     cp -pR $(WEBFILE_PATH)/common_wificert/* $(MODEL_FS_PATH)/web/
  2969. endif
  2970. ifeq ($(INCLUDE_AUTOREBOOT), y)
  2971. ifneq ($(INCLUDE_VN_SPEC), y)
  2972.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2973.     cp -pR $(WEBFILE_PATH)/common_autoReboot/* $(MODEL_FS_PATH)/web/
  2974. endif
  2975. endif
  2976. ifeq ($(INCLUDE_WEB_NEWLOGO),y)
  2977.     @echo "#############  WEB  NEWLOGO  here  BEGIN  ###################"
  2978.     rm -rf  $(MODEL_FS_PATH)/web/img/
  2979.     cp -pRf $(WEBFILE_PATH)/common_newVI/* $(MODEL_FS_PATH)/web/
  2980.     find $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2981.     #$(TOP_PATH)/build/replaceRed.sh $(MODEL_FS_PATH)/web/
  2982.     @echo "################  END  ###########################"
  2983. endif
  2984. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  2985.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2986.     cp -pR $(WEBFILE_PATH)/common_dualBand/* $(MODEL_FS_PATH)/web/
  2987. endif
  2988.  
  2989. ifeq ($(INCLUDE_MEXICO_SPEC), y)
  2990.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2991.     cp -pR $(WEBFILE_PATH)/common_spec/MEXICO/* $(MODEL_FS_PATH)/web/
  2992. endif
  2993.  
  2994. ifeq ($(INCLUDE_KOREA_SPEC), y)
  2995.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  2996.     cp -pR $(WEBFILE_PATH)/common_spec/KOREA/* $(MODEL_FS_PATH)/web/
  2997. endif
  2998.  
  2999. ifeq ($(INCLUDE_CANADA_SPEC), y)
  3000.     mkdir $(MODEL_FS_PATH)/bil/
  3001.     #cp -pR $(MODEL_FS_PATH)/web/* $(MODEL_FS_PATH)/bil/
  3002.     cp -pRf $(WEBFILE_PATH)/common_spec/CANADA/default/* $(MODEL_FS_PATH)/web/
  3003.     cp -pRf $(WEBFILE_PATH)/common_spec/CANADA/bil/* $(MODEL_FS_PATH)/bil/
  3004.     cp -pRf $(WEBFILE_PATH)/multilang/fr_CA/* $(MODEL_FS_PATH)/bil/js/
  3005. endif
  3006.  
  3007. ifeq ($(INCLUDE_ISRAEL_SPEC), y)
  3008.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3009.     cp -pR $(WEBFILE_PATH)/common_spec/ISRAEL/* $(MODEL_FS_PATH)/web/
  3010. endif
  3011.  
  3012. ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  3013.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3014.     cp -pR $(WEBFILE_PATH)/common_spec/MALAYSIA/* $(MODEL_FS_PATH)/web/
  3015. endif
  3016.  
  3017. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  3018.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3019.     cp -pR $(WEBFILE_PATH)/common_spec/RUSSIA/* $(MODEL_FS_PATH)/web/
  3020. endif
  3021.  
  3022. ifeq ($(INCLUDE_TW_SPEC), y)
  3023.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3024.     cp -pR $(WEBFILE_PATH)/common_spec/TW/* $(MODEL_FS_PATH)/web/
  3025. endif
  3026.  
  3027. # delete by wuguocheng, 25Jan2016 (for UN->EU)
  3028. #ifeq ($(INCLUDE_US_SPEC), y)
  3029. #   cp -pR $(WEBFILE_PATH)/common_spec/US/* $(MODEL_FS_PATH)/web/
  3030. #endif
  3031.  
  3032. ifeq ($(INCLUDE_BR_SPEC), y)
  3033. ifneq ($(INCLUDE_MULTI_LANGUAGE_Q), y)
  3034.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3035.     cp -pRf $(WEBFILE_PATH)/common_spec/BR/* $(MODEL_FS_PATH)/web/
  3036. endif
  3037. endif
  3038.  
  3039. ifeq ($(INCLUDE_ES_SPEC), y)
  3040.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3041.     cp -pRf $(WEBFILE_PATH)/common_spec/ES/* $(MODEL_FS_PATH)/web/
  3042. endif
  3043.  
  3044. ifeq ($(INCLUDE_GERMANY_SPEC), y)
  3045.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3046.     cp -pR $(WEBFILE_PATH)/common_spec/GERMANY/* $(MODEL_FS_PATH)/web/
  3047. endif
  3048.  
  3049. ifeq ($(INCLUDE_VIETNAM_FPT), y)
  3050.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3051.     cp -pR $(WEBFILE_PATH)/common_spec/VIETNAM_FPT/* $(MODEL_FS_PATH)/web/
  3052. endif
  3053.  
  3054. ifeq ($(INCLUDE_NEWZEALAND_MYREPUBLIC_SPEC), y)
  3055.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3056.     cp -pR $(WEBFILE_PATH)/common_spec/NEWZEALAND_MYREPUBLIC/* $(MODEL_FS_PATH)/web/
  3057. endif
  3058.  
  3059. ifeq ($(INCLUDE_JAPAN_SPEC),y)
  3060.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3061.     cp -pR $(WEBFILE_PATH)/common_spec/JAPAN/* $(MODEL_FS_PATH)/web/
  3062. endif
  3063.  
  3064. ifeq ($(INCLUDE_PL_SPEC), y)
  3065.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3066.     cp -pR $(WEBFILE_PATH)/common_spec/POLAND/* $(MODEL_FS_PATH)/web/
  3067. endif
  3068.  
  3069. ifeq ($(INCLUDE_VN_SPEC), y)
  3070.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3071.     cp -pR $(WEBFILE_PATH)/common_spec/VIETNAM/* $(MODEL_FS_PATH)/web/
  3072. endif
  3073.  
  3074. ifeq ($(INCLUDE_ROMANIA_SPEC), y)
  3075.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3076.     cp -pR $(WEBFILE_PATH)/common_spec/ROMANIA/* $(MODEL_FS_PATH)/web/
  3077. endif
  3078.  
  3079. # added by caoqichen for multi mode
  3080. ifeq ($(INCLUDE_MULTIMODE), y)
  3081.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3082.     cp -pR $(WEBFILE_PATH)/common_multiMode/* $(MODEL_FS_PATH)/web/
  3083. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  3084.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3085.     cp -pR $(WEBFILE_PATH)/common_multiMode_dualBand/* $(MODEL_FS_PATH)/web/
  3086. endif
  3087. endif
  3088.  
  3089. ifeq ($(INCLUDE_TPDOMAIN_AP), y)
  3090.     cd $(MODEL_FS_PATH)/web/ && sed -i 's/tplinkwifi.net/tplinkap.net/g' domain-redirect.htm
  3091. endif
  3092.  
  3093. ifeq ($(INCLUDE_HARDWARE_DEBUG), y)
  3094.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3095.     cp -pR $(WEBFILE_PATH)/common_hardwareDebug/* $(MODEL_FS_PATH)/web/
  3096. endif
  3097.  
  3098. ifeq ($(REGION),)
  3099.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3100.     -cp -pR $(WEBFILE_PATH)/common_products/$(MODEL)/* $(MODEL_FS_PATH)/web/
  3101. else
  3102.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3103.     -cp -pR $(WEBFILE_PATH)/common_products/$(MODEL)/$(REGION)/* $(MODEL_FS_PATH)/web/
  3104. endif
  3105.  
  3106. ifeq ($(INCLUDE_MULTI_LANGUAGE_Q),y)
  3107.     make webpages_add_multilanguage
  3108. endif
  3109. ifeq ($(strip $(MODEL)), WR840NV5)
  3110.  
  3111. # clean htm for RUSSIA_SPEC
  3112. ifeq ($(INCLUDE_RUSSIA_SPEC),y)
  3113.     make webpages_clean
  3114. endif  # tag end of INCLUDE_RUSSIA_SPEC
  3115.  
  3116. # clean htm for KOREA_SPEC
  3117. ifeq ($(INCLUDE_KOREA_SPEC),y)
  3118.     make webpages_clean
  3119. endif  # tag end of INCLUDE_KOREA_SPEC
  3120.  
  3121. # clean htm for VIETNAM_SPEC
  3122. ifeq ($(INCLUDE_VN_SPEC),y)
  3123.     make webpages_clean
  3124. endif  # tag end of INCLUDE_VN_SPEC
  3125. endif # WR840NV5
  3126.  
  3127. ifneq ($(findstring $(MODEL), WR840NV6 WR849NV6 WR841NV14), )
  3128. # clean htm for KOREA_SPEC
  3129. ifeq ($(INCLUDE_KOREA_SPEC),y)
  3130.     make webpages_clean
  3131. endif  # tag end of INCLUDE_RUSSIA_SPEC
  3132.  
  3133. # clean htm for RUSSIA_SPEC
  3134. ifeq ($(INCLUDE_RUSSIA_SPEC),y)
  3135.     make webpages_clean
  3136. endif  # tag end of INCLUDE_RUSSIA_SPEC
  3137.  
  3138. # clean htm for VIETNAM_SPEC
  3139. ifeq ($(INCLUDE_VN_SPEC),y)
  3140.     make webpages_clean
  3141. endif  # tag end of INCLUDE_VN_SPEC
  3142.  
  3143. ifeq ($(INCLUDE_ES_SPEC),y)
  3144.     make webpages_clean
  3145. endif  # tag end of INCLUDE_ES_SPEC
  3146.  
  3147. ifeq ($(INCLUDE_CANADA_SPEC),y)
  3148.     make webpages_clean
  3149. endif  # tag end of INCLUDE_CANADA_SPEC
  3150.  
  3151. ifeq ($(INCLUDE_ROMANIA_SPEC),y)
  3152.     make webpages_clean
  3153. endif  # tag end of INCLUDE_ROMANIA_SPEC
  3154.  
  3155. ifeq ($(INCLUDE_BR_SPEC),y)
  3156.     make webpages_clean
  3157. endif  # tag end of INCLUDE_BR_SPEC
  3158.  
  3159. ifeq ($(INCLUDE_JAPAN_SPEC),y)
  3160.     make webpages_clean
  3161. endif  # tag end of INCLUDE_JAPAN_SPEC
  3162. endif
  3163. ifeq ($(INCLUDE_WEB_NEWLOGO),y)
  3164.     $(TOP_PATH)/build/replaceRed.sh $(MODEL_FS_PATH)/web/
  3165. endif
  3166.  
  3167. else   # # it is not include NEW webui
  3168.  
  3169.     @echo "##################NEW Style Web UI Begin #######################"
  3170.     # clean the web  
  3171.     # rm -r $(MODEL_FS_PATH)/web/*
  3172.     # copy new web
  3173.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3174.     cp -pR  $(WEBFILE_PATH_NEW)/common/*  $(MODEL_FS_PATH)/web/
  3175.  
  3176. ifeq ($(INCLUDE_USB), y)
  3177.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3178.     cp -pR $(WEBFILE_PATH_NEW)/common_usb/* $(MODEL_FS_PATH)/web/
  3179. endif  
  3180.  
  3181. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  3182.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3183.     cp -pR $(WEBFILE_PATH_NEW)/common_dualBand/* $(MODEL_FS_PATH)/web/
  3184. endif
  3185.  
  3186. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  3187.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3188.     cp -pR $(WEBFILE_PATH_NEW)/common_spec/RUSSIA/* $(MODEL_FS_PATH)/web/
  3189. endif
  3190.  
  3191. ifeq ($(INCLUDE_MULTIMODE), y)
  3192.     find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3193.     cp -pR $(WEBFILE_PATH_NEW)/common_multiMode/* $(MODEL_FS_PATH)/web/
  3194. endif
  3195.  
  3196.     @echo "##################NEW Style Web UI End #######################"
  3197.  
  3198. endif #INCLUDE_NEW_WEBUI   
  3199.  
  3200. ifeq ($(INCLUDE_MULTIMODE_RE), y)
  3201.     sed -i "s#wlan_wds = 1#wlan_wds = 0#g" $(MODEL_FS_PATH)/web/js/custom.js
  3202.     @echo "###########NO WDS###########"
  3203. endif
  3204.  
  3205.     cd $(MODEL_FS_PATH)/web/js && echo $(DFLAGS) | sed 's/-D//g' | sed "s/\([^ ]\{1,\}\)/-e s\/\\\\\\\<\1\\\\\\\>\/\1=1\//g" | sed -e 's/=[0-9]\\/\\/g' -e 's/=\([0-9]\{1,\}\)=1/=\1/g' | xargs sed oid_str.js > temp1.js
  3206.     cd $(MODEL_FS_PATH)/web/js && echo $(WEBFLAGS) | sed 's/ /\n/g' | sed 's/^/var /g' | sed 's/$$/\n/g' > temp2.js && cat temp1.js >> temp2.js && mv temp2.js oid_str.js && rm temp1.js | sed -i "/^[ \t]*\/\*/,/.*\*\//d" oid_str.js
  3207.  
  3208.     cp -pR $(CONFFILE_PATH)/common/default_config.xml $(MODEL_FS_PATH)/etc/
  3209.  
  3210. ifeq ($(INCLUDE_WIFI_CERTIFIED), y)
  3211.     cp -pR $(CONFFILE_PATH)/common/default_config_wificert.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3212. endif
  3213.  
  3214. ifeq ($(INCLUDE_MEXICO_SPEC), y)
  3215.     cp -pR $(CONFFILE_PATH)/common/default_config_Mexico.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3216. else ifeq ($(INCLUDE_TW_SPEC), y)
  3217.     cp -pR $(CONFFILE_PATH)/common/default_config_TW.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3218. endif
  3219.  
  3220. ifeq ($(INCLUDE_MALAYSIA_SPEC), y)
  3221.     cp -pR $(CONFFILE_PATH)/common/default_config_Malaysia.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3222. endif
  3223.  
  3224. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  3225.     cp -pR $(CONFFILE_PATH)/common/default_config_Russia.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3226. endif
  3227.  
  3228. ifeq ($(INCLUDE_CANADA_SPEC), y)
  3229.     cp -pR $(CONFFILE_PATH)/common/default_config_Canada.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3230. endif
  3231.  
  3232. ifeq ($(INCLUDE_KOREA_SPEC), y)
  3233.     cp -pR $(CONFFILE_PATH)/common/default_config_Korea.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3234. endif
  3235.  
  3236. ifeq ($(INCLUDE_ISRAEL_SPEC), y)
  3237.     cp -pR $(CONFFILE_PATH)/common/default_config_Israel.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3238. endif
  3239.  
  3240. ifeq ($(INCLUDE_US_SPEC), y)
  3241.     cp -pR $(CONFFILE_PATH)/common/default_config_US.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3242. endif
  3243.  
  3244. ifeq ($(INCLUDE_BR_SPEC), y)
  3245.     cp -pR $(CONFFILE_PATH)/common/default_config_BR.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3246. endif
  3247.  
  3248. ifeq ($(INCLUDE_GERMANY_SPEC), y)
  3249.     cp -pR $(CONFFILE_PATH)/common/default_config_Germany.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3250. endif
  3251.  
  3252. ifeq ($(INCLUDE_VIETNAM_FPT), y)
  3253.     cp -pR $(CONFFILE_PATH)/common/default_config_Vietnam_fpt.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3254. endif
  3255.  
  3256. ifeq ($(INCLUDE_UN_IPTV), y)
  3257.     cp -pR $(CONFFILE_PATH)/common/default_config_UN_IPTV.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3258. endif
  3259.  
  3260. ifeq ($(INCLUDE_NEWZEALAND_MYREPUBLIC_SPEC), y)
  3261.     cp -pR $(CONFFILE_PATH)/common/default_config_NewZealand_MyRepublic.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3262. endif
  3263.  
  3264. ifeq ($(INCLUDE_JAPAN_SPEC),y)
  3265.     cp -pR $(CONFFILE_PATH)/common/default_config_Japan.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3266. endif
  3267.  
  3268. ifeq ($(INCLUDE_ROMANIA_SPEC),y)
  3269.     cp -pR $(CONFFILE_PATH)/common/default_config_Romania.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3270. endif
  3271.  
  3272. ifneq ($(REGION),)
  3273.     -cp -pRL $(BUILD_PATH)/config/$(MODEL)/$(REGION)/default_config.xml $(MODEL_FS_PATH)/etc/default_config.xml
  3274. endif
  3275.  
  3276. ifeq ($(REGION), )
  3277.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3278. endif
  3279.  
  3280. ifneq ($(REGION),)
  3281.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(BUILD_PATH)/config/$(MODEL)/$(REGION)/reduced_data_model.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3282. else
  3283. ifeq ($(INCLUDE_ISRAEL_SPEC), y)
  3284.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Israel.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3285. endif
  3286. ifeq ($(INCLUDE_MEXICO_SPEC), y)
  3287.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Mexico.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3288. endif
  3289. #ifeq ($(INCLUDE_US_SPEC), y)
  3290. #   $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_US.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3291. #endif
  3292. ifeq ($(INCLUDE_RUSSIA_SPEC), y)
  3293.     if [ -e $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Russia.xml ]; then \
  3294.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Russia.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml;fi
  3295. endif
  3296. ifeq ($(INCLUDE_CANADA_SPEC), y)
  3297.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Canada.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3298. endif
  3299. ifeq ($(INCLUDE_KOREA_SPEC), y)
  3300.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Korea.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3301. endif
  3302. ifeq ($(INCLUDE_BR_SPEC), y)
  3303.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_BR.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3304. endif
  3305. ifeq ($(INCLUDE_GERMANY_SPEC), y)
  3306.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Germany.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3307. endif
  3308.  
  3309. ifeq ($(INCLUDE_JAPAN_SPEC), y)
  3310.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Japan.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3311. endif
  3312.  
  3313. ifeq ($(INCLUDE_ROMANIA_SPEC), y)
  3314.     $(TOOLS_PATH)/mkcfg -m $(CONFFILE_PATH)/common/reduced_data_model.xml -s $(CONFFILE_PATH)/oem/$(MODEL)/reduced_data_model_Romania.xml -o $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3315. endif
  3316.  
  3317. endif
  3318.     @test -f $(BUILD_PATH)/config/$(MODEL)/$(REGION)/flash_config.xml && $(TOOLS_PATH)/mkcfg -m $(BUILD_PATH)/config/$(MODEL)/$(REGION)/default_config.xml -s $(BUILD_PATH)/config/$(MODEL)/$(REGION)/flash_config.xml -o $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml || echo "$(BUILD_PATH)/config/$(MODEL)/$(REGION)/flash_config.xml not found, do not generate merged flash config file."
  3319.  
  3320.     cp -pR $(MODEL_FS_PATH)/etc/reduced_data_model.xml $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml
  3321.  
  3322.     $(TOOLS_PATH)/enc -e -i $(MODEL_FS_PATH)/etc/default_config.xml
  3323.  
  3324.     $(TOOLS_PATH)/enc -e -i $(MODEL_FS_PATH)/etc/reduced_data_model.xml
  3325.    
  3326. ifeq ($(INCLUDE_MULTIPLE_LOCALIZATION), y)
  3327.     -cp -pRL $(BUILD_PATH)/config/$(MODEL)/$(REGION)/oem_config_*.xml $(MODEL_FS_PATH)/etc/
  3328.     for i in $(MODEL_FS_PATH)/etc/oem_config_*.xml; do $(TOOLS_PATH)/enc -e -i "$$i"; done
  3329. endif
  3330.  
  3331. ifneq ($(INCLUDE_NEW_WEBUI), y)
  3332. ifeq ($(MODEL), WR841HPV5)
  3333.     for i in  $(MODEL_FS_PATH)/web/main/*.htm ; do echo '<script language="javascript" type="text/javascript">$$.styleInputElements();</script>' >> $$i ; done
  3334. endif
  3335. endif #INCLUDE_NEW_WEBUI   
  3336.    
  3337.     #find $(MODEL_FS_PATH)/lib -name "*.so*" -type f | xargs $(STRIP) --strip-unneeded
  3338.     find $(MODEL_FS_PATH)/lib -name "*.ko" | xargs $(STRIP) --strip-unneeded
  3339.    
  3340. .PHONY:compress_web
  3341. compress_web:
  3342. ifeq ($(INCLUDE_VN_SPEC), y)
  3343.     $(TOOLS_PATH)/fsCompress/doCompress.sh --webdir $(MODEL_FS_PATH)/web --compress-web --no-dsl --no-usb --no-5g
  3344. else
  3345.     $(TOOLS_PATH)/fsCompress/doCompress.sh --webdir $(MODEL_FS_PATH)/web --compress-web --no-dsl --no-usb --no-hnat --no-5g
  3346. endif
  3347.    
  3348. .PHONY:strip_libs
  3349. strip_libs:
  3350.     echo "strip all libs"
  3351.     find $(MODEL_FS_PATH)/lib -name "*.so*" -type f | xargs $(STRIP) --strip-unneeded
  3352.     find $(MODEL_FS_PATH)/lib -name "*.ko" | xargs $(STRIP) --strip-unneeded
  3353.    
  3354. .PHONY:strip_bins
  3355. strip_bins:
  3356.     echo "strip all bins"
  3357.     find $(MODEL_FS_PATH)/bin ! -name "*.*" -type f | xargs $(STRIP)
  3358.     find $(MODEL_FS_PATH)/sbin ! -name "*.*" -type f | xargs $(STRIP)
  3359.     find $(MODEL_FS_PATH)/usr/bin ! -name "*.*" -type f | xargs $(STRIP)
  3360.     find $(MODEL_FS_PATH)/usr/sbin ! -name "*.*" -type f | xargs $(STRIP)
  3361.  
  3362. .PHONY:fs_rootfs
  3363. fs_rootfs: fakeroot
  3364.     find  $(MODEL_FS_PATH) -name ".svn" | xargs rm -rf
  3365. ifeq ($(INCLUDE_REDUCE_FS_SIZE), y)
  3366.     -make strip_bins
  3367.     make strip_libs
  3368.     make compress_web
  3369.     -rm -f $(MODEL_FS_PATH)/usr/bin/cli
  3370.     -rm -f $(MODEL_FS_PATH)/usr/bin/diagTool
  3371.     -rm -f $(MODEL_FS_PATH)/usr/bin/reg
  3372.     -rm -f $(MODEL_FS_PATH)/usr/bin/iwlist
  3373.     -rm -f $(MODEL_FS_PATH)/usr/bin/iwconfig
  3374. endif
  3375.  
  3376. ifeq ($(INCLUDE_HARDWARE_DEBUG), y)
  3377.     cp -pR $(PRIVATE_APPS_BIN_PATH)/cli $(MODEL_FS_PATH)/usr/bin/
  3378. endif
  3379.  
  3380.     cd $(TOOLS_PATH) && $(FAKEROOT_PATH)/fakeroot ./buildFs $(MODEL_FS_PATH) $(ROOTFSTOOLS) $(MODEL) $(SUPPLIER) $(ROOTFS_BLOCK_SIZE)
  3381. $(FAKEROOT_PATH)/.configured:
  3382.     (tar -jkxf fakeroot.tar.bz2 2> /dev/null || true)
  3383.     cd $(FAKEROOT_PATH); CFLAGS="-O2 -DGNU -I./" CC=gcc ./configure --prefix=/usr --disable-nls
  3384.     touch $@
  3385.     make -C $(FAKEROOT_PATH)
  3386.  
  3387. .PHONY:fakeroot
  3388. fakeroot: $(FAKEROOT_PATH)/.configured
  3389.     @sed -e 's,^PREFIX=.*,PREFIX=$(FAKEROOT_PATH),g' -e 's,^BINDIR=.*,BINDIR=$(FAKEROOT_PATH),g' -e 's,^PATHS=.*,PATHS=$(FAKEROOT_PATH)/.libs:/lib:/usr/lib,g' $(FAKEROOT_PATH)/scripts/fakeroot > $(FAKEROOT_PATH)/fakeroot
  3390.     @chmod u+x $(FAKEROOT_PATH)/fakeroot
  3391.  
  3392. ifeq ($(REGION),)
  3393. build_all: env_build boot_build kernel_build modules_build apps_build fs_build image_build
  3394. else
  3395. build_all: region_build env_build boot_build kernel_build modules_build apps_build fs_build image_build
  3396. endif
  3397. ####################################################
  3398. #
  3399. #Build image
  3400. #
  3401. ####################################################
  3402.  
  3403. .PHONY:mkkernel_build
  3404. mkkernel_build:
  3405.     test -d $(TARGETS_PATH)/image_$(MODEL)/ || mkdir -p $(TARGETS_PATH)/image_$(MODEL)/
  3406.     #$(TOOLS_PATH)/mkkernel -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL)
  3407. ifeq ($(INCLUDE_ISRAEL_SPEC), y)
  3408.     $(TOOLS_PATH)/mkkernel_Israel -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL)
  3409. endif
  3410. #ifeq ($(INCLUDE_US_SPEC), y)
  3411.     $(TOOLS_PATH)/mkkernel_Israel -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL)
  3412. #endif
  3413. .PHONY:image_build
  3414. image_build:
  3415. ifneq ($(REGION), )
  3416. ifneq ($(INCLUDE_DUAL_UBOOT), )
  3417.     test -d $(TARGETS_PATH)/image_$(MODEL)/ || mkdir -p $(TARGETS_PATH)/image_$(MODEL)/
  3418.     @test -f $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml && USING_FLASH_CONFIG="-l $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml" || echo "$(MODEL_FS_PATH)/../flash_config_$(MODEL).xml not found, do not include flash config in flash.bin.";\
  3419.     $(TOOLS_PATH)/imageTool/mkimage_locale -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL) -r $(IMAGE_REGION) $$USING_FLASH_CONFIG -s $(MTD_FLASH_SIZE) -u $(BUILD_PATH)/config/$(MODEL)/$(REGION)/supportlist.bin -a $(BOOT_TG_PATH)/factory_boot_$(MODEL).bin -c $(FACTORY_UBOOT_SIZE) -e $(SECOND_UBOOT_SIZE)
  3420. else
  3421.     test -d $(TARGETS_PATH)/image_$(MODEL)/ || mkdir -p $(TARGETS_PATH)/image_$(MODEL)/
  3422.     @test -f $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml && USING_FLASH_CONFIG="-l $(MODEL_FS_PATH)/../flash_config_$(MODEL).xml" || echo "$(MODEL_FS_PATH)/../flash_config_$(MODEL).xml not found, do not include flash config in flash.bin.";\
  3423.     $(TOOLS_PATH)/imageTool/mkimage_locale -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL) -r $(IMAGE_REGION) $$USING_FLASH_CONFIG -s $(MTD_FLASH_SIZE) -u $(BUILD_PATH)/config/$(MODEL)/$(REGION)/supportlist.bin
  3424. endif
  3425. else
  3426.     test -d $(TARGETS_PATH)/image_$(MODEL)/ || mkdir -p $(TARGETS_PATH)/image_$(MODEL)/
  3427.     $(TOOLS_PATH)/imageTool/mkimage_locale -m $(KERNEL_MAX_SIZE) -t $(MTD_PART_TYPE) -p $(MODEL_FS_PATH)/../reduced_data_model_plaintext_$(MODEL).xml -b $(BOOT_TG_PATH)/boot_$(MODEL).bin -k $(KERNEL_TG_PATH)/linux.7z -f $(TARGETS_PATH)/rootfs.$(MODEL) -v $(KERNEL_TG_PATH)/vmlinux -i $(TARGETS_PATH)/image_$(MODEL) -s $(MTD_FLASH_SIZE)
  3428. endif
  3429.  
  3430.  
  3431. ####################################################
  3432. #
  3433. # Clear object              
  3434. #
  3435. ###################################################
  3436. prepare_clean:boot_clean kernel_clean modules_clean image_clean
  3437.     @echo "Clear boot && kernel && modules Object"
  3438.  
  3439. clean:boot_clean kernel_clean modules_clean apps_clean fs_clean fakeroot_clean
  3440.     @echo "Clear All Object"
  3441.  
  3442. #boot_clean:
  3443. #ifeq ($(strip $(SUPPLIER)),mtk)
  3444. #   cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo bootbase_clean
  3445. #else
  3446. #   cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) bootbase_clean
  3447. #endif
  3448.  
  3449. kernel_clean:
  3450.     cd $(KERNELPATH) && $(MAKE) clean
  3451.     rm -rf $(KERNEL_TG_PATH)
  3452.  
  3453. modules_clean:
  3454. ifeq ($(strip $(SUPPLIER)),mtk)
  3455.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE)_demo modules_clean
  3456. endif   #SUPPLIER,mtk
  3457.  
  3458. ifeq ($(strip $(SUPPLIER)),ralink)
  3459.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) modules_clean
  3460. endif   #SUPPLIER,ralink
  3461.  
  3462. # zl added 2011-10-20
  3463. ifeq ($(strip $(SUPPLIER)),realtek)
  3464.     cd $(TOP_PATH)/$(SUPPLIER) &&  $(MAKE) modules_clean
  3465. endif   #SUPPLIER,realtek
  3466.  
  3467. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  3468.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/usbip-0.1.7 && $(MAKE) clean
  3469. endif
  3470.  
  3471.     cd $(MODULES_PATH)/ipt_STAT && $(MAKE) clean
  3472.     cd $(MODULES_PATH)/tp_domain && $(MAKE) clean
  3473.    
  3474. ifneq ($(strip $(INCLUDE_VOIP)),)
  3475.     cd $(TP_MODULES_PATH)/voip/ && $(MAKE) clean
  3476. endif
  3477.     rm -rf $(MODULE_TG_PATH)
  3478. # end--added
  3479.  
  3480. ifeq ($(INCLUDE_PPTP), y)
  3481.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/accel-pptp-0.8.5 && $(MAKE) clean
  3482. endif
  3483.  
  3484. ifeq ($(INCLUDE_L2TP), y)
  3485. ifeq ($(KERNELVERSION), 2.6.22.15)
  3486.     @echo "Kernel version is lower than 2.6.23, clean pppol2tp-kmod-0.17"
  3487.     cd $(TOP_PATH)/$(SUPPLIER)/modules/public/pppol2tp-kmod-0.17 && $(MAKE) clean
  3488. endif
  3489. endif
  3490.  
  3491. .PHONY:apps_clean
  3492. apps_clean:cmm_clean voip_clean pjsip_clean mtk_tools_clean
  3493.     $(MAKE) -C $(PUBLIC_APPS_PATH)/busybox-1.19.2 clean
  3494.     $(MAKE) -C $(PUBLIC_APPS_PATH)/iproute2-2.6.24-rc7  clean
  3495.     $(MAKE) -C $(PUBLIC_APPS_PATH)/iptables-1.4.17 clean
  3496. ifeq ($(INCLUDE_ADSLWAN), y)
  3497.     $(MAKE) -C $(PUBLIC_APPS_PATH)/br2684ctl clean
  3498. endif
  3499.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ebtables-v2.0.10-4 clean
  3500.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ppp-2.4.5/pppd clean
  3501. ifeq ($(INCLUDE_ADSLWAN), y)
  3502.     $(MAKE) -C $(PUBLIC_APPS_PATH)/linux-atm clean
  3503. endif
  3504.     $(MAKE) -C $(PUBLIC_APPS_PATH)/upnp_libs clean
  3505.     $(MAKE) -C $(PUBLIC_APPS_PATH)/IGD clean
  3506.     $(MAKE) -C $(PUBLIC_APPS_PATH)/os_libs clean
  3507.  
  3508. ifeq ($(INCLUDE_IPPING_DIAG), y)
  3509.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ipping clean
  3510. endif
  3511. ifeq ($(INCLUDE_TRACEROUTE_DIAG), y)
  3512.     $(MAKE) -C $(PUBLIC_APPS_PATH)/traceroute-2.0.3 clean
  3513. endif
  3514.  
  3515. #add by pxlan 20140331 
  3516. ifeq ($(INCLUDE_PORTABLE_APP), y)
  3517.     $(MAKE) -C $(PUBLIC_APPS_PATH)/dropbear clean
  3518. endif
  3519. #end by pxlan
  3520.  
  3521. ifeq ($(INCLUDE_SSL), y)
  3522.     $(MAKE) -C $(PUBLIC_APPS_PATH)/openssl clean
  3523. endif
  3524.    
  3525. ifeq ($(INCLUDE_USB_OVER_IP_TPLINK), y)
  3526.     $(MAKE) -C $(PUBLIC_APPS_PATH)/usbip-0.1.7 clean
  3527. endif
  3528.  
  3529. ifeq ($(INCLUDE_USB_FTP_SERVER), y)
  3530.     $(MAKE) -C $(PUBLIC_APPS_PATH)/vsftpd-2.3.2 clean
  3531. endif
  3532.  
  3533. ifeq ($(INCLUDE_RIP), y)
  3534.     $(MAKE) -C $(PUBLIC_APPS_PATH)/zebra-0.95a clean
  3535. endif
  3536.  
  3537. ifeq ($(INCLUDE_IPV6), y)
  3538.     $(MAKE) -C $(PUBLIC_APPS_PATH)/radvd-1.5 clean
  3539. endif
  3540.  
  3541. ifeq ($(INCLUDE_IPV6), y)
  3542.     $(MAKE) -C $(PUBLIC_APPS_PATH)/wide-dhcpv6-20080615 clean
  3543. endif
  3544.  
  3545. ifeq ($(INCLUDE_IPV6), y)
  3546.     cd $(PUBLIC_APPS_PATH)/flex-2.5.35 && test -e Makefile || ./configure --host=mips-linux
  3547.     cd $(PUBLIC_APPS_PATH)/flex-2.5.35 && $(MAKE) clean
  3548.     rm -rf $(PUBLIC_APPS_PATH)/lib
  3549. endif
  3550.    
  3551. ifeq ($(INCLUDE_IPV6), y)
  3552.     $(MAKE) -C $(PUBLIC_APPS_PATH)/iproute2-2.6.39 clean
  3553. endif
  3554.  
  3555. ifeq ($(INCLUDE_USB_STORAGE), y)
  3556.     #for the clean of samba and ntfs-3g, zjj, 20111129
  3557. ifeq ($(INCLUDE_USB_SAMBA_SERVER), y)
  3558. ifeq ($(INCLUDE_SAMBA_3_6_25), y)
  3559.     cd $(PUBLIC_APPS_PATH)/samba-3.6.25/source3 && $(MAKE) clean   
  3560. endif
  3561. ifeq ($(INCLUDE_SAMBA_3_0_14a), y)
  3562.     cd $(PUBLIC_APPS_PATH)/samba-3.0.14a/source && $(MAKE) clean
  3563. endif
  3564. endif   #INCLUDE_USB_SAMBA_SERVER
  3565.     cd $(PUBLIC_APPS_PATH)/ntfs-3g_ntfsprogs-2012.1.15 && $(MAKE) clean
  3566.     cd $(PRIVATE_APPS_PATH)/usbp && $(MAKE) clean
  3567.     cd $(PRIVATE_APPS_PATH)/hotplug && $(MAKE) clean
  3568.     #end by zjj
  3569. else
  3570. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  3571.     cd $(PRIVATE_APPS_PATH)/hotplug && $(MAKE) clean
  3572. endif #INCLUDE_USB_3G_DONGLE
  3573. endif   #INCLUDE_USB_STORAGE
  3574.  
  3575. ifeq ($(INCLUDE_USB_3G_DONGLE), y)
  3576.     cd $(PUBLIC_APPS_PATH)/ppp-2.4.5/chat && $(MAKE) clean
  3577.     cd $(PUBLIC_APPS_PATH)/usb-modeswitch-1.2.3 && $(MAKE) clean
  3578.     cd $(PUBLIC_APPS_PATH)/libusb-1.0.8 && $(MAKE) clean && rm -rf install/*
  3579.     cd $(PUBLIC_APPS_PATH)/libusb-compat-0.1.3 && $(MAKE) clean && rm -rf install/*
  3580.     cd $(PRIVATE_APPS_PATH)/handle_card && $(MAKE) clean
  3581. endif
  3582.  
  3583. #for dlna , LI CHENGLONG
  3584. ifeq ($(INCLUDE_USB_MEDIA_SERVER), y)
  3585.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ffmpeg-0.6 clean
  3586.     $(MAKE) -C $(PUBLIC_APPS_PATH)/libdlna-0.2.3 clean
  3587.     $(MAKE) -C $(PUBLIC_APPS_PATH)/ushare-1.1a clean
  3588. endif
  3589. #end by LI CHENGLONG
  3590.  
  3591. ifeq ($(INCLUDE_BPA), y)
  3592.     $(MAKE) -C $(PUBLIC_APPS_PATH)/bpalogin-2.0.2 clean
  3593. endif
  3594.  
  3595. ifeq ($(strip $(SUPPLIER)),ralink)
  3596.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) tcci_clean
  3597.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) ethcmd_clean
  3598.    
  3599. ifeq ($(INCLUDE_LAN_WLAN), y)
  3600.     cd $(TOP_PATH)/$(SUPPLIER) &&  make PROFILE=$(CPU_TYPE) wirelesstool_clean
  3601. else    #INCLUDE_LAN_WLAN
  3602.     @echo no wifi
  3603. endif   #INCLUDE_LAN_WLAN
  3604.  
  3605. endif   #SUPPLIER
  3606.  
  3607. # zl added 2011-10-19
  3608. ifeq ($(strip $(SUPPLIER)),realtek)
  3609.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/sarctl_clean
  3610.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/adslctrl_by_tp_clean
  3611.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/ethctrl_by_tp_clean
  3612. ifeq ($(INCLUDE_LAN_WLAN), y)
  3613.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/ated_clean
  3614.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/wsc_clean
  3615.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/auth_clean
  3616.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/mini_upnp_clean
  3617.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/wireless_tools_clean
  3618. endif
  3619. endif
  3620. # end--added
  3621.  
  3622. ifeq ($(INCLUDE_IPSEC), y)
  3623.     cd $(PUBLIC_APPS_PATH)/ipsectools && $(MAKE) clean
  3624.     cd $(PUBLIC_APPS_PATH)/openssl && $(MAKE) clean
  3625.     cd $(PUBLIC_APPS_PATH)/openssl && rm -rf ./lib
  3626.     rm -rf $(PUBLIC_APPS_PATH)/myipsec
  3627.     rm -rf $(PUBLIC_APPS_PATH)/myssl
  3628. endif
  3629.  
  3630. ifeq ($(INCLUDE_ADSLWAN), y)
  3631.  
  3632.  
  3633. ifeq ($(strip $(SUPPLIER)),lantiq)
  3634.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/feed_opensource_apps/linux-atm/clean
  3635.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_common/lib-dti/clean
  3636.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-api-vrx/clean
  3637.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-control-vrx/clean
  3638.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-vr9-firmware-xdsl/clean
  3639. endif
  3640.  
  3641. else    #INCLUDE_ADSLWAN
  3642.     @echo no dsl_app
  3643. endif   #INCLUDE_ADSLWAN
  3644.  
  3645. .PHONY: mtk_tools_clean
  3646. mtk_tools_clean:
  3647. ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4120)
  3648.     cd $(TOP_PATH)/$(SUPPLIER)/apps/reg && $(MAKE) clean
  3649.     cd $(TOP_PATH)/$(SUPPLIER)/apps/hw_nat && $(MAKE) clean
  3650. else ifeq ($(strip $(SUPPLIER)),mtk_ApSoC_4320)
  3651.     cd $(TOP_PATH)/$(SUPPLIER)/apps/reg && $(MAKE) clean
  3652. endif
  3653.  
  3654. .PHONY: voip_clean
  3655. voip_clean:
  3656. ifneq ($(strip $(INCLUDE_VOIP)),)
  3657.     $(MAKE) -C $(PRIVATE_APPS_PATH)/voip clean
  3658. else   
  3659.     @echo "skipped voip_clean"
  3660. endif
  3661.    
  3662. .PHONY: pjsip_clean
  3663. pjsip_clean:
  3664. ifneq ($(strip $(INCLUDE_VOIP)),)
  3665.     rm -f $(PUBLIC_APPS_PATH)/pjsip_1.10/config_cache_file
  3666.     $(MAKE) -C $(PUBLIC_APPS_PATH)/pjsip_1.10 clean
  3667. else   
  3668.     @echo "skipped sip_clean"
  3669. endif
  3670.    
  3671. .PHONY:cmm_clean
  3672. cmm_clean:
  3673.     $(MAKE) -C $(PRIVATE_APPS_PATH)/user clean
  3674.    
  3675. .PHONY:dsl_clean
  3676. dsl_clean:
  3677. ifeq ($(strip $(SUPPLIER)),lantiq)
  3678.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/feed_opensource_apps/linux-atm/clean
  3679.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_common/lib-dti/clean
  3680.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-api-vrx/clean
  3681.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-cpe-control-vrx/clean
  3682.     #cd $(TOP_PATH)/$(SUPPLIER) && make package/feeds/ifx_dsl_cpe/ifx-dsl-vr9-firmware-xdsl/clean
  3683. endif
  3684.    
  3685. .PHONY:rtl_clean
  3686. rtl_clean:
  3687. ifeq ($(strip $(SUPPLIER)),realtek)
  3688.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/sarctl_clean
  3689.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/adslctrl_by_tp_clean
  3690.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/ethctrl_by_tp_clean
  3691. ifeq ($(INCLUDE_LAN_WLAN), y)
  3692.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/ated_clean
  3693.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/wsc_clean
  3694.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/auth_clean
  3695.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/mini_upnp_clean
  3696.     cd $(TOP_PATH)/$(SUPPLIER) &&  make user/wireless_tools_clean
  3697. endif
  3698. endif
  3699.  
  3700. ifeq ($(INCLUDE_L2TP), y)
  3701.     cd $(PUBLIC_APPS_PATH)/xl2tpd-1.1.12 && $(MAKE) clean
  3702. endif
  3703.  
  3704. .PHONY:image_clean
  3705. image_clean:
  3706.     rm -rf $(TARGETS_PATH)/image_$(MODEL)/*
  3707.     rm -rf $(TARGETS_PATH)/mtk_ApSoC_4320_boot/*
  3708.     rm -rf $(TARGETS_PATH)/mtk_ApSoC_4120_boot/*
  3709.  
  3710. .PHONY:region_build
  3711. region_build:
  3712. ifeq ($(REGION),)
  3713.     @echo "This products haven't REGION "
  3714.     @if test -d $(BUILD_PATH)/config/$(MODEL)/EU/; \
  3715.     then \
  3716.         echo "Default EU " ;\
  3717.         cp -pRL $(BUILD_PATH)/config/$(MODEL)/EU/$(MODEL).config $(BUILD_PATH)/config/; \
  3718.     else \
  3719.         echo "Locatization not exist"; \
  3720.     fi;
  3721. else
  3722.     @echo "this products REGION = $(REGION)"
  3723.     @cp -pRL $(BUILD_PATH)/config/$(MODEL)/$(REGION)/$(MODEL).config  $(BUILD_PATH)/config/
  3724. endif #REGION
  3725.  
  3726. .PHONY:webpages_clean
  3727. webpages_clean:
  3728.     @echo "###################################################################"
  3729.     @echo "Begin romove Pages useless , YOU Should CHECK your products!!!!!!"
  3730.     @echo "###################################################################"
  3731.     #  delete the files for Emulator    
  3732.     rm -rf $(MODEL_FS_PATH)/web/xml
  3733.     #rm -rf $(MODEL_FS_PATH)/web/js/local.js
  3734.     rm -rf $(MODEL_FS_PATH)/web/img/bgColor.jpg
  3735.     rm -rf $(MODEL_FS_PATH)/web/img/icon.jpg
  3736.     rm -rf $(MODEL_FS_PATH)/web/img/empty.gif
  3737.     rm -rf $(MODEL_FS_PATH)/web/img/pw.gif
  3738.     rm -rf $(MODEL_FS_PATH)/web/img/plus.gif
  3739.     rm -rf $(MODEL_FS_PATH)/web/img/minus.gif
  3740.     rm -rf $(MODEL_FS_PATH)/web/img/helpPic.gif
  3741.     rm -rf $(MODEL_FS_PATH)/web/img/switch.gif
  3742.     rm -rf $(MODEL_FS_PATH)/web/img/error.gif
  3743.     rm -rf $(MODEL_FS_PATH)/web/img/signalstrength.gif
  3744.     rm -rf $(MODEL_FS_PATH)/web/img/login/loginBg.png
  3745. ifeq ($(INCLUDE_MULTI_LANGUAGE_Q), y)
  3746.     rm -rf $(MODEL_FS_PATH)/web/img/top-right.png
  3747.     rm -rf $(MODEL_FS_PATH)/web/img/login/username.png
  3748.     rm -rf $(MODEL_FS_PATH)/web/img/login/password.png
  3749.     rm -rf $(MODEL_FS_PATH)/web/img/login/input-box1.png
  3750.     rm -rf $(MODEL_FS_PATH)/web/img/login/loginButton1.png
  3751.     rm -rf $(MODEL_FS_PATH)/web/img/login/loginButton.png
  3752.     rm -rf $(MODEL_FS_PATH)/web/img/login/domain-redirect.png
  3753.     rm -rf $(MODEL_FS_PATH)/web/help/SiteSurveyHelpRpm.htm
  3754. endif
  3755.     rm -rf $(MODEL_FS_PATH)/web/frame/accErr.htm
  3756.     rm -rf $(MODEL_FS_PATH)/web/frame/banner.htm
  3757.     rm -rf $(MODEL_FS_PATH)/web/main/rip.htm
  3758.     rm -rf $(MODEL_FS_PATH)/web/css/ie6.css
  3759.     rm -rf $(MODEL_FS_PATH)/web/css/ie7.css
  3760.     rm -rf $(MODEL_FS_PATH)/web/css/ie8.css
  3761.     rm -rf $(MODEL_FS_PATH)/web/css/other.css
  3762.     rm -rf $(MODEL_FS_PATH)/web/css/ban.css
  3763.     sed -i '/<link rel=.*css\/other.css/d;' $(MODEL_FS_PATH)/web/index.htm
  3764. ifneq ($(WEB_QS_CHANGEPASSWORD), y)
  3765.     -rm -r $(MODEL_FS_PATH)/web/main/qspassword.htm
  3766.     -rm -r $(MODEL_FS_PATH)/web/help/QsChangeLoginPwdHelpRpm.htm
  3767. endif # WEB_QS_CHANGEPASSWORD
  3768. ifneq ($(INCLUDE_BETA),y)
  3769.     rm -rf $(MODEL_FS_PATH)/web/img/login/tp-beta-mark.png
  3770. endif
  3771.     rm -rf $(MODEL_FS_PATH)/web/img/Thumbs.db
  3772.     # ipv6 route function HTM , config pages
  3773.     -rm -r $(MODEL_FS_PATH)/web/main/route6Edit.htm
  3774.     -rm -r $(MODEL_FS_PATH)/web/main/route6.htm
  3775.     -rm -r $(MODEL_FS_PATH)/web/main/defGateway6.htm
  3776.     -rm -r $(MODEL_FS_PATH)/web/main/ddedde6.htm
  3777.     -rm -r $(MODEL_FS_PATH)/web/main/tunnel6.htm
  3778.     # ipv6 Access control HTM , config pages
  3779.     -rm -r $(MODEL_FS_PATH)/web/main/fw6Rules.htm
  3780.     -rm -r $(MODEL_FS_PATH)/web/main/fw6RulesEdit.htm
  3781.     -rm -r $(MODEL_FS_PATH)/web/main/fw6Lan.htm
  3782.     -rm -r $(MODEL_FS_PATH)/web/main/fw6LanEdit.htm
  3783.     -rm -r $(MODEL_FS_PATH)/web/main/fw6Wan.htm
  3784.     -rm -r $(MODEL_FS_PATH)/web/main/fw6WanEdit.htm
  3785.     -rm -r $(MODEL_FS_PATH)/web/main/fw6Sche.htm
  3786.     -rm -r $(MODEL_FS_PATH)/web/main/fw6ScheEdit.htm
  3787.     # ipv6 help
  3788.     -rm -r $(MODEL_FS_PATH)/web/help/IPv6TunnelHelp.htm
  3789.     #common_gpon   
  3790.     -rm -r $(MODEL_FS_PATH)/web/main/alg.htm
  3791.     -rm -r $(MODEL_FS_PATH)/web/main/dhcpCond.htm
  3792.     -rm -r $(MODEL_FS_PATH)/web/main/dhcpCondEdit.htm
  3793.     -rm -r $(MODEL_FS_PATH)/web/main/group.htm
  3794.     -rm -r $(MODEL_FS_PATH)/web/main/groupAdd.htm
  3795.     -rm -r $(MODEL_FS_PATH)/web/main/wlScheEdit.htm
  3796. ifneq ($(INCLUDE_UN_IPTV), y)
  3797.     -rm -r $(MODEL_FS_PATH)/web/main/ethIptv.htm
  3798.     -rm -r $(MODEL_FS_PATH)/web/help/IPTVHelp.htm
  3799.     -rm -f $(MODEL_FS_PATH)/web/js/vlancfg.js
  3800.     sed -i '/<script src=.*js\/vlancfg.js/d;' $(MODEL_FS_PATH)/web/index.htm
  3801.     sed -i '/<script src=.*js\/vlancfg.js/d;' $(MODEL_FS_PATH)/web/mainFrame.htm
  3802. endif  
  3803. ifneq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  3804.     -rm -r $(MODEL_FS_PATH)/web/main/qsWl5G.htm
  3805.     -rm -r $(MODEL_FS_PATH)/web/main/wlQss5G.htm
  3806.     -rm -r $(MODEL_FS_PATH)/web/main/wlSec5G.htm
  3807.     -rm -r $(MODEL_FS_PATH)/web/main/wlStats5G.htm
  3808.     -rm -r $(MODEL_FS_PATH)/web/main/wlScheEdit5G.htm
  3809.     -rm -r $(MODEL_FS_PATH)/web/main/wlGuest5G.htm
  3810.     -rm -r $(MODEL_FS_PATH)/web/main/wlGuestStats5G.htm
  3811.     -rm -r $(MODEL_FS_PATH)/web/main/wlFrequency.htm
  3812.     -rm -r $(MODEL_FS_PATH)/web/help/DualBandSelectionHelpRpm.htm
  3813. endif
  3814. ifneq ($(INCLUDE_USB), y)
  3815.     -rm -r $(MODEL_FS_PATH)/web/main/usbFolderBrowse.htm
  3816.     -rm -r $(MODEL_FS_PATH)/web/main/usbSmbSrv.htm
  3817.     -rm -r $(MODEL_FS_PATH)/web/help/UsbSharingHelp.htm
  3818.     -rm -r $(MODEL_FS_PATH)/web/main/usbUserAccount.htm
  3819.     -rm -r $(MODEL_FS_PATH)/web/help/UsbAccountHelp.htm
  3820. endif
  3821. ifneq ($(INCLUDE_USB_3G_DONGLE), y)
  3822.     -rm -r $(MODEL_FS_PATH)/web/main/qs3g.htm
  3823.     -rm -r $(MODEL_FS_PATH)/web/help/WzdMobileBackupCfgRpm.htm
  3824.     -rm -r $(MODEL_FS_PATH)/web/main/usb3g.htm
  3825.     -rm -r $(MODEL_FS_PATH)/web/help/Usb3gHelpRpm.htm
  3826.     -rm -r $(MODEL_FS_PATH)/web/main/usb3gModemList.htm
  3827.     -rm -r $(MODEL_FS_PATH)/web/help/Usb3gModemListHelpRpm.htm
  3828.     -rm -r $(MODEL_FS_PATH)/web/main/usb3gUpload.htm
  3829.     sed -i '/<script src=.*js\/3g.js/d;' $(MODEL_FS_PATH)/web/index.htm
  3830.     sed -i '/<script src=.*js\/3g.js/d;' $(MODEL_FS_PATH)/web/mainFrame.htm
  3831. endif # INCLUDE_USB_3G_DONGLE  
  3832.  
  3833. ifneq ($(INCLUDE_YANDEX_DNS), y)
  3834.     -rm -r $(MODEL_FS_PATH)/web/help/YandexDnsHelpRpm.htm
  3835.     -rm -r $(MODEL_FS_PATH)/web/main/yandexDns.htm
  3836.     -rm -r $(MODEL_FS_PATH)/web/main/yandexDnsEdit.htm
  3837. endif #INCLUDE_YANDEX_DNS
  3838.  
  3839. ifneq ($(INCLUDE_HW_NAT), y)
  3840. #   some spec  need this page for example VN
  3841. #   -rm -r $(MODEL_FS_PATH)/web/main/hw_nat.htm
  3842. #   -rm -r $(MODEL_FS_PATH)/web/help/NatStatusCfgHelpRpm.htm
  3843. endif #INCLUDE_HW_NAT
  3844.  
  3845. ifneq ($(INCLUDE_LED_CONTROL), y)
  3846.     -rm -r $(MODEL_FS_PATH)/web/help/ledControlHelp.htm
  3847.     -rm -r $(MODEL_FS_PATH)/web/main/ledControl.htm
  3848. endif #INCLUDE_LED_CONTROL
  3849.  
  3850. ifneq ($(INCLUDE_FEEDBACK), y)
  3851.     -rm -r $(MODEL_FS_PATH)/web/help/FeedbackHelp.htm
  3852.     -rm -r $(MODEL_FS_PATH)/web/main/userFeedBack.htm
  3853. endif #INCLUDE_FEEDBACK
  3854.  
  3855. ifneq ($(INCLUDE_MULTIMODE_MSSID), y)
  3856.     -rm -r $(MODEL_FS_PATH)/web/help/WlanNetworkHelpRpm_MSSID.htm
  3857.     -rm -r $(MODEL_FS_PATH)/web/help/QsMultissidHelpRpm.htm
  3858.     -rm -r $(MODEL_FS_PATH)/web/main/qsMultiSSID.htm
  3859.     -rm -r $(MODEL_FS_PATH)/web/main/wlAclAdvMssid.htm
  3860.     -rm -r $(MODEL_FS_PATH)/web/main/wlAclMssid.htm
  3861.     -rm -r $(MODEL_FS_PATH)/web/main/wlBasicMssid.htm
  3862.     -rm -r $(MODEL_FS_PATH)/web/main/wlSecMssid.htm
  3863. endif #INCLUDE_MULTIMODE_MSSID
  3864.  
  3865. ifeq ($(INCLUDE_VN_SPEC), y)
  3866.     -rm -f $(MODEL_FS_PATH)/web/js/vlancfg.js
  3867.     sed -i '/<script src=.*js\/vlancfg.js/d;' $(MODEL_FS_PATH)/web/index.htm
  3868.     sed -i '/<script src=.*js\/vlancfg.js/d;' $(MODEL_FS_PATH)/web/mainFrame.htm
  3869. endif #INCLUDE_VN_SPEC
  3870.     @echo "###################################################################"
  3871.     @echo "remove Useless web/ pages END !!!!"
  3872.     @echo "###################################################################"
  3873. # clean htm for 4M flash
  3874.  
  3875. .PHONY:webpages_add_multilanguage
  3876. webpages_add_multilanguage:
  3877. ifneq ($(INCLUDE_MULTI_LANGUAGE_Q), )
  3878.     @mkdir -p $(MODEL_FS_PATH)/web/locale
  3879.     -rm -r $(MODEL_FS_PATH)/web/js/str.js
  3880.     -rm -r $(MODEL_FS_PATH)/web/js/err.js
  3881.     -rm -r $(MODEL_FS_PATH)/web/js/help.js
  3882. ifeq ($(INCLUDE_MULTILANGUAGE_EN), y)
  3883.     cp -rf $(WEBFILE_PATH)/multilang/en_US $(MODEL_FS_PATH)/web/locale/
  3884. endif
  3885. ifeq ($(INCLUDE_MULTILANGUAGE_FR), y)
  3886.     cp -rf $(WEBFILE_PATH)/multilang/fr_CA $(MODEL_FS_PATH)/web/locale/
  3887. endif
  3888. ifeq ($(INCLUDE_MULTILANGUAGE_ES), y)
  3889.     cp -rf $(WEBFILE_PATH)/multilang/es_MX $(MODEL_FS_PATH)/web/locale/
  3890. endif
  3891. ifeq ($(INCLUDE_MULTILANGUAGE_BR), y)
  3892.     cp -rf $(WEBFILE_PATH)/multilang/pt_BR $(MODEL_FS_PATH)/web/locale/
  3893. endif
  3894. ifeq ($(INCLUDE_MULTILANGUAGE_RU), y)
  3895.     cp -rf $(WEBFILE_PATH)/multilang/ru_RU $(MODEL_FS_PATH)/web/locale/
  3896. endif
  3897. ifeq ($(INCLUDE_MULTILANGUAGE_TW), y)
  3898.     cp -rf $(WEBFILE_PATH)/multilang/zh_TW $(MODEL_FS_PATH)/web/locale/
  3899. endif
  3900.     @find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3901.     @cp -pR $(WEBFILE_PATH)/common_multilang/* $(MODEL_FS_PATH)/web/
  3902. ifeq ($(INCLUDE_LAN_WLAN_DUALBAND),y)
  3903.     @find  $(MODEL_FS_PATH)/web/ -name ".svn" | xargs rm -rf
  3904.     @cp -pR $(WEBFILE_PATH)/common_multilang_dualBand/* $(MODEL_FS_PATH)/web/
  3905. endif
  3906.     @echo "add language END !!!"
  3907. else
  3908.     @echo "##################WARNING!!!!!#######################"
  3909.     @echo "You didn't define INCLUDE_LANGAUAGE_Q !!!!!"
  3910.     @echo "You didn't define INCLUDE_LANGAUAGE_Q !!!!!"
  3911.     @echo "You didn't define INCLUDE_LANGAUAGE_Q !!!!!"
  3912.     @echo "##################WARNING END########################"
  3913. endif
  3914.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement