日期:2014-05-16  浏览次数:20824 次

yaffs2移植到内核linux2.6.38

 

在移植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打补丁。