大破雑記帳

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

SKS8300-8X JFFS2メモ

1. mkfs.jffs2 -p -b -f -U -v -o /tmp/tmp.jffs2 -d /etc/jffs2

SPI-NORだしerase sizeは64Kだろう、と思って普通に出したやつ

root@OpenWrt:~# mkfs.jffs2 -p -b -f -U -v -o /tmp/tmp.jffs2 -d /etc/jffs2
/
        f 0644   7476168 (  7607884)     0:0   nos.img


Compression mode: priority
Compressors:
      none             compr: 1937 blocks (7476168)  decompr: 0 blocks
     rtime (prio:50) + compr: 0 blocks (0/0)  decompr: 0 blocks 
Compression errors: 0
root@OpenWrt:~# mtd -e firmware write /tmp/tmp.jffs2 firmware
Unlocking firmware ...
Erasing firmware ...

Writing from /tmp/tmp.jffs2 to firmware ...
root@OpenWrt:~# reboot
...
[ 1255.845041] reboot: Restarting system
System is initializing...
**************************************************
WINBOND/
Net Initialization Completed
U-boot version: V2.00
Hit Ctrl+B to stop autoboot:  0 

###########################################
######## Uboot for Flash Main Menu ########
###########################################
 [1] Enable Network On
 [2] Config Ethernet Environment Variables
 [3] Ping Host IP Address
 [4] Running the System Kernel image
 [5] Burn the production firmware Bin
 [6] Set Serail Number&System CPU MAC&Software License
 [7] Set Serail Number&System CPU MAC
 [8] Perform Reset of the Uboot
 [9] Show Uboot Saved Info
Enter your selection:
Enter the password:(1-32 characters)
********************
Please wait for PHY init-time ...

Boot# debug_unish_env
RTL9300# chpart nor0,3
RTL9300# fsinfo
### filesystem type is JFFS2
Compression: NONE
        frag count: 223
        compressed sum: 455624
        uncompressed sum: 455624
Compression: ZERO
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: RTIME
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: RUBINMIPS
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: COPY
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: DYNRUBIN
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: ZLIB
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: LZO
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
RTL9300# mw.l 0x81000000 0 40
RTL9300# md.l 0x81000000 40  
81000000: 00000000 00000000 00000000 00000000    ................
81000010: 00000000 00000000 00000000 00000000    ................
81000020: 00000000 00000000 00000000 00000000    ................
81000030: 00000000 00000000 00000000 00000000    ................
81000040: 00000000 00000000 00000000 00000000    ................
81000050: 00000000 00000000 00000000 00000000    ................
81000060: 00000000 00000000 00000000 00000000    ................
81000070: 00000000 00000000 00000000 00000000    ................
81000080: 00000000 00000000 00000000 00000000    ................
81000090: 00000000 00000000 00000000 00000000    ................
810000a0: 00000000 00000000 00000000 00000000    ................
810000b0: 00000000 00000000 00000000 00000000    ................
810000c0: 00000000 00000000 00000000 00000000    ................
810000d0: 00000000 00000000 00000000 00000000    ................
810000e0: 00000000 00000000 00000000 00000000    ................
810000f0: 00000000 00000000 00000000 00000000    ................
RTL9300# fsload openwrt-realtek-rtl930x-xikestor_sks8300-8x-nos.img
loading image to 0x81000000 with JFFS2
load image size: 7476168 bytes
RTL9300# md.l 0x81000000 40                                        
81000000: 00000000 00000000 00000000 00000000    ................
81000010: 00000000 00000000 00000000 00000000    ................
81000020: 00000000 00000000 00000000 00000000    ................
81000030: 00000000 00000000 00000000 00000000    ................
81000040: 00000000 00000000 00000000 00000000    ................
81000050: 00000000 00000000 00000000 00000000    ................
81000060: 00000000 00000000 00000000 00000000    ................
81000070: 00000000 00000000 00000000 00000000    ................
81000080: 00000000 00000000 00000000 00000000    ................
81000090: 00000000 00000000 00000000 00000000    ................
810000a0: 00000000 00000000 00000000 00000000    ................
810000b0: 00000000 00000000 00000000 00000000    ................
810000c0: 00000000 00000000 00000000 00000000    ................
810000d0: 00000000 00000000 00000000 00000000    ................
810000e0: 00000000 00000000 00000000 00000000    ................
810000f0: 00000000 00000000 00000000 00000000    ................

FSは認識されるが全く読めていない

ふとSPI-NORの4Kセクタについて思い出して確認したら、stockのJFFS2は4Kであり、これが原因と思われる

$ busybox hexdump -n $((0x10000)) -C mtd3_firmware.bin | grep "^[0-9]\{8\}  19 85 00 03"
00000000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00001000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00002000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00003000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00004000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00005000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00006000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00007000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00008000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|
00009000  19 85 00 03 00 00 00 0c  f0 60 dc 98 19 85 e0 02  |.........`......|