2011年1月23日日曜日

CQW-MRB Firmware更新失敗→起動不具合→復旧

CQW-MRBにL-02A/b-mobileを接続したときに、時々インターネット接続ができないことがありました。それで、D31HW専用とされている2.02betaを試してみました。ところが、起動不具合となってしましいました。
しばらく、放置していたのですが、年末・年始でなんとか復旧できたので、その経緯をここに記載します。

1. 2.02betaへの更新失敗とログ

CQW-MRBの管理画面から、2.02betaのfirmwareに更新を実施したところ、PCからの有線・無線の接続ができなくってしまいました。シリアル接続の方法はわかっていますから、(http://john-doe-memorandum.blogspot.com/2010_09_01_archive.html , 38400bps) 接続してみたところ、kernel 起動後 root file systemのmountに失敗し、panicとなっていることがわかりました。

U-Boot 1.1.4 (Dec  7 2009 - 14:15:23)
U-Boot code: 00000000 -> 0001A204  BSS: -> 0001F15C
CPU Clock: 200 MHz
1.8V Vdd Output: 1.793
2.5V Vdd Output: 2.531
途中省略
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: BNEP (Ethernet Emulation) ver 1.2
Bluetooth: BNEP filters: protocol multicast
SQUASHFS error: sb_bread failed reading block 0x8da
SQUASHFS error: Unable to read metadata cache entry [2369cd]
SQUASHFS error: Unable to read inode [2369cd:12d6]
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)

上記のログによると、root file systemとしているsquashfsの読込みに失敗し、その結果、Kernel panicとなり、起動不具合を起こしているようです。

2. MRB-CQW 1.04 firmwareへの復旧

以下の資料を参考にしました。
  • openwrt Webサイト (http://www.openwrt.org/)
  • u-boot解説の各サイト (u-boot本家はどこなのでしょうか)
  • 「国産ルーターをLinuxサーバーにする」, 日経Linux 2010 8月号
  • 正常時の起動ログ (下記)
Hit any key to stop autoboot: 0
## Starting application at 0x10040000 ...
Uncompressing Linux................................................................................... done, booting the kernel.
Linux version 2.6.16-star (root@vance.localdomain) (gcc version 3.4.6) #1414 Tue Jun 15 10:42:15 CST 2010
CPU: FA526id(wb) [66015261] revision 1 (ARMv4)

Creating 5 MTD partitions on "STR9100 NOR Flash":
0x00000000-0x00040000 : "ARMBOOT"
0x00040000-0x001a0000 : "Linux Kernel1"
0x001a0000-0x003e0000 : "ROOT FS1"
0x003e0000-0x00400000 : "Configs"
0x00040000-0x003e0000 : "Upgrade"
その結果、判明したことは以下の通りです。
  • CQW-MRBのfirmwareのその大きさ(3689KB)から推測すると、Kernel, root file system(squashfs)がまとめられており、kernel/root file systemを個別に作成する必要はなさそうだ。
  • Kernelの起動は、0x10040000へのジャンプで始まっている。ここはFlash memoryの領域らしい。printenvでも確認できる。
  • Firmwareは一度、tftp serverからRAMにdownloadし、そこからFlash memoryにコピーする。

復旧までの作業は以下の通りです。
  • PCにtftp serverをインストールし、CQW-MRB 1.04 firmwareをtftp serverのroot directoryに配置する。
  • CQW-MRBの筐体を開け、PCとシリアルケーブルで接続する。PCではシリアル端末接続可能な端末プログラム(teratermなど)を起動する。シリアル接続に対応するCOM portを指定することとbit rateは384000にする。
  • CQW-MRBに電源を接続し、u-bootのメッセージが表示されたら、端末プログラムから何かのキーを押して、起動を中止させる。
  • u-bootのプロンプトが出てきたところで、環境変数のserveripとipaddrを設定する。serveripはtftp serverのip address、ipaddrは自機(CQW-MRB)のip address。
Star Vela # setenv serverip 192.168.1.1 
Star Vela # setenv ipaddr 192.168.1.2
Star Vela # saveenv
  • tpftpserverから1.04 firmwareをdownload。download先は、とりあえず0x40000 (正常時の起動ログによる、0x40000 から “upgrade”となっているのという単純な理由)をコピー先とする。
Star Vela # tftpboot 0x40000 cqwmrb_v104.bin
netboot_common, argc= 3
init RTL8201CP
Select server or client model: 1/2
client model start
TFTP from server 192.168.1.1; our IP address is 192.168.1.2
Filename 'cqwmrb_v104.bin'.
Load address: 0x40000
Loading: #################################################################
途中省略            
done
Bytes transferred = 3776514 (39a002 hex)
  • RAMからFlash memoryにコピー。Flashは一度、消去をかけてからのcopyになるようです。
Star Vela # cp.b 0x40000 0x10040000 0x39a002
Copy to Flash...
Erasing sector 11 @ 10040000... OK
Erasing sector 12 @ 10050000... OK
途中省略
Erasing sector 67 @ 103C0000... OK
Erasing sector 68 @ 103D0000... OK
Erased 58 sectors
0x0039a002        done
  • 試しに0x10040000から起動
Star Vela # go 0x10040000
## Starting application at 0x10040000 ...
Uncompressing Linux................................................................................... done, booting the kernel.
Linux version 2.6.16-star (root@vance.localdomain) (gcc version 3.4.6) #1414 Tue Jun 15 10:42:15 CST 2010
CPU: FA526id(wb) [66015261] revision 1 (ARMv4)
Machine: STAR STR9100
途中省略
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: BNEP (Ethernet Emulation) ver 1.2
Bluetooth: BNEP filters: protocol multicast
VFS: Mounted root (squashfs filesystem) readonly.
Freeing init memory: 100K
init started: BusyBox v1.11.1 (2010-06-15 10:42:52 CST)
starting pid 615, tty '': '/etc/rc.sh'
Cannot run '/etc/rc.sh': No such file or directory
  • OKならば、resetで再起動。

3. 今後

なぜ、2.02betaのfirmware updateに失敗し、再起動不具合が発生してしまったのか、余裕ができたら、再度updateを実施してみる。
2011-01-23: 20.02betaに無事upgradeできました。


4. History

  • 2011-01-22: Initial Release
  • 2011-01-23: 2.02beta upgradeについて記載