哎呀,睡了一晚了,也该工作了
昨天我们遇到的问题是yaffs2编译出错,现在我们来修改源码解决它。
出现错误的原因显然是应为版本不兼容,API接口有出路。我们昨天下载的文件系统代码是最新的,但是人家不是为3.10.102版的linux做的,所以要理解
经过测试,只要修改 Yaffs_nfs.c 一个文件就可以了
1.
将yaffs_proc_write函数的原型修改为
- static ssize_t yaffs_proc_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
复制代码
2.
修改这个函数:
- 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;
- }
- }
复制代码
为:
- #include
- 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)
- {
- my_proc_entry = proc_create("yaffs",
- S_IRUGO | S_IFREG,
- YPROC_ROOT,
- &procfs_ops);
- #endif
- if (my_proc_entry) {
- return 0;
- } else {
- return -ENOMEM;
- }
- }
复制代码
再执行:
- CHK include/generated/uapi/linux/version.h
- CHK include/generated/utsrelease.h
- make[1]: “include/generated/mach-types.h”是最新的。
- CALL scripts/checksyscalls.sh
- CC scripts/mod/devicetable-offsets.s
- GEN scripts/mod/devicetable-offsets.h
- HOSTCC scripts/mod/file2alias.o
- HOSTLD scripts/mod/modpost
- CHK include/generated/compile.h
- CC fs/yaffs2/yaffs_vfs.o
- LD fs/yaffs2/yaffs.o
- LD fs/yaffs2/built-in.o
- LD fs/built-in.o
- LINK vmlinux
- LD vmlinux.o
- MODPOST vmlinux.o
- GEN .version
- CHK include/generated/compile.h
- UPD include/generated/compile.h
- CC init/version.o
- LD init/built-in.o
- KSYM .tmp_kallsyms1.o
- KSYM .tmp_kallsyms2.o
- LD vmlinux
- SORTEX vmlinux
- SYSMAP System.map
- OBJCOPY arch/ARM/boot/Image
- Kernel: arch/arm/boot/Image is ready
- GZIP arch/arm/boot/compressed/piggy.gzip
- AS arch/arm/boot/compressed/piggy.gzip.o
- LD arch/arm/boot/compressed/vmlinux
- OBJCOPY arch/arm/boot/zImage
- Kernel: arch/arm/boot/zImage is ready
复制代码
好了,顺利编译,连警告都没有
0
|
|
|
|
头像被屏蔽
· 2016-7-2 21:58:45
|
|
|
|
|