Test tftp connection in u-boot


is it possible to detect working tftp transfer via U-Boot scripts ? (something like test -e usb 0:1 updateMe)


i want to change bootorder to tftp/nfs; usb; emmc. If tftp transfer fails (Timeout), it stay there and wait for connection (Loading: T T T T).

Best regards


Hi Lars

You’re trying something unusual.
Maybe you could try to ping the server before starting the TFTP transaction, however there is also a seconds long timeout in which U-Boot waits for the answer to ping.
E.g. with echo as a surrogate to tftpboot:

Colibri iMX6 # ping && echo up
Using FEC device
ping failed; host is not alive

Colibri iMX6 # ping && echo up
Using FEC device
host is alive

Additionally you could break the restart loop:

Colibri iMX6 # setenv netretry once

Additionally you could influence the timeout counts by changing the U-Boot configuration and recompile.


You can make a test with ping to verify that the host is alive, positive ae case forward if it fails go to the next boot.

Update variable environment U-boot bootcmd for this, something like:

setenv trytftp ping

setenv bootcmd if run tryftp; then "COMMAND TFTP BOOT"; else "OTHER BOOT; fi;

Then of course save this changes if it works with saveenv.

I not tested, but I have done something and it worked fine.

Cleiton Bueno

Blog | Linkedin | B2Open