• tftp

    • 可传输单个文件,不能传文件夹
    • 需要通过命令传输文件,略显复杂
    • 一般调试kernel时,用uboot通过tftp方式启动,不用每次都烧写存储介质
  • nfs

    • 在host linux(ubuntu)上的nfs文件夹中存放文件
    • 开发板上mount ubuntu的文件夹,mount后就像自己的文件一样
    • 这种方式共享文件很方便
    • 也有linux启动后,拿nfs作为根文件系统,方便调试根文件系统的内容
  • ftp

    • 没有host linux环境时,可以把windows当成ftp client,开发板ftp server
    • 方便拖动文件

tftp

0.客户端命令

tftp -r fileserver -g 192.168.1.200
tftp -l fileclient -p 192.168.1.200

缺点:不能传文件夹,没有NFS方便

1.目的

通过tftp、nfs、ftp等方式,实现开发板linux与host高效交换文件。

2.环境说明

  • PC:

    • windows 7 IP:192.168.1.100
    • vmware ubuntu 16.04 IP:192.168.1.200
    • 桥接
  • 开发板:
    • IP:192.168.1.1

windows/ubuntu/开发板三者能ping通。

3.tftp

3.1原理

ubuntu作为服务器,开发板作为客户端,共享数据。

windows也可以作为客户端,不过现在VMware共享数据很方便,没有这个必要了。

3.2 ubuntu tftp server配置

3.2.1 tftp/tfpd和tftp-hpa/tftpd-hpa

  • d表示server,是demon的缩写
  • hpa是后来的改进版,网上搜索大部分人都用hpa版本。

3.2.2 tftp-hpa/tftpd-hpa安装及配置

安装

sudo apt-get install tftpd-hpa
sudo apt-get install tftp-hpa

配置

sudo vim /etc/default/tftpd-hpa
sudo service tftpd-hpa restart
ps -A | grep "tftp*"
显示:37921 ? 00:00:00 in.tftpd

修改后的/etc/default/tftpd-hpa文件,修改了目录和TFTP_OPTIONS,注意该目录的权限

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/home/liuwanpeng/work/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -c -s"

关于TFTP_OPTIONS的几个有用配置:

man tftpd
-l, --listen
Run the server in standalone (listen) mode, rather than run from
inetd. In listen mode, the --timeout option is ignored, and the
--address option can be used to specify a specific local address
or port to listen to. --create, -c
Allow new files to be created. By default, tftpd will only
allow upload of files that already exist. Files are created
with default permissions allowing anyone to read or write them,
unless the --permissive or --umask options are specified. --secure, -s
Change root directory on startup. This means the remote host
does not need to pass along the directory as part of the trans‐
fer, and may add security. When --secure is specified, exactly
one directory should be specified on the command line. The use
of this option is recommended for security as well as compati‐
bility with some boot ROMs which cannot be easily made to
include a directory name in its request.

3.3 开发板tftp client配置及操作

3.3.1 基本操作

开发板busy box默认安装的是tftpd客户端,不再专门安装-hpa。

开发板输入tftp,查看帮助

root@xilinx-zcu102-2017_2:~# tftp
BusyBox v1.24.1 (2017-06-19 21:24:47 MDT) multi-call binary. Usage: tftp [OPTIONS] HOST [PORT] Transfer a file from/to tftp server -l FILE Local FILE
-r FILE Remote FILE
-g Get file
-p Put file

从主机的tftpboot目录下读取Makefile文件,保存到本地,名字不变。没有-l参数,同名保存。

存到哪了?默认保存到当前目录

tftp -l Makefile -r Makefile -g 192.168.1.200
tftp -r Makefile -g 192.168.1.200
tftp -l Makefile  -p 192.168.1.200

3.3.2 错误处理

tftp: server error: (1) File not found:

服务器端没有开启上传权限

root@xilinx-zcu102-2017_2:~/test# tftp -l Makefile  -p 192.168.1.200
tftp: server error: (1) File not found

nfs

0.客户端命令

mount -n -o nolock 192.168.1.200:/home/liuwanpeng/work/share/ /mnt/

1.目的

通过tftp、nfs、ftp等方式,实现开发板linux与host高效交换文件。

2.环境说明

  • PC:

    • windows 7 IP:192.168.1.100
    • vmware ubuntu 16.04 IP:192.168.1.200
    • 桥接
  • 开发板:
    • IP:192.168.1.1

windows/ubuntu/开发板三者能ping通。

3.nfs

3.1原理

  • 在ubuntu上搭建NFS服务器,将ubuntu上的某个目录作为NFS的输出,等待开发板挂载。
  • 挂载后在开发板上就可以像操作本机的文件一样操作NFS服务器上的文件了.
  • linux系统启动以后这种方式很方便。

3.2 ubuntu nfs server配置

3.2.1 安装

sudo apt-get install nfs-kernel-server

3.2.2 配置

安装后会生成配置文件

sudo gedit /etc/exports

增加一行配置,文件如下:

 sudo cat /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/liuwanpeng/work/share 192.168.1.*(rw,sync,no_root_squash)

重启nfs服务

sudo  /etc/init.d/nfs-kernel-server restart

