大破雑記帳

個人用メモな雑記ブログ いろんなことをざっくりと。

WRC-X3000GS3 factoryテスト

  • WRC-X3000GS3の場合、ヘッダ有効長としてWRC-X1800GSと同じ 0x68 ではなく、公式FWでその後に続く ELECOM... 分の 0x1c が追加で必要(合計: 0x84
    • ヘッダ有効長が合計 0x84 に足りない場合、CRC32をチェックされるFW本体データが不足分足して切り出され(0x1c 不足なら 0x1c 足される)、範囲が狂い算出結果もおかしくなり、チェックがコケてfailとなる
      • ヘッダ有効長は 0xFF でない範囲で判定しているようである
    • ヘッダ最後の 0x1c 部分は、公式FWに存在する ELECOM... が無くてもチェックは通った

OK時:

root@(none):/tmp# tftp -r openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-
factory.bin -g 192.168.1.99
root@(none):/tmp# mstc_fwcheck openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squa
shfs-factory.bin 
STARTING fw checker
1 fw magic = 434f4d44 crc = cf90e5a2
get mstc fw
split_head_file: fw.header 
split_image_file:FW.ras 
split_image_file:openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-factory.bin.ras
file: , len = 870000 crc = a2e590cf
fw checksum check OK
root@(none):/tmp# echo $?
1

fail時:

root@(none):/tmp# mstc_fwcheck openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squa
shfs-factory.bin 
STARTING fw checker
1 fw magic = 434f4d44 crc = 145e792c
get mstc fw
split_head_file: fw.header 
split_image_file:FW.ras 
split_image_file:openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-factory.bin.ras
file: , len = 87001c crc = 2b054911
fw checksum check  fail
root@(none):/tmp# ls -alh
drwxrwxrwt    7 root     root         260 Jan  1 00:42 .
drwxr-xr-x   16 root     root         319 Aug  7  2024 ..
-rwx------    1 root     root           4 Jan  1 00:00 .failsafe
-rw-------    1 root     root           0 Jan  1 00:00 .preinit
-rw-r--r--    1 root     root           0 Jan  1 00:00 failsafe
drwxr-xr-x    2 root     root          40 Jan  1 00:00 lock
-rw-r--r--    1 root     root        8.6M Jan  1 00:42 openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-factory.bin
-r-S--x---    1 root     root        8.4M Jan  1 00:42 openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-factory.bin.ras
drwxr-xr-x    2 root     root          40 Jan  1 00:00 run
drwxrwxrwt    2 root     root          40 Jan  1 00:00 shm
drwxr-xr-x    2 root     root          40 Jan  1 00:00 state
drwxr-xr-x    2 root     root          80 Jan  1 00:00 sysinfo
-rw-r--r--    1 root     root           2 Jan  1 00:00 tmp.JCbGoO
root@(none):/tmp# hexdump -n 128 -C openwrt-mediatek-filogic-elecom_wrc-x3000gs3
-squashfs-factory.bin.ras 
00000000  73 79 73 75 70 67 72 61  64 65 2d 65 6c 65 63 6f  |sysupgrade-eleco|
00000010  6d 5f 77 72 63 2d 78 33  30 30 30 67 73 33 2f 00  |m_wrc-x3000gs3/.|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  00 00 00 00 30 30 30 30  37 35 35 00 30 30 30 30  |....0000755.0000|
00000070  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
00000080
root@(none):/tmp# gzip -c openwrt-mediatek-filogic-elecom_wrc-x3000gs3-squashfs-
factory.bin.ras | tail -c8 | hexdump -C
00000000  11 49 05 2b 1c 00 87 00                           |.I.+....|
00000008
root@(none):/tmp# tail -c $((0x1c)) openwrt-mediatek-filogic-elecom_wrc-x3000gs3
-squashfs-factory.bin.ras | hexdump -C
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000010  00 00 00 00 00 00 00 00  00 00 00 00              |............|
0000001c