RedBoot Example

From Linux/Xtensa
Jump to navigation Jump to search

Booting Linux Using RedBoot

Here is an example series of steps that setup RedBoot to boot Linux on an XT-AV60 (LX60) or XT-AV200 (LX200) board.

  • Build Linux for the LX60 (see the Buildroot Build Instructions).
    • When configuring the kernel, include ip=bootp or ip=dhcp in the kernel command line, as desired.
  • Flash RedBoot on the board (see Tensilica XT-AV60 (LX60) docs for how).
    • Reset the board.
    • Wait for RedBoot to boot to its prompt.
  • The Tensilica docs show two methods of putting RedBoot into flash using OCD. If you used RedBoot to flash itself, the flash filesystem is probably already initialized. Otherwise you have to init the flash filesystem. To check just do:
RedBoot> fis list

and see whether you get a useful list of flash images. If not, do:

RedBoot> fis init -f
y
RedBoot> fconfig -i -l
y
  • Download the kernel image <build>/arch/xtensa/boot/zImage.redboot to address 0xd1000000. For example, put that file on a TFTP server, and load it using RedBoot like this:
RedBoot> load -r -b 0xd1000000 zImage.redboot

(use the proper pathname for accessing the file over TFTP instead of zImage.redboot, as needed).

  • Now that the kernel image is in memory, you can execute it directly:
RedBoot> exec -w 3 0xd1000000
  • Or, you can instead put the image in flash so you can boot it multiple times without loading again:
RedBoot> fis create -b 0xd1000000 -l 0xNNNNNN -e 0xd1000000 -r 0xd1000000 linux

where 0xNNNNNN is the size of the downloaded image and "linux" is just some name for the image. (You can have multiple images with different names, as flash space allows; use the same name in the fis load <name> command below.)

  • You might double check that the image is now there. Something like:
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xF8000000  0xF8000000  0x00020000  0x00000000
RedBoot[backup]   0xF8020000  0xF8020000  0x00020000  0x00000000
RedBoot config    0xF83E0000  0xF83E0000  0x00001000  0x00000000
FIS directory     0xF83F0000  0xF83F0000  0x00010000  0x00000000
linux             0xF8020000  0xD1000000  0x001C0000  0xD1000000
RedBoot>
  • You can reload the image from flash to memory using:
RedBoot> fis load linux
  • Now the fun part. You can setup RedBoot with a script to load the image (from network or flash) and execute it, automatically at reset. Here is an example that loads from flash, with a timeout set to 5 seconds so that you can Ctrl-C to avoid booting Linux if you want a boot prompt:
RedBoot> fconfig
Run script at boot: true
Boot script:
Enter script, terminate with empty line
 >> fis load linux
 >> exec -w 3 0xd1000000
 >>
Boot script timeout (1000ms resolution): 5
Use BOOTP for network configuration: true
Console baud rate: 38400
GDB connection port: 9000
Network debug at boot time: false
Update RedBoot non-volatile configuration - are you sure (y/n)? y
... Erase from 0xf83e0000-0xf83e1000: .
... Program from 0xd3f6e000-0xd3f6f000 at 0xf83e0000: .
RedBoot>

(although I left BOOTP enabled above, you might not need it if always loading from flash)

  • Now you should be able to reset the board, and see RedBoot booting, and see Linux automatically booting afterwards.
  • At the Linux login prompt, login as root as usual