nfs 安装
(1)下载安装包
apt-get install nfs-kernel-server
apt-get install portmap nfs-common
(2)共享文件夹,如/home
编辑/etc/exports在空白处添加
/home/ *(rw,sync,no_root_squash)
(3)修改挂载点的属性
chmod 777 /home/
(4)重启nfs
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/portmap restart
(5)安装minicom
apt-get install minicom
(6)查看目标机的ip
打开minicom,给目标机上电,这时,可以看到目标机的启动信息,目标机启动结束后,输入ifconfig可以看到目标机的ip:192.168.210.231
(7)查看宿主机的ip
在nfs重启后,输入ifconfig eth0,查看ethernet0的ip,需要设置为与目标机同一个网段,如192.168.210.131。(同一个网段的两台设备是在同一个局域网中)
(8)在本机上挂载测试
在minicom端:
showmount -e
mount -o nolock -t nfs 192.168.210.131:/home /mnt
或 mount 172.20.149.190:/home/ /mnt
ls -l /mnt
注:1.可以通过一个符号链接来export NFS目录,但在/etc/exports下所添加的挂载点应为真正的目录。比如建一个符号链接
ln -s /home/pub/work/freerunner/out/target/product/freerunner /home/jgyang/nfsroot
这样在开发板上设置的内核命令行中设置的NFS目录就可是:/home/jgyang/nfsroot,但在/etc/exports文件中 export出的目录应当是实际的NFS所在的目录,即
/home/pub/work/freerunner/out/target/product/freerunner。
这样有两个好处,一是可以省去开发板中启动参数命令过长的麻烦;二是在重新编译android之后可以直接使用生成的NFS,而不必再重新拷贝一份。
2. 设置IP(设置网卡eth0的IP地址和子网掩码)sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0 设置网关 sudo route add default gw 192.168.2.254
重启网络服务(若不行,请重启ubuntu:sudo reboot):sudo /etc/init.d/networking restart
/