配置主机tftp服务,用于开发板启动挂载使用
(1)安装tftp-hpa,tftpd-hpa,xinetd
~$ sudo apt-getinstall tftp-hpa , tftpd-hpa, xinetd
(2)在/etc/xinetd.d/下创建并配置tftp文件
~$ sudo vim/etc/xinetd.d/tftp
1 service tftp
2 {
3 socket_type= dgram
4 protocol =udp
5 wait = yes
6 user = root
7 server =/usr/sbin/in.tftpd
8 server_args= -s
/home/jet/images
-c # -c
用于开启上传功能。
9 disable = no
10 per_source =11
11 cps =100 2
12 flags = IPv4
13 }
(3)配置tftpd-hpa
~$ sudo vim/etc/default/tftpd-hpa
1#/etc/default/tftpd-hpa
2
3 TFTP_USERNAME="tftp"
4 TFTP_DIRECTORY=" /home/jet/images "
5 TFTP_ADDRESS="0.0.0.0:69"
6 TFTP_OPTIONS="-l -c -s"
其中 /home/jet/images 为tftp共享目录
(4) 修改xinetd.conf文件
~$ sudo vim/etc/xinetd.conf
defaults
6 {
7
8 # Please notethat you need a log_type line to be able to use log_on_success
9 # andlog_on_failure. The default is the following :
10 # log_type =SYSLOG daemon info
11
12 }
13
14 #includedir/etc/xinetd.d
15 tftp dgram udpwait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/jet/images
(5) 重启tftp服务并测试
sudo servicetftpd-hpa restart
sudo/etc/init.d/xinetd reload
sudo/etc/init.d/xinetd restart
(6)本机测试
在 /home/jet/images 下包含测试文件uImage
测试一下tftp服务:
重新打开一个终端
#tftp 127.0.0.1
tftp>get uImage
tftp>q
#ls
退出后,查看当前目录,发现uImage文件已在当前目录。
(7)其他
如果上述设置还不行的话,那么就要把selinux禁用掉:
sudo gedit/etc/selinux/config //如果没有selinux/config这个文件,则创建。
# This file controlsthe state of SELinux on the system.
# SELINUX= can takeone of these three values:
# enforcing -SELinux security policy is enforced.
# permissive -SELinux prints warnings instead of enforcing.
# disabled -SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= typeof policy in use. Possible values are:
# targeted -Only targeted network daemons are protected.
# strict -Full SELinux protection.
SELINUXTYPE=targeted
把上面的SELINUX=enforcing改为:SELINUX=disable 禁用SeLinux
然后reboot重启PC