RIoTBoard开发板系列笔记(十)—— nfs服务搭建

嵌入式开发一般是交叉编译环境,开发中经常需要将编译好的linux 镜像或ko放在开发板中测试,可以选择用sd将执行文件拷贝到开板中,更便捷的方法是通过nfs(Network File System)网络文件系统,使用挂在nfs服务的方式进行传输。

1 nfs服务器安装

ubuntu安装nfs命令:

sudo apt-get install nfs-kernel-server

然后编辑/etc/exports 文件文件进行NFS服务配置:

sudo vim /etc/exports

输入以下内容:

/home/zhy/code/nfs_server 192.168.10.*(rw,async,no_root_squash)

其中:/home/zhy/code/nfs_server表示要被挂载的文件夹;
192.168.10.* 表示可以被ip为192.168.10. 开头的任何机器挂载;
括号中表示以可读写的、异步的、可以以root身份挂载。
配置完成后重启nfs服务:

zhy@zhy-ThinkPad-E480:~$ sudo /etc/init.d/nfs-kernel-server restart
[ ok ] Restarting nfs-kernel-server (via systemctl): nfs-kernel-server.service.

2 在开发板上挂载nfs服务

挂载命令:

mount -n -o nolock 192.168.10.195:/home/zhy/code/nfs_server/ /mnt/

此时使用ls查看/mnt/目录就能看到PC上的文件

# ls -l
total 6668 -rw-r--r--    1 root     root       6825736 Sep  4  2022 zImage

猜你喜欢

转载自blog.csdn.net/qq_38694388/article/details/126571242