說明
1. 改造 TP-LINK WR886N 3.0 (芯片 TP9343)
2. OpenWRT 版本:LEDE 17
3. 環境:Ubuntu 16.04 x64
第一步:修改硬件
1. 換 RAM 為 64M
2. 換 flash 為 16M
注:本教程主要說明制作鏡像部分,具體修改硬件步驟請參考:鏈接
第二步:獲取源碼
使用以下命令克隆源碼:
git clone https://github.com/lede-project/source.git
我當時使用的版本:
git reset --hard 97eb8ab
第三步:target profile 添加新路由器
修改文件:/target/linux/ar71xx/image/tp-link.mk
添加以下內容:
define Device/tl-wr886n-v3
? $(Device/tplink-16mlzma)
? DEVICE_TITLE := TP-LINK TL-WR886N v3
? BOARDNAME := TL-WR886N-v3
? TPLINK_HWID := 0x88600003
endef
TARGET_DEVICES += tl-wr886n-v3
刪除 /tmp 目錄,使用以下命令配置:
make menuconfig
在 Target System 里選擇 Atheros AR7xxx/AR9xxx,然后在 Target Profile 里找到 TP-LINK TL-WR886 v3 并選中。
此時,編譯一下,看看有沒有錯誤。
make
make 成功后,/bin/targets/ar71xx/generic/ 目錄下面會生成 WR886N 的 factory.bin,但是這時候下載到 flash 還不能啟動,因為內核并沒有支持 WR886N,繼續下面的步驟。
第四步:kernel arch machine 新增路由器
新建文件:/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.4.74/arch/mips/ath79/mach-tl-wr886n-v3.c
文件內容:
修改文件:/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.4.74/arch/mips/ath79/Kconfig
添加以下內容:
config ATH79_MACH_TL_WR886N_V3
? ? bool "Tplink WR886N V3 support"
? ? select SOC_TP9343
? ? select ATH79_DEV_ETH
? ? select ATH79_DEV_GPIO_BUTTONS
? ? select ATH79_DEV_LEDS_GPIO
? ? select ATH79_DEV_M25P80
? ? select ATH79_DEV_WMAC
? ? help
? ? ? Say 'Y' here if you want your kernel to support the
? ? ? Atheros AP121 reference board.
修改文件:/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.4.74/arch/mips/ath79/machtypes.h
添加以下內容:
ATH79_MACH_TL_WR886N,
修改文件:/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.4.74/arch/mips/ath79/Makefile
添加以下內容:
obj-$(CONFIG_ATH79_MACH_TL_WR886N_V3)? += mach-tl-wr886n-v3.o
使用以下命令配置:
make kernel_menuconfig
-> Machine selection
-> Atheros AR71XX/AR724X/AR913X machine selection
Tplink WR886N V3 support
此時,編譯一次看看有沒有問題:
make
make 成功后,如果直接固件下載到 flash,已經能啟動了,但會出現網絡問題,繼續看第五步。
第五步:network 配置問題(ar71xx系列)
修改文件:/target/linux/ar71xx/base-files/etc/board.d/02_network
添加以下內容:
? ? tl-wr886-v3)
? ? ? ? ucidef_set_interfaces_lan_wan "eth1" "eth0"
? ? ? ? ucidef_add_switch "switch0" "1" "1"
? ? ? ? ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
? ? ? ? ;;
修改文件:/target/linux/ar71xx/base-files/lib/ar71xx.sh
添加以下內容:
? ? *"TL-WR886N v3"*)
? ? ? ? name="tl-wr886-v3"
? ? ? ? ;;
此時,再編譯一次看看有沒有問題:
make
make 成功后,如果下載固件到 flash,網絡已經沒問題了,但是會發現 LED 燈工作得不正常,繼續看第六步。
第六步:LED 燈問題
修改文件:/target/linux/ar71xx/base-files/etc/board.d/01_leds
添加以下內容:
tl-wr886-v3)
? ? ucidef_set_led_netdev "wan" "WAN" "tl_wr886n:green:wan1" "eth0"
? ? ucidef_set_led_switch "lan0" "LAN0" "tl_wr886n:white:main" "switch0" "0x01"
? ? ucidef_set_led_switch "lan1" "LAN1" "tl_wr886n:green:lan1" "switch0" "0x10"
? ? ucidef_set_led_switch "lan2" "LAN2" "tl_wr886n:green:lan2" "switch0" "0x08"
? ? ucidef_set_led_switch "lan3" "LAN3" "tl_wr886n:green:lan3" "switch0" "0x04"
? ? ucidef_set_led_switch "lan4" "LAN4" "tl_wr886n:green:lan4" "switch0" "0x02"
? ? ;;
這時候已經大功告成了,最后編譯一次:
make
將固件下載到 flash 一切正常!