歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> yaffs2的補丁文件patch-ker分析

yaffs2的補丁文件patch-ker分析

日期:2017/3/1 10:06:39   编辑:Linux編程

為內核打上yaffs2 補丁

(1)將yaffs2代碼加入內核

這可以通過yaffs2目錄下的腳本文件patch-ker.sh來給內核打補丁,用法如下:

usage: ./patch-ker.sh c/l kernelpath

if c/l is c, then copy. if l then link.

這表明,如果c/l是c,則yaffs2的代碼會被復制到內核目錄下,如果是l,則在內核的目錄下創建一些鏈接文件。這裡yaff2所在的目錄/root/linux-test/,和linux-2.6.32.2在同一個目錄下,執行如下命令打補丁:

[root@localhost yaffs2]# ./patch-ker.sh c /root/linux-test/linux-2.6.32.2
usage: ./patch-ker.sh c/l m/s kernelpath
if c/l is c, then copy. If l then link
if m/s is m, then use multi version code. If s then use single version code
[root@localhost yaffs2]# ./patch-ker.sh c s /root/linux-test/linux-2.6.32.2

*** Warning ***
You have chosen to use the single kernel variant of the yaffs VFS glue code
that only works with the latest Linux kernel tree. If you are using an older
version of Linux then you probably wanted to use the multi-version variant by
re-running the patch-ker.sh script using m as a the second argument.
ie ./patch-ker.sh c m /root/linux-test/linux-2.6.32.2

Updating /root/linux-test/linux-2.6.32.2/fs/Kconfig
Updating /root/linux-test/linux-2.6.32.2/fs/Makefile
[root@localhost yaffs2]#

注意第二個參數m/s,如果不指定,有時會執行失敗。

上述命令完成下面三件事:

<1>修改內核文件/fs/Kconfig,增加下面兩行(在177行附近):

if MISC_FILESYSTEMS

source "fs/adfs/Kconfig"
source "fs/affs/Kconfig"
source "fs/ecryptfs/Kconfig"
source "fs/hfs/Kconfig"
source "fs/hfsplus/Kconfig"
source "fs/befs/Kconfig"
source "fs/bfs/Kconfig"
source "fs/efs/Kconfig"
source "fs/yaffs2/Kconfig"
source "fs/jffs2/Kconfig"
# UBIFS File system configuration

<2>修改內核文件/fs/Makefile,增加下面兩行(在129行附近):

obj-$(CONFIG_GFS2_FS) += gfs2/
obj-$(CONFIG_EXOFS_FS) += exofs/
obj-$(CONFIG_YAFFS_FS) += yaffs2/

<3>在內核文件的fs目錄下創建yaffs2子目錄,然後復制如下文件:

將yaffs2源碼目錄下的Makefile.kernel文件復制為內核fs/yaffs2/Makefile文件。

將yaffs2源碼目錄下的Kconfig文件復制為內核fs/yaffs2/目錄下。

將yaffs2源碼目錄下的*.c、*.h文件(不包括子目錄下的文件)復制為內核fs/yaffs2/目錄下。

Copyright © Linux教程網 All Rights Reserved