赞
踩
TFTP(Trivial File Transfer Protocol,简单文件传输协议)是 TCP/IP 协议族中的一个用来在客户机与服务器之间进行简单文件传输的协议,提供不复杂、开销不大的文件传输服务,端口号为 69。
在 U-Boot 中也支持 TFTP 协议,可以通过 tftp 命令从服务端下载文件。服务端可以是 Linux,也可以是 Windows,只要支持 TFTP 服务就可以。
本文介绍如何在 Ubuntu 24.04 中搭建 TFTP 服务,并实现在 U-Boot 中使用 tftp 命令下载 Linux 内核镜像文件到开发板 DRAM 中。
- sudo apt-get install tftp-hpa tftpd-hpa
- sudo apt-get install xinetd
mkdir -m 777 /tftpboot
- server tftp
- {
- socket_type = dgram
- protocol = udp
- wait = yes
- user = root
- server = /usr/sbin/in.tftpd
- server_args = -s /tftpboot/
- disable = no
- per_source = 11
- cps = 100 2
- flags = IPv4
- }
修改 /etc/default/tftpd-hpa 文件:
- # /etc/default/tftpd-hpa
-
- TFTP_USERNAME="tftp"
- TFTP_DIRECTORY="/tftpboot/"
- TFTP_ADDRESS="0.0.0.0:69"
- TFTP_OPTIONS="-l -c -s"
重启 tftp 服务
sudo service tftpd-hpa restart
tftp测试,创建一个test文件,使用tftp推送过去,查看/tftp目录可以看到test文件,表示服务搭建成功:
- richard@ubuntu24:~$ touch test
- richard@ubuntu24:~$ tftp
- (to) localhost
- tftp> put test
- tftp>
- richard@ubuntu24:~$ ls /tftp
- test
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。