MR11U的固件还没出,拿MR3420练了个手。
Update. 出了:
- OpenWrt固件:http://ishare.iask.sina.com.cn/f/22538055.html.this
- 官方固件:http://www.tp-link.cn/pages/download-detail.asp?d=680
网刷比较无聊,把固件传上去就行了。有的官方ROM会检查固件头,不同版本改法不一样。
JTAG因为没有器材也没搞,感觉不刷bootloader的话也用不到吧。
所以就只是用串口试了一下。因为现在的机器大多没串口了就用USB转串口。比较常用的转换器是Prolific的PL2303,Linux应该已经有它的驱动了。用lsmod usbserial确认一下就行了。
然后配置一下minicom。Serial port setup里面的Serial Device设置成/dev/ttyUSB0,Bps/Par/Bits设置成115200 8N1,Hardware Flow Control关闭。配置完了选Save setup as dfl保存。最后Exit from Minicom退出。
关闭路由器。保持线缆连接,启动minicom,给路由器重新上电,这时候就能在minicom里看到路由器启动的消息了:
U-Boot 1.1.4 (May 12 2010 - 12:48:25) AP99 (ar7241 - Virian) U-boot DRAM: sri ar7240_ddr_initial_config(133): virian ddr1 init #### TAP VALUE 1 = 0xf, 2 = 0x10 [0x0: 0x1f] 32 MB id read 0x100000ff sector count = 64 Flash: 4 MB Using default environment In: serial Out: serial Err: serial Net: ag7240_enet_initialize... No valid address in Flash. Using fixed address No valid address in Flash. Using fixed address Virian MDC CFG Value ==> 4 : cfg1 0xf cfg2 0x7014 eth0: 00:03:7f:09:0b:ad eth0 up Virian MDC CFG Value ==> 4 : cfg1 0xf cfg2 0x7214 eth1: 00:03:7f:09:0b:ad ATHRS26: resetting s26 ATHRS26: s26 reset done eth1 up eth0, eth1 Autobooting in 1 seconds
看到那个Autobooting in 1 seconds的时候快速敲下tpl三个键,阻止bootloader加载内核并显示prompt。不知道命令就打help。有个printenv可以试一下,能看到bootloader的一些设置,例如本机和服务器IP,以及从哪个地址启动内核之类:
ar7240> printenv bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART) REVISIONID bootcmd=bootm 0x9f020000 bootdelay=1 baudrate=115200 ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee ipaddr=192.168.1.10 serverip=192.168.1.27 stdin=serial stdout=serial stderr=serial ethact=eth0 Environment size: 368/65532 bytes
知道怎么回事了就先退出来,把该下载的东西下载了。比如ROM映像:http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin。
然后在PC机上安装tftpd。Arch上可用yaourt -S tftp-hpa搞定。/etc/rc.d/tftpd start即可启动,默认根目录为/var/tftpboot,当然可以在配置文件/etc/conf.d/tftpd里面改。
把上面那个文件下来改名成code.bin(这样以后少敲很多字母),放在/var/tftpboot目录下面。将和路由器相连的网卡的地址设为192.168.1.27(在printenv时看到过的),然后启动tftpd。用tftp 192.168.1.27和get code.bin测试一下,保证能下载。
然后给路由器上电,还是关键点那个地方敲tpl进入bootloader的prompt。然后输入下面的命令(前面那个是prompt,你懂的):
ar7240> erase 0x9f020000 +0x3c0000 ar7240> tftpboot 0x81000000 code.bin ar7240> cp.b 0x81000000 0x9f020000 0x3c0000 ar7240> bootm 0x9f020000
这一坨干的事情就是说把flash上以0x9f020000为起点,长度为0x3c0000的区块擦除。然后用TFTP把code.bin(长度正好为0x3c0000)加载到RAM,再把RAM的数据写到flash,最后从flash的指定位置启动。
然后就进到OpenWrt里面去了,剩下的爱怎么折腾怎么折腾。
最后是用串口烧ROM时候的完整log:
ar7240> erase 0x9f020000 +0x3c0000
First 0x2 last 0x3d sector size 0x10000
61
Erased 60 sectors
ar7240> tftpboot 0x81000000 code.bin
dup 1 speed 1000
Using eth1 device
TFTP from server 192.168.1.27; our IP address is 192.168.1.10
Filename 'code.bin'.
Load address: 0x81000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
######################################################
done
Bytes transferred = 3932160 (3c0000 hex)
ar7240> cp.b 0x81000000 0x9f020000 0x3c0000
Copy to Flash... write addr: 9f020000
done
ar7240> bootm 0x9f020000
哦,还要上图两张:
Links:
- http://wiki.openwrt.org/toh/tp-link/tl-mr3420
- http://eko.one.pl/?p=openwrt-mr3420
- http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Feko.one.pl%2F%3Fp%3Dopenwrt-mr3420(上面的Google Translate)
- http://wiki.openwrt.org/doc/techref/flash.layout
- http://wiki.openwrt.org/doc/techref/opkg





