mini2440在烧写uboot,kernel和根文件系统后,启动程序,无法进入系统,从启动日志如下:
Creating 5 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
*****************************************************(此处被省略君占领)
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 160K
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
Backtrace:
[<c0034b78>] (dump_backtrace+0x0/0x12c) from [<c0034cbc>] (dump_stack+0x18/0x1c)
r7:00000000 r6:c002077c r5:c04a32ac r4:c04a2a54
[<c0034ca4>] (dump_stack+0x0/0x1c) from [<c0048b4c>] (panic+0x40/0x120)
one_wire_status: 2
[<c0048b0c>] (panic+0x0/0x120) from [<c00305a8>] (init_post+0xac/0x11c)
r3:c3823ee8 r2:00000000 r1:c054a060 r0:c03f6b20
[<c00304fc>] (init_post+0x0/0x11c) from [<c0008a6c>] (kernel_init+0xf0/0x120)
one_wire_status: 3
r4:c04a2a58
[<c000897c>] (kernel_init+0x0/0x120) from [<c004b238>] (do_exit+0x0/0x618)
r6:00000000 r5:00000000 r4:00000000
原因定位:
从日志看,大致是由于挂载根文件系统时出现了问题。经过确认,是由于烧写根文件系统出现了问题。通过uboot的命令行方式,查看到我的uboot的分区是
uboot(offset:0,size:0x00040000)
params(offset:0x00040000,size:0x00020000)
kernel(offset:0x00060000,0x00400000)
root(offset:0x00460000,size:----)
对比内核打印的日志:
Creating 5 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
很明显是uboot和内核分区不一致。我在烧写都是通过dnw的(非dnw的命令行方式),dnw根据uboot,烧写各分区数据,由于uboot中内核分区是4M,导致我烧写的根文件系统其实位置是0x00460000。而内核启动后去挂载根文件系统时,是去读取自己的分区数据,从0x00560000位置开始读取,导致读取不到完整的根文件系统而卡死。
解决方案:
保证uboot分区和内核分区分区相同。由于我是菜鸟,对相对于uboot和内核分区,我比较熟悉uboot的内核分区的位置,于是,我修改了我的uboot源码,具体位置在include/configs/100ask24x0.h(文件名根据自己编译的产品不同会改变)中的