Once U‑Boot has been loaded onto the target system it may retrieve a memory image via a TFTP server. This section will describe how to setup a TFTP server under SuSE Linux as well as Windows and how to use this server to load uClinux via U‑Boot.
TFTP supports an optional Blocksize option. (see RFC 2348. This can help decrease download times on slow networks. To see how much, and experiment was run to measure tftp throughput on a slow network (U-Boot client running in USA, tftp server in Germany).
| tftpblocksize | download | |
|---|---|---|
| (bytes) | (ms) | |
| 512 | default | 48,246 |
| 1468 | ( 1MTU) | 17,243 |
| 2948 | ( 2MTU) | 8,912 |
| 4428 | ( 3MTU) | 6,167 |
| 5908 | ( 4MTU) | 4,840 |
| 7388 | ( 5MTU) | 4,042 |
| 8868 | ( 6MTU) | 3,425 |
| 10348 | ( 7MTU) | 2,974 |
| 11828 | ( 8MTU) | 2,736 |
| 13308 | ( 9MTU) | 2,508 |
| 14788 | (10MTU) | 2,281 |
| 16268 | (11MTU) | 2,174 |
So, that is 48-seconds (default, if your tftp server does not support RFC 2348), to either 17 (1 max packet size), or 2 seconds, if your U-Boot supports packet re-assembly or defragmentation.
However, it appears that some tftp servers (the older BSD version, Debian's “tftpd”) doesn't support RFC 2348 (blksize), and always use a block size of 512, causing the traffic to slow down. :( You need to make sure that you install the the Peter Anvin version, which does support RFC 2348, and blksize up to 65,464 bytes (Debian's “tftpd-hpa”). This can be found on this Web site.
How to tell which you have? Check your man page: ”man tftpd” or ask for the version:
Peter Anvin version:
rgetz@imhotep:~> /usr/sbin/in.tftpd -V tftp-hpa 0.48, with remap, with tcpwrappers rgetz@imhotep:~>
non-RFC 2348 one:
rgetz@imhotep:~> /usr/sbin/in.tftpd -V rgetz@imhotep:~>
Even when using the Peter Anvin version, block size can still be reduced via two methods:
-B-B 512)-r-r blksize)
Check your local /etc/xinetd.d/tftp or /etc/inetd.conf file to see how your tftpd server is being invoked.$ sudo apt-get install xinetd tftpd-hpa tftp
user@machine:~ $ /usr/sbin/in.tftpd -V tftp-hpa 0.36, with remap, with tcpwrappers
/etc/xinetd.d/tftp and put this entry:service tftp
{
protocol = udp
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
/tftpboot directory$ sudo mkdir /tftpboot $ sudo chmod -R 777 /tftpboot $ sudo chown -R nobody /tftpboot
$ sudo /etc/init.d/xinetd start
The procedure for setting up a TFTP server under SuSE Linux is given below. For other distributions of Linux this procedure may differ slightly. You may have to install TFTP if it is not already installed on your system.
First, as root, make a directory to store the uClinux image which will be loaded onto the target system.
bash# mkdir /tftpboot
Next the ownership of this directory must be changed to nobody as this is the default user ID setup by tftpd. It is also a good idea to give world write permission to this directory, to allow normal users (not root) to copy files for downloading.
bash# chown nobody:nobody /tftpboot bash# chmod 777 /tftpboot
Next move the image of a compiled version of uClinux into the tftpboot directory. This file is usually named linux. For more information on compiling uClinux see Compiling the Kernel.
Now the file /etc/xinetd.d/tftp must be edited to match the following:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
Under SuSE Linux 9.0 the following options needed to be changed from their default values:
disable = no (enables the TFTP service)
server_args = -s /tftpboot (sets the directory to /tftpboot
Next, to start the TFTP server enter the following command as root:
bash# /etc/init.d/xinetd restart
Alternately the TFTP server may be enabled through the XWindows interface. These instructions are for SuSE Linux 9.0. For other distributions of Linux this procedure may vary.
Open the Control Center which is located under the start menu. The Control Center window should now be displayed:
Click on YaST2 modules.
The YaST2 modules sub-menu should now be displayed in the sidebar:
Click on Network Services.
The Network Services sub-menu should now be displayed in the sidebar:
Click on TFTP Server then click the Administrator Mode button (you will need the root password).
After entering the root password the TFTP server configuration module should now be displayed:
Select the Enable radio button.
Enter /tftpboot in the Boot Image Directory textbox.
Click Finish.
There are several TFTP server programs available for the Windows platform. The setup instructions in this section are for the program TFTP Turbo. TFTP Turbo is available free of charge from Weird-solutions. The setup procedure for other TFTP server programs will differ.
First, download the installer program for TFTP Turbo and run it. Follow the instructions given to install TFTP Turbo, select a full installation. Once installation is complete start TFTP Turbo. The TFTP Turbo main window should now be displayed:
Double Click on localhost in the Servers sidebar
The login dialog should now be displayed:
Leave the Password field blank and click on Login
With localhost still selected, under the Edit menu select Properties. The Server Properties dialog should now be displayed:
In the Virtual Root field enter the path to the directory you wish to use as the TFTP root directory.
In this example C:\tftpboot is used. Ensure that a valid uClinux kernel image exists in this directory.
Next, with localhost still selected, under the Tools menu select Control Service. The Control Service dialog should now be displayed:
If the message says ”TFTP Turbo is running on localhost” simply click OK.
If the message says ”TFTP Turbo is not running on localhost” click Start then click OK.
The TFTP Turbo server should now be running.
The first step in testing tftp is to check if local access works.
blackfin@linux 0 ~ $ netstat -l -u | grep ftp udp 0 0 *:tftp
foo in the /tftpboot directory.blackfin@linux 0 ~ $ touch /tftpboot/foo
blackfin@linux 0 ~ $ tftp localhost tftp> get foo tftp> quit blackfin@linux 0 ~ $ ls -l foo -rw-r--r-- 1 blackfin users 0 2006-07-31 09:49 foo
blackfin@linux 0 ~ $ /sbin/ifconfig | grep "inet addr"
inet addr:10.99.22.176 Bcast:10.99.22.255 Mask:255.255.255.0
inet addr:127.0.0.1 Mask:255.0.0.0
blackfin@linux 0 ~ $ tftp 10.99.22.176
tftp> get foo
tftp> quit
blackfin@linux 0 ~ $ ls -l foo
-rw-r--r-- 1 blackfin users 0 2006-07-31 09:49 foo
Complete Table of Contents/Topics

