How to: Install and setup TFTP server in Ubuntu for embedded Linux development

By | May 29, 2016

Trivial File Transfer Protocol in short TFTP is a network utility. Embedded Linux target uses this utility to download binaries such as kernel, device tree, initRamFS and other application software from a remote host computer.

This type approach save lots of time by avoiding repetitive binary flashing. In a few scenarios where we will not have physical access with a remote system, in such cases we can setup a tftpboot to fetch the images from remote computer.

The main aim of the post is to install a TFTP server and setup the host computer to download images from target board. There are other ways to setup tftp server. This post describes a easy and latest method of setting.

TFTP Server -

Required packages :

Run below command to install TFTP demon. After installation, tftp demon will start server automatically and listen to the network.

$ sudo apt-get install tftpd-hpa

Checking TFTP status: 

If you are unsure about the tftp status, run any of the below commands to find.

$ sudo service tftpd-hpa status

In response to the command, you will get below message.

tftpd-hpa start/running, process xxxxx

(or)

$ sudo netstat -a | grep tftp

Response to the above command is something like

udp6   0   0 [::]:tftp        [::]:*

For any reason, If you don’t see any response for the above commands then you need to start tftpd-hpa demon (Command is available below)

Verifying TFTP default configuration:

TFTP Default configuration file is  are available in this path /etc/default/tftpd-hpa

$ cat /etc/default/tftpd-hpa

Content of the file is as shown below.

# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="[::]:69"
TFTP_OPTIONS="--secure"

TFTP_DIRECTORY holds a path of a directory where embedded Linux target images will be copied.

You can change the default directory path. In case if you change default directory, don’t forget to restart the TFTP server.

Start, restart, and stop a TFTP server :

To start the server run below command.

$ sudo service tftpd-hpa start
tftpd-hpa start/running, process xxxx

If server is in running state, response will be as shown below

$ sudo service tftpd-hpa start 
start: Job is already running: tftpd-hpa

To Stop TFTP server

$ sudo service tftpd-hpa stop
tftpd-hpa stop/waiting

In case of any modification in TFTP server environment, you need to restart tftpd demon. Run below command to restart

$ sudo service tftpd-hpa restart
tftpd-hpa stop/waiting
tftpd-hpa start/running, process 3761

In the upcoming post, we will download kernel and device tree images to embedded target using tftp.

Leave a Reply

Your email address will not be published. Required fields are marked *