移植Linux操作系統時候遇到的問題

1.Kernel panic - not syncing: Attempted to kill init! 

  上網搜索了一些相關信息,找到了解決問題的途徑。 原因在於:編譯內核和busybox使用的編譯器是arm-linux-gcc 4.3.2,而這個編譯器默認是打開“EABI選項”的,這樣編譯出來的busybox就是EABI的。但是內核編譯的時候,默認是把“EABI選項”關掉的。所以busybox和內核無法正常配合。把“EABI選項”打開,重新編譯內核後,一切正常。
Kernel Features  ---> 
[*] Use the ARM EABI to compile the kernel 
[*]   Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (NEW)

---------------------------------------------------------------------------------
2.啓動時提示:cannot run '/etc/init.d/rcS': Permission denied
RAMDISK: gzip image found at block 0                                            
VFS: Mounted root (ext2 filesystem) on device 1:0.                              
Freeing init memory: 120K                                                       
cannot run '/etc/init.d/rcS': Permission denied    
(none) login: 
 ---rcS需要有執行權限,chmod 777 rcS後就好了。    
                        
------------------------------------------------------------------------
3.啓動時提示輸入登錄用戶及密碼:(none) login: 
RAMDISK: gzip image found at block 0                                            
VFS: Mounted root (ext2 filesystem) on device 1:0.                              
Freeing init memory: 120K                                                       
(none) login:      
-----要求登錄認證,我把inittab裏的::respawn:-/bin/sh去掉之後就沒有了

--------------------------------------------------------------------------------
4.提法不能運行文件,是因爲shell腳本有非法字符(肉眼看不到,其實不是空格)
RAMDISK: gzip image found at block 0                                            
VFS: Mounted root (ext2 filesystem) on device 1:0.                              
Freeing init memory: 120K                                                       
cannot run '/etc/init.d/rcS': No such file or directory    
--------rcS是shell腳本文件,我是從網上拷的,所以在行尾可能有多餘的非法字符,手動輸入後,就開始執行rcS文件的內容了。                

--------------------------------------------------------------------
5.進不了shell,呈死機狀態
::askfirst:/bin/sh 
我在inittab里加上這一句就好了。

-----------------------------------------------------------------------
6.有兩個文件找不到:
mount: mounting tmpfs on /dev/shm failed: No such file or directory             
mount: mounting devpts on /dev/pts failed: No such file or directory 
我們之前建立文件系統的目錄結構的時候沒有建立這兩個目錄,重新建一下就好了。

---------------------------------------------------------------------------
7.出現提示:/bin/sh: can't access tty; job control turned off 
Please press Enter to activate this console.                                    
/bin/sh: can't access tty; job control turned off 
其實只要有這個-表示該shell是login shell就行了。busybox inittab的id字段是用來標識tty的,如果沒有明確指明就是tty1即console。
把::askfirst:/bin/sh改爲:::askfirst:-/bin/sh
可以看看busybox的examples目錄下的例子就明白了。

----------------------------------------------------------------
8.通過啓啓信息發現,profile文件沒有執行
::askfirst:/bin/sh加了“-”之後,沒有執行profile文件的問題也解決了。

-----------------------------------------------------------------
9.在busybox裏設置setenv時,分號“;"輸入之後,後面的內容就設置不到環境變量裏。
  解決方法是:在分號前加反斜槓"\"!
             算是一個有用的小技巧吧

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章