AVR32 NGW100 Reflashing firmware from SuSE 10.1

These are notes on how I was able to successfully reflash my NGW100 using the most recent factory images at Atmel AVR32 beta-ware site.

The reflash takes place in two stages. The first stage is done from uBoot to reflash the root file system. The second stage takes place from the NGW100 BusyBox command prompt, so you have to have a good bootable root file system in order to proceed to the second stage. The second stage is a reflash of the /usr file system.

In order to do this, you need both a working TFTP server and NFS server or you need to be able to create the /usr/ file system on a Compact Flash so that in the second stage it can pull the image from the CF instead of NFS. I went for the first method, TFTP and NFS as the source.

I should also mention that if you have issues in the second stage with updating the /usr/ flash, and you reboot, your eth0 interface will come up static and you won't be able to talk to your NFS server from the NGW100. In that case, you should still be able to manually give it an IP address like this:

ifconfig eth0 192.168.5.170

where your IP address is one that is on the same segment as or routable to your NFS server.

Step 1) Set up TFTP and NFS and insure they are working:
After downloading the root file system and usr file system .img files from the Atmel site, I created a /ngw symlink that pointed to them on my SuSE linux box. Then from Yast2, I setup an NFS server and added the /ngw and other NGW related BSP directories to the export list for NFS.

I also pointed my TFTP server to the same place (the latest ngw .img file directory on Linux.)

Step 2) start the reflash of the root file system:
So, starting from there, I booted the NGW100 and broke into uBoot with the typical space key. This is where these notes pick up:

Uboot> protect off 0x20000 0x7EFFFF
Un-Protected 125 sectors
Uboot> erase 0x20000 0x7EFFFF
Erasing sector 9...Erasing sector 10...Erasing sector 11...Erasing sector 12...Erasing sector 13...Erasing sector
14...Erasing sector 15...Erasing sector 16...Erasing sector 17...Erasing sector 18...Erasing sector 19...Erasing
sector 20...Erasing sector 21...Erasing sector 22...Erasing sector 23...Erasing sector 24...Erasing sector 25...
Erasing sector 26...Erasing sector 27...Erasing sector 28...Erasing sector 29...Erasing sector 30...Erasing sector
31...Erasing sector 32...Erasing sector 33...Erasing sector 34...Erasing sector 35...Erasing sector 36...Erasing
sector 37...Erasing sector 38...Erasing sector 39...Erasing sector 40...Erasing sector 41...Erasing sector 42...
Erasing sector 43...Erasing sector 44...Erasing sector 45...Erasing sector 46...Erasing sector 47...Erasing sector
48...Erasing sector 49...Erasing sector 50...Erasing sector 51...Erasing sector 52...Erasing sector 53...Erasing
sector 54...Erasing sector 55...Erasing sector 56...Erasing sector 57...Erasing sector 58...Erasing sector 59...
Erasing sector 60...Erasing sector 61...Erasing sector 62...Erasing sector 63...Erasing sector 64...Erasing sector
65...Erasing sector 66...Erasing sector 67...Erasing sector 68...Erasing sector 69...Erasing sector 70...Erasing
sector 71...Erasing sector 72...Erasing sector 73...Erasing sector 74...Erasing sector 75...Erasing sector 76...
Erasing sector 77...Erasing sector 78...Erasing sector 79...Erasing sector 80...Erasing sector 81...Erasing sector
82...Erasing sector 83...Erasing sector 84...Erasing sector 85...Erasing sector 86...Erasing sector 87...Erasing
sector 88...Erasing sector 89...Erasing sector 90...Erasing sector 91...Erasing sector 92...Erasing sector 93...
Erasing sector 94...Erasing sector 95...Erasing sector 96...Erasing sector 97...Erasing sector 98...Erasing sector
99...Erasing sector 100...Erasing sector 101...Erasing sector 102...Erasing sector 103...Erasing sector 104...Erasing
sector 105...Erasing sector 106...Erasing sector 107...Erasing sector 108...Erasing sector 109...Erasing sector 110...
Erasing sector 111...Erasing sector 112...Erasing sector 113...Erasing sector 114...Erasing sector 115...Erasing sector
116...Erasing sector 117...Erasing sector 118...Erasing sector 119...Erasing sector 120...Erasing sector 121...Erasing
sector 122...Erasing sector 123...Erasing sector 124...Erasing sector 125...Erasing sector 126...Erasing sector 127...
Erasing sector 128...Erasing sector 129...Erasing sector 130...Erasing sector 131...Erasing sector 132...Erasing sector
133...Erased 125 sectors
Uboot> tftp 0x90000000 ngw_jffs2_root.img
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
*** ERROR: `ipaddr' not set

Set the ipaddr for uBoot to use during flashing from the TFTP server:

Uboot> set ipaddr 192.168.5.170
Uboot> set bootcmd 'set bootfile uImage;dhcp;bootm'
Uboot> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...Erasing sector 134...Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
Uboot> tftp 0x90000000 ngw_jffs2_root.img
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
*** ERROR: `ipaddr' not set
Uboot> set ipaddr 192.168.5.170
Uboot> printenv
baudrate=115200
ethaddr=00:04:25:1C:50:DC
bootdelay=1
ethact=macb0
eth1addr=00:04:25:1C:50:DD
tftpip=192.168.5.177
serverip=192.168.5.177
stdin=serial
stdout=serial
stderr=serial
bootargs=console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2
bootcmd=set bootfile uImage;dhcp;bootm
ipaddr=192.168.5.170

