RedBoot

Bootloader Initialization

RedBoot will emit a number of important details upon execution. The following example is from the i.MX31 ADS board. Your mileage may vary depending on the version of RedBoot and the board that is used.

With RedBoot in flash, the board outputs the following on the serial port at power-on/reset:


++... Read from 0x07ee0000-0x07f00000 at 0xa1fe0000: .
... Read from 0x07ed3000-0x07ed4000 at 0xa1fff000: .

Booting from [NOR flash]

... waiting for BOOTP information
... waiting for BOOTP information
Ethernet eth0: MAC address 00:04:9f:00:2e:af
IP: 192.168.2.79/255.255.255.0, Gateway: 192.168.2.2
Default server: 192.168.2.20

RedBootTM bootstrap and debug environment [ROMRAM]
Non-certified release, version FSL 200610 - built 10:26:48, Mar  9 2006

Platform: MX31 ADS (Freescale i.MX31 based) PASS 1.1 [x32 DDR]
Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.

RAM: 0x00000000-0x07f00000, [0x00013e40-0x07ed1000] available
FLASH: 0xa0000000 - 0xa2000000, 256 blocks of 0x00020000 bytes each.
RedBoot>

Configuring the Network Interface

Finding and Changing the MAC Address

The MAC address in normally displayed when the board is reset. If the MAC address is not set you can use the setmac command to do so:

RedBoot> setmac
MAC address: 0x00:0x04:0x9f:0x00:0x2e:0xaf

Changing the IP Address

The IP Addresses of the board and tftp server are set using fconfig. The fconfig command prompts you for values for a series of configuration options.

RedBoot> fconfig 
Run script at boot: false
Use BOOTP for network configuration: true
Default server IP address: 192.168.2.20
Board specifics: 0
Console baud rate: 115200
Set eth0 network hardware address [MAC]: false
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false

The IP address will be set with these values after a reset. It can also be set using the ip_addr command, which takes the following format:

ip_addr [-b ] 
        [-l local_IP_address[ netmask_length ] ] 
        [-h server_IP_address ] 
        [-d DNS_server_IP_address ]
Flag Description Default
-b Use DHCP to determine address. Off
-l local_IP_address[ netmask_length ] The IP address that RedBoot should use, and optionally the netmask length. None
-h server_IP_address The IP address of the default TFTP server. None
-d DNS_server_IP_address The IP address of the DNS server to resolve host names. None

IMPORTANT! The -b flag is not available in every version of RedBoot.

Example:

The following command loads an IP address using DHCP:

RedBoot> ip_addr -b

Downloading the Kernel

Once the network interface is configured, the kernel can be loaded via TFTP using the load command. It takes the following format:

load [-v ] [-d ] [-r ] 
     [-h server_IP_address ] 
     [-f flash_location ] 
     [-b ram_location ] 
     [file_name ]
Flag Description Default
-v Display a spinner to indicate progress Off
-d Decompress gzipped file Off
-r Raw or binary data. Must use -b or -f Off
-h server_IP_address TFTP Server IP Address Value set by ip_addr or in config
-f flash_location Location in flash memory to load file. Set by data format
-b ram_location Location in RAM memory to load file. Set by data format
filename Name of file to download from the server. None

Example:

The following command loads the raw file zImage from the server determined by ip_addr to the RAM location 0x01008000. It will also display a spinner.

RedBoot> load -v -r -b 0x01008000 zImage

Booting the Kernel

The loaded kernel is booted using the exec command. It takes the following format:

exec [-w timeout ] 
     [-r ramdisk_address ] 
     [-s ramdisk_length ] 
     [-b load_address  {-l load_length} ] 
     [-c kernel_command_line ] 
     [entry_point ]
Flag Description Default
-w timeout Time to wait before execution 0
-r ramdisk_address Address of the initrd image None
-s ramdisk_length Length of the initrd image None
-b load_address Address of the kernel image Set by load
-l load_length Length of kernel image None
-c kernel_command_line Command line passed to Linux kernel Determined by kernel configuration
-x Boot kernel with endianess opposite that of RedBoot Off
entry_point Starting point of execution Implied by architecture

Example:

The following example will execute a kernel loaded via the load instruction with the given command line.

RedBoot> exec -c "noinitrd console=ttymxc0,115200 \
                  root=/dev/nfs nfsroot=192.168.2.19:/opt/timesys/linux/6.1/armv5l-std/rfs \
                  init=/linuxrc ip=192.168.2.12:192.168.2.13" 

Booting from Flash

The following section describes how to kernel from flash.

Determine Flash Size

The flash size is displayed by Redboot when the board is reset.

Example:

   FLASH: 0xf0000000 - 0xf2000000, 256 blocks of 0x00020000 bytes each.

Initialize the Flash

You must execute the fis init command to initialize the FIS on the board.

This command should only be executed once, when the board is booted for the first time.

fis init [-f ] 
Flag Description Default
-f All blocks of flash memory (except for the boot blocks) will be erased Off

