i.MX7D Flashing Embedded Linux over Ethernet

We are trying to setup an TFTP server on our Ubuntu Linux host machine for downloading and flashing embedded Linux images to our device which contains a Colibri i.MX7D V1.1C module. We’ve followed the information contained in the: Flashing Embedded Linux over Ethernet and How to setup Networking for Embedded Linux Application Development documents for setup and configuration of the TFPT server running on our Ubuntu Linux host.

We downloaded tftpd-hpa using sudo apt-get install tftpd-hpa and we created the file: tftpd-hpa on the host in the folder: /etc/default/. Here are the contents of the tftpd-hpa file:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp/"
TFTP_ADDRESS="[::]:69"
TFTP_OPTIONS="--secure"

These are the file contents specified in the How to setup Networking for Embedded Linux Application Development document.

We are using IP addresses in U-boot for the client and server that are different from those specified in the Flashing Embedded Linux over Ethernet document since we have a private network setup for communication between the Ubuntu Linux host and the device. For the host we are using 192.168.0.8 instead of 192.168.10.1, and for the client we are using 192.168.0.1 instead of 192.168.10.2.

We are running the Ubuntu Linux host in a VMware virtual machine in a Windows 7 OS. We’ve been successfully using this setup, along with our private network, to debug and download a Qt Application to the device. We can also use SCP to copy files to and from the device using commands from a Terminal Emulator window in Ubuntu Linux.

We’ve tried pining the host IP address from U-boot, and we receive the following output which indicates that U-boot sees the host:

Colibri iMX7 # ping 192.168.0.8
Using FEC0 device
host 192.168.0.8 is alive
Colibri iMX7 #

But when we start U-boot and type: run setupdate we see the following output which indicates that U-boot is attempting to make a connection to the tftp server:

Colibri iMX7 # run setupdate
MMC: no card present
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... unable to get device descriptor (error=-1)
1 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
** Bad device usb 0 **
Using FEC0 device
TFTP from server 192.168.0.8; our IP address is 192.168.0.1
Filename 'colibri_imx7/flash_eth.img'.
Load address: 0x80800000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
Colibri iMX7 #

The client seems to be timing out waiting for a connection to the TFTP server.

We’ve made sure that the TFTP server is running by executing the following command from a Terminal Emulator window: sudo service tftpd-hpa start.

We also have the necessary files available in the /srv/tftp/ location which were placed there using the ./update.sh -o /srv/tftp/. We found documentation online that indicates problems occur on occasion when using the line: TFTP_ADDRESS="[::]:69" in a file. The suggestion was to use: TFTP_ADDRESS="0.0.0.0:69" instead. We tried this but still experienced the same problem.

What can we do to fix this problem and make TFTP work correctly as it will be important for us to use this method of downloading the image in the future?

Thank You.

Hi

What can we do to fix this problem and make TFTP work correctly as it will be important for us to use this method of downloading the image in the future?

This looks like your tftp server is not correctly setup, I doubt it has to do with the Colibri side of things.

  • You could test for an active firewall blocking incoming tftp traffic.
  • File permissions in /srv/tftp/… ?
  • And last but not least: does the file exist?

You could try a local tftp client on your PC which would bypass e.g. the firewall:

g@g:~$ sudo apt-get install tftp-hpa
...

g@g:~$ tftp localhost -c get colibri_imx7/flash_eth.img
g@g:~$ ls flash_eth.img 
flash_eth.img

You could boot the module into Linux and use the busybox tftp client to get a faster test for a running tftp server.

root@apalis-imx6:~# ls flash_eth.img
ls: flash_eth.img: No such file or directory
root@apalis-imx6:~# tftp -g -r colibri_imx7/flash_eth.img 192.168.10.1
root@apalis-imx6:~# ls flash_eth.img
flash_eth.img

Max

This looks like your tftp server is not correctly setup, I doubt it has to do with the Colibri side of things.

You could test for an active firewall blocking incoming tftp traffic.

As a test I turned off both the Windows 7 firewall and the Ubuntu Linux firewall running in the VMware virtual machine. It did not help. I still have same problem.

File permissions in /srv/tftp/… ?

I set the file permissions of all files in the /srv/tftp folder to read & write. It did not help. I still have the same problem.

And last but not least: does the file exist?

The files exists on the PC in the /srv/tftp/colibri_imx7 folder. The flash_eth.img file is located there.

I tried the: tftp localhost -c get colibri_imx7/flash_eth.img command that you provided above, on the host PC. It didn’t work. I had to use: sudo tftp localhost -c get colibri_imx7/flash_eth.img. It worked and the file was copied. I had to use sudo since the file permissions to set according to the Toradex documentation: How to setup Networking for Embedded Linux Application Development is in the line: sudo chown -R :nogroup /srv/tftp/ so it’s set for root permissions. If I execute the line: sudo chown -R [My Username]:nogroup /srv/tftp/ then I can execute the line: tftp localhost -c get colibri_imx7/flash_eth.img as you provided above and it works, but in either case I cannot run: run setupdate from U-boot. The attempt is made to download the file, but it times out.

