s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
nand: Samsung NAND 256MiB 3,3V 8-bit
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Creating 5 MTD partitions on "nand":
0x000000000000-0x000000040000 : "supervivi"
__nand_correct_data: uncorrectable ECC error
0x000000040000-0x000000060000 : "param"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "Kernel"
ftl_cs: FTL header not found.
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "nand" -- size truncated to 0xfaa0000
ftl_cs: FTL header not found.
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "nand" -- size truncated to 0x10000000
__nand_correct_data: uncorrectable ECC error
发现开发板已经可以识别nand flash的信息,但是打印出如下信息:
ftl_cs: FTL header not found.
解决方法如下:在内核根目录下执行make menuconfig,进入
Device Drivers ->
Memory Technology Devices (MTD) ->
去掉如下选项
<>FTL (Flash Translation Layer) support
<> NFTL (NAND Flash Translation Layer) support
<>INFTL (Inverse NAND Flash Translation Layer) support
保存后重新编译即可。
1.6到目前为止已经完成了对nand flash的支持,但是因为缺少根文件系统,内核依旧无法正常启动。接下去我们将为内核添加对yaffs2的支持。
在终端下执行#git clone git://www.aleph1.co.uk/yaffs2 获取最新的yaffs2源码。同步完后,进入yaffs2目录,执行# ./patch-ker.sh c m 内核源码路径,既可对内核打上yaffs2的补丁。进入内核目录,执行make menuconfig
选择File systems --->
[*] Miscellaneous filesystems --->
│ yaffs2 file system support
保存后退出,重新编译,此时会遇到几个错误,因为新版的Linux内核有一些对文件操作的函数进行了修改,我们需要按照错误逐一进行修改。按照错误:
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_readpage_nolock':
fs/yaffs2/yaffs_vfs.c:286: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_hold_space':
fs/yaffs2/yaffs_vfs.c:484: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_release_space':
fs/yaffs2/yaffs_vfs.c:502: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_write':
fs/yaffs2/yaffs_vfs.c:594: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c:606: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_flush':
fs/yaffs2/yaffs_vfs.c:730: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c:741: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_sync_object':
fs/yaffs2/yaffs_vfs.c:771: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: At top level:
fs/yaffs2/yaffs_vfs.c:781: error: 'generic_file_aio_read' undeclared here (not in a function)
fs/yaffs2/yaffs_vfs.c:782: error: 'generic_file_aio_write' undeclared here (not in a function)
fs/yaffs2/yaffs_vfs.c:787: error: 'generic_file_splice_write' undeclared here (not in a function)
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_iterate':
fs/yaffs2/yaffs_vfs.c:1719: error: 'struct file' has no member named 'f_dentry'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_flush_inodes':
fs/yaffs2/yaffs_vfs.c:2190: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_flush_super':
fs/yaffs2/yaffs_vfs.c:2203: error: too few arguments to function 'yaffs_flush_whole_cache'
打开/fs/yaffs2/yaffs_vfs.c,使用替换功能,将代码中的所有f_dentry均替换为f_path.dentry,将所有的yaffs_flush_file(obj, 1, 0);替换为yaffs_flush_file(obj, 1, 0,1);将yaffs_flush_file(obj, 1, datasync);替换为yaffs_flush_file(obj, 1, datasync,1);将yaffs_flush_file(obj, 1, 0);替换为yaffs_flush_file(obj, 1, 0,1);yaffs_flush_whole_cache(dev);替换为yaffs_flush_whole_cache(dev,1);
718行附近
-.read = do_sync_read,
-.write = do_sync_write,
+.read = new_sync_read,
+.write = new_sync_write,
-.aio_read = generic_file_aio_read,
-.aio_write = generic_file_aio_write,
+ .read_iter =generic_file_read_iter,
+ .write_iter =generic_file_write_iter,
-.splice_write = generic_file_splice_write,
+.splice_write = iter_file_splice_write,
保存后重新编译,下载内核至开发板,同时烧录文件系统(为了测试方便,这次我先使用友善提供的制作好的文件系统root_qtopia.img在以后的教程中我们也会制作自己的文件系统),重启开发板,看到如下引导信息
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 3.19.3 (root@ginger-virtual-machine) (gcc version 4.4.3 (ctng-1.6.1) ) #6 Sat Apr 25 13:37:14 CST 2015
[1] [2]