關於啟動ubuntu中的nfs啟動問題


嵌入式開發,如果使用nfs掛載來啟動內核和文件系統,這樣便於調試文件系統和驅動,則首先要保證ubuntu開啟nfs服務,

執行以下命令安裝nfs服務,安裝后自動運行

sudo apt-get install nfs-kernel-server

配置其配置文件

sudo vi /etc/exports 在里面增加想要掛載的文件路徑

#
11 /work/nfs_root *(rw,sync,no_root_squash)
12 /work/nfs_root/first_fs *(rw,sync,no_root_squash)
13 /work/kernel *(rw,sync,no_root_squash)
14 /work/nfs_root/fs_qtopia *(rw,sync,no_root_squash)
15 /work/system/u-bootbin *(rw,sync,no_root_squash)
16 / *

 其中"*"表示所有客戶機都可以訪問(只要能通過網絡訪問到你)

      rw當然表示有讀寫權限(不要擔心)

      no_root_squash表示客戶機對此目錄有root操作權限

這樣就可以通過nfs服務來掛載nfs_root,kernel等目錄下的所有文件;

 配置完畢,可以重啟NFS服務

       sudo /etc/init.d/portmap restart      //nfs is a RPC service, portmap maps its port

       sudo /etc/init.d/nfs-kernel-server restart

   

       查看NFS目錄可以使用  ”showmount -e“ 命令

測試NFS服務是否開啟成功

      在本機ubuntu(10.13.60.120)上掛載nfs目錄到/mnt,(掛載未在/etc/exports里面添加的目錄是無效的)

      sudo mount -t nfs 10.13.60.120:/home

      可以看到/mnt下已經有/home的內容了 ,卸載使用 umount /mnt命令即可

 

通常,為了能夠正常使用NFS,還需要一些相關的服務來協同工作:
nfs:啟動相應RPC服務進程來服務對於NFS文件系統的請求。
nfslock:一個可選的服務,用於啟動相應的RPC進程,允許NFS客戶端在服務器上對文件加鎖。
portmap:Linux的RPC服務,它響應RPC服務的請求和與請求的RPC服務建立連接。

 

問題:當我把u-boot中關於nfs掛載參數設置好后,一直出現如下錯誤:

Booting Linux ...
ERROR: resetting DM9000 -> not responding
dm9000 i/o: 0x20000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
could not establish link
File transfer via NFS from server 10.13.62.120; our IP address is 10.13.62.100
Filename '/work/kernel/uImage'.
Load address: 0x30007fc0
Loading: Timeout
## Booting image at 30007fc0 ...
Bad Magic Number

 

問題是這樣解決的:因為我的ubuntu沒有開啟portmap功能

sudo /etc/init.d/portmap restart 

開啟后再重新啟動nfs系統就可以正常掛載ubuntu中的內核

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM