linux-4.1.15移植yaffs2 之编译

1. download yaffs2源码

git clone git://www.aleph1.co.uk/yaffs2

2. patch到linux4.1.15 内核

cd yaffs2

./patch-ker.sh c m /home/diskf/home/hyj/imx6ul-qt5.6/linux-4.1.15

3. 直接修改目标deconfig文件 后编译进kernel


4. 或是通过make menuconfig 选择yaffs2后保存到.config 后再编译进内核

File systems --->

  Miscellaneous filesystems  --->

   <*>   yaffs2 file system support

5. 编译内核

此时会有很多报错:

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_readpage_nolock':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:309:8: note: in expansion of macro 'yaffs_dentry_to_obj'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
        ^
fs/yaffs2/yaffs_vfs.c:309:28: note: in expansion of macro 'Y_GET_DENTRY'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
                            ^
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_hold_space':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:507:8: note: in expansion of macro 'yaffs_dentry_to_obj'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
        ^
fs/yaffs2/yaffs_vfs.c:507:28: note: in expansion of macro 'Y_GET_DENTRY'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
                            ^
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_release_space':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:525:8: note: in expansion of macro 'yaffs_dentry_to_obj'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
        ^
fs/yaffs2/yaffs_vfs.c:525:28: note: in expansion of macro 'Y_GET_DENTRY'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
                            ^
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_write':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:617:8: note: in expansion of macro 'yaffs_dentry_to_obj'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
        ^
fs/yaffs2/yaffs_vfs.c:617:28: note: in expansion of macro 'Y_GET_DENTRY'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
                            ^
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:629:10: note: in expansion of macro 'Y_GET_DENTRY'
  inode = Y_GET_DENTRY(f)->d_inode;
          ^
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_flush':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:753:26: note: in expansion of macro 'yaffs_dentry_to_obj'
  struct yaffs_obj *obj = yaffs_dentry_to_obj(Y_GET_DENTRY(file));
                          ^
fs/yaffs2/yaffs_vfs.c:753:46: note: in expansion of macro 'Y_GET_DENTRY'
  struct yaffs_obj *obj = yaffs_dentry_to_obj(Y_GET_DENTRY(file));
                                              ^
fs/yaffs2/yaffs_vfs.c: At top level:
fs/yaffs2/yaffs_vfs.c:804:10: error: 'new_sync_read' undeclared here (not in a function)
  .read = new_sync_read,
          ^
fs/yaffs2/yaffs_vfs.c:805:11: error: 'new_sync_write' undeclared here (not in a function)
  .write = new_sync_write,
           ^
fs/yaffs2/yaffs_vfs.c:1063:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
  .getxattr = yaffs_getxattr,
              ^
fs/yaffs2/yaffs_vfs.c:1063:14: note: (near initialization for 'yaffs_file_inode_operations.getxattr')
fs/yaffs2/yaffs_vfs.c:1192:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
  .getxattr = yaffs_getxattr,
              ^
fs/yaffs2/yaffs_vfs.c:1192:14: note: (near initialization for 'yaffs_symlink_inode_operations.getxattr')
fs/yaffs2/yaffs_vfs.c:1674:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
  .getxattr = yaffs_getxattr,
              ^
fs/yaffs2/yaffs_vfs.c:1674:14: note: (near initialization for 'yaffs_dir_inode_operations.getxattr')
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_iterate':
fs/yaffs2/yaffs_vfs.c:260:29: error: 'struct file' has no member named 'f_dentry'
 #define Y_GET_DENTRY(f) ((f)->f_dentry)
                             ^
fs/yaffs2/yaffs_vfs.c:218:39: note: in definition of macro 'yaffs_inode_to_obj_lv'
 #define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
                                       ^
fs/yaffs2/yaffs_vfs.c:225:35: note: in expansion of macro 'yaffs_inode_to_obj'
 #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
                                   ^
fs/yaffs2/yaffs_vfs.c:1806:8: note: in expansion of macro 'yaffs_dentry_to_obj'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
        ^
fs/yaffs2/yaffs_vfs.c:1806:28: note: in expansion of macro 'Y_GET_DENTRY'
  obj = yaffs_dentry_to_obj(Y_GET_DENTRY(f));
                            ^
make[2]: *** [fs/yaffs2/yaffs_vfs.o] Error 1
make[2]: *** Waiting for unfinished jobs....
  CC      fs/fhandle.o
make[1]: *** [fs/yaffs2] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [fs] Error 2

make: *** Waiting for unfinished jobs....

接下来解决报错问题:

1) error: 'struct file' has no member named 'f_dentry'


cd fs/yaffs2

sed 's/f_dentry/f_path.dentry/g' yaffs_vfs.c > yaffs_vfsbak.c

mv yaffs_vfsbak.c yaffs_vfs.c

2) error: 'new_sync_read' undeclared here (not in a function) and error: 'new_sync_write' undeclared here (not in a function)

对比一下fs/ext3/file.c中的51行左右,将fs/yaffs2/yaffs_vfs.c中的804行左右修改如下:4.1.15版本的kernel已经不存在注释掉的两个函数了



这样修改后编译通过。


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值