U-Boot

Bootloader Initialization

U-Boot will emit a number of important details upon execution. The following example is from U-Boot 1.3.0 for the AT91 boards. Your mileage may vary depending on the version of U-Boot and the board that is used.

U-Boot 1.3.0 (Nov 28 2007 - 10:58:54)                                           

DRAM:  64 MB                                                                    
NAND:  NAND device: Manufacturer ID: 0xec, Chip ID: 0xda ( NAND 256MiB 3,3V 8-bit)
NAND: Pagesize: 2048, Blocksize: 128K, OOBsize: 64                              
256 MiB                                                                         
DataFlash:AT45DB642                                                             
Nb pages:   8192                                                                
Page Size:   1056                                                               
Size= 8650752 bytes                                                             
Logical address: 0xD0000000                                                     
Area 0: D0000000 to D0003FFF (RO)                                               
Area 1: D0004000 to D0007FFF                                                    
Area 2: D0008000 to D0037FFF (RO)                                               
Area 3: D0038000 to D083FFFF                                                    
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
DM9161A PHY Detected                                                            
End of Autonegotiation

Configuring the Network Interface

Finding and Changing the MAC Address

The MAC address is printed out at boot time by U-Boot. It may be found in the initialization output, or as the value of the ethaddr environment variable.

If the MAC address is all zeroes it may be set by:

U-Boot> setenv ethaddr 12:34:56:78:99:aa

The MAC address specified in U-Boot is passed to the kernel automatically.

Changing the IP Address

The IP addresses of both the target board and TFTP server must be configured in order to download Linux using TFTP.

The following commands are examples of setting these values in U-Boot:

U-Boot> setenv ipaddr 10.10.0.11
U-Boot> setenv serverip 10.10.0.3

Downloading the Kernel

The tftp command is used to download the kernel from a server to the main memory of the target machine. It has the following format:

tftp [load address] [filename]

It uses the following environment variables:

  • ipaddr — IP Address of the target machine.
  • serverip — IP Address of the host machine.
  • loadaddr — Load address of the image on the target machine. Only used if the load address parameter and filename are not specified.
  • bootfile — Name of the image to be downloaded from the host machine. Only used if the load address parameter and filename are not specified.

The tftp command produces the following output:

Example:

U-Boot> tftp                                                                    
TFTP from server 10.10.0.3; our IP address is 10.10.0.10                        
Filename 'uImage-9260-7.0'.                                                     
Load address: 0x21400000                                                        
Loading: #################################################################      
         ############################                                           
done                                                                            
Bytes transferred = 1358924 (14bc4c hex)

Booting the Kernel

The bootm command is used to boot a uImage loaded into the main memory. For a Linux kernel, it has the following format:

bootm [kernel_addr] [initrd_addr]

If kernel_addr is not specified, U-Boot uses the last address that something was loaded in to. All parameters must be specified if an initrd image is used.

Example:

U-Boot> bootm                                                                   
## Booting image at 21400000 ...                                                
   Image Name:   Linux-2.6.22.9                                                 
   Image Type:   ARM Linux Kernel Image (uncompressed)                          
   Data Size:    1358860 Bytes =  1.3 MB                                        
   Load Address: 20008000                                                       
   Entry Point:  20008000                                                       
   Verifying Checksum ... OK                                                    
OK                                                                              

Starting kernel ...  

Booting from Flash

To boot a kernel from flash, you'll typically need to copy it to RAM using the cp command.

cp[.b|.w] <source address> <destination address> <size>
  • .b — Byte-wise copy
  • .w — Word-wise copy
  • source address — Source address for image
  • destination address — Destination address in memory
  • size — Number of (bytes|words) to be transferred

Once the image is loaded to RAM, you can boot it as usual.

Example:

To copy an image of at most 0x20000 bytes from 0xC0038000 to 0x21400000, use the following command:

U-Boot> cp.b 0xc0038000 0x21400000 0x200000

References