- Embedded Linux (4)
- OpenWRT (3)
- Music (1)
- Open source (3)
- Drupal (1)
- Linux (7)
- Arch Linux (3)
- Icadyptes (0)
- Politics (0)
Okay. You guys know how fond I am of tinkering and breaking things :-). Well, today, I discovered once again how fabulous OpenWRT is. Those familiar with Linux will know cross-compiling can be a pain. Routers and other embedded devices often run on non-x86 architectures (my router, an Asus WL-500G Deluxe, is a MIPS-based device), which means you have to set up some sort of cross compilation environment, and that takes time. Well, with OpenWRT, there's no need to go through all of that.
For now, there is one drawback to OpenWRT: despite of being the ultimate router distro (I consider it a distro, yes), a firmware upgrade will wipe all your settings (you can choose not to wipe the jffs2 partition if you use the X-WRT web interface, but I haven't tried it yet). This is kind of inconvenient if you tweaked your setup a lot. I've upgraded from 7.06 to 7.07 (both Kamikaze), and now 7.09 was waiting around the corner. I already had a tarball of the configuration directory, so I could just untar it into the root, and be done with it. Unfortunately, that just replaces new files with old ones, thus removing any updates or bug fixes in those files. That is not what we want - after all, you upgrade to get the bug fixes, right? - so I started writing a script to restore all my settings after flashing in a firmware upgrade. Flashing is as easy as doing mtd -r write openwrt-brcm-2.4-squashfs.trx linux.
Now let's move on to the pièce de résistance. Originally I just wanted to diff the vanilla configuriation files against my own modified ones, so I could easily apply those diffs after upgrading - only to discover OpenWRT's busybox provided no 'diff' or 'patch'. God! But no worries: sed to the rescue. What I have now is a script full of sed commands which does the job mighty fine - that is, after rendering my router unusable multiple times :-P. I won't share this script, it contains MAC addresses, a WPA2 key, DynDNS credentials, and my SSH key - I suppose you understand my paranoia ;-).
Although the job was done, I decided to build busybox with diff and patch enabled. And that is really a piece of cake... All you need is the Kamikaze 7.09 source tarball which is only a few MB. Don't use any of the SVN revisions unless you're enough of an ace to fix any breakages yourself; this version was tagged stable for a reason ;-). Check the README to see if you installed all prerequisites - if not your build will probably fail somewhere in the middle, and that ain't fun.
Change into the newly created dir, run make menuconfig and you'll be presented with an ncurses configuration menu that looks very similar to a kernel configuration menu:
OpenWRT 7.09 Buildroot
You can preselect your device if supported, which will set the defaults for that and disable some others, thus generating a firmware tailored to your router. Of course you can also remove/add other features - I removed ppp support because I'm on cable internet, and added patch, diff, and ext2progs support (I occasionally mount a USB stick onto the router on which I install some heavier packages that don't fit onto the router's flash). Once you configured OpenWRT to your liking, you exit and save the configuration, then you run make, and after that, you get nice firmware images in the bin/ dir, together with the corresponding packages in bin/packages. And all that in a matter of minutes. Not bad for some rather complex cross-compling, is it?