我们为目标/设备(ARM,NOR原始FLASH)配置了JFFS2,用于存储配置信息/参数 .
使用以下命令在我们的系统中设置JFFS2:
/busybox mkdir /mnt/nor_flash/part2
/busybox mount -t jffs2 /dev/mtdblock6 /mnt/nor_flash/part2
尝试在(循环)write()操作期间使用断电事件挑战系统,发现配置文件已损坏 . 重新上电后,s / w无法打开文件(错误#2) . 但请注意,文件在系统中显示(ls),我们可以复制,hexdum或vi,尽管其内容看起来已损坏 . 以防万一,当我在不切断电源的情况下对文件执行循环write()时,文件可以正常打开()并且其内容正常 .
我仔细检查了我们的内核配置和代码,并试图调整一些MTD / JFFS2选项而没有任何结果 . 在阅读了http://www.linux-mtd.infradead.org/中提供的许多文章,帖子和所有信息之后,我已经走到了尽头......在阅读时,我无法理解以下主要冲突:
•许多文章/指南声明JFFS2 over MTD不适用于块设备,并且不是(断电)安全的 . 例如:
-
MTD_BLOCK参数说明@ http://how-to.wikia.com/wiki/Howto_configure_the_Linux_kernel/drivers/mtd .
-
"Can I mount ext2 over an MTD device?" @ http://www.linux-mtd.infradead.org/faq/general.html#L_mtd_vs_hdd
-
"The BusyBox version of mount is known to not work without the mtdblock device" @ http://www.linux-mtd.infradead.org/faq/jffs2.html
-
"The most naïve implementation of a translation layer is the mtdblock driver, which provides /dev/mtdblockN devices, with a 1:1 mapping between logical and physical sectors. The illusion of being able to overwrite 512-byte sectors individually is provided by reading an entire erase block into RAM, modifying the changed sectors, and thenerasing and rewriting the flash. This, obviously, provides no reliability in the face of power loss or kernel crashes—and not only are the sectors being modified likely to be lost, but also a large amount of data surrounding them. However, the mtdblock driver is useful for purely read-only access, in conjunction with “normal” filesystems such as Cramfs."引自"Building Embedded Linux Systems" book p.210 @ https://theswissbay.ch/pdf/Gentoomen%20Library/Operating%20Systems/Linux/OReilly.Building.Embedded.Linux.Systems.Aug.2008.eBook-DDU.pdf
•另一方面,互联网上提供的所有JFFS2安装示例都使用mtdblock设备(就像我们一样),而不是mtd设备 . 当我尝试使用mtd设备执行JFFS2安装时,挂载失败,同时打印必须提供块设备的消息...
问题:
•是否可以使JFFS2电源故障安全?如果有,怎么样?
•是否可以使用mtd设备安装JFFS2?如果有,怎么样?
•UBI超过MTD的UBIF - 是否可以替代实现电源故障安全文件系统?
谢谢,Nissim .