DM814x掛載網絡文件系統失敗

一、內核打印

CPSW phy found : id is : 0x1cc912
PHY 0:00 not found
IP-Config: Complete:
     device=eth0, addr=192.168.0.33, mask=255.255.255.0, gw=192.168.0.1,
     host=192.168.0.33, domain=, nis-domain=(none),
     bootserver=192.168.0.1, rootserver=192.168.0.150, rootpath=
PHY: 0:01 - Link is Up - 1000/Full
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00             128 mtdblock0  (driver?)
1f01            2304 mtdblock1  (driver?)
1f02             128 mtdblock2  (driver?)
1f03            4352 mtdblock3  (driver?)
1f04          107520 mtdblock4  (driver?)
1f05           12288 mtdblock5  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
Backtrace:
[<c004bf70>] (dump_backtrace+0x0/0x110) from [<c038ef44>] (dump_stack+0x18/0x1c)
 r6:00008000 r5:c4770000 r4:c0500b58 r3:60000013
[<c038ef2c>] (dump_stack+0x0/0x1c) from [<c038efa4>] (panic+0x5c/0x178)
[<c038ef48>] (panic+0x0/0x178) from [<c0009184>] (mount_block_root+0x1c4/0x204)
 r3:00000000 r2:00000000 r1:c4425f58 r0:c0448c15
 r7:c0448c79
[<c0008fc0>] (mount_block_root+0x0/0x204) from [<c0009358>] (mount_root+0xac/0xcc)
[<c00092ac>] (mount_root+0x0/0xcc) from [<c00094e4>] (prepare_namespace+0x16c/0x1cc)
 r4:c0500024
[<c0009378>] (prepare_namespace+0x0/0x1cc) from [<c0008d70>] (kernel_init+0x114/0x154)
 r5:c002d0ac r4:c002d0ac
[<c0008c5c>] (kernel_init+0x0/0x154) from [<c00731d4>] (do_exit+0x0/0x5d0)
 r5:c0008c5c r4:00000000



二、問題背景

   筆者用百兆網線連接板子的時候,可以進入文件系統,這也隱含說明,筆者的網絡文件系統是

沒有問題的;但是用千兆網線連接板子的時候,內核啓動的時候會卡在掛載網絡文件系統的那一步。

見(一、內核打印)中打印的信息。

   筆者使用的網卡不是TI官方原理圖上的那個網卡,是我們後換了個網卡(RTL8211CL),所以剛

開始懷疑可能是內核網卡驅動對我們這款網卡千兆支持有問題,所以費了點時間熟悉了下RTL8211CL,並結合內核代碼去分析。後來筆者在 genphy_read_status()這個函數跟蹤打印中,有了點突破性

的發現,這個函數在drivers/net/phy/phy_device.c 。本來在百兆網線連接的環境下,因爲打印

也出現了卡住問題(見:一、內核打印),後來思考問題可能網卡哪邊初始化太遲,導致在掛載

網絡文件系統的時候,還未完成,就導致了這卡住的問題,順着這個思路,進行了一些測試,最後

問題解決了。


三、問題分析

   去分析 init/main.c 、init/do_mounts.c 、net/phy/phy_device.c 文件中相關代碼。


四、解決方法

   方法一、在啓動參數 bootargs 中添加 rootdelay=2 即可;

   方法二、在內核代碼init/main.c文件中,有個kernel_init()函數,在此函數中以下代碼

           位置添加一個延時兩秒 ssleep(2),注意包含頭文件 #include <linux/delay.h>;

if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
    ramdisk_execute_command = NULL;
    ssleep(2);//延時兩秒左右
    prepare_namespace();
}


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