大破雑記帳

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

WRC-X3000GS2 SPI-NAND (MX35UF1G24AD-Z4I)のoob size問題

Linux Kernelでの登録とMacronixのデータシートではoob size=128として登録され、認識は走るがblock deviceとしての読み出しがI/Oエラーとなる

パーティション列挙途中のエラーは、u-boot-envのNVMEM認識中にmtdの読み出しで死んでエラーになっている

[    1.345227] spi-nand spi0.0: Macronix SPI NAND was found.
[    1.345273] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[    1.362207] 22 qcomsmem partitions found on MTD device spi0.0
[    1.362266] Creating 22 MTD partitions on "spi0.0":
[    1.366951] 0x000000000000-0x000000080000 : "0:sbl1"
[    1.373431] 0x000000080000-0x000000100000 : "0:mibib"
[    1.379994] 0x000000100000-0x000000140000 : "0:bootconfig"
[    1.383788] 0x000000140000-0x000000180000 : "0:bootconfig1"
[    1.388886] 0x000000180000-0x000000280000 : "0:qsee"
[    1.395484] 0x000000280000-0x000000380000 : "0:qsee_1"
[    1.400384] 0x000000380000-0x0000003c0000 : "0:devcfg"
[    1.404395] 0x0000003c0000-0x000000400000 : "0:devcfg_1"
[    1.409480] 0x000000400000-0x000000440000 : "0:cdt"
[    1.415113] 0x000000440000-0x000000480000 : "0:cdt_1"
[    1.419594] 0x000000480000-0x000000500000 : "0:appsblenv"
[    1.425231] 1 fixed-partitions partitions found on MTD device 0:appsblenv
[    1.428587] Creating 1 MTD partitions on "0:appsblenv":
[    1.435448] 0x000000000000-0x000000040000 : "env-data"
[    1.497588] u-boot-env-layout: probe of 79b0000.qpic-nand:flash@0:partitions:partition-0-appsblenv:partition@0:nvmem-layout failed with error -74
[    1.498361] 0x000000500000-0x000000640000 : "0:appsbl"
[    1.512622] 0x000000640000-0x000000780000 : "0:appsbl_1"
[    1.517504] 0x000000780000-0x000000880000 : "0:art"
[    1.522833] 0x000000880000-0x000000900000 : "0:training"
[    1.526591] 0x000000900000-0x000003c40000 : "rootfs"
[    1.600230] mtd: setting mtd16 (rootfs) as root device
[    1.601104] mtdsplit: error occured while reading from "rootfs"
[    1.604347] 0x000003c40000-0x000003fc0000 : "config"
[    1.616185] 0x000003fc0000-0x000007300000 : "rootfs_1"
[    1.687548] 0x000007300000-0x000007680000 : "config_2"
[    1.694067] 0x000007680000-0x000007b80000 : "reserved"
[    1.702819] 0x000007b80000-0x000007c00000 : "fwheader"
[    1.705246] 0x000007c00000-0x000007c80000 : "factory"
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "0:sbl1"
mtd1: 00080000 00020000 "0:mibib"
mtd2: 00040000 00020000 "0:bootconfig"
mtd3: 00040000 00020000 "0:bootconfig1"
mtd4: 00100000 00020000 "0:qsee"
mtd5: 00100000 00020000 "0:qsee_1"
mtd6: 00040000 00020000 "0:devcfg"
mtd7: 00040000 00020000 "0:devcfg_1"
mtd8: 00040000 00020000 "0:cdt"
mtd9: 00040000 00020000 "0:cdt_1"
mtd10: 00080000 00020000 "0:appsblenv"
mtd11: 00040000 00020000 "env-data"
mtd12: 00140000 00020000 "0:appsbl"
mtd13: 00140000 00020000 "0:appsbl_1"
mtd14: 00100000 00020000 "0:art"
mtd15: 00080000 00020000 "0:training"
mtd16: 03340000 00020000 "rootfs"
mtd17: 00380000 00020000 "config"
mtd18: 03340000 00020000 "rootfs_1"
mtd19: 00380000 00020000 "config_2"
mtd20: 00500000 00020000 "reserved"
mtd21: 00080000 00020000 "fwheader"
mtd22: 00080000 00020000 "factory"
root@OpenWrt:~# strings /dev/mtdblock10
[26427.133154] mtdblock: MTD device '0:appsblenv' is NAND, please consider using UBI block devices instead.
[26427.134125] I/O error, dev mtdblock10, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 2
[26427.142240] I/O error, dev mtdblock10, sector 8 op 0x0:(READ) flags 0x80700 phys_seg 3 prio class 2
[26427.151427] I/O error, dev mtdblock10, sector 16 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 2
[26427.160440] I/O error, dev mtdblock10, sector 24 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
[26427.169619] I/O error, dev mtdblock10, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
[26427.178083] Buffer I/O error on dev mtdblock10, logical block 0, async page read

