一、安裝tftpd-hpa
sudo apt-get install tftpd-hpa -y
二、編輯配置文件
sudo gedit /etc/default/tftpd-hpa
修改line 4:配置服務器的文件目錄
修改line 6:配置操作權限:-l:表示listen模式,-c:可以創建新文件,-s:不需要指定路徑
端口和用戶名稱不用修改!!!
三、重啓服務器
sudo service tftpd-hpa restart
四、拷貝一個文件到服務器文件路徑下
sudo cp ./nuttx.bin ~/tftpws/
五、測試一
硬件開發板通過tftp服務器進行固件更新:
U-Boot 2018.11 (Jul 22 2019 - 17:20:27 +0800)
Model: STM32F7 BOARD
DRAM: 16 MBytes
Flash: 2 MiB
In: serial
Out: serial
Err: serial
Net:
Warning: ethernet@40028000 (eth0) using random MAC address - ee:e9:b7:dc:ab:9f
eth0: ethernet@40028000
Hit SPACE in 3 seconds to stop autoboot.
U-Boot> tftpboot 0x08040000 nuttx.bin
Speed: 100, full duplex
Using ethernet@40028000 device
TFTP from server 192.168.10.200; our IP address is 192.168.10.30
Filename 'nuttx.bin'.
Load address: 0x8040000
Loading: ##########################################
66.4 KiB/s
done
Bytes transferred = 606412 (940cc hex)
六、測試二
通過終端獲取服務器文件
tftp 192.168.10.200 (本機的ip地址)
tftp> get nuttx.bin
tftp> quit