目录列表
一、从window下发送文件到板端
挂载SD卡:
mount /dev/mmcblk0p1 /mnt/tfcard
启动板端服务器:
udpsvd -vE 0.0.0.0 69 tftpd -c &
windows中启动TFTP客户端
单个文件发送:
window中tftp命令:
从当前本机,向远端192.168.1.27 中发送C:\Users\Administrator\Downloads\test.wav 文件
TFTP.EXE -i 192.168.1.27 PUT C:\Users\Administrator\Downloads\test.wav
使用bat脚本多文件发送:(注意检查更换目标IP地址、本地路径、目标路径)
@echo off
setlocal
:: Set the IP address of the TFTP server
set TFTP_SERVER=192.168.1.27
:: Set the source directory path (modify as per your actual situation)
set SOURCE_DIR=Y:\AX620Q\kanhujia_AX620E_SDK_V3.0.0_20241120230136_NO1951\build\out\AX620Q_nor_arm32_k419\images\sd_update_pack
:: Set the destination directory path (modify as per your actual situation)
set DEST_DIR=/mnt/tfcard/bin
:: Set the list of files to be transferred (relative to SOURCE_DIR)
set FILES=customer.img ddrinit.img dtb.img dtb_b.img kernel.img kernel_b.img logo.img logo_b.img opt.img rootfs.img spl.bin uboot.bin uboot_b.bin version_info.txt
:: Switch to the source directory
cd /d %SOURCE_DIR%
for %%F in (%FILES%) do (
echo Uploading %SOURCE_DIR%\%%F to %DEST_DIR%/%%F...
:: Note: Not all TFTP clients support specifying a remote file path directly.
:: If your TFTP client and server both support it, you can use the following command:
tftp -i %TFTP_SERVER% PUT %%F %DEST_DIR%/%%F
:: If not supported, remove the line above and uncomment the line below:
REM tftp -i %TFTP_SERVER% PUT %%F
if errorlevel 1 (
echo Failed to upload %%F.
echo Press Enter to exit...
pause >nul
exit
)
)
echo All files uploaded successfully.
:: Wait for the user to press Enter before closing the console window
echo Press Enter to exit...
pause >nul
endlocal
效果如下:
二、从板端获取目标服务端的文件:
需要先启动服务端的服务器, (Windows下tftp服务器配置都差不多) ,以SecureCRT为例子:
打开全局选项:
指定TFTP服务器的上传/下载目录
启动tftp服务器
单个文件获取:
Linux中tftp命令:
从192.168.1.4 远端中的C:\Users\Administrator\Downloads中获取stream_chn0_Apr–5-03-44-47-1970.h264 文件
板端使用shell脚本,循环获取多个远端(对应上方下载目录)文件到板端(注意更换ip地址和文件名)
TFTP_SERVER="192.168.1.4"
FILES="customer.img ddrinit.img dtb.img dtb_b.img kernel.img kernel_b.img logo.img logo_b.img opt.img rootfs.img spl.bin uboot.bin uboot_b.bin version_info.txt"
for FILE in $FILES; do
echo "Uploading $FILE..."
tftp -g -r "$FILE" "$TFTP_SERVER"
if [ $? -ne 0 ]; then
echo "Failed to upload $FILE."
exit 1
fi
done
echo "All files uploaded successfully."