This is an old revision of the document!


TFTP Server

TFTP (Trivial File Transfer Protocol) is a simplified version of FTP (File Transfer Protocol),running on port 69. It can be setup with very litte effort.
For example the TFTP server can be used to provide the binaries (u-boot, device tree blob and Linux kernel) for firmware updates in u-boot on the target hardware.

The first thing is to install install the client and the server package, together with xinetd superserver.

sudo apt-get install xinetd tftpd tftp

The next step is to create folder to act as TFTP root, the files for e.g. firmware updates on the Starterkit must be stored here .
Typically this folder is located at the root level and named tftpboot

sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot

Now a new xinetd tftp serivce has to be configured by creating the file /etc/xinetd.d/tftp containing the following lines of code:

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}

After setting up everything properly, the xinetd service must be restarted by the following command:

sudo sudo service xinetd restart

The default TFTP suite is tftp-hpa. To install the following step is needed:

user@ubuntu:~$ sudo apt-get install tftpd-hpa tftp-hpa

The TFTP default directory is /var/lib/tftpboot.

Change the following line in /etc/default/tftpd-hpa to point to the images directory of the BSP:

TFTP_DIRECTORY="/home/tq/workspace/TQMa6x-BSP-REV.0104/platform-MBa6x/images"

To restart the TFTP server type:

user@ubuntu:~$ sudo service tftpd-hpa restart

To test the server copy some file to the server and get it back with

user@ubuntu:~$ tftp 127.0.0.1 -c get <filename> 
user@ubuntu:~$ sudo apt-get install xinetd tftpd tftp

To cofigure TFTP the file /etc/xinetd.d/tftp must be created and filled with the following content. This configuration uses the directory /tftpboot.

service tftp
{
  socket_type             = dgram
  protocol                = udp
  wait                    = yes
  user                    = root
  server                  = /usr/sbin/in.tftpd
  server_args             = -s /tftpboot
  per_source              = 11
  cps                     = 100 2
}

The directory requires at least the access authorisation “dr-xr-xr-x”.

After the configuration was changed the server should be restarted:

user@ubuntu:~$ sudo service xinetd restart

TFTP uses port 69 UDP. This port must be opened.

  • Last modified: 2022/08/04 15:04