3.3 开发板nfs client配置及操作

开发板只需mount就可以了

mount -n -o nolock 192.168.1.200:/home/liuwanpeng/work/share/ /mnt/
参数说明:
-n, --no-mtab don't write to /etc/mtab

ftp 暂不添加

MPSOC之9——host、embeded间tftp、nfs、ftp环境搭建的更多相关文章

  1. nfs:环境搭建

    准备环境 通过VirtualBox创建两台虚拟机client1和client2,这两台虚拟机和物理主机组成一个网络.将物理主机作为NFS的服务端,虚拟机client1和client2作为NFS的客户端 ...

  2. Linux nfs+autofs 环境搭建

    两台服务器环境为centos 6.6 1.安装配置nfs 安装portmap 和  nfs [root@node0 ~]# yum install portmap [root@node0 ~]# yu ...

  3. 【Linux】TFTP & NFS 服务器配置

    Why?--交叉开发 一.交叉开发模型 宿主机(PC)------ 网络.串口.USB.JTAG ------ 目标机(ARM系统) PC机作为TFTP & NFS 服务器,目标机从网络下载软 ...

  4. 嵌入式环境搭建之NFS

    嵌入式环境搭建之NFS Author:tiger-johnTime:2013-08-04mail:jibo.tiger@gmail.comBlog:http://blog.csdn.net/tiger ...

  5. qt5集成libcurl实现tftp和ftp的方法一:搭建环境(五篇文章)

    最近使用QT5做一个软件,要求实现tftp和ftp文件传输,使用QT5开发好UI界面等功能,突然发现QT5不直接提供tftp和ftp支持,无奈之下只好找第三方库来间接实现,根据网友的介绍,libcur ...

  6. NFS配置与搭建

    参考: Linux下NFS服务器的搭建与配置 https://www.cnblogs.com/liuyisai/p/5992511.html http://blog.51cto.com/hongten ...

  7. atitit.网络文件访问协议.unc smb nfs ftp http的区别

    atitit.网络文件访问协议.unc smb nfs ftp http的区别 1. 网络文件访问协议1 2. NETBios协议  2 3. SMB(Server Message Block)2 3 ...

  8. ubuntu 16.04 nfs服务的搭建

    nfs服务是实现Linux和Linux之间的文件共享,nfs服务的搭建比较简单. 现在介绍如何在ubuntu16.04系统中搭建nfs服务,ubuntu的搭建比红帽的还要简单. 1.安装nfs服务 s ...

  9. Red Hat 6.5 nfs服务的搭建

    nfs服务是实现Linux和Linux之间的文件共享,nfs服务的搭建比较简单. 现在介绍如何在红帽6.5系统中搭建nfs服务. 1.关闭selinux服务 如果已经关闭该服务的可以直接跳过该步骤. ...

随机推荐

  1. php 常用 常量集合

    DIRECTORY_SEPARATOR 常量 DIRECTORY_SEPARATOR  目录分割符

  2. asp .net连接打开数据库初步

    1 #endregion59 WebDriver

  3. Shell 快速指南

    Shell 快速指南 ███████╗██╗ ██╗███████╗██╗ ██╗ ██╔════╝██║ ██║██╔════╝██║ ██║ ███████╗███████║█████╗ ██║ ...

  4. 使用sshkey的方式访问gitlab

    在使用jenkins创建jobs的时候配置git为ssh访问的方式报错 记录错误信息 Failed to connect to repository : Command "/usr/bin/ ...

  5. 小随笔:利用Shader给斯坦福兔子长毛和实现雪地效果

    0x00 前言 发现最近没有了写长篇大论的激情,可能是到了冬天了吧.所以这篇小文只是简单介绍下如何在Unity中利用shader很简单的实现雪地效果以及毛皮效果,当然虽然标题写在了一起,但其实这是俩事 ...

  6. 正确释放Vector的内存

    http://blog.jobbole.com/37700/ 今天在看微博的时候, 有人提出了一个对于Vector内存泄露的疑问( Link). 博主采用 Vector存储一些数据,但是发现在执行 c ...

  7. JavaFx新手教程-布局-StackPane

    cmlanche: 您叫什么名字? StackPane cmlanche: 您好,StackPane君,可以问下您在JavaFX家族中是什么地位? stackpane君: 我可重要了,我是在JavaF ...

  8. 契约测试框架-Pact实践

    在前一篇博客中我们讲到契约测试是什么,以及它能给我们软件交付带来什么价值,本次将介绍一个开源的契约测试框架Pact,它最初是用ruby语言实现的,后来被js,C#,java,go,python 等语言 ...

  9. ThinkPHP中处理Layout模板的问题

    ThinkPHP中的模板引擎内置了布局模板功能支持,可以方便实现嵌套. 其中有两种布局方式,一种为以布局模板为入口的布局方式,但是需要开启LAYOUT_ON 参数(默认不开启) 并且设置布局入口文件名 ...

  10. 小程序采坑系列-this.setData

    今天踩了大坑,坑里还都是碎瓶渣子.. 先说一下基本使用.官网也有. 比如说你在main.js里面有这些变量.想修改某些值. data: { main_view_bgcolor: "" ...