【嵌入式Linux】ARM开发板经过NFS挂载Linux主机实现文件共享

通常在Linux主机上arm-linux-gcc编译程序,而后将该生成的可执行文件发送给ARM开发板,ARM开发板再运行该文件。node

(主机Linux系统)--->(ARM开发板Linux系统)  传送文件的过程能够采用NFS,FTP等多种方法linux

采用NFS实现远程挂载,ARM开发板能够直接运行主机上的程序,而不须要下载到开发板上,也是用的最多的方法url


1,ARM开发板上电,启动Linuxspa

2,查看开发板Linux内核是否支持NFSrest

      执行 cat /proc/filesystemserver

      如有一行为 nodev nfs,则开发板Linux内核支持NFS,反之须要配置内核开发

      一样方法查看Linux主机内核是否支持NFSrpc

3,配置主机共享目录
it

      执行 gedit /etc/exports更改主机NFS配置
编译

      在最后一行添加 /nfs_root *(rw,sync,no_root_squash)表示将主机 /nfs_root设置为共享目录,全部Linux系统均可以挂载该目录

      若添加 /nfs_root 192.168.1.100(rw,sync,no_root_squash)表示只有IP为192.168.1.100的Linux系统能挂载该目录

4,主机启动NFS服务

      sudo service nfs start 或者 sudo service nfs-kernel-server restart

5,ARM开发板挂载主机共享目录

      开发板上执行 mount 192.168.1.139:/nfs_root /mnt

      其中,192.168.1.139是主机IP,/nfs_root是主机共享目录,/mnt表示将该共享目录挂载到ARM开发板/mnt目录下

6,若未报错,则挂载成功

      开发板上执行 ls /mnt

      能够看到ARM开发板/mnt下的内容与主机/nfs_root下内容一致

7,若报错

rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
lockd_up: makesock failed, error=-5
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).

      多是主机防火墙或者文件锁的缘由。

      开发板上执行 mount -o nolock -t nfs192.168.1.139:/nfs_root /mnt

      从新挂载,成功。

8,若仍未成功,可根据报错信息查看http://wenku.baidu.com/link?url=Ze35J5DwpLbZZKU59t4xDiHKrY4TRLLzsOrYp3jTJN1u3mXv10i99JP7FRVPSrECnLQiuQ2lFBRgB7Bo_2ld4vnhoohgrrqvTtDd-R0XOO7