Environment size: 299/65532 bytes

Now flash the root file system from the TFTP server on SuSE Linus:

Uboot> tftp 0x90000000 ngw_jffs2_root.img
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
Using macb0 device
TFTP from server 192.168.5.177; our IP address is 192.168.5.170
Filename 'ngw_jffs2_root.img'.
Load address: 0x90000000
Loading: T #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
####################
done
Bytes transferred = 6422528 (620000 hex)
Uboot>
Uboot> cp.b 0x90000000 0x20000 0x620000
Copy to Flash... done
Uboot> protect on all
Protect Flash Bank # 1
Uboot> set bootcmd 'fsload;bootm'
Uboot>boot

sometimes I have to manually give the iface its address if the /usr partition is not initialized (not currently flashed)

# ifconfig eth0 192.168.5.170

Next I followed the instructions to /etc/init.d/S90reboot and flash_erase at the AVR NGW100 wiki
then setting up to use NFS mount to reflash the /usr partition

Before this S90reboot step, it's important to establish an /nfs mount point:

mkdir /nfs

After the S90reboot, you won't be able to make the /nfs directory, though if you forget, you can make it in /tmp/nfs and then adjust the following commands according to map /nfs to /tmp/nfs

~ # /etc/init.d/S90reboot
find: /var/run/*.pid: No such file or directory


* terminating .pid progs ... [ OK ]
* terminating klogd ... [ OK ]
* terminating syslogd ... [ OK ]
* syncronizing filesystems ... [ OK ]
* unmounting filesystems: /usr /var/run /var/lib/samba /var/log /
* Rebooting ...

~ #

~ # umount /usr
umount: cannot umount /usr: Invalid argument
~ # flash_eraseall /dev/mtd3
Erasing 1 Kibyte @ 83fbe0 -- 99 % complete.

Make sure you have network connectivity to your NFS server:

~ # ping 192.168.5.177
PING 192.168.5.177 (192.168.5.177): 56 data bytes
64 bytes from 192.168.5.177: icmp_seq=0 ttl=64 time=2.5 ms
64 bytes from 192.168.5.177: icmp_seq=1 ttl=64 time=0.6 ms

--- 192.168.5.177 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.6/1.5/2.5 ms
~ # cat /etc/fstab
# device mount point type options dump pass
/dev/mtdblock1 / jffs2 defaults 1 1
/dev/mtdblock3 /usr jffs2 defaults 1 1
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0
dev /dev tmpfs defaults 0 0
pts /dev/pts devpts defaults 0 0
run /var/run tmpfs defaults 0 0
log /var/log tmpfs defaults 0 0
samba /var/lib/samba tmpfs defaults 0 0
tmp /tmp tmpfs defaults 0 0
config /config configfs defaults 0 0

This was a key thing to get figured out in order to mount the nfs share from the linux host

~ # mount -t nfs -o nfsvers=2,nolock 192.168.5.177:/ngw /nfs

If that succeeds then you should be able t list the .img files from the NFS mount:

~ # ls /nfs
ChangeLog ngw_jffs2_root.img
README ngw_jffs2_usr.img
~ #

~ # df
Filesystem 1k-blocks Used Available Use% Mounted on
dev 15468 7932 7536 51% /dev
df: /dev/pts: No such file or directory
tmp 15468 0 15468 0% /tmp
run 15468 0 15468 0% /var/run
samba 15468 0 15468 0% /var/lib/samba
log 15468 4 15464 0% /var/log
/dev/mtdblock3 8448 292 8156 3% /usr
dev 15468 7932 7536 51% /dev
run 15468 0 15468 0% /var/run
log 15468 4 15464 0% /var/log
samba 15468 0 15468 0% /var/lib/samba
tmp 15468 0 15468 0% /tmp
dev 15468 7932 7536 51% /dev
run 15468 0 15468 0% /var/run
log 15468 4 15464 0% /var/log
samba 15468 0 15468 0% /var/lib/samba
tmp 15468 0 15468 0% /tmp
192.168.5.177:/ngw 22650952 1312728 21338224 6% /nfs

This step reflashes the /usr partition by copying the usr.img file to the device:

~ # dd if=/nfs/ngw_jffs2_usr.img of=/dev/mtd3 bs=1056
7680+0 records in
7680+0 records out
~ # reboot
Clicky Web Analytics