Thursday, November 4, 2010

Updating the squashfs with an external rootfs

If it ain't broke don't fix it

We've all heard the phrase at least a dozen times in our life. Yet knowingly it's disobeyed over and over because of shiny new features that we don't need.

It was brought to my attention that there have been a ton of ath9k fixes pulled into the 10.03.1-rc3 interim candidate that should improve wifi performance.  I've had some wifi problems, but it's hard to assess if they'd really be fixed by these patches.  I figured I didn't have much to lose and decided to svn up and rebuild my squashfs image to upgrade on the router.

Normally, this is supposed to be a rather straightforward process (

1) svn up
2) make
3) scp bin/ar71xx/openwrt-ar71xx-dir-825-b1-squashfs-sysupgrade.bin root@
4) ssh root@
5) sysupgrade -v /tmp/openwrt-ar71xx-dir-825-b1-squashfs-sysupgrade.bin
6) Profit

Unfortunately I ran into lots of problems along the way, that eventually stemmed to the contents of the external rootfs being out of sync with what was on the jffs2 partition.  Running an opkg upgrade caused the router to not boot anymore with the flash drive plugged in.

Consequently, I've discovered when you have an external rootfs, you need to follow a bit of a different process when flashing new ROMs.

1) Update svn
svn up
2) Refresh config
make menuconfig
3) Examine the contents of /overlay/etc/ on the router.  In your source tree, you will want to make a files/etc directory and copy in all the relevant configs that you need to persist after you flash.  They'll be baked directly into the ROM image itself.  Over time you should eventually not even need much of overlay configs in /overlay/etc as they'll be in your home rolled roms.
4) Record a list of all packages you have installed that you care about.
4) Power off the router and plug the flash drive into a computer.  Format it.
5) build the new ROM
6) follow the regular steps to scp the ROM over and load it.  Don't plug in your flash drive yet.
7) Reboot the router and make sure it comes up
8) Now insert the flash drive and reboot
9) Lastly, install any relevant packages you previously recorded a list of.

All of your configuration should already be on the ROM, so you won't need to reconfigure anything.

No comments:

Post a Comment