关于警告:CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0
学习资料 2008-03-30 02:53 阅读8 评论0
字号: 大 中 小
如果挂载jffs2的时候,出现类似于:
CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0
的问题,则见到网上说的办法:
在嵌入式Linux系统中挂载 jffs2 根文件系统
二、制作根文件系统的JFFS2镜像。
使用MTD工具中的mkfs.jffs2命令,具体做法如下:
mkfs.jffs2 -r /home/tekkamanninja/working/nfs/rootfs -o rootfs.jffs2 -e 0x4000 --pad=0x500000 -s 0x200 -n |
各参数的意义:
(1)-r : 指定要做成image的源資料夾.
(2)-o : 指定輸出image檔案的文件名.
(3)-e : 每一塊要抹除的block size,預設是64KB.要注意,不同的flash, 其block size會不一樣.我的是三星的K9F1208U0B.
(4)--pad (-p): 用16進制來表示所要輸出檔案的大小,也就是root.jffs2的size。很重要的是, 為了不浪費flash空間, 這個值最好符合flash driver所規劃的區塊大小.以我的板子來說,就是5MB.
(5)如果挂载后会出现类似:CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0 的警告,则加上 -n 就会消失。
(6) 还有的选项,自己看帮助!-h
不过,貌似网上记得有人说过,这样最好还是加上:
What is cleanmarker and what it is used for ?
Cleanmarker is a special JFFS2 node which is written to the beginning of a block just after the block has been erased. On NOR flashes it is a special small JFFS2 node at the beginning of the block. On NAND flashes it is placed to the spare area of the first page.
The main reason why cleanmarkers are used is the need to be sure that the block erase operation was correctly completed. All 0xFF bytes in the block are not necessarily mean the block is ready to be utilized. For example, if an unclean reboot happened just at the end of the block erase cycle, the block might have unstable bits, which are read as "1" one time and might be read as "0" next time.
When preparing a flash partition for JFFS2, it is recommended to put cleanmarkers to the erased blocks. This might be done by means of "-j" option of the "flash_eraseall" MTD utility. Otherwise, JFFS2 will re-
erase the blocks which contain all 0xFF and have no cleanmarker. This is an unneeded wasting of time.
但是呢,对于大家常见的,也极少出现reboot的情况,所以我们在保证在对nand flash上分区制作jffs2的时候(???),没有reboot,这时候,就可以去掉那个 了,也就是加上 -n 或者 --no-cleanmarker
就像这这位说的:
http://lists.infradead.org/pipermail/linux-mtd/2004-June/009835.html
> Hi,
> I'm playing with jffs2 on NAND chips (Samsung 128Mbyte), MTD CVS is week
> old and kernel is 2.6.5.
>
> I'm making image with
> ./mkfs.jffs2 -b --eraseblock=131072 --pagesize=2048 -p -r /test_root -v -o
> test_root.img
>
> and then copy it with cp (nandwrite seems to have problems wiht endianess). > Everything work fine except on mounting filesystem I have messages:
>
> CLEANMARKER node found at 0x00000000 has totlen 0xc != normal 0x0
> CLEANMARKER node found at 0x00020000 has totlen 0xc != normal 0x0
> CLEANMARKER node found at 0x00040000 has totlen 0xc != normal 0x0
On NAND we store the cleanmarker (markes a clean erased block) in the out of
band area. So the cleanmarker node should be omitted when creating the fs
image. Add -n to the options
总结:
据我理解,意思是说,cleanmarker,是用于标记一个块是_完整地_被擦除了,(好像是因为只有_完整地_擦除后,Flash才能被写入)。因为如果有某些特殊情况,如系统在擦除周期末尾的时候,结果系统重启了,这时候,可能会导致flash中的位不稳定,可能此时读出是0,但是下次读出是1,所以就用这个cleanmarker来标记,这个块是否是真正地完整地擦除了。
因此,在用make.jffs2制作jffs2文件系统的时候,这个标记,也就没有必要加上了。也就是制作文件系统的时候,加上-n,或者--no-cleanmarker。表示没有这个cleanmarker.(估计这个cleanmarker是可以之后,某些具体操作擦除之后,同时标记上的。而第一次文件系统挂上的时候,应该是无所谓的。) 而应该在用mtd的工具flash_eraseall去格式化flash的时候,要加上-j参数,表示带上这个标记,也就是当擦除完flash之后,在oob中设置对应的cleanmark位,表示这个块已经被完整擦除了。这样,在jffs2 在以后对该块操作的的时候,就可以发现这个块已经被擦除了,就不用再浪费时间去重新擦除这个已经是0xff的块了。
附加说明:
在编译配置选项中,jffs2关于cleanmark也有相关的说明,:
[*] Do not use Cleanmarker
Do not use cleanmarkers if using NAND flash or Dataflash where the pagesize is not a power of 2
即,如果是nand flash,或者是页大小不是2的某次方的dataflash,都最好不要使用cleanmarker