If you cannot mount your JFFS2 file system and you see many messages like
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000024: 0x2b10 instead ...
Further such events for this erase block will not be printed
this means that the data on your flash device is not a valid JFFS2 file system. There is no single solution for this problem, but we will try to provide you some ideas how to fix this.
The first question you should try to answer is "why the data on my flash device is incorrect so that JFFS2 rejects to deal with it?". There are may be a plenty of reasons, e.g.:
Anyways, JFFS2 wouldn't complain if it was able to find correct data. As it does complain, there is something wrong with the data it reads.
One common mistake is to use /dev/mtdX
or /dev/mtdblockX
devices to flash JFFS2 images on NAND flashes. E.g.
cp jffs2_fs.img /dev/mtd2
This is incorrect because when dealing with NAND flashes one has to skip bad eraseblocks and write only in NAND page size chunks. Please, use the nandwrite
utility instead.
Also please, do not forget to erase your flash before flashing the image. You may use the flash_eraseall
utility for this. And it makes sense to make sure the erase functionality actually works my reading the erase MTD device back and checking that only 0xFF bytes were read.
You may try to check if your flash driver works correctly and if you flashed the file system image correctly by means of reading the flash back after you have flashed your image, and compare the read image with the original one. Please, use the nandread
utility to read from NAND flashes.
You can also do the following experiment to make sure JFFS2 works well. Erase your MTD device and mount it to JFFS2. You will end up with an empty file system. Copy some files to the JFFS2 file system and unmount it. Then mount it again and see if it mounts without problems. If it does, this is most probably not a JFFS2 bug.