oob size=64 への修正後:

[    1.357755] spi-nand spi0.0: Macronix SPI NAND was found.
[    1.357799] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[    1.362683] nand: WARNING: (null): the ECC used on your system is too weak compared to the one required by the NAND chip
[    1.384049] 22 qcomsmem partitions found on MTD device spi0.0
[    1.384107] Creating 22 MTD partitions on "spi0.0":
[    1.388790] 0x000000000000-0x000000080000 : "0:sbl1"
[    1.395432] 0x000000080000-0x000000100000 : "0:mibib"
[    1.400767] 0x000000100000-0x000000140000 : "0:bootconfig"
[    1.405220] 0x000000140000-0x000000180000 : "0:bootconfig1"
[    1.410522] 0x000000180000-0x000000280000 : "0:qsee"
[    1.417069] 0x000000280000-0x000000380000 : "0:qsee_1"
[    1.422300] 0x000000380000-0x0000003c0000 : "0:devcfg"
[    1.426188] 0x0000003c0000-0x000000400000 : "0:devcfg_1"
[    1.431456] 0x000000400000-0x000000440000 : "0:cdt"
[    1.436778] 0x000000440000-0x000000480000 : "0:cdt_1"
[    1.441469] 0x000000480000-0x000000500000 : "0:appsblenv"
[    1.447057] 1 fixed-partitions partitions found on MTD device 0:appsblenv
[    1.450474] Creating 1 MTD partitions on "0:appsblenv":
[    1.457195] 0x000000000000-0x000000040000 : "env-data"
[    1.519461] 0x000000500000-0x000000640000 : "0:appsbl"
[    1.523377] 0x000000640000-0x000000780000 : "0:appsbl_1"
[    1.526647] 0x000000780000-0x000000880000 : "0:art"
[    1.531591] 0x000000880000-0x000000900000 : "0:training"
[    1.535466] 0x000000900000-0x000003c40000 : "rootfs"
[    1.609522] mtd: setting mtd16 (rootfs) as root device
[    1.610755] mtdsplit: no squashfs found in "rootfs"
[    1.613640] 0x000003c40000-0x000003fc0000 : "config"
[    1.624474] 0x000003fc0000-0x000007300000 : "rootfs_1"
[    1.694803] 0x000007300000-0x000007680000 : "config_2"
[    1.701580] 0x000007680000-0x000007b80000 : "reserved"
[    1.709768] 0x000007b80000-0x000007c00000 : "fwheader"
[    1.711711] 0x000007c00000-0x000007c80000 : "factory"
oot@OpenWrt:~# strings /dev/mtdblock10
[  132.018880] mtdblock: MTD device '0:appsblenv' is NAND, please consider using UBI block devices instead.
bootcmd=bootipq
baudrate=115200
wifi2=7C:F8:54:xx:xx:F3
CRASH_COUNT=0
serialnum81=xxxxxxxxxxxx
serialnum=xxxxxxxxxxxxxxx
countrycode=EA
ethaddr=38:97:A4:xx:xx:60
wifi0=38:97:A4:xx:xx:61
wifi1=38:97:A4:xx:xx:62
eth0addr=38:97:A4:xx:xx:63
eth1addr=38:97:A4:xx:xx:60
wifi1ssid1=elecom-xxxx60
wifi1ssid2=e-tomo-xxxx60
wifi1ssid3=elecom-s-xxxx60
wifi2ssid1=elecom-xxxx60
wifi2ssid2=e-tomo-xxxx60
wifi2ssid3=elecom-s-xxxx60
wifiwpapsk=xxxxxxxxxxxx
wifiguestwpapsk=xxxxxxxxxxxx
wifiwpspin=xxxxxxxx
webguipwd=xxxxxxxx
wifisecuritywpapsk=xxxxxxxxxxxx
DebugFlag=0
bootdelay=3