嵌入式Linux中tftp和nfs的笔记
2017-05-16 14:55
337 查看
一、tftp
我用的ubuntu14.04已经安装好tftp服务,这里记录下网上的安装方法:1、服务器安装tftp,
apt-get install tftpd-hpa, tftp-hpa
我没有安装xinetd,能够成功从服务器下载文件到开发板。
2、配置TFTP服务器:
# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/root/hi3518/tftpboot" #服务器端的tftp目录 TFTP_ADDRESS="0.0.0.0:69" #TFTP_OPTIONS="--secure" TFTP_OPTIONS="-l -c -s"
3、重启tftp服务service tftpd-hpa restart
看看服务是否开启
netstat -a | grep tftp
显示结果为
udp 0 0 :tftp :*
表明服务已经开启,就表明tftp配置成功了。
4、在服务器端测试tftp:
tftp
get “filename”
但我这步没有成功。
下面是在开发板上测试tftp
“需要注意的的是设置开发板的serverip与服务器的ip设置一样”
“关闭防火墙”
“开发板在编译内核时应该把tftp选中,编译进内核中”
1、在开发板进入Linux系统后,busybox中的tftp命令为:
# tftp BusyBox v1.16.1 (2015-04-01 19:35:12 HKT) multi-call binary. Usage: tftp [OPTIONS] HOST [PORT] Transfer a file from/to tftp server Options: -l FILE Local FILE (本地文件) -r FILE Remote FILE (远程服务器上tftp目录下的文件) -g Get file (下载文件) -p Put file (上传文件到服务器) -b SIZE Transfer blocks of SIZE octets #
2、下载文件到当前目录tftp -g -r
# ls hello hello.c world.c # rm hello # ls hello.c world.c # rm hello.c # rm world.c # ls # tftp -g -r hello.c 192.168.1.105 hello.c 100% |**************************| 512 --:--:-- ETA # cat hello.c #include<stdio.h> main(){ printf("hello\r\n"); } # tftp -g -r hello 192.168.1.105 hello 100% |*************************| 5120 --:--:-- ETA # ./hello -sh: ./hello: Permission denied # ls -l hello -rw-r--r-- 1 root root 4681 Jan 1 00:13 hello # chmod 777 hello # ./hello hello #
3、uboot中也带有tftp服务,其命令格式与busybox中的不一样
在uboot命令下tftp下载服务器文件到ram中的确定的地址
mw.b 82000000 ff 100000 (擦除一定空间大小)
tftp 0x82000000 (下载文件到此地址中)
这样可方便的下载编译好的内核和文件系统,如果在Windows系统下用tftp需要tftpd32软件,把在Linux系统中编译好的文件复制到Windows下,比较麻烦。
二、nfs
1、服务器端nfs的配置,网上很多配置文件:etc目录下的exports文件,最后面添加下面一句:
/root/hi3518/nfs *(insecure,rw,sync,no_root_squash)
前面的目录自己设置,*表示所有ip都可以访问这个目录,若要指定Ip可以这样写
/root/hi3518/nfs 192.168.1.*(insecure,rw,sync,no_root_squash)
开启nfs
/etc/init.d/portmap start //用service portmap stasrt也可以
/etc/init.d/nfs start 或者service nfs start也可以
nfs挂载有两种,一是把服务器端的完整的文件系统作为开发板的跟文件系统挂载,
参考嵌入式linux之NFS启动根文件系统
二是把服务器nfs目录挂载在开发板上的一个目录上。
linux nfs配置
# ls nfs tftp # cd nfs # cd .. # mount -t nfs -o nolock 192.168.1.105:/root/hi3518/nfs nfs # cd nfs # ls hello hello.c ircut ko redled sample_venc # cd .. # ls nfs tftp # umount -t nfs 192.168.1.105:/root/hi3518/nfs umount: can't umount 192.168.1.105:/root/hi3518/nfs: No such file or directory # ls nfs tftp # cd nfs # ls #
相关文章推荐
- [国嵌笔记][010][TFTP与NFS服务器配置]
- ubuntu 安装配置shh,tftp,nfs 笔记
- 嵌入式软件开发培训笔记——网络配置(详细NFS及TFTP配置)
- Yocto开发笔记之《工具使用:TFTP & NFS & SSH》(QQ交流群:519230208)
- 嵌入式软件开发培训笔记——ARM架构Linux系统下交叉编译环境搭建、NFS、TFTP服务配置及Nandflash的读写
- TFTP使用二-----详解为什么开发板的TFTP、NFS等网络功能神奇消失
- 2410 TFTP源码 学习笔记414757749
- 嵌入式linux的tftp安装配置
- RHCE课程-RH253Linux服务器架设笔记二-NFS服务器配置 推荐
- Linux高可用(HA)集群笔记heartbeat+drbd+nfs
- PXE网络安装LINUX [DHCP+TFTP+NFS]
- Dhcp+nfs+tftp+ks 完全无人值守安装linux操作系统
- inux高可用(HA)集群笔记heartbeat+drbd+nfs ZT
- linux高可用(HA)集群笔记heartbeat+drbd+nfs (原创)
- Dhcp+nfs+tftp+ks 完全无人值守安装linux操作系统(最强版)
- Linux学习笔记——文件服务之NFS
- 嵌入式linux的NFS开发环境的建立及配置实例
- Linux服务笔记之五:NFS服务
- 嵌入式linux的tftp安装配置
- Windows下Linux开发环境设置(一)--TFTP服务器设置和NFS服务器设置