Reflashing

From GumstixWiki

There are at least two ways to flash the Gumstix. These include flashing via serial and flashing from a console on the Gumstix.

Contents

Reflashing the filesystem

From the boot-loader

Note this depends on the uboot version and if you are using old gums or verdex.

Reflashing U-Boot

This is very dangerous - so only do it with two people checking every keystroke! if you have an old uboot carefully update it:

loadb a2000000     (then kermit send u-boot.bin from your terminal)
protect off 1:0-1
cp.b a2000000 0 ${filesize}
reset

U-Boot 1.2.0

to install a new linux filesystem:

GUM>loadb a2000000
kermit>send rootfs.arm_nofpu.jffs2
kermit>connect
GUM>pro on 1:0-1 && jera all && cp.b a2000000 40000 ${filesize}

GUM>loadb a2000000
kermit>send uImage
kermit>connect
GUM>katinstall 100000
GUM>katload 100000
GUM>bootm

Transferring data to U-Boot

There are several options in the boot-loader, serial, cf/mmc or tftp transfer, both will require a serial console daughter board. Tftp requires an ethernet expansion board but is significantly faster than serial transfer, but has no other difference, and in most serial and tftp operations should be interchangeable. Using a mmc/cf card is much faster than serial, and very easy to use.

The 'magic' number, a2000000, you will see in many places represents a memory address in hexadecimal notation at a point in the RAM which is placed beyond the section used by the boot-loader. The variable ${filesize} will contain the size of the transferred data, but should only be relied upon when a transfer successfully completes.

other notes

You will need to configure your serial port properly to connect nicely to the gumstix. Below is our script for linux systems.

#!/usr/bin/kermit
set line /dev/ttyS0
set flow-control none 
set carrier-watch off
set speed 115200
set reliable 
fast
set prefixing all
set file type bin
set rec pack 4096
set send pack 4096
set window 5    
connect

Then reset the board and interrupt the boot process to get a prompt.

GUM> loadb a2000000
send file in hyperterminal
GUM> 

Your file should now be transferred to RAM.

TFTP transfer

First of all we need to give the gumstix an IP address and the address of the TFTP server it will get the data from, then save the environment so these settings will persist across reboots.

GUM> setenv ipaddr 192.168.0.2
GUM> setenv serverip 192.168.0.1
GUM> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash... done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
GUM>

Now transfer the data with the following command:

GUM> tftp a2000000 rootfs.gumsense

While TFTP transfer is fast in our experience it is a bit tricky! Often a transfer will timeout and fail.

GUM> tftp a2000000 rootfs.gumsense
Using SMC91C1111-0 device
TFTP from server 152.78.64.205; our IP address is 152.78.65.78
Filename 'rootfs.gumsense'.
Load address: 0xa2000000
Loading: T #################################################################
         #################################################################
         ##T T ###############################################################
         #######################<snip>###################################
         #####T ############################################################
         #################################################################
         ###T ########T T T T T T T T T T T T T T T 
Retry count exceeded; starting again
Using SMC91C1111-0 device
TFTP from server 152.78.64.205; our IP address is 152.78.65.78
Filename 'rootfs.gumsense'.
Load address: 0xa2000000
Loading: T T T T T T T T T T T T T T T T T T T T 
Retry count exceeded; starting again

In our experience after getting several T's in a row it is a sign the transfer will fail so we Ctrl+C to cancel the transfer. We also found that after a failed transfer attempt the gumstix needed to be rebooted before it will start receiving data again.

To reboot u-boot simply type:

GUM> reset

A successful transfer will look something like this:

         <snip>
         ##################################################################
         ###############################
done
Bytes transferred = 15466496 (ec0000 hex)
GUM>

Using mmc card under uboot 1.2.0 to flash OE

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>

Once the card is initialised then the files can be listed using fatls mmc 1 The root file system then needs to be installed

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

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> cp.b a2000000 40000 ${filesize}
Copy to Flash... done
GUM>

Finally the kernel needs installing

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

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


From Linux

This can be a much less painful process, and the procedure is documented on the gumstix.net website here.