在用制作的yaffs2 文件系统启动内核遇到下面的问题:
Warning: unable to open an initial console.
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel
百度发现有很多朋友都遇到了相同的问题,发现造成Failed to execute /linuxrc的原因有很多种比如:
1、linuxrc的权限问题没有设为可执行文件,在制作根文件系统时,最好 chmod 777 linuxrc 一下,以免出现Failed to execute /linuxrc的麻烦。
2、在安装busybox的时候,没有静态编译链接库。解决方法,在busybox选项中选择静态编译,或者将交叉编译器中的lib/目录下的链接库 cp到根文件系统下的 lib/目录下,这样做出来的文件系统往往较大。
3、yaffs2 文件系统被烧写到了错误的分区。yaffs2 文件系统文件系统应烧写在nand的root分区下。
4、如果你是用的是uboot,你是否用对了yaffs的烧写指令,nand write.yaffs 而不是 nand write ,另外你的uboot是否正确修改了yaffs文件系统的烧写支持。
5、mkyaffs2image工具 做的是否成功?
如果你碰到了这个问题,原因不外乎以上几种,如果您还碰到其他导致相同问题的错误,希望您能在百忙之中留言,一同讨论。
我遇到的错误
Warning: unable to open an initial console.
Failed to execute /linuxrc. Attempting defaults...
提示使问题指向很明显,Warning: unable to open an initial console.这个提示说命名系统找不到/dev/ 下的console这个设备文件。但是我已经在制作文件系统时把这个设备文件创建好了,可见系统根本没有发现我的文件系统。 后来找到原因我用了nand write 。。。
改正用nand write.yaffs 指令却又出现文件系统烧写位置全是坏块的问题
用uboot都无法擦除
NAND erase: device 0 offset 0x560000, size 0xc00000
Skipping bad block at 0x00580000
Skipping bad block at 0x005a0000
Skipping bad block at 0x005c0000
Skipping bad block at 0x005e0000
Skipping bad block at 0x00600000
Skipping bad block at 0x00620000
Skipping bad block at 0x00640000
Skipping bad block at 0x00660000
Skipping bad block at 0x00680000
Skipping bad block at 0x006a0000
Skipping bad block at 0x006c0000
Skipping bad block at 0x006e0000
Skipping bad block at 0x00700000
Skipping bad block at 0x00720000
Skipping bad block at 0x00740000
Skipping bad block at 0x00760000
Skipping bad block at 0x00780000
Skipping bad block at 0x007a0000
Skipping bad block at 0x007c0000
Skipping bad block at 0x007e0000
Skipping bad block at 0x00800000
Skipping bad block at 0x00820000
Skipping bad block at 0x00840000
Skipping bad block at 0x00860000
Skipping bad block at 0x00880000
Skipping bad block at 0x008a0000
Skipping bad block at 0x008c0000
Skipping bad block at 0x008e0000
Skipping bad block at 0x00900000
Skipping bad block at 0x00920000
Skipping bad block at 0x00940000
Skipping bad block at 0x00960000
Skipping bad block at 0x00980000
Skipping bad block at 0x009a0000
Skipping bad block at 0x009c0000
Skipping bad block at 0x009e0000
Skipping bad block at 0x00a00000
Skipping bad block at 0x00a20000
Skipping bad block at 0x00a40000
Skipping bad block at 0x00a60000
Skipping bad block at 0x00a80000
Skipping bad block at 0x00aa0000
Skipping bad block at 0x00ac0000
Skipping bad block at 0x00ae0000
Skipping bad block at 0x00b00000
Skipping bad block at 0x00b20000
Skipping bad block at 0x00b40000
Skipping bad block at 0x00b60000
Skipping bad block at 0x00b80000
Skipping bad block at 0x00ba0000
Skipping bad block at 0x00bc0000
Skipping bad block at 0x00be0000
Skipping bad block at 0x00c00000
Skipping bad block at 0x00c20000
Skipping bad block at 0x00c40000
Skipping bad block at 0x00c60000
Skipping bad block at 0x00c80000
Skipping bad block at 0x00ca0000
Skipping bad block at 0x00cc0000
Skipping bad block at 0x00ce0000
Skipping bad block at 0x00d00000
Skipping bad block at 0x00d20000
Skipping bad block at 0x00d40000
Skipping bad block at 0x00d60000
Skipping bad block at 0x00d80000
Skipping bad block at 0x00da0000
Skipping bad block at 0x00dc0000
Skipping bad block at 0x00de0000
Skipping bad block at 0x00e00000
Skipping bad block at 0x00e20000
Skipping bad block at 0x00e40000
Skipping bad block at 0x00e60000
Skipping bad block at 0x00e80000
Skipping bad block at 0x00ea0000
Skipping bad block at 0x00ec0000
Skipping bad block at 0x00ee0000
Skipping bad block at 0x00f00000
Skipping bad block at 0x00f20000
Skipping bad block at 0x00f40000
Skipping bad block at 0x00f60000
Skipping bad block at 0x00f80000
Skipping bad block at 0x00fa0000
Skipping bad block at 0x00fc0000
Skipping bad block at 0x00fe0000
Skipping bad block at 0x01000000
Skipping bad block at 0x01020000
Skipping bad block at 0x01040000
Skipping bad block at 0x01060000
Skipping bad block at 0x01080000
Skipping bad block at 0x010a0000
Skipping bad block at 0x010c0000
Erasing at 0x1140000 -- 100% complete.
OK
只好 nand scrub了
又出现新的问题了 为什么会出现坏块,nand write.yaffs 没修改好 还是mkyaffs2image工具问题。一个一个排除
换了一个mkyaffs2image 重做文件系统,nand write.yaffs nand bad 提示
Device 0 bad blocks:
0abe0000
0cf20000
0ff80000
OK 可见nand write.yaffs 没问题 启动
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
block 1333 is bad
block 1615 is bad
block 2002 is bad
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: New USB device found, idVendor=058f, idProduct=9254
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: Generic USB Hub
usb 1-1: Manufacturer: ALCOR
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
Freeing init memory: 120K
Failed to execute /rootfs/linuxrc. Attempting defaults...
Processing /etc/profile... Done
# ls
bin lib mnt sys var
dev linuxrc proc tmp
etc lost+found sbin usr
系统启动成功,可见是我制作的mkyaffs2image工具有问题,另外Failed to execute /rootfs/linuxrc 内核linuxrc路径 配置错了。
修改 问题解决。