jffs2(mtd-utils 版本 1.5.0,mkfs.jffs2
修订版 1.60)的最小擦除块大小似乎是 8KiB:
Erase size 0x1000 too small. Increasing to 8KiB minimum
但是我使用 at25df321a 运行 Linux 3.10,
m25p80 spi32766.0: at25df321a (4096 Kbytes),
并且擦除块大小仅为 4KiB:
mtd5
Name: spi32766.0
Type: nor
Eraseblock size: 4096 bytes, 4.0 KiB
Amount of eraseblocks: 1024 (4194304 bytes, 4.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:10
Bad blocks are allowed: false
Device is writable: true
有没有办法让 mtd 系统将多个擦除块视为一个?也许一些 ioctl 或模块参数?
如果我用更大的擦除块大小刷新 jffs2 映像,我会收到很多内核错误消息、丢失文件,有时还会出现恐慌。
解决方法
flasherase --jffs2
尽管擦除块大小为 4KiB,但我发现这会导致文件系统正常工作。所以我破解了mkfs.jfss2.c
文件,生成的图像似乎工作正常。我会给它一些测试。
diff -rupN orig/mkfs.jffs2.c new/mkfs.jffs2.c
--- orig/mkfs.jffs2.c 2014-10-20 15:43:31.751696500 +0200
+++ new/mkfs.jffs2.c 2014-10-20 15:43:12.623431400 +0200
@@ -1659,11 +1659,11 @@ int main(int argc, char **argv)
}
erase_block_size *= units;
- /* If it's less than 8KiB, they're not allowed */
- if (erase_block_size < 0x2000) {
- fprintf(stderr, "Erase size 0x%x too small. Increasing to 8KiB minimum\n",
+ /* If it's less than 4KiB, they're not allowed */
+ if (erase_block_size < 0x1000) {
+ fprintf(stderr, "Erase size 0x%x too small. Increasing to 4KiB minimum\n",
erase_block_size);
- erase_block_size = 0x2000;
+ erase_block_size = 0x1000;
}
break;
}