前邊 已經提到過吧vmare的IP改成了靜態IP,對於上網來說,這個是個麻煩的事。現在重新配置Vmware的IP
VMware-Edit-Virtual network editor

選擇PC機的無線網卡(可以上網),name:VMnet0
2、VMware-VM-Setting-Network adapter

選擇custom-VMnet0
3、在ubuntu系統中編輯網絡:

選擇編輯連接,添加網絡命名無線連接:

如圖配置,然后就可以重現上網了。
配置虛擬機與ARM(am335x開發板)的NFS網絡文件共享方法:
安裝NFS服務器:sudo apt-get install nfs-kernel-server
配置NFS服務器:sudo gedit /etc/exports
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). # # Example for NFSv2 and NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /home/zyr/Source_code/text/nfs 192.168.200.*(rw,sync,no_root_squash)
在最后加上自己共享目錄的路徑。
重啟服務器:
-
sudo /etc/init.d/portmap start
-
sudo /etc/init.d/nfs-kernel-server start
- 若是找不到portmap有可能ubuntu是64位的沒有這個東東(自己猜的),需要重啟這個命令(sudo /etc/init.d/rpcbind restart),再打開步驟2就ok了。
配置ARM(am335x開發板)板的IP,可以在/etc/init.d/rcS中直接配置:
# --------------------------------------------- # Mount the default file systems # --------------------------------------------- echo -n " Mounting other filesystems : " mount -a status $? 0 #######配置網絡################################ echo "config_network : " /sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 /sbin/ifconfig eth0 192.168.200.70 /sbin/ifconfig eth0 netmask 255.255.255.0 /sbin/route add default gw 192.168.200.255 eth0 /sbin/ifconfig eth1 192.168.200.71 netmask 255.255.255.0 /sbin/route add default gw 192.168.200.255 eth1
重新配置VMare的網絡為有線連接1,如圖:


目的是主機IP靜態:192.168.200.123
最后將主機(虛擬機)目錄的/hmoe/zyr/Source_code/text/nfs 掛在開發板上還需要:
[root@zyr-am335x ]#mount -t nfs -o nolock 192.168.200.123:/home/zyr/Source_code/text/nfs /mnt [root@zyr-am335x ]#cd /mnt [root@zyr-am335x mnt]#ls led_test zyr-hello.ko [root@zyr-am335x mnt]#insmod zyr-hello.ko [ 5299.759382] misc-register led_core [root@zyr-am335x mnt]#./led_test Start led test. [ 5309.324907] GPIO LED set low. [ 5310.338522] GPIO LED set high. [ 5311.342169] GPIO LED set low. [ 5312.345413] GPIO LED set high.
NFS掛載結束,以后在內核中編寫驅動時再也不用SD卡插拔插拔插拔了,所有的所有只要敲敲命令就OK了。
參考:博客
http://jingyan.eeboard.com/article/75498
后續:當PC機與開發板都斷電后,如果下次還需要重新共享PC機的文件,要對PC機進行一下配置:
1、根據之前的配置,custom---VMnet,網絡編輯選擇有線連接1
2、開啟nfs服務,終端輸入:
sudo /etc/init.d/portmap start
sudo /etc/init.d/nfs-kernel-server start
3、ping開發板:ping 192.168.200.70(可以ping通的)
4、掛載:
[root@zyr-am335x ]#mount -t nfs -o nolock 192.168.200.123:/home/zyr/Source_code/ text/nfs /mnt [root@zyr-am335x ]#ls 123 fisl.sh mnt self1.tar.gz var bin home proc self2.tar.gz boot lib root sys dev linuxrc sbin tmp etc lost+found self.tar.gz usr [root@zyr-am335x ]#cd mnt/ [root@zyr-am335x mnt]#ls led_test zyr-hello.ko [root@zyr-am335x mnt]#