Example:

The following example formats the flash memory.

RedBoot> fis init -f
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xf0040000-0xf1fc0000: .........................................
...............................................................................
...............................................................................
...............................................
... Erase from 0xf1fe0000-0xf1fe0000:
... Erase from 0xf2000000-0xf2000000:
... Unlock from 0xf1fe0000-0xf2000000: .
... Erase from 0xf1fe0000-0xf2000000: .
... Program from 0x0ffdf000-0x0ffff000 at 0xf1fe0000: .
... Lock from 0xf1fe0000-0xf2000000: .

Listing Flash Partitions

After flash is initialized the following default flash partition map (FIS directory) may be listed using the fis list command.

fis list

If the kernel is built with CONFIG_MTD_REDBOOT_PARTS enabled, you cannot define any partitions statically. Instead, you should use FIS to create and initialize partitions.

Example:

The following example lists the default RedBoot partitions:

    RedBoot> fis list
    Name              FLASH addr  Mem addr    Length      Entry point
    RedBoot           0xF0000000  0xF0000000  0x00040000  0x00000000
    RedBoot config    0xF1FC0000  0xF1FC0000  0x00001000  0x00000000
    FIS directory     0xF1FE0000  0xF1FE0000  0x00020000  0x00000000

Writing the Kernel to Flash

To store the kernel in flash:

  1. Use load to download the kernel image from the TFTP server.
  2. Use fis create to create a FIS directory and copy the image to flash.
  3. Use fis list to verify the contents of your flash.
fis create -b mem_base 
           -l length 
           [ -r ram_addr ]
           [ -f flash_addr ] 
           name
Flag Description Default
-b mem_base Address of data to be written to the flash. None
-l length Length of data area to copy None
-r ram_addr Address where the image should be relocated to by the fis load command. None
-f flash_addr Address in flash to occupy. First free Vblock
name Name of flash partition None

Example:

  1. Load kernel 'zImage.iq81342' to memory address 0x01008000:
    RedBoot> load -r -b 0x01008000 zImage.iq81342
    Using default protocol (TFTP)
    Raw file loaded 0x01008000-0x01152c43, assumed entry at 0x01008000
    
  2. Create an fis directory at 0xf0040000 called Kernel:
    RedBoot> fis create -b 0x01008000 -l 0x01152c43 -r 0x01008000 -f 0xf0040000 Kernel
    ... Erase from 0xf0040000-0xf11a0000: ...........................................
    .................................................................................
    ...............
    ... Program from 0x01008000-0x0215ac43 at 0xf0040000: ...........................
    .................................................................................
    ...............................
    ... Unlock from 0xf1fe0000-0xf2000000: .
    ... Erase from 0xf1fe0000-0xf2000000: .
    ... Program from 0x0ffdf000-0x0ffff000 at 0xf1fe0000: .
    ... Lock from 0xf1fe0000-0xf2000000: .
    
  3. Verify the contents of your flash:
    RedBoot> fis list
    Name              FLASH addr  Mem addr    Length      Entry point
    RedBoot           0xF0000000  0xF0000000  0x00040000  0x00000000
    RedBoot config    0xF1FC0000  0xF1FC0000  0x00001000  0x00000000
    FIS directory     0xF1FE0000  0xF1FE0000  0x00020000  0x00000000
    Kernel            0xF0040000  0x01008000  0x01160000  0x01008000
    RedBoot>
    

Loading the Kernel from Flash

The kernel can then be loaded into memory and booted using the fis load command.

fis load [-b memory_load_address ] 
         [-c] 
         [-d] 
         name
Flag Description Default
-b memory_load_address Address in RAM to load file. Defined in partition table
-d Decompress gzipped image Off
-c Print checksum of image Off
name Name of flash partition to load None

Example:

The following example loads an image from the "Kernel" partition and boots it.

RedBoot> fis load kernel
RedBoot> go -n
Uncompressing Linux..............................................................
........................... done, booting the kernel.
Linux version 2.6.11-timesys.1 (root@bslave04) (gcc version 3.4.1 20040714 (TimeS
ys 3.4.1-7)) #1 Fri Dec 2 10:48:46 EST 2005
... etc..

MTD Boot Partitions in Linux

If CONFIG_MTD_REDBOOT_PARTITIONS is set in the kernel configuration, then the FIS directories will appear in the kernel boot log as follows:

    Searching for RedBoot partition table in phys_mapped_flash at offset 0x1fe0000
    6 RedBoot partitions found on MTD device phys_mapped_flash
    Creating 6 MTD partitions on "phys_mapped_flash":
    0x00000000-0x00040000 : "RedBoot" 
    0x00040000-0x011a0000 : "Kernel" 
    0x00040000-0x011a0000 : "Kerne" 
    0x011a0000-0x01fc0000 : "unallocated" 
    0x01fc0000-0x01fc1000 : "RedBoot config" 
    0x01fe0000-0x02000000 : "FIS directory" 

References

RedBoot Project homepage