by lunarg on January 31st 2007, at 20:50

Did an upgrade of my Linksys WRT54GL to the latest OpenWRT firmware. These are roughly the steps I followed.

My old firmware was a OpenWRT rc5, default release. For my new firmware, I used the ImageBuilder to create a more customized firmware with a lot of packages (such as ntpclient, openvpn, nas, gpio, ...) preinstalled in the squashfs image. I left the new Webif^2 out on purpose, as it's updated at a fair regular base. The image (which has it's build list attached) is called cad, which is because I originally selected it for use with routers at work.

Anyway, updating my WRT54GL, was not as straight-forward as I had hoped. The upgrade firmware function of both Webif and Webif^2 did not work with my customized image (haven't looked why not, but I guess it's either the image, or a broken function).

My second attempt was to use tftp, so I enabled boot_wait, and more specifically set the wait_timeout to 5 seconds (did this with Webif^2, as the wait_timeout function does not exist in regular Webif). Unfortunately, at power cycling the router, for some reason, boot_wait did not work. My guess is the boot_wait has no effect on WRT54GL (but haven't verified this yet), and thus no tftp server is started at power cycle.

Luckily, the third attempt (and method) was a success. I roughly followed the explanation at
First, I took a backup of the current image and NVRAM:

# mount -o remount,ro /dev/mtdblock/4 /
# dd if=/dev/mtdblock/1 > /tmp/wrt-linux.trx
# mount -o remount,rw /dev/mtdblock/4 /
# dd if=/dev/mtdblock/3 > /tmp/wrt-nvram.bin

This gave me two files, a small one (nvram.bin) and a file around 3.5 meg (linux.trx). I scp'ed these out to a safe location.
Since writing the new image will also erase the JFFS2 partition, I copied all the important config files to my computer, so I could easily restore them once the new firmware was in place.

After that, I took the plain TRX-file (openwrt-brcm-2.4-squashfs.trx) - .bin files probably don't work, but haven't tested this - and ran the following commands:

# mount -o remount,ro /dev/mtdblock/4 /
# mtd -r write /tmp/wrt-linux.trx linux

Note the remount to read-only of the JFFS2 partition. We wouldn't want an unhappy process to write to the partition when we're writing our new image. The -r parameter tells the router to reboot when the image writing is completed.

After a reboot, everything will be as right after the first OpenWRT install, with the exception of the NVRAM settings. As a consequence, I had to telnet back in and set the password, so ssh was activated and accessible again. The sshd will have generated a new keypair, so clearing out the old one in my known_hosts file on my computer was a necessity.
Once that's taken care of, I copied/merged my own config files (specific firewall settings, openvpn config and keys, ...) back to the right locations, and I was off again. As a final note, I reinstalled the new Webif^2 (from

That's pretty much the steps in short (though, it's gotten very long... ;-) ). Anyway, a more advanced howto will be made available in the Articles section (when it get finished, just about before the cows come go ;-) )...

« July 2019»
« When a bird does poo poo in your eye, be happy elephants don't fly. »