- kernel打patch支持yaffs2文件格式
参考:http://www.cnblogs.com/lixiaoming90/p/3776292.html
进入解压后的文件夹,在该执行目录下会有yaffs2文件夹,进入该文件夹。
$ ./patch-ker.sh c m ../../kernel/test/linux-3.14.4
Updating../../kernel/test/linux-3.14.4/fs/Kconfig
Updating../../kernel/test/linux-3.14.4/fs/Makefile
有以上两个信息,说明已经打好补丁,并且在fs/目录下,多了yaffs2文件夹,其实这是从yaffs2文件夹中复制过来的。
下面配置内核,在linux目录下makemenuconfig
我们发现在File system—>Miscellaneous filesystems—>下面并找不到yaffs2选项。原来是这样的
查看YAFFS2的Kconfig文件,需要先选择MTD_BLOCK才会有显示YAFFS2
#
# yaffs file system configurations
#
config YAFFS_FS
tristate "yaffs2 file system support"
default n
depends on MTD_BLOCK
select YAFFS_YAFFS1
select YAFFS_YAFFS2
help
也就说需要先选择DeviceDrivers-->MTD-->Caching block device access to MTD devices,然后才能够在FileSystems--->Miscellaneous filesystem下面找到YAFFS2。
好的,配置完后,这下要执行make clean;make Image了。剩下的工作就是解决一大堆编译错误了!!!!
Q: error: incompatibletypes when assigning to type ‘kuid_t’ from type ‘u32’
A:编译过程出现太多兼容性问题,将uid_t/gid_t/u32修改为兼容的kuid_t/kgid_t;
uid_t uid(xx_uid); ->kuid_t uid(xx_uid);
gid_t gid(xx_gid); ->kgid_t gid(xx_gid);
u32 uid; ->kuid_t uid;
u32 gid; ->kgid_t gid;
Q:error: incompatibletypes
oh->yst_uid= swap_u32(oh->yst_uid);
A://yaffs_endian.c中
voidyaffs_do_endian_oh(struct yaffs_dev *dev, struct yaffs_obj_hdr *oh)
{
if(!dev->swap_endian)
return;
/*Change every field */
oh->type= swap_u32(oh->type);
oh->parent_obj_id= swap_u32(oh->parent_obj_id);
oh->yst_mode= swap_u32(oh->yst_mode);
#if 0
oh->yst_uid= swap_u32(oh->yst_uid);
oh->yst_gid= swap_u32(oh->yst_gid);
#endif
oh->yst_atime= swap_u32(oh->yst_atime);
oh->yst_mtime= swap_u32(oh->yst_mtime);
oh->yst_ctime= swap_u32(oh->yst_ctime);
oh->file_size_low= swap_u32(oh->file_size_low);
oh->equiv_id= swap_u32(oh->equiv_id);
oh->yst_rdev= swap_u32(oh->yst_rdev);
Q:error: implicitdeclaration of function ‘create_proc_entry’[-Werror=implicit-function-declaration]
A:**/yaffs2/yaffs_vfs.c
static const struct file_operations yaffs_fops = {
.owner = THIS_MODULE,
.read =yaffs_proc_read,
.write =yaffs_proc_write,
};
/*end*/
staticint __init init_yaffs_fs(void)
{
interror = 0;
structfile_system_to_install *fsinst;
yaffs_trace(YAFFS_TRACE_ALWAYS,
"yaffsbuilt " __DATE__ " " __TIME__ " Installing.");
mutex_init(&yaffs_context_lock);
my_proc_entry = proc_create("yaffs",S_IRUGO |S_IFREG, YPROC_ROOT, &yaffs_fops);
#if 0
/*Install the proc_fs entries */
my_proc_entry= create_proc_entry("yaffs",
S_IRUGO | S_IFREG, YPROC_ROOT);
#endif
if(my_proc_entry) {
#if 0
my_proc_entry->write_proc= yaffs_proc_write;
my_proc_entry->read_proc= yaffs_proc_read;
my_proc_entry->data= NULL;
#endif
}else {
return-ENOMEM;
}
/*end*/
/*Now add the file system entries */
fsinst= fs_to_install;
Q:error: incompatibletype for argument 5 of ‘yaffs_create_obj’
A:**/yaffs2/yaffs_guts.c
/*yaffs_link_obj returns the object id of the equivalent object.*/
structyaffs_obj *yaffs_link_obj(struct yaffs_obj *parent, const YCHAR * name,
struct yaffs_obj *equiv_obj)
{
/*Get the real object in case we were fed a hard link obj */
equiv_obj= yaffs_get_equivalent_obj(equiv_obj);
if(yaffs_create_obj(YAFFS_OBJECT_TYPE_HARDLINK,
parent,name, 0, KUIDT_INIT(0), KGIDT_INIT(0),
equiv_obj,NULL, 0))
returnequiv_obj;
returnNULL;
}