HowTo flash the Nightwing firmware using RedBoot
RedBoot is a complete bootstrap environment for embedded systems. Based on the eCos Hardware Abstraction Layer. RedBoot has many features, including the use of the command line interface (CLI).
Through the CLI we can manipulate the flash memory of our device (in our case the router), we can also upload and download the images to flash memory through a tftp server.
Redboot can be access via a serial interface or Ethernet.
To access the CLI interface, we use the serial adaptor, which we connect to the device. This access we do it through minicom or another serial console emulator.
Then we must break the normal boot process at power-on, by hitting control-c and entering in CLI interface
On the serial console, we are presented with the CLI: RedBoot>
The commands to use and a brief description of what they do, are as follows:
fconfig Allows to make changes to the default RedBoot configuration
fis init Initializes the Flash Image System (FIS)
fis list Lists the directories of the FIS.
fis delete Deletes an image from the flash
fis load Loads a flash image into the RAM memory
fis create Creates a flash image
fis free Shows the free space in the flash memory
In summary, the steps to reflash a device are this:Just before the first time we flash it:
fconfig (if we need to change something of what come with default)
fis init
Allways that we flash:
fis load -r -b %{FREEMEMLO} nightwing-vmlinux.lzma
fis create -r 0x80041000 -e 0x80041000 kernel
fis load -r -b %{FREEMEMLO} nightwing-root.squashfs
fis free (2° nš 1° nš = nš to be used in the fis create of the rootfs)
fis create -l 0x2F0000 rootfs
A description of the commandsfconfigThis command presents us an interactive secuence by wich we configure RedBoot. It's important to remember to asign the server IP address that we'll use to load the images to be used.
RedBoot> fconfig
Run script at boot: false
Use BOOTP for network configuration: false
Local IP address: 192.168.1.123
Default server IP address: 192.168.1.42
DNS server IP address: 192.168.1.254
GDB connection port: 9000
Network debug at boot time: false
fis initThis command is used to initialize the Flash Image System (FIS). It should normally only be executed once, when RedBoot is first installed on the router or when we first delete the partitions the first time we flash. Subsequent executions will cause loss of previously stored information in the FIS.
RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xbffe0000-0xbfff0000: .
... Program from 0x80ff0000-0x81000000 at 0xbffe0000: .
fis listThis command lists the images currently available in the FIS. Certain images used by RedBoot have fixed names and have reserved slots in the FIS (these can be seen after using the fis init command). Other images can be manipulated by the user.
RedBoot> fis list
Name FLASH addr Mem addr Length Entry point
RedBoot 0xBFC00000 0xBFC00000 0x00030000 0x00000000
FIS directory 0xBFFE0000 0xBFFE0000 0x0000F000 0x00000000
RedBoot config 0xBFFEF000 0xBFFEF000 0x00001000 0x00000000
This images list is when no own images has been created or when they have been deleted; you can only see the ones that RedBoot has.
fis deleteThis command creates an image in the FIS directory. The reserved images for RedBoot shloud not be deleted.
RedBoot> fis delete rootfs
Delete image 'rootfs' - continue (y/n)? y
... Erase from 0xbfce0000-0xbffe0000: ...........................................
... Erase from 0xbffe0000-0xbfff0000: .
... Program from 0x80ff0000-0x81000000 at 0xbffe0000: .
fis loadThis command is used to transfer an image to the router, it's stored in the RAM memory.
RedBoot> load -r -b %{FREEMEMLO} nightwing-vmlinux.lzma
Using default protocol (TFTP)
Raw file loaded 0x80040c00-0x800f0bff, assumed entry at 0x80040c00
fis createThis command creates an image in the FIS directory. We use it to copy what we previously stored in the RAM memory with the fis load command.
RedBoot> fis create -r 0x80041000 kernel
... Erase from 0xbfc30000-0xbfce0000: ...........
... Program from 0x80040c00-0x800f0c00 at 0xbfc30000: ...........
... Erase from 0xbffe0000-0xbfff0000: .
... Program from 0x80ff0000-0x81000000 at 0xbffe0000: .
fis freeThis command shows which areas of the flash memory are currently not in use.
RedBoot> fis free
0xBFCE0000 .. 0xBFFE0000
For more information about the use of RedBoot you can see the User's Guide:
http://ecos.sourceware.org/ecos/docs-latest/redboot/redboot-guide.html