NGW100: Restore or Upgrade Root Filesystem With TFTP
May 23rd, 2009 by TheKidd
Next I am going to look at using TFTP to restore or upgrade the /root filesystem on the NGW100. The /root file system will require more intereaction with U-Boot so let us get started!
For this exercise, I will be basing my walk through off of AVR Freak’s Wiki documentation. For other updating options, please refer to the Firmware Upgrade page on AVR Freak’s Wiki.
Quick TFTP Setup
- Open a console on your Ubuntu development desktop.
- Run sudo apt-get install tftpd to install the tftp server.
- Make sure /srv/tftp exists on the desktop system.
- Restart tftpd with /etc/init.d/openbsd-inetd restart.
- Download the /root filesystem (rootfs.avr32.jffs2-root) from atmel.no.
Note: Make sure you grab the right version to match u-boot. - Copy this file to your TFTP server directory (/srv/tftp). You are ready to go!
Using U-Boot and TFTP To Restore The Root Filesystem
This section assumes that your Linux desktop is not your DHCP server. I don’t know too many people who would have this setup normally so why even bother screwing with that when its quite easy to type a few extra lines and get the same results.
- Make sure your desktop and NGW100 are connected via serial cable and that you are connected via a terminal program. Also connect and ethernet cable between the NGW100’s WAN port and your network. Power the NGW100 on if needed.
- If you only have U-Boot installed, you will end up at a Uboot> prompt. If not watch carefully when the board frist starts.
Note: There is a line mentioning that you have one second to hit space. Doing so will drop you to U-boot. - You can run the command dhcp real quick to have uboot grab an ip address for your ethernet connection.
You may get an error saying that ethaddr is not set. So we will set a bogus mac address for the the NGW100 as follows:
Uboot> set ethaddr 00:11:95:00:00:00 - If NGW100 did not get an IP from your DHCP server, run this line.
Uboot> set ipaddr 192.168.100.105
Set to an IP that is available on your network - Now we set the rest of the important environment variables for TFTP.
Uboot> set tftpip 192.168.100.103
Change to your TFTP Server IP
Uboot> set serverip 192.168.100.103
Change to your TFTP Server IP
Uboot> tftp
This command will fail because you did not specify a file but it should show that it connected to the TFTP server and tried to download a file. If it did try to load one, you are ready to actually erase the existing root image. I personally find the above test methods much better then erasing the flash first before knowing you can get to the file. - Now we are ready to flash the root filesystem to the NGW100 as follows:
Uboot> protect off 0×20000 0×7EFFFF
This turns off /dev/mtd1 flash protection.
Uboot> erase 0×20000 0×7EFFFF
This erases the entire /dev/mtd1 flash chip.
Uboot> tftp 0×90000000 rootfs.avr32.jffs2-root
This connects to your TFTP server, downloads the root image file and places it into SDRAM for temporary storage.
Uboot> cp.b $(fileaddr) 0×20000 $(filesize)
This copies the file (fileaddr) located in SDRAM to the start of the /dev/mtd1 flash chip and it also specifies its size. These two variables are added to the environment when you ran tftp above.
Uboot> protect on all
Turns read only protection back on for /dev/mtd1. - Now just reboot your NGW100 and watch as Linux loads!
Note: If you are upgrading the root filesystem from an older version, you will notice that the SYS LED now blinks red. This is normal. It represents the CPU’s heartbeat. No need to freak out (I know I did at first)!
Note: The first time I tried to boot the root filesystem, I got some unexpected errors. For more information check here.
That wasn’t too difficult. Next we will use WGET to load the /usr filesystem.
[...] a fresh u-boot and root image onto your Atmel NGW100 board. You can also use TFTP to load a root image or you can move on to loading the usr [...]