[英]Can the logical erase block size of an MTD device be increased?
The minimum erase block size for jffs2 (mtd-utils version 1.5.0, mkfs.jffs2
revision 1.60) seems to be 8KiB: jffs2(mtd-utils版本1.5.0,
mkfs.jffs2
修订版1.60)的最小擦除块大小似乎是8KiB:
Erase size 0x1000 too small. Increasing to 8KiB minimum
However I am running Linux 3.10 with an at25df321a, 但是我正在使用at25df321a运行Linux 3.10,
m25p80 spi32766.0: at25df321a (4096 Kbytes),
and the erase block size is only 4KiB: 并且擦除块大小仅为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
Is there a way to make the mtd system treat multiple erase blocks as one? 有没有办法使mtd系统将多个擦除块视为一个? Maybe some ioctl or module parameter?
也许一些ioctl或模块参数?
If I flash a jffs2 image with larger erase block size, I get lots of kernel error messages, missing files and sometimes panic. 如果以较大的擦除块大小刷新jffs2图像,则会收到许多内核错误消息,文件丢失甚至有时出现紧急情况。
workaround 解决方法
I found that flasherase --jffs2
results in a working filesystem inspite of the 4KiB erase block size. 我发现
flasherase --jffs2
4KiB擦除块大小, flasherase --jffs2
使文件系统正常工作。 So I hacked the mkfs.jfss2.c
file and the resulting image seems to work fine. 因此,我入侵了
mkfs.jfss2.c
文件,生成的图像似乎工作正常。 I'll give it some testing. 我会做一些测试。
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;
}
http://lists.infradead.org/pipermail/linux-mtd/2010-September/031876.html http://lists.infradead.org/pipermail/linux-mtd/2010-September/031876.html
JFFS2 should be able to fit at least one node to eraseblock.
JFFS2应该能够容纳至少一个节点以擦除块。 The maximum node size is 4KiB+few bytes.
最大节点大小为4KiB +几个字节。 This is why the minimum eraseblocks size is 8KiB.
这就是为什么最小擦除块大小为8KiB的原因。
But in practice, even 8KiB is bad because you and up with wasting a lot of space at the end of eraseblocks.
但是实际上,即使8KiB也很糟糕,因为您和其他人在擦除块末尾浪费了大量空间。
You should join several erasblock into one virtual eraseblock of 64 or 128 KiB and use it - this will be more optimal.
您应该将多个erasblock合并为一个64或128 KiB的虚拟擦除块,然后使用它—这样做会更好。
Some drivers have already implemented this. 一些驱动程序已经实现了这一点。 I know about
我知道
MTD_SPI_NOR_USE_4K_SECTORS
Linux configuration option. Linux配置选项。 It have to be set to "n" to enable large erase sectors of size 0x00010000.
必须将其设置为“ n”以启用大小为0x00010000的较大擦除扇区。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.