Nand Flash Yaffs系统大量写入数据失败问题的解决方法。
一個朋友的問題,我們共同分析后搞定。其實以前也遇到過同樣問題,時間長了,沒總結。
?
事發:在Nand Flash上使用2.6.14的linux kernel,三星2440的板子,連續寫入文件,到一定大小限制就刪除,文件寫入沒有超過flash保留10%的空閑,應該說還差很多。
?
第一步,不適用syslog寫,換做自己寫代碼寫入,出現幾率降低;
第二步,fwrite換成write,幾率增加,很快就壞。
?
壞的時候提示:yaffs tragedy: no more eraased blocks !!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!
?
重新啟動,就會標出很多壞塊(bad block...),當然是假的,一格式化,就好。
?
第三步,朋友說用2.6.34的內核,沒有問題,但從14移到34,需要修改的驅動之類太多,數據結構變化太大。
第四步,我想起以前說起nand時候mtd校驗和yaffs校驗不能同時開啟。
第五步,讓在14內核上關閉yaffs軟校驗,開啟mtd nand硬件校驗,出現:mtd ecc error unfixed on chunk 26784
第六步,14內核,關閉mtd nand硬件校驗,使用yaffs軟校驗,出現: VFS: Mounted root (cramfs filesystem) readonly. Mounted devfs on /dev Freeing init memory: 108K Error -3 while decompressing! c02ccb50(312)->c3cc0000(4096) Failed to execute /linuxrc. Attempting defaults... Kernel panic - not syncing: No init found. Try passing init= option to kernel.
然后,想了想。
34可以,14同樣的配置不可以,應該是軟件差異。查看14下yaffs的版本,挺老。朋友說34下的yaffs拿過去編譯無法通過。
我從這邊使用的18內核摳出來yaffs部分給他,這個yaffs是:
Id: yaffs_mtdif.c,v 1.22 2009/03/06 17:20:51 wookey Exp $";
編譯,還是有一個頭文件(linux/uaccess.h)找不到,屏蔽之,OK。
再編譯,使用mtd的硬nand ecc,關閉yaffs own ecc,測試,OK,寫文件OK,寫入斷電 OK。
總結:主要就是兩種ECC沖突的事情,yaffs官網上寫道:
Nand interface: For yaffs to function, it must be able to be the only code that writes to the oob area on the NAND device. The existing NAND driver in kernel 2.4.19 assumes that it will do the ecc/oob management for the host fs. For yaffs, this is quite wrong. You can disable ecc/oob calculations either by hand patching the mtd code to bypass ecc calculations or by merging the latest mtd cvs.
當然這針對2.4的內核,莫非2.6也濤聲依舊?
總結
以上是生活随笔為你收集整理的Nand Flash Yaffs系统大量写入数据失败问题的解决方法。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中国铁路:D2809殉职司机5秒内采取了
- 下一篇: A20 文件系统预装APK