Disaster Recovery

 

Today's Flash ROM chips are highly reliable once data have been written successfully. If you do not write to the chips, most manufacturers guaranteed that their chips have data retention for more than 10 years. However, the seeming perfect reliability is basing on data have been successful written. What they didn't specify is the failure rate of writing itself. It does exist, though quite low.

 

In the embedded computer world, unfortunately, we need to update the contents of Flash so frequently, for example, writing to JFFS2 disk and firmware updating. Writing data to Flash is where most troubles come from.

 

If, for some reason, portion of the flash ROM corrupts, and the uClinux can not start normally. As long as the boot loader is still alive, we can use it to recover from disasters. The bootloader is network-ready and has a built-in TFTP server. Normally, to restore a 8 MB ROM image, it takes only 2.5 minutes.

 

Alternatively, using XMODEM 256/1K protocols on low speed serial interface is also supported, though it is not recommended for its poor performance (15 minutes for downloading 8 MB ROM image).

 

Debug Monitor

 

*         Connect to the serial console

Connect to the device with terminal emulation software, e.g. Hyper Terminal, and a RS232 cable, at 115200,n,8,1.

 

*         Connect the device to network.

The boot loader is network-ready. Files and images can be downloaded via TFTP.

 

*         Enable debug mode.

Set the hardware jumper to enable debug mode.

 

*         Reset the device

Reset or power off/on the device. The following messages will be shown on the terminal:

 

*         Enter debug monitor

Press ESC to enter debug monitor

 

Metavert Bootloader Nov 24 2009 17:41:46

SDRAM: 16 MB

CFI Flash ROM found, total 8192 KB

Region #1   64 KB,    8 KB/sector

Region #2 8128 KB,   64 KB/sector

Serial Number: 3D820240

Press ESC to enter debug mode .

  Commands:

  XF       Xmodem flash programming

  LS       List images in flash

  CLEAR   Clear MTD user disk

  IP       Set IP address

  Q        Quit

> IP = 10.0.0.29 (assigned by DHCP server)

 

 

Restore System by TFTP

 

TFTP Client Software

 

The TFTP client is available on both Windows and linux platforms:

 

Windows: built-in command

tftp ¡Vi [ip_address] put [file_name]

 

linux: The package ¡¥tftp-hpa¡¦ needs to be installed

tftp ¡Vm octet [ip_address] ¡Vc put [file_name]

 

Supported File Types

 

While receiving files from the TFTP client, the boot loader uses the file name to determine which operation should be performed:

 

File Name

Operation

bootloader.bin

Update the boot loader in the 0-0x10000 preserved block.

linux*

Update the linux kernel.

romfs*

Update the rom file system.

*.bin

Other files with .bin suffix are treated as raw ROM images.

 

Examples

 

Restore ROM Image

Windows:    tftp ¡Vi 192.168.0.123 put ROM.bin

linux:           tftp ¡Vm octet 192.168.0.123 ¡Vc put ROM.bin

 

Update linux kernel

Windows:    tftp ¡Vi 192.168.0.123 put linux.zip

linux:           tftp ¡Vm octet 192.168.0.123 ¡Vc put linux.zip

 

Update rom file system

Windows:    tftp ¡Vi 192.168.0.123 put romfs.zip

linux:           tftp ¡Vm octet 192.168.0.123 ¡Vc put romfs.zip

 

Update boot loader

Windows:    tftp ¡Vi 192.168.0.123 put bootloader.bin

linux:           tftp ¡Vm octet 192.168.0.123 ¡Vc put bootloader.bin

 

 

Restore System by XMODEM

 

The boot loader supports XMODEM 256 and XMODEM 1K protocols. Though still very slow, the later, XMODEM 1K is slightly faster than the former. If network interface is available, it is recommended to restore system by TFTP which is much faster than the serial interface.

 

There are three types of downloading:

 

XF All          Update the whole image except the 0-0x10000 block.

 

XF linux       Update the linux kernel

 

XF romfs     Update the rom file system

 

 

Command Reference

 

XF

The XF command can transfer files to memory with XMODEM protocol and write them to FLASH ROM.

 

> XF

Usage: XF [all | linux | romfs]

  all   = update entire ROM

  linux = update linux kernel only

  romfs = update ROM file system only

>

 

LS

The LS command lists the images in the flash ROM.

 

> ls

romfs.zip      557 KB    @0x0f0000

linux.zip      757 KB    @0x020000

>

 

CLEAR

The CLEAR command clears the user MTD disk (formatting)

 

> clear

Erase MTD area ? Y/N [ ]

Erasing

................................

................................

................................

.......

MTD area erased

>

 

IP

The IP command sets the device¡¦s IP address manually. This command is optional. Normally, the device will automatically request an IP from the DHCP server, if there¡¦s a DHCP server on the network.

 

> IP 192.168.0.100

Ok

 

Q

The Q command quits the boot loader and proceeds to the normal boot process.

 

> q

Processing image 6 ...

Unzip image 6 ...

Processing image 7 ...

Unzip image 7 ...

Executing image 7 ...

Linux version 2.4.20-uc0 (metavert@vm-linux) (gcc version 3.0) #651 Wed Nov 25 0

1:58:42 CST 2009

Processor: Winbond W90P710 revision 1

Architecture: W90P710

On node 0 totalpages: 3808

zone(0): 0 pages.

zone(1): 3808 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/rom0 rw

Calibrating delay loop... 39.83 BogoMIPS

Memory: 14MB = 14MB total