的概述
在嵌入式开发过程中有宿主机和目标机的角色之分:宿主机是执行编译、链接嵌入式软件的计算机,目标机是运行嵌入式软件的硬件平台。Tftp服务器作为工作于宿主机上的软件,主要提供对目标机的主要映像文件的下载工作。
1.2 tftp安装测试
1.2.1使用RPM包安装tftp-server
利用下面的命令查看服务器是否已经启动,如果已经安装则不用安装
netstat –a | grep tftp
已安装结果:udp 00 *:tftp *:*
如果没有安装则执行
#rpm-ivhtftp-0.42-3.1.i386.rpm//安装tftp-client注意要安装了客户端才有tftp命令#rpm-ivhtftp-server-0.42-3.1.i386.rpm//安装tftp-server
1.2.2建立tftp主工作目录
mkdir /tftpboot
注意:权限问题chmod 777 /tftpboot
1.2.3修改配置文件
vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#protocol.The tftp protocol is often used to boot diskless \
#workstations, download configuration files to network-aware printers, \
#and to start the installation process for some operating systems.
service tftp
{
disable= no
socket_type= dgram
protocol= udp
wait= yes
user= root
server= /usr/sbin/in.tftpd
server_args= -s /tftpboot–c 工作目录
per_source= 11
cps= 100 2
flags= IPv4
}
1.2.4重启服务
/etc/init.d/xinetd restart
netstat –a | grep tftp
udp 00 *:tftp *:*
1.2.5测试服务
修改客户机的IP跟主机在同一个网段ifconfig eth0 192.168.1.30
tftp> put 1.txt
tftp> get 1.txt
安装过程中出现的问题及原因现象一:tftp> get test.log
Transfer timed out.原因:tftpd服务没有启动现象二:tftp> get test.log
Error code 2: Only absolute filenames allowed原因:在/etc/xinetd.d/tftpd中设置的server_args为/etc/default/tftpd-hpa
cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-s /home/tftpd -c -p -U 077 -u tftpd"设置的时候只要将server_args=改为你自己设定的服务器文件夹就行了现象三:tftp> put ex070416.log
Error code 1: File not found原因:指定的文件不存在;或tftpd启动参数中没有指定-c选项,允许上传文件。
现象四:
tftp> get test.log
Error code 1: File not found
原因:
指定文件的权限不够,使用chmod 777