I also tried booting the module into embedded Linux and running the line that you provided above: tftp -g -r colibri_imx7/flash_eth.img 192.168.0.8 using my host IP address of 192.168.0.8, but it does not work. I receive a timeout error.

Do you have any other suggestions to get this working?

May I ask what exact Ubuntu flavor you are trying this on?

Hello marcel.tx,

Thanks for your response.

The OS we are using is:

Ubuntu 14.04.5 LTS

I’m not sure if this would help you, but the kernel version is:

Linux ubuntu 3.13.0-123-lowlatency #172-Ubuntu SMP PREEMPT Mon Jun 26 18:53:37 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Thank You.

It looks like you may have a highly customised system as in general it should work just fine on Ubuntu 14.04 x86_64.

Yeah, I don’t know. For now the USB drive that I have works when used to flash our Colibri i.MX7D modules, but it would be nice to get Ethernet updating to work because access space will be vary limited in the released product and we have the ability to connect Ethernet externally.

Thanks, I’ll keep looking into this and see if I can figure this out.

We do actually have some test PCs which happen to have the same Ubuntu version installed and their TFTP works just fine. Please find some information about their configuration as follows:

tester@testseat1:~$ cat /etc/issue.net 
Ubuntu 14.04.5 LTS

tester@testseat1:~$ uname -a
Linux testseat1 3.13.0-125-generic #174-Ubuntu SMP Mon Jul 10 18:51:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

tester@testseat1:~$ cat /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

tester@testseat1:~$ ls -l /srv/tftp/
total 20
drwxr-xr-x 2 root   root   4096 Jan  5  2017 apalis_t30
-rw-rw-r-- 1 tester tester   32 Jul 21 09:38 configblock.bin
-rw-r--r-- 1 root   root    710 Jan  5  2017 flash_blk.img
-rw-r--r-- 1 root   root    444 Jan  5  2017 flash_eth.img
-rw-r--r-- 1 root   root    307 Jan  5  2017 flash_mmc.img

tester@testseat1:~$ ls -l /srv/tftp/apalis_t30/
total 435200
-rw-r--r-- 1 root root   575488 Jan  5  2017 apalis_t30.img
-rw-r--r-- 1 root root 16777216 Jan  5  2017 boot.vfat
-rw-r--r-- 1 root root     4427 Jan  5  2017 flash_blk.img
-rw-r--r-- 1 root root     4183 Jan  5  2017 flash_eth.img
-rw-r--r-- 1 root root      512 Jan  5  2017 mbr.bin
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-100
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-101
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-102
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-103
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-104
-rw-r--r-- 1 root root 67108864 Jan  5  2017 root.ext3-105
-rw-r--r-- 1 root root 33554432 Jan  5  2017 root.ext3-106
-rw-r--r-- 1 root root  4389888 Jan  5  2017 uImage
-rw-r--r-- 1 root root      231 Jan  5  2017 versions.txt

tester@testseat1:~$ ls -l configblock.bin 
ls: cannot access configblock.bin: No such file or directory
tester@testseat1:~$ ls -l apalis_t30.img
ls: cannot access apalis_t30.img: No such file or directory

tester@testseat1:~$ tftp localhost -c get configblock.bin
tester@testseat1:~$ tftp localhost -c get apalis_t30/apalis_t30.img

tester@testseat1:~$ ls -l configblock.bin 
-rw-rw-r-- 1 tester tester 32 Jul 21 14:24 configblock.bin
tester@testseat1:~$ ls -l apalis_t30.img 
-rw-rw-r-- 1 tester tester 575488 Jul 21 14:25 apalis_t30.img

I hope that helps.

We’ve actually got this working now. The problem had to do with the fact that we are running Ubuntu Linux in a VMware virtual machine. I had to configure the VMware Workstation for port forwarding, set the Ubuntu firewall to allow a connection on port 69, and configure an inbound rule for Windows Firewall on port 69 as well.

Now, it seems to be working fine. Thanks for all of the information everyone. I appreciate your suggestions as I worked through solving this problem. :).

We’ve actually got this working now. The problem had to do with the fact that we are running Ubuntu Linux in a VMware virtual machine. I had to configure the VMware Workstation for port forwarding, set the Ubuntu firewall to allow a connection on port 69, and configure an inbound rule for Windows Firewall on port 69 as well.

Now, it seems to be working fine. Thanks for all of the information everyone. I appreciate your suggestions as I worked through solving this problem. :).