Skip to content
Narrow screen resolution Wide screen resolution Auto adjust screen size Increase font size Decrease font size Default font size

gumstix developer site

Home arrow Documentation arrow Developer how to'sarrow Reflashing using a serial connection and an MMC/SD/microSD card
Reflashing using a serial connection and an MMC/SD/microSD card
Print 
For those who have an expansion card or motherboard with MMC/SD/microSD support, this method of reflashing can save substantial time over downloading images over a serial connection.

You will still require a serial console connection in order to enter the reflashing commands, but the image data for the linux kernel and root file system can be transfered direcly from the memory card. If you don't know how to do so, see the section on Setting up a serial connection .

Storing the linux kernel and rootfs images on your memory card

Your development machine will need a built-in or USB adaptor for your flash memory card for this step. Your memory card must be formatted with the FAT file system since u-boot will not be able to read other file systems.

Copy your rootfs and uimage files to the memory card using your choice of command line or GUI utility. If you wish to update u-boot you should also copy over the u-boot.bin image (this will only be necessary in extremely rare circumstances). The instructions below assume you have named your linux kernel, root file system, and u-boot images: uimage, rootfs, and uboot.bin respectively.

To prevent data corruption, make sure to umount (command line) or unmount/eject (GUI) your memory card volume before removing it from your development machine's adaptor.

Loading image data from your memory card

Now physically transfer the memory card form your development machine to the slot on your gumstix expansion card or motherboard.

Normally you will only be replacing the root file system and kernel images. If you find it necessary, the instructions for reflashing u-boot are located at the end of this page.

Reboot your gumstix system and quickly press a key to enter the u-boot command mode:

U-Boot 1.2.0 (Jan 21 2008 - 09:22:10) - PXA270@600 MHz - 1578M

*** Welcome to Gumstix ***

DRAM:  128 MB
Flash: 32 MB
Using default environment

Hit any key to stop autoboot:  0
GUM> 

Next initialize the MMC/SD system by typing the mmcinit command:

GUM> mmcinit
Detected: 1984000 blocks of 512 bytes (968MB) SD card.
Vendor: Man 03 OEM SD "SU01G" Date 09/2007
Product: 28940146
Revision: 8.0
GUM>

To see what files you have on your memory card you can use the fatls command:

GUM> fatls mmc 1
161432   uboot.bin 
992696   uimage 
9649540   rootfs 
3 file(s)
GUM> 

Now, lets load the rootfs image into memory:

GUM> fatload mmc 1 a2000000 rootfs
reading rootfs
9649540 bytes read
GUM>

Getting the new filesystem copied into flash memory is a two-step process. First, the old filesystem must be erased; then, the new filesystem must be written from RAM to flash.

To erase the old filesystem, enter:

GUM> protect on 1:0-1
Protect Flash Sectors 0-1 in Bank # 1
.. done
GUM> erase all
Erase Flash Bank # 1 - Warning: 2 protected sectors will not be erased!
................................................................................................................................................................................................................................................................. done
GUM>

The first command protects flash sectors 0 and 1, which contain the uboot bootloader. This line is very important! If you omit it, your Gumstix will be unusable and will have to be reflashed at the factory. The second line erases all of flash except the 2 sectors that we just protected.

Now, commit your new filesystem to flash:

GUM> cp.b a2000000 40000 ${filesize}
Copy to Flash... done
GUM>

This copies your new filesystem into flash (at address 40000). ${filesize} is a reference to the variable filesize, which was set by your file transfer.

We now use a similar process to load the kernel image into memory:

GUM> fatload mmc 1 a2000000 uimage
reading uimage
992696 bytes read
GUM>

There are special commands to help you install and run the kernel image:

GUM> katinstall 100000
Copying kernel from 0xa2000000 to 0x01f00000 (length 0x00100000)...Erasing...
........... done
Erased 11 sectors
Writing...done
GUM> katload 100000
Copying kernel to 0xa2000000 from 0x01f00000 (length 0x00100000)...done
GUM>bootm

That's it! You have replaced your root file system and kernel images and at this point should be seeing linux's boot messages scrolling by on your screen.

Reflashing u-boot

It is not normally necessary to reflash U-boot. Proceed with the following only if you are absolutely certain that you need to update U-boot.

It is quite possible to "brick" your gumstix motherboard if you do not follow these instructions accurately. Please be careful!

NOTE: At the moment gumstix-oe does not build U-Boot. If you need to update U-Boot you can find pre-built U-Boo binaries at:

http://www.gumstix.net/feeds/u-boot

The instructions below assume that you have stored a copy of the u-boot binary on your memory card as uboot.bin

The first step is to initialize the SD/MMC system and read the u-boot image into memory:

GUM> mmcinit
Detected: 1984000 blocks of 512 bytes (968MB) SD card.
Vendor: Man 03 OEM SD "SU01G" Date 09/2007
Product: 28940146
Revision: 8.0
GUM> fatload mmc 1 a2000000 uboot.bin
reading uboot.bin
161432 bytes read
GUM>

Getting the new u-boot copied into flash memory is a two-step process. First, the old u-boot image must be erased; then the new u-boot image must be written from RAM to flash.

To erase the old u-boot image:

GUM> protect off all
Un-Protect Flash Bank # 1
................................................................................................................................................................................................................................................................... done
GUM> erase 1:0-1
Erase Flash Sectors 0-1 in Bank # 1 
.. done
GUM> 

Now we flash the new u-boot image:

Note: this command is very similar to the command you normally use to reflash the rootfs. Note that the address is 0 not 4000! Be careful not to mistype this!

GUM> cp.b a2000000 0 ${filesize}
Copy to Flash... done
GUM>reset

At this point your system will reboot and execute the new u-boot image.

 

Tags