在移植linux2.6.38版本內核到s3c6410時出現以下錯誤
VFS: Cannot open root device"mtdblock2" or unknown-block(31,2)
Please append a correct "root="boot option; here are the available partitions:
1f00 512 mtdblock0 (driver?)
1f01 5120 mtdblock1 (driver?)
1f02 256512 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable tomount root fs on unknown-block(31,2)
查看打印信息,確定nandflash設備已經起來,並且已完成分區,排除了存儲設備的問題,突然想到內核是不支持yaffs2文件系統的,所以得手動添加,讓內核支持yaffs2文件系統。
1. 網上下載yaffs2源碼
2. 解壓,進入源碼根目錄,執行以下命令;
\ shpatch-ker.sh c /work/s3c6410/kernel/linux-2.6.38.5/
注:/work/s3c6410/kernel/linux-2.6.38.5/為內核目錄
3.配置內核,支持yaffs2
Filesystems --->
[*]Miscellaneous filesystems --->
<*> YAFFS2 file system support
另外下面選項也要選上,要不會出不來上面的選項的
<*> Caching block device access to MTDdevices
問題一:
編譯時出現一下問題:
fs/yaffs2/yaffs_fs.c:275: warning:initialization from incompatible pointer type
fs/yaffs2/yaffs_fs.c:334: warning:initialization from incompatible pointer type
fs/yaffs2/yaffs_fs.c:347: error: unknownfield 'delete_inode' specified in initializer
fs/yaffs2/yaffs_fs.c:347: warning:initialization from incompatible pointer type
fs/yaffs2/yaffs_fs.c:348: error: unknownfield 'clear_inode' specified in initializer
fs/yaffs2/yaffs_fs.c:348: warning:initialization from incompatible pointer type
fs/yaffs2/yaffs_fs.c: In function'yaffs_delete_inode':
fs/yaffs2/yaffs_fs.c:563: error: implicitdeclaration of function 'clear_inode'
fs/yaffs2/yaffs_fs.c: In function'yaffs_write_begin':
fs/yaffs2/yaffs_fs.c:748: error: implicitdeclaration of function '__grab_cache_page'
fs/yaffs2/yaffs_fs.c:748: warning:assignment makes pointer from integer without a cast
fs/yaffs2/yaffs_fs.c: In function'yaffs_mknod':
fs/yaffs2/yaffs_fs.c:1236: error: 'structtask_struct' has no member named 'fsuid'
fs/yaffs2/yaffs_fs.c:1237: error: 'structtask_struct' has no member named 'fsgid'
fs/yaffs2/yaffs_fs.c: In function'yaffs_symlink':
fs/yaffs2/yaffs_fs.c:1416: error: 'structtask_struct' has no member named 'fsuid'
fs/yaffs2/yaffs_fs.c:1417: error: 'structtask_struct' has no member named 'fsgid'
fs/yaffs2/yaffs_fs.c: In function'yaffs_setattr':
fs/yaffs2/yaffs_fs.c:1541: error: implicitdeclaration of function 'inode_setattr'
fs/yaffs2/yaffs_fs.c: In function'yaffs_internal_read_super':
fs/yaffs2/yaffs_fs.c:1957: warning: format'%d' expects type 'int', but argument 2 has type 'uint64_t'
fs/yaffs2/yaffs_fs.c:2123: error: implicitdeclaration of function 'init_MUTEX'
出現該問題原因:
Linux版本與yaffs2版本不兼容,下載新版yaffs2,或者給yaffs2打補丁。