1,下载源代码。
进入urdir目录(为描述方便,将yaffs文件下载至urdir目录下,内核源码目录为urdir/linux3.6.5)。
如果系统已经安装git工具,直接执行:
git clonegit://www.aleph1.co.uk/yaffs2 (@qingwu:一般在终端下都有git支持)
如果没有git工具,首先下载安装git(http://git-scm.com/ ,如果在Fedora下,可直接yum安装,命令:yum installgit.i686)。当然,也可以在windows下用git工具下载(这里请注意:windows下的文件可能会出现回车换行的错误,比如^M不能识别等)
2,给内核打补丁
yaffs源代码下载完后,进入urdir/yaffs源代码目录,执行:
#./patch-kernel.sh c m ../linux-3.6.5
根据帮助文档说明,可知c m的含义(you wish to copy(c) or link (l) the code and the path to your kernel sources and whether youwant to use the single-version or multi-version code.)
3,进入内核源码目录,配置内核,命令:[root@localhostlinux-3.6.5]#make menuconfig,进入内核配置界面。
File systems --->
[*] Miscellaneous filesystems --->
<*> yaffs2 file system support
如果在文件系统配置界面中发现没有yaffs的配置选项,解决办法:
在配置界面,查找 /yaffs。
其中[]内的参数是对应选项当前的状态,要让yaffs_fs选项为[y],依赖于MISC_FILESYSTEMS 和 MTD_BLOCK同时为[y],但是后者当前状态为[n],因此,需要将其选为[y]。请自行配置。
4,如果在这里直接make,会出现下面一连串错误,解决方法在错误的对应行已给出。
提到的需要修改的文件目录为:
[root@localhost linux-3.6.5]# vim include/linux/fs.h
[root@localhost linux-3.6.5]# vim fs/yaffs2/yaffs_vfs.c
[root@localhost linux-3.6.5]# vim fs/yaffs2/yaffs_mtdif.c
注:这一条的解决办法是转载的,原文链接:
http://blog.csdn.net/longtian635241/article/details/8259107
fs/yaffs2/yaffs_vfs.c:438: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:439: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:443: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:445: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:478: error: unknown field 'write_super' specified in initializer——在fs.h中的struct super_operations中添加 void (*write_super) (struct super_block *);
fs/yaffs2/yaffs_vfs.c:478: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_evict_inode':
fs/yaffs2/yaffs_vfs.c:873: error: implicit declaration of function 'end_writeback' —— 此函数改为了clear_inode
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_do_sync_fs':
fs/yaffs2/yaffs_vfs.c:2203: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c:2214: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c:2216: error: 'struct super_block' has no member named 's_dirt'——在fs.h的struct super_block中添加unsigned char s_dirt;
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_put_super':
fs/yaffs2/yaffs_vfs.c:2506: error: 'struct mtd_info' has no member named 'sync' ——所有mtd_info中的报错,都在参数前面加下划线
fs/yaffs2/yaffs_vfs.c:2507: error: 'struct mtd_info' has no member named 'sync'——例:mtd->sync改为 mtd->_sync
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_touch_super':
fs/yaffs2/yaffs_vfs.c:2523: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
fs/yaffs2/yaffs_vfs.c:2699: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2700: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2701: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2702: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2703: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2704: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2705: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2729: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2730: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2756: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2756: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2946: error: implicit declaration of function 'd_alloc_root' —— 此函数改为d_make_root
fs/yaffs2/yaffs_vfs.c:2946: warning: assignment makes pointer from integer without a cast
fs/yaffs2/yaffs_vfs.c:2955: error: 'struct super_block' has no member named 's_dirt'
make[2]: *** [fs/yaffs2/yaffs_vfs.o] 错误 1
make[1]: *** [fs/yaffs2] 错误 2
fs/yaffs2/yaffs_mtdif.c: In function 'nandmtd_erase_block':
fs/yaffs2/yaffs_mtdif.c:53: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_mtdif.c: In function 'yaffs_mtd_write':
fs/yaffs2/yaffs_mtdif.c:79: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_mtdif.c: In function 'yaffs_mtd_read':
fs/yaffs2/yaffs_mtdif.c:115: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_mtdif.c: In function 'yaffs_mtd_erase':
fs/yaffs2/yaffs_mtdif.c:168: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_mtdif.c: In function 'yaffs_mtd_mark_bad':
fs/yaffs2/yaffs_mtdif.c:184: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_mtdif.c: In function 'yaffs_mtd_check_bad':
fs/yaffs2/yaffs_mtdif.c:196: error: 'struct mtd_info' has no member named 'block_isbad'
make[2]: *** [fs/yaffs2/yaffs_mtdif.o] 错误 1
make[1]: *** [fs/yaffs2] 错误 2
make: *** [fs] 错误 2
5,修改完成,在源码目录下make即可。
[root@localhost linux-3.6.5]# make
剩下的工作就是往开发板上烧写内核了。