With a network connection available, U-Boot can load files quickly and easily via TFTP.
If you need information about how to even connect to the board initially for basic communication, please see the terminal programs document.
If you need information about how to setup a TFTP server, please see the setting up a TFTP server document.
If you need information about how to connect your board to the network, please see the DHCP and Network Configuration pages.
We'll start off with a terminal connected to the board and sitting at the U-Boot prompt.
There is just one U-Boot command that everything else uses and that is the tftp command. All you have to specify is the load address and the file to load.
bfin> help tftp tftpboot [loadAddress] [bootfilename]
Things to keep in mind:
Like any other command, the tftp command can (and often times is) used in the autoboot command that U-Boot runs automatically.
A common example of using the tftp command is loading up a U-Boot binary to test:
bfin> tftp 0x1000 u-boot.bin Using Blackfin EMAC device TFTP from server 192.168.0.2; our IP address is 192.168.0.15 Filename 'u-boot.bin'. Load address: 0x1000 Loading: ############################ done Bytes transferred = 141016 (226d8 hex) bfin> go 0x1000 ## Starting application at 0x00001000 ...Here we loaded the
u-boot.bin file into external memory at address 0x1000. Then we proceeded to simply start executing at that address.
Another common example is loading up a bootable U-Boot image that contains the Linux kernel:
bfin> tftp 0x1000000 uImage
Using Blackfin EMAC device
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'uImage'.
Load address: 0x1000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#######################################################
done
Bytes transferred = 3937349 (3c1445 hex)
bfin> bootm
## Booting image at 01000000 ...
Image Name: Linux-2.6.22.14-ADI-2007R2-pre-s
Created: 2007-11-29 14:46:30 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 3937285 Bytes = 3.8 MB
Load Address: 00001000
Entry Point: 00150000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 150000
Linux version 2.6.22.14-ADI-2007R2-pre-svn3955 (vapier@G5) (gcc version 4.1.2 (ADI svn)) #22 Thu Nov 29 09:46:25 EST 2007
Here we loaded the uImage file into external memory at address 0x1000000. Then we proceeded to boot it. Keep in mind that compressed images (like uImages), the address of the uImage needs to be different from that of the load address of the executable and that it needs to be loaded outside of the decompressed file. Our kernel here loads at 0x1000 and is only 3.8 megs, so the load address of the uImage at 16 meg (0x1000000) is clearly outside of the decompression range.
It is recommended when doing development to load and boot uImage files rather than linux files. The bootable U-Boot format includes compression while the ELF format does not. The time to decompress is typically smaller than the time to load a larger uncompressed file. With recent versions of U-Boot, booting a Linux ELF will not work properly anyways.
Another common example is loading up the ELF image of a standalone U-Boot application:
bfin> tftp 0x1000000 smc91111_eeprom SMC91111: MAC 00:e0:22:fe:05:3f Using SMC91111-0 device TFTP from server 192.168.0.2; our IP address is 192.168.0.15 Filename 'smc91111_eeprom'. Load address: 0x1000000 Loading: ## done Bytes transferred = 17699 (4523 hex) bfin> boote Loading phdr 0 to 0x00001000 (2836 bytes) ## Starting application at 0x00001490 ... SMC91111>Here we loaded the
smc91111_eeprom file into external memory at address 0x1000000. Then we proceeded to boot it. Keep in mind that the two memory regions cannot overlap. The memory region where U-Boot loads the ELF cannot overlap the memory region where the ELF loads and executes.