通过修改mkyaffs2image,可以正确烧写了,就是修改write_chunk函数中的shuffle_oob(spareData, &pt);为shuffle_oob(spareData + 2, &pt);
让OOB位置右移2个字节。现在内核仍然无法加载,也许是内核OOB布局的问题。内核最终停在:
yaffs: dev is 32505861 name is "mtdblock5" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs2 filesystem) on device 31:5.
devtmpfs: error mounting -2
Freeing unused kernel memory: 148K (803ab000 - 803d0000)
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.60 #33
[<80012d58>] (unwind_backtrace+0x0/0xf8) from [<80010c54>] (show_stack+0x10/0x14)
[<80010c54>] (show_stack+0x10/0x14) from [<8029d6c8>] (panic+0x8c/0x1d8)
[<8029d6c8>] (panic+0x8c/0x1d8) from [<8029c9c8>] (kernel_init+0xc0/0xe4)
[<8029c9c8>] (kernel_init+0xc0/0xe4) from [<8000e0d8>] (ret_from_fork+0x14/0x3c)
而且这时重启用nand dump去检查文件系统分区的数据会发现全部变成0xff了。
我现在内核关闭了硬件ecc功能,并且修改了vim drivers/mtd/nand/s3c2410.c中的NAND_ECC_SOFT为NAND_ECC_NONE。
内核也配置了采用yaffs ecc选项,照理说这时oob布局会采用mtd默认的nand_oob_64,应该没问题了:
static struct nand_ecclayout nand_oob_64 = {
.eccbytes = 24,
.eccpos = {
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63},
.oobfree = {
{.offset = 2,
.length = 38} }
};
0~1前2个字节作为坏块标记,2~39作为yaffs的OOB区域,剩下是yaffs ECC校验信息,应该没问题了啊
但是依然不能正常启动,实在想不通还有什么问题。