Eternal's Blog

[備忘]Fon刷DD-WRT

準備:將連結Fon的網路卡IP設定為:169.254.255.2,網路遮罩:255.255.0.0

1.將Fon的SSH打開
建立兩個html,code分別為:
1:
<html> 
<head> 
</head> 
<body> 
<center> 
<form method="post" action="http://169.254.255.1/cgi-bin/webif/connection.sh" enctype="multipart/form-data"> 
<input name="username" value="$(/usr/sbin/iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT)" size="68" > 
<input type="submit" name="submit" value="Submit" onClick="{this.form.wifimode.value='";' + this.form.wifimode.value +';"'}" /> 
</form> 
</body> 
</html>

2:
<html> 
<head> 
</head> 
<body> 
<center> 
<form method="post" action="http://169.254.255.1/cgi-bin/webif/connection.sh" enctype="multipart/form-data"> 
<input name="username" value="$(/etc/init.d/dropbear)" size="68" > 
<input type="submit" name="submit" value="Submit" onClick="{this.form.wifimode.value='";' + this.form.wifimode.value +';"'}" /> 
</form> 
</body> 
</html>

隨後開啟第一個html,點submit後,在開啟第二個html,一樣點擊submit,等到網頁導入Fon設定畫面後,使用SSH連線至169.254.255.1,預設帳號root,密碼admin。
將 /etc/firewall.user 的第 22、23 行註解拿掉
# vi /etc/firewall.user

把 fon 的 sshd 設定為開機即啟動
# cd /etc/init.d
# mv dropbear S50dropbear

# passwd
# sync

reboot後就開啟SSH的功能了。

接下來使用TFTP SERVER(Mac OS X有內建,終端機輸入sudo /sbin/service tftp start 即可啟動,傳輸檔案放置於/private/tfpboot/)

2.將Fon強制進入Redboot
使用ssh連入fon後,輸入:
cd /tmp
mtd -e vmlinux.bin.l7 write openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma vmlinux.bin.l7
reboot
重新啟動後,在連入Fon中輸入:
cd /tmp
mtd -e "RedBoot config" write out.hex "RedBoot config"
reboot
重新開機後Fon就會停在Redboot狀態,這時候將root.fs以及vmlinux.bin.l7放入TFTP的資料夾(OSX:/private/tftpboot/)底下,然後將電腦IP設定為192.168.1.166,使用telnet連入192.168.1.254 9000接著輸入:
ip_address -l 192.168.1.254/24 -h 192.168.1.166
fis init
load -r -v -b 0x80041000 root.fs
fis create -b 0x80041000 -f 0xA8030000 -l 0x002C0000 -e 0x00000000 rootfs
load -r -v -b 0x80041000 vmlinux.bin.l7
fis create -r 0x80041000 -e 0x80041000 -l 0x000E0000 vmlinux.bin.l7
fis create -f 0xA83D0000 -l 0x00010000 -n nvram
reset
重新啟動後就完成了

更新DD-WRT最新版韌體:
到DD-WRT官方網站下載最新版DD-WRT for Fon,將linux.bin放到TFTP的資料夾後,必須使用Putty或是linux等非OSX的telnet連接,才能讓fon進入Redboot模式,進入後輸入:
ip_address -l 192.168.1.254/24 -h 192.168.1.166
fis init -f
load -r -v -b 0x80041000 linux.bin
fis create linux
完成後接著輸入:
fconfig
一直按enter直到enter the bootscript輸入畫面,然後輸入:
fis load -l linux
exec
(空白為結束)
然後一樣一直enter直到寫入nvram,選擇y同意寫入,即大功告成。

參考資料:

Author: eternalmind -  Date: 08 Apr 2009 16:03
Category: 備忘 -  Visits: 520 -  No Comments



Comments:

No comments posted yet!


Add Comment

Comment Form

 (Required)

 (Optional, will not be published)

 (Optional, format: http(s)://website.com)



 (jqz3vpuf)