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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tiandawangliang/article/details/52794871

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

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

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


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

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

      执行 cat /proc/filesystem

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

      同样方法查看Linux主机内核是否支持NFS

3,配置主机共享目录

      执行 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



猜你喜欢

转载自blog.csdn.net/tiandawangliang/article/details/52794871