linux3.01 yaffs2补丁,AT91SAM9261EK Linux 3.10.12 yaffs2 移植成功

经过测试,发现最新版本的yaffs2很容易移植到Linux 2.xx与Linux 3.xx的版本上。

我使用Linux 3.10.12之前的版本,打上yaffs2最新版本补丁后,直接编译通过。但Linux 3.10.12却提示错误:

fs/yaffs2/yaffs_vfs.c: In function 'init_yaffs_fs':

fs/yaffs2/yaffs_vfs.c:3398: error: implicit declaration of function 'create_proc_entry'

fs/yaffs2/yaffs_vfs.c:3399: warning: assignment makes pointer from integer without a cast

fs/yaffs2/yaffs_vfs.c:3402: error: dereferencing pointer to incomplete type

fs/yaffs2/yaffs_vfs.c:3403: error: dereferencing pointer to incomplete type

fs/yaffs2/yaffs_vfs.c:3404: error: dereferencing pointer to incomplete type

make[2]: * [fs/yaffs2/yaffs_vfs.o] Error 1

make[1]: * [fs/yaffs2] Error 2

make: * [fs] Error 2

经过查找并搜索相应的代码,发现内核改了。

create_proc_entry()/create_proc_read_entry() are killed off; use proc_create().

因此需要用:proc_create来代替原来的:

# gedit ./fs/yaffs2/yaffs_vfs.c

#ifdef YAFFS_NEW_PROCFS

static int yaffs_proc_show(struct seq_file *m, void *v)

{

/* FIXME: Unify in a better way? */

char buffer[512];

char *start;

int len;

len = yaffs_proc_read(buffer, &start, 0, sizeof(buffer), NULL, NULL);

seq_puts(m, buffer);

return 0;

}

static int yaffs_proc_open(struct inode *inode, struct file *file)

{

return single_open(file, yaffs_proc_show, NULL);

}

static struct file_operations procfs_ops = {

.owner = THIS_MODULE,

.open  = yaffs_proc_open,

.read  = seq_read,

.write = yaffs_proc_write,

};

static int yaffs_procfs_init(void)

{

/* Install the proc_fs entries */

my_proc_entry = proc_create("yaffs",

S_IRUGO | S_IFREG,

YPROC_ROOT,

&procfs_ops);

if (my_proc_entry) {

return 0;

} else {

return -ENOMEM;

}

}

#else

static int yaffs_procfs_init(void)

{

/* Install the proc_fs entries */

my_proc_entry = create_proc_entry("yaffs",

S_IRUGO | S_IFREG,

YPROC_ROOT);

if (my_proc_entry) {

my_proc_entry->write_proc = yaffs_proc_write;

my_proc_entry->read_proc = yaffs_proc_read;

my_proc_entry->data = NULL;

return 0;

} else {

return -ENOMEM;

}

}

#endif

因此,只要打开编译开关 YAFFS_NEW_PROCFS 即可!经过进一步搜索:YAFFS_NEW_PROCFS,发现有版本宏控制,因此修改如下:

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))        /* edit here use NEW PROCFS */

#define YAFFS_NEW_PROCFS

#include

#endif

把:KERNEL_VERSION(3,12,0)->KERNEL_VERSION(3,10,0))这里因为在3.10版本里,已经使用 YAFFS_NEW_PROCFS了。

修改后,就可以正常编译并下载成功了。

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值