ファームの書き換え

とりあえずrebootしたらすぐCtrl+C連打

== Executing boot script in 1.000 seconds - enter ^C to abort

一秒以内って厳しいなー。grubだって数秒くらい待つのが普通だろJK
foreraのIPとファームを送るTFTPサーバーのIPを設定。

RedBoot> ip_address -l 192.168.1.8/24 -h 192.168.1.13
IP: 192.168.1.8/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.11

既存のファームを削除!

RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .

サーバー側で認証のいらないTFTPサーバーを立てる*1 *2

# yum install tftp-server
# yum install tftp
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = no <- yesからnoへ
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
# service xinetd restart

通ることを確認。

# cp /etc/xinetd.d/tftp /tftpboot/
# tftp localhost
tftp> get tftp
Received 284 bytes in 0.0 seconds
tftp> q

windowsからでも取れる
C:\work>tftp 192.168.1.11 GET test.txt

ファーム送り込み

RedBoot> load -r -v -b 0x80041000 linux.bin
\/←がすぐ回り始める。ここでかたまるとかタイムアウトするようなら
  tftpdの設定見直す。

RedBoot> fis create linux
... Erase from 0xa8030000-0xa869b000: .......................................................................................................
... Program from 0x80041000-0x806ac000 at 0xa8030000: .......................................................................................................
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot>
RedBoot> fconfig
Run script at boot: true
Boot script:
.. fis load -l linux
.. exec
Enter script, terminate with empty line
>> fis load -l linux
>> exec
>>
Boot script timeout (1000ms resolution): 10
Use BOOTP for network configuration: false
Gateway IP address: 192.168.1.1
Local IP address: 192.168.1.8
Local IP address mask: 255.255.255.0
Default server IP address:
Console baud rate: 9600 → このままだとlinux起動メッセージが文字化けしたので115200に変更
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot>
The Milkfish Router Services
Restoring SIP ddaliases database from NVRAM...
Empty.
connect: Network is unreachable
connect: Network is unreachable
connect: Network is unreachable
gethostbyname: Network is unreachable
ここでEnter押さないと進まないw
DD-WRT v24-sp2 std (c) 2009 NewMedia-NET GmbH
Release: 10/10/09 (SVN revision: 13064)

DD-WRT login: root
Password: ← admin
==========================================================

 ____  ___    __        ______ _____         ____  _  _
 | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
 || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
 ||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _|
 |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_|

                       DD-WRT v24-sp2
                   http://www.dd-wrt.com

==========================================================
Jan  1 00:05:00 login[1532]: root login on 'console'


BusyBox v1.13.4 (2009-10-10 01:49:22 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@DD-WRT:~#

ネットワークtrueの場合

RedBoot> fconfig
Run script at boot: true
Boot script:
.. fis load -l linux
.. exec
Enter script, terminate with empty line
>> fis load -l linux
>> exec
>>
Boot script timeout (1000ms resolution): 10
Use BOOTP for network configuration: true
Default server IP address: 192.168.1.8
Console baud rate: 115200
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> 

LaFonera Software Flashing - DD-WRT Wiki
他参考
telnet 192.168.1.1 80
GET / HTTP/1.0

webのセットアップでミスして繋がらなくなってしまったら背面ボタンを長押
しして再起動すれば戻る。

tftpのポートの入出力を見る。
tcpdump -i br0 port 69

tcpdumpの使い方 - TECHNERD::INIT

*1:なぜかubuntuでは上手くいかなかったのでCentOSを使用CentOSなぜかすんなりいった。

*2:tcpdumpで見るtとアクセスは着ているみたいなんだがiptables全部落としても”tftpd: read: Connection refused”になるし、設定をubuntuに持って行ってもダメだし、inetd, xinetd いろいろ試したけれどーんーわからん