yaffs2 檔案系統 核心啟動時 Failed to execute /linuxrc. 問題的解決
在用製作的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路徑 配置錯了。
修改 問題解決。