SyntaxHighlighter

2013年1月11日星期五

OpenWRT for WR720N

OpenWRT already officially support WR720N!
Ref:
http://wiki.openwrt.org/toh/tp-link/tl-wr720n

准备工作


Linux磁盘空间大概要准备10G.

先从svn checkout出OpenWRT
svn checkout svn://svn.openwrt.org/openwrt/trunk openwrt

进去看一下

[jejer@arch ~]$ cd openwrt/
[jejer@arch openwrt]$ ls
BSDmakefile LICENSE README feeds.conf.default package scripts toolchain
Config.in Makefile docs include rules.mk target tools

好了.

修改源文件


1. 720比703多一个网口,修改target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c

[jejer@arch openwrt]$ cat mach-tl-wr703n.c.patch
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c  2013-01-11 09:38:21.023697097 +0800
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c.720n     2013-01-11 09:41:35.537043980 +0800
@@ -77,10 +77,12 @@
                         "USB power");
        ath79_register_usb();
-       ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+       ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+       ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
        ath79_register_mdio(0, 0x0);
        ath79_register_eth(0);
+       ath79_register_eth(1);
        ath79_register_wmac(ee, mac);
 }
[jejer@arch openwrt]$ patch -p0 < mach-tl-wr703n.c.patch
然后手动附加上一个/etc/config/network配置文件
[jejer@arch openwrt]$ mkdir -p files/etc/config/
[jejer@arch openwrt]$ vim files/etc/config/network
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'
config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'
config interface 'lan'
        option ifname 'eth1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
2. 让OpenWRT的WEB界面通刷所有703N 720N固件
    703n的固件标识是:07030101,720n的是:07200103
    target/linux/ar71xx/base-files/lib/upgrade/platform.sh
[jejer@arch openwrt]$ cat platform.sh.patch
--- target/linux/ar71xx/base-files/lib/upgrade/platform.sh      2013-01-11 09:16:58.527929980 +0800
+++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh.720n 2013-01-11 10:14:35.546380864 +0800
@@ -178,7 +178,13 @@
                local imageid
                hwid=$(tplink_get_hwid)
+               [ "$hwid" = "07200103" ] && {
+                       hwid="07030101"
+               }
                imageid=$(tplink_get_image_hwid "$1")
+               [ "$imageid" = "07200103" ] && {
+                       imageid="07030101"
+               }
                [ "$hwid" != "$imageid" ] && {
                        echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
[jejer@arch openwrt]$ patch -p0 < platform.sh.patch

3. 使路由的Router Model显示为    TP-LINK TL-WR720N V3
    target/linux/ar71xx/base-files/lib/ar71xx.sh
[jejer@arch openwrt]$ cat ar71xx.sh.patch
--- target/linux/ar71xx/base-files/lib/ar71xx.sh        2013-01-11 09:16:58.527929980 +0800
+++ target/linux/ar71xx/base-files/lib/ar71xx.sh.720n   2013-01-11 10:19:06.548365673 +0800
@@ -475,7 +475,7 @@
        [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
        echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
-       echo "$AR71XX_MODEL" > /tmp/sysinfo/model
+       echo "TP-LINK TL-WR720N V3" > /tmp/sysinfo/model
 }
 ar71xx_board_name() {
[jejer@arch openwrt]$ patch -p0 < ar71xx.sh.patch

4. 无线开启
    package/mac80211/files/lib/wifi/mac80211.sh
    package/madwifi/files/lib/wifi/madwifi.sh?
[jejer@arch openwrt]$ cat mac80211.sh.patch
--- package/mac80211/files/lib/wifi/mac80211.sh 2013-01-11 09:17:02.621297461 +0800
+++ package/mac80211/files/lib/wifi/mac80211.sh.720n    2013-01-11 10:37:01.223478065 +0800
@@ -591,7 +591,6 @@
 $dev_id
 $ht_capab
        # REMOVE THIS LINE TO ENABLE WIFI:
-       option disabled 1

 config wifi-iface
        option device   radio$devidx
[jejer@arch openwrt]$ patch -p0 < mac80211.sh.patch

5. 长按RESET恢复出厂设置
6. 模式切换开关

OpenWRT配置与编译

make clean
svn up
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make menuconfig
Target System (Atheros AR7xxx/AR9xxx)
Target Profile (TP-LINK TL-WR703N)
LuCI--Collections--<*> luci
USB Storage http://wiki.openwrt.org/doc/howto/usb.storage
extroot http://wiki.openwrt.org/doc/howto/extroot
3G http://wiki.openwrt.org/doc/recipes/3gdongle
make V=99

参考链接

diff -Naur 旧的目录 新的目录 > patch文件
或者
diff -Naur 旧的文件 新的文件 > patch文件

没有评论:

发表评论