Firmware upgrade

Contents


Introduction

This step by step guide explains how to perform a firmware upgrade of your Network Gateway. There are three methods: 1. SD card, 2. Network. 3. Serial.

The SD card method is preferred, but is known to not work with some setups.

The network method requires some (advanced) setup in your network environment, but when in place, it will ease both upgrades and development with the Network Gateway.

Finally the serial method is possible. It requires nothing but an RS-232 cable and the windows' hyper terminal. This method thus have the least prerequisites, but it is rather lengthy.


The Network Gatway file system consists of 3 partitions

  1. The Uboot boot loader
  2. The Linux root file system
  3. The /usr partition of Linux

The procedure described here can be used to upgrade the Network Gateway Linux root file system and the /usr partition. This guide assumes that the U-boot boot loader is installed and working correctly.

Be careful to write the memory addresses exactly as written so you do not corrupt the U-boot boot loader. If U-boot gets corrupted, a JTAGICEmkII is required to resurrect the Network Gateway!

Preparation

On Atmel.no beta ware you will find two files below the NGW100 Firmware Images heading.

  • A tar archive with the root and usr image files to be written to the Network Gateway flash.
  • A pre-built SD card image for automatic upgrade with the SD card method below.

Note that you will only need one of the two.

Connect a RS-232 cable between the Network Gateway kit and your PC to gain access to the boot console. (com port settings 115200-8N1) When powering up the kit, press space to abort the automatic loading. This will present you with the bootloader prompt: "Uboot>"

With SD card

On Atmel.no beta ware You can find a pre-built image of a SD card which will upgrade your Network Gateway more or less automatically. This image is tested and known to work with the following cards:

  • No-name MMC 32 MB (supplied with Nokia phones)
  • TwinMOS MMC 32MB
  • Kingston SD 128 MB (stk1000)
  • SanDisk SD 128 MB (stk1000)
  • Kingston Elite Pro SD 256 MB
  • Viking SD Interworks 256 MB
  • TwinMOS Ultra-X SD 512 MB


Assuming that sdb is the device of your SD card, write the image with dd on your Linux workstation with:

~# sudo dd if=ngw_fw_upgrade.img of=/dev/sdb 

If you are using Windows, please refer to writing images with dd on Windows.

Note that the image distributed is a complete SD card image, the device should thus be sdb not sdb1 etc.


With the SD card ready, you must now boot the Network Gateway from the SD card and copy the usr and root images to flash. This is done automatically by the pre-built image and you can monitor progress on the rs-232 console.

To boot the SD card type the following in Uboot:

Uboot> askenv bootcmd
Please enter 'bootcmd': mmcinit; ext2load mmc 0:1 0x10300000 /uImage; bootm 0x10300000
Uboot> set bootargs 'console=ttyS0 root=/dev/mmcblk0p1 ro' 
Uboot> boot

The Linux system will now boot, and if you are using the pre-built image, upgrade will complete without further user interaction. The LEDs on ATNGW100 will flash while upgrading, and light steady when completed. At this point the Linux prompt will be presented at the console. Remove power and SD card and the Network Gateway upgrade is complete. If the upgrade fails, the LEDs will turn off.


Expert option

You can also build the SD card your self:

Format a SD-card with ext2 copy a ATNGW100 Linux filesystem to it together with rootfs.avr32.jffs2-root and rootfs.avr32.jffs2-usr. The latest usr and root images can be found at Atmel.no beta ware

When your SD card is done booting, you can copy the images onto the ATNGW100 flash with:

~# flash_eraseall /dev/mtd3 
~# flash_eraseall /dev/mtd1
~# dd if=/rootfs.avr32.jffs2-root of=/dev/mtd1 bs=1024
~# dd if=/rootfs.avr32.jffs2-usr of=/dev/mtd3 bs=1056

With Network (TFTP/FTP/NFS) expert option!

If you already have a TFTP server and working network boot environment, this can be used to upgrade the Network Gateway.

Put the rootfs.avr32.jffs2-root file on your tftp server. (the latest image can be found at Atmel.no beta ware

in uboot type:

Uboot> protect off 0x20000 0x7EFFFF
Uboot> erase 0x20000 0x7EFFFF
Uboot> dhcp 0x90000000 rootfs.avr32.jffs2-root
Bytes transferred = 6553600 (640000 hex)

Note the size and use it as the last argument to cp.b

Uboot> cp.b 0x90000000 0x20000 0x640000
Copy to Flash... done
Uboot> protect on all
Uboot> 

reboot your network gateway

The Network Gateway will now boot the new root image. The amount of error messages is due to a non upgraded /usr partition.

Note to users without a DHCP server

If you do not have a DHCP server you must set the ip address of the Network Gateway and the tftp server manually. In addition you must replace the dhcp command with tftp:

Uboot> set ipaddr 10.0.0.100   
Uboot> set tftpip 10.0.0.1
Uboot> tftp 0x90000000 rootfs.avr32.jffs2-root


Upgrading the /usr part of the file system

The rootfs.avr32.jffs2-usr contains the /usr part of the Network Gateway Linux. This is upgraded from the Network Gateway console after Linux has booted.

Stop all processes running from /usr

~# /etc/init.d/S90reboot

Unmount the /usr disk

~# umount /usr

Erase flash disk

~# flash_eraseall /dev/mtd3

Get rootfs.avr32.jffs2-usr to the ATNGW100

You can use an SD card, or retrieve retrieve the file from an NFS, FTP or web server.

For SD card

~# mount /dev/mmcblk0p1 mnt

For NFS server

use these instructions to mount the nfs share to /mnt.

For ftp or web server

use wget to retrieve the file and replace "/mnt" with "/tmp" with dd below.
~# cd /tmp
~# busybox wget http://put_your_server_here.com/rootfs.avr32.jffs2-usr


Copy rootfs.avr32.jffs2-usr to /dev/mtd3

~# dd if=/mnt/rootfs.avr32.jffs2-usr of=/dev/mtd3 bs=1056

These steps will upload the root image to your Network gateway. The root image can be found at Atmel.no beta ware. You can use any terminal program that supports the Kermit transfer protocol

in uboot type:

Uboot> protect off 0x20000 0x7EFFFF
Uboot> erase 0x20000 0x7EFFFF
Uboot> loadb 0x90000000
## Ready for binary (kermit) download to 0x90000000 at 115200 bps...

Now select file transfer from in your terminal program, and upload the file 'rootfs.avr32.jffs2-root' with Kermit as protocol. Be prepared to wait ~25 minutes for the transfer to complete!

## Total Size      = 0x00640000 = 6553600 Bytes
## Start Addr      = 0x90000000

Note the size and use it as the last argument to cp.b

Uboot> cp.b 0x90000000 0x20000 0x640000
Copy to Flash... done
Uboot> protect on all
Uboot> 

reboot your network gateway

The Network Gateway will now boot the new root image. The amount of error messages is due to a non upgraded /usr partition. Please follow the steps for upgrading the /usr partition above to complete the Network Gateway upgrade.

Summary of U-Boot commands

protect off <from_addr> <to_addr> unlock flash
protect on <from_addr> <to_addr> lock flash
erase <from_addr> <to_addr> erase flash
cp.b <from_addr> <to_addr> <count> copy data (bytewise)

The flash of the Network Gateway is partitioned:

0x000000 - 0x020000 U-Boot partition. You'll need a JTAGICEmkII if you corrupt this
0x020000 - 0x7F0000 Linux root partition. (This is what we'll update with this guide)