idea6410 linux3.6.6的yaffs移植

其实移植yaffs还是比较简单,代码编译还是挺顺利的,但是我碰到了第一次烧写不能启动,的重新烧写内核才行,刚开始移植认为是Ecc校验有问题,查了好久,今天来了灵感,在烧写是突然想到内核是多大,超过了2M,唉,这个问题纠结了好久啊~终于解决了~

第一步,我们需要YAFFS2的源码,如果大家有兴趣想了解YAFFS2文件系统的驱动原理的话可以直接去访问他们的官网,地址是

下载是有两种方法:一种用git,还有一种直接下载~不过直接下载可能打不开

第二步,将下载下来的YAFFS2最新源码 YAFFS2.tar.gz 放入你Linux的任意一个目录下,执行 tar zxvf YAFFS2.tar.gz 然后进入YAFFS2源码包,由于最新的源码再执行脚本 patch-ker.sh(具体方法见此目录下README-linux-patch) 时 有四个参数,可以追加:c,l,m,s,
./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
上面这段英文应该很好懂吧,简而言之,C 是复制文件,L是链接文件,M是多种,S是单个的
xiao@urbetter-Ubuntu:~/linux-3.6.6$ ./patch-ker.sh c m ../linux-3.6.6    即可!
 
第三步:配置(make menuconfig)
 Device Drivers  --->
 <*> Memory Technology Device (MTD) support  --->
                    <*>  Direct char device access to MTD devices                                              | | 
  | |                    -*-  Common interface to block layer for MTD 'translation layers'                          | | 
  | |                    <*>  Caching block device access to MTD devices
 File systems  --->
[*] Miscellaneous filesystems  --->
<*>  yaffs2 file system support                                                            | | 
  | |                    -*-    512 byte / page devices                                                            | | 
  | |                    [ ]      Use older-style on-NAND data format with pageStatus byte                          | | 
  | |                    [ ]        Lets yaffs do its own ECC                                                      | | 
  | |                    -*-    2048 byte (or larger) / page devices                                                | | 
  | |                    [*]      Autoselect yaffs2 format                                                          | | 
  | |                    [ ]      Disable yaffs from doing ECC on tags by default                                  | | 
  | |                    [ ]    Force chunk erase check                                                            | | 
  | |                    [ ]    Empty lost and found on boot                                                        | | 
  | |                    [ ]    Disable yaffs2 block refreshing                                                    | | 
  | |                    [ ]    Disable yaffs2 background processing                                                | | 
  | |                    [*]    Enable yaffs2 xattr support
 
 
第四步:编译
fs/yaffs2/yaffs_vfs.c:438: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:439: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:443: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:445: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:478: error: unknown field 'write_super' specified in initializer  (在fs.h中的struct super_operations中添加 void (*write_super) (struct super_block *); )
fs/yaffs2/yaffs_vfs.c:478: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_evict_inode':
fs/yaffs2/yaffs_vfs.c:873: error: implicit declaration of function 'end_writeback'                                          (此函数改为了clear_inode)
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_do_sync_fs':
fs/yaffs2/yaffs_vfs.c:2203: error: 'struct super_block' has no member named 's_dirt'                            (新版中去掉了这个函数,你可以选择去掉,当然我选着了定义此函数)
fs/yaffs2/yaffs_vfs.c:2214: error: 'struct super_block' has no member named 's_dirt'              在fs.h的struct super_block中添加unsigned char  s_dirt;
fs/yaffs2/yaffs_vfs.c:2216: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_put_super':
fs/yaffs2/yaffs_vfs.c:2506: error: 'struct mtd_info' has no member named 'sync'                      添加下划线
fs/yaffs2/yaffs_vfs.c:2507: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_touch_super':
fs/yaffs2/yaffs_vfs.c:2523: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
fs/yaffs2/yaffs_vfs.c:2699: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2700: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2701: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2702: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2703: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2704: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2705: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2729: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2730: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2731: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2754: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2756: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2756: error: 'struct mtd_info' has no member named 'write_oob'                  (上面都添加下划线_)
fs/yaffs2/yaffs_vfs.c:2946: error: implicit declaration of function 'd_alloc_root'                                (此函数改为d_make_root)
fs/yaffs2/yaffs_vfs.c:2946: warning: assignment makes pointer from integer without a cast
fs/yaffs2/yaffs_vfs.c:2955: error: 'struct super_block' has no member named 's_dirt'
make[2]: *** [fs/yaffs2/yaffs_vfs.o] 错误 1
make[1]: *** [fs/yaffs2] 错误 2
make: *** [fs] 错误 2
其他错一般都是添加下划线即可!
第五步:烧写
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
Freeing init memory: 156K

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/362ad63bb83982bd632adc8ab9e66f81.html