The Trivial File Transfer Protocol (TFTP) is a very basic form of FTP. It is often used on devices with low memory since the TFTP implementation does not require a lot of memory. It can be used to boot devices over the network or, like used on the GuruPlug/Sheevaplug, to transfer the kernel, uboot and rootfs images. The only thing which TFTP does is reading or writing files from a defined server. It should only be used on the private network since there is no security.

 

Installation

On Linux, a widely known tftp-server is atftp(d) (the one ending with d is the server). At first, I used atftpd on my PC but the problem of atftpd is that it can not transfer large files (limited to 32MB, but the rootfs image is 185MB). However, I found two other tftp-servers: opentftpd and tftp-hpa. I decided to use tftp-hpa which is ubuntu's packets.

$ sudo apt-get install tftp-hpa

 

Setup

My tftp-server did not run right away (compared to atftp which was ready right after installing it). I first had to add the line

RUN_DAEMON="yes"

to the file /etc/default/tftpd-hpa. Open the file with

$ sudo gedit /etc/default/tftpd-hpa

and add the mentioned line at the end of the file.

 

I also changed the tftp-directory since my files were in another directory from using atftp previously. To change the path, just change the TFTP_DIRECTORY-line within the quotes. My line looks like this:

TFTP_DIRECTORY="/srv/tftp"

 

Now restart tftpd-hpa with either

$ sudo sudo /etc/init.d/tftpd-hpa restart

or (like on my Ubuntu 10.04) with

$ service tftpd-hpa restart

 

Example

Regarding my tutorial on how to reset the GuruPlug, an example on how to get a file from the tftp-server.

The GuruPlug is the tftp-client, the PC is the tftp-server.

 

At first you have to specify the client and server IP-addresses on the client. They are both saved within specific environment variables:

# setenv serverip <tftp-server IP, the IP of your PC>
# setenv ipaddr <tftp-client IP, just any IP with the same subnet as the tftp-server IP>

I used

# setenv serverip 192.168.1.34
# setenv ipaddr 192.168.1.10

 

Now you can request a file from your tftp-server. Of course, the file has to be in the tftp-directory of your server. Using the tftp-directory (TFTP_DIRECTORY) specified above, your file has to be in /srv/tftp. To request the /srv/tftp/uImage-guruplug for example, use the following command on your tftp-client:

# tftp <start address in memory to save image> <file-name>

On the GuruPlug, you have to type:

# tftp 0x6400000 uImage-guruplug

and it will transfer the file to the memory of your GuruPlug.