|Loading Linux Images via Ethernet and TFTP|
This note explains how to load images to the target via Ethernet. With an Ethernet connection available, U-Boot can load images from a TFTP host quickly and easily.
The download procedure is based on the tftpboot command provided by the U-Boot command interface. tftboot implements a download capability over Ethernet using the TFTP protocol and has the following synopsis:
tftpboot <file> [<load_addr>]
If you do not specify a load address, then the value will be taken from the loadaddr environment variable. On the LPC4357 Dev Kit loadaddr is set as follows, placing the download buffer into external SDRAM:
EA-LPC4357> print loadaddr
The MAC address of the Ethernet interface is defined by the ethaddr environment variable.The IP address of the board is defined by the ipaddr U-Boot environment variable. The TFTP server IP address is defined by the serverip U-Boot environment variable. Make sure you define these environment variables to values that make sense for your LAN and save them in non-volatile Flash:
EA-LPC4357> setenv ethaddr C0:B1:3D:88:88:89
Once the transmission using tftpboot finishes, the file will be in memory at the specified load address. The loadaddr environment variable will automatically be set to the address the tftpboot command used. The filesize environment variable will automatically be set to the number of bytes transferred during the load operation.
Then you are free to do whatever you like with the loaded image. You can boot Linux from the image (assuming it is a Linux uImage file), copy it to some other place (for instance, Flash device), display the memory, etc.
One typical command sequence involving tftpboot is defined in the netboot environment variable, which by default is set in U-Boot as follows:
EA-LPC4357> print netboot
What netboot does is load from a TFTP host a file defined by image (the tftp command), then add the TCP/IP related parameters to the kernel command string (addip), and finally boot Linux from the just loaded image (bootm).
Let's use netboot to boot Linux via TFTP from the sample Linux image (networking.uImage) included in the Emcraft software distribution. Copy networking.uImage to the TFTP directory on the host and then from U-Boot on the target set the image environment variable to point to the image:
EA-LPC4357> setenv image vlad/networking.uImage
Then just run netboot to boot Linux via TFTP:
EA-LPC4357> ru netboot
Here are some troubleshooting tips, in case tftpboot does not work for you from U-Boot: