On Friday 16 May 2008 09:00:48 Chun Kit Edwin Lau wrote: > Hi everyone, > > I am developing an embedded system using yaffs2+2k page NAND as my rootfs. > I know there have been incomptabilities between MTD and YAFFS. I applied > some patches. I was not sure if they were the right one. My file stopped > missing after mount/umount cycle if and only if I erased the flash before I > mounted the partition the very first time. But > > nandwrite -a -o /dev/mtdX image > > didn't work. And no file will show up, just more bad block > > My question is is this problem fixed now in the stock kernel (and what > version)? If not, where are correct the patches? I have spent so much time > digging for it now, but I didn't seem to find it. Please excuse for my > stupidity. > > Thank you very much I won't call you stupid :-). It took Wookey and I about 6 hours to sort this out for one platform and we are pretty familiar with how this stuff hangs together and the platform being used. Getting the mtd + yaffs2 going to the level you mention (being able to read/write an image file) depends on getting quite a few things working together. Almost always the cause is the spare area being trashed, and typically by bugs in the mtd because quite often the spare read/write handing gets broken. The nandread/write userspace programs use some different handling and spare can get damaged in this too. It sounds in this case that the spare writing is writing over the bad block marking bytes which it should not be doing. I suggest a yaffs2 + mtd bring up is done in phases: 1) First get to the stage where you can start with an empty partition (erase all) and write/read and unmount /remount without losing files. Getting there proves the r/w of the spare area and that you have basic functional NAND interfacing. The best thing to do here is to walk through how the spare bytes are laid down and then read back from yaffs all the way down to the nand. 2) Get the image file r/w going (if you need it) This requires sorting out any issues in the nandread/write path. I hope that helps a bit. -- Charles