nfs掛載android根檔案系統

來源:互聯網
上載者:User

1、在主機(server)上安裝和配置NFS

安裝nfs服務軟體
$sudo apt-get isntall nfs-kernel-server

修改nfs設定檔/etc/exports
$sudo emacs exports
添加下面一行到檔案中:
/srv            *(rw,sync,no_root_squash,no_subtree_check)
/srv是你允許客戶機訪問的檔案路徑,*是你允許的客戶機IP或機器名(用*表示全體客戶都可以訪問),()中的參數是存取控制方式:
ro 唯讀訪問
rw 讀寫訪問
sync 所有資料在請求時寫入共用
async nfs在寫入資料前可以響應請求
secure nfs通過1024以下的安全TCP/IP連接埠發送
insecure nfs通過1024以上的連接埠發送
wdelay 如果多個使用者要寫入nfs目錄,則歸組寫入(預設)
no_wdelay 如果多個使用者要寫入nfs目錄,則立即寫入,當使用async時,無需此設定。
hide 在nfs共用目錄中不共用其子目錄
no_hide 共用nfs目錄的子目錄
subtree_check 如果共用/usr/bin之類的子目錄時,強制nfs檢查父目錄的許可權(預設)
no_subtree_check 和上面相對,不檢查父目錄許可權
all_squash 共用檔案的UID和GID映射匿名使用者anonymous,適合公用目錄。
no_all_squash 保留共用檔案的UID和GID(預設)
root_squash root使用者的所有請求映射成如anonymous使用者一樣的許可權(預設)
no_root_squas root使用者具有根目錄的完全管理存取權限
anonuid=xxx 指定nfs伺服器/etc/passwd檔案中匿名使用者的UID
anongid=xxx 指定nfs伺服器/etc/passwd檔案中匿名使用者的GID

啟動nfs服務
$sudo /etc/init.d/portmap restart
$sudo /etc/init.d/nfs-kernel-server restart

測試nfs服務
$showmount -e
Export list for user:
/srv *

好了到此nfs 的安裝和配置工作已經完成,除了可以掛載Android的根檔案系統外,我們也可以用一下命令將共用檔案掛載到本地磁碟上:
$ sudo mount -t nfs localhostip:/srv /mnt/disk
可以運行mount命令查看是否掛載成功。查看後可以使用以下命令卸載:
$ sudo umount /mnt

2、在/srv中建立和製作android根檔案目錄
$ sudo mkdir nfs
$sudo mv /root_nfs/* /srv/nfs
關於root_nfs的製作請參考文章http://zhougaofeng.ixiezi.com/2010/03/02/android%e7%9a%84%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f%e7%bb%93%e6%9e%84%e5%8f%8a%e5%85%b6%e5%bc%95%e5%af%bc%e8%bf%87%e7%a8%8b/

3、設定u-boot和kernel command參數
>>setenv ipaddr 192.168.1.101
>>setenv serverip 192.168.1.100
>>setenv bootargs root=/dev/nfs rootfstype=nfs rsize=1024,wsize=1024 nfsroot=${serverip}:/srv/nfs/ ip=${ipaddr}:${serverip}::255.255.255.0::eth0:on console=ttyS0,115200 init=/init android video=dovefb:lcd0:1024x600-16@60,lcd1:1024x768-16@60 clcd.lcd0_enable=1 clcd.lcd1_enable=0 pm_disable
>>saveenv
ip和nfsroot根據你實際情況來定。

好了,所有工作都做完了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.