gpt4 book ai didi

linux - MTD 设备的逻辑删除 block 大小可以增加吗?

转载 作者:太空宇宙 更新时间:2023-11-04 03:50:44 27 4
gpt4 key购买 nike

jffs2(mtd-utils 版本 1.5.0、mkfs.jffs2 修订版 1.60)的最小删除 block 大小似乎为 8KiB:

Erase size 0x1000 too small. Increasing to 8KiB minimum

但是我正在使用 at25df321a 运​​行 Linux 3.10,

m25p80 spi32766.0: at25df321a (4096 Kbytes),

且删除 block 大小仅为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系统将多个删除 block 视为一个?也许是一些 ioctl 或模块参数?

如果我刷新具有较大删除 block 大小的 jffs2 镜像,我会收到大量内核错误消息、丢失文件,有时还会出现 panic 。

解决方法

我发现,尽管删除 block 大小为 4KiB,但 flasherase --jffs2 仍能生成有效的文件系统。所以我破解了 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;
}

最佳答案

http://lists.infradead.org/pipermail/linux-mtd/2010-September/031876.html

JFFS2 should be able to fit at least one node to eraseblock. The maximum node size is 4KiB+few bytes. This is why the minimum eraseblocks size is 8KiB.

But in practice, even 8KiB is bad because you and up with wasting a lot of space at the end of eraseblocks.

You should join several erasblock into one virtual eraseblock of 64 or 128 KiB and use it - this will be more optimal.

一些驱动程序已经实现了这一点。我知道

MTD_SPI_NOR_USE_4K_SECTORS

Linux 配置选项。必须将其设置为“n”才能启用大小为 0x00010000 的大删除扇区。

关于linux - MTD 设备的逻辑删除 block 大小可以增加吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26466470/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com