Downloading Files to U-Boot

On many occasions it is necessary to download files to U-Boot, either via a serial or network connection.

For example, U-Boot configuration scripts, bootloader and kernel images may all be downloaded by this means.

This Section describes these basic procedures that are used when working with U-Boot.

All of U-Boot's file download commands (serial and network) require a memory address at which the file data will be stored. The address used depends upon the task that is being performed.

Network File Download

U-Boot supports various network protocols to allow user to download files via ethernet to the target platform. Refer to the DAS U-Boot Manual for more information. This section will only address file download via the TFTP protocol.

Download file via TFTP protocol

U-Boot supports the TFTP (Trivial FTP) protocol for file transfer, this allows the user to download files from the host machine to the target device. The U-Boot "tftp" command requires two parameters, the name of the file and the location in memory to store the downloaded file.

The following example will download the file image.ub to the location 0x10000000.

U-Boot> tftp 0x10000000 image.ub

U-Boot will output the size and load address of the file it just downloaded, the user should check to ensure these values are correct. If not, repeat the download procedure.

The following example shows the output message of a tftp download session in U-Boot.

U-Boot> tftp 0x10000000 image.ub
TFTP from server 192.168.0.1; our IP address is 192.168.0.10
Filename 'image.ub'.
Load address: 0x10000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################################
done
Bytes transferred = 2519104 (267040 hex)
U-Boot> 

Download file via NFS protocol

U-Boot also supports the Network File System (NFS) protocol so you can download images from your existing NFS server as well. The U-Boot "nfs" command requires three parameters, the server ip address, the name of the file (including path) and the location in memory to store the downloaded file.

The following example will download the file /home/user/petalinux/petalinux/software/petalinux-dist/images/image.ub to the location 0x10000000.

U-Boot> nfs 0x10000000 192.168.0.1:/home/user/petalinux/software/petalinux-dist/images/image.ub

Note: The "image.ub" file needs to be placed in a directory exported by the nfs server accessible to the target board.

U-Boot will output the size and load address of the file it just downloaded, the user should check to ensure these values are correct. If not, repeat the download procedure.

The following example shows the output message of a nfs download session in U-Boot.

U-Boot> nfs 0x10000000 192.168.0.1:/home/user/petalinux/software/petalinux-dist/images/image.ub
TFTP from server 192.168.0.1; our IP address is 192.168.0.10
Filename '/home/user/petalinux/software/petalinux-dist/images/image.ub'.
Load address: 0x10000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################################
done
Bytes transferred = 2519104 (267040 hex)
U-Boot> 

Serial File Download

U-Boot provides the ' loadb ' command to allow user to send images via the serial port to the target platform. Refer to the DAS U-Boot Manual for more information on using ' loadb '.

This section provides a step by step guide to downloading an image via U-Boot's 'loadb' program onto the target platform.

Start the loadb command

On the U-Boot console type the following command.

U-Boot> loadb {address}
## Ready for binary (kermit) download to {address} at 115200 bps...

where {address} is the memory address at which the file should be stored.

The address specified can reside in either the Flash or SDRAM memory range - if the address is in flash, then U-Boot will attempt to write to the Flash. It is the user's responsibility to unlock and erase the appropriate Flash sector(s), before attempting to write a file directly into Flash.

Send file via Kermit

(Refer to http://www.columbia.edu/kermit for instructions on how to use kermit)

On the Kermit window, hold down the "Control" and forward-slash ("\") keys simultaneously, then press "c" to activate the kermit prompt. Note this is different from the common "Control-C" key combination.

The following message should appear on the kermit window.

(Back at ....)
----------------------------------------------------
(/usr/local/petalogix/projects/fs-boot/) C-Kermit>

At this point, U-Boot's loadb command has started, and is waiting to receive the file over the serial port.

Then, use the Kermit send command to send the image file to U-Boot.

(/usr/local/petalogix/projects/fs-boot/) C-Kermit> send /bin /tftpboot/ub.config.img

The above example will start transmitting the 'ub.config.img' file in binary mode to U-Boot via the serial connection.

Transmission commpleted

After file transmission completes, the Kermit command prompt will reappear. Use the Kermit connect command to re-establish the serial console connection to U-Boot.

(/usr/local/petalogix/projects/fs-boot/) C-Kermit>connect
Connecting to /dev/ttyS0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x00000512 = 1298 Bytes
## Start Addr      = 0x10000000
U-Boot>

U-Boot will output the size, and start address of the file it has just received - you should check to ensure these are correct. If not, repeat the download procedure.