OpenWRT 101by Ash Dyer
OpenWRT is one of the key drivers behind the Wi-Fi revolution. It got its start as an embedded Linux platform for wireless routers, perhaps inspired by (while separate from) the GPL'd Linksys code, and since 2004 it has been managed as an open source project. OpenWRT has proven to be highly versatile and has spawned a number of forks such as FreeWRT, dd-WRT, and Ewrt, and serves as the operating system for such Wi-Fi notables as Fon and Meraki.
In this article, I will discuss the differences between the forks, how to install and configure OpenWRT without bricking your router, and some of the packages that will be useful for securing and managing your router.
Understanding the forks
There are currently three major active branches of the OpenWRT platform: OpenWRT, FreeWRT, and DD-WRT. OpenWRT is the original code base, which focuses on a minimal embedded Linux platform with a number of modules to add various functionalities. FreeWRT is a direct outgrowth of OpenWRT and focuses on providing an advanced platform for experienced developers. DD-WRT started with Sveasoft Alchemy but switched over to a WRT kernel to make use of commodity access points from companies like Linksys and Netgear as opposed to high-end APs. DD-WRT has a nice control panel and some other features for easy setup and use. (Ewrt is, alas, no more, so I won't describe it here).
There are a couple versions of OpenWRT: White Russian (stable), Kamikaze (experimental), and buildroot-ng. Development on White Russian has been concluded since February 2007, but for the purposes of this article, I'll stick to the White Russian version anyway since it's stable and there are readily-available binaries. The other forks build on the OpenWRT kernel, so if you decide to go down one of those paths what you learn from this article should still be applicable.
Understanding your device
First, you should make sure that your router is supported by OpenWRT by checking the Table of Hardware. The OpenWRT wiki also has instructions for how to flash each supported router. It's important to read these instructions thoroughly to understand how to install OpenWRT on your particular device, as well as differences you might encounter between revs of the same device (like reduced memory, etc.).
Binaries are available for White Russian. Before downloading be sure to check http://wiki.openwrt.org/OpenWrtDocs/Hardware to make sure that your router is supported in White Russian (some are only supported in Kamikaze) and which White Russian binary to download. You'll probably want the binaries from the /default/ directory, which is the standard installation, unless you need PPTP or a micro distribution. Don't worry about any of the other files for now.
Compiling from source
If you want to compile your own binaries, download the latest version from the svn repository. You'll also want to checkout the additional packages from https://svn.openwrt.org/openwrt/packages/ (to compile these packages you need to create symlinks to these in the package subdirectory of /trunk/ by typing
Once you checkout the latest release, go to the trunk directory and run the command:
%make menuconfig. This brings up a screen that will allow you to select your router platform and what packages to include in your build. To figure out what platform your router is (and if it's supported by OpenWRT), take a look at the Table of Hardware and your router-specific instructions. Make sure the kernel version and filesystem you select are recommended by the afore-mentioned router-specific instructions.
When you compile your binaries, I suggest using a minimal number of included packages and compiling most of the packages you want as "M" or maybes. By compiling the packages separately, you ensure that your base installation will fit on the limited flash memory on your router.
Exit menuconfig (the save dialog will pop up on exit) and then compile the binaries by typing:
%make. The script will then download the actual source (the files in the repository are linked to all of the source) and then compile it into your firmware binaries and packages. OpenWRT's make system downloads the latest source from the server and compiles it, so make sure you have an Internet connection when you compile your binaries.
Flashing the device
Follow the instructions for your device under http://wiki.openwrt.org/OpenWrtDocs/Hardware to install OpenWRT on your router. In most cases, you will likely just use the firmware update interface provided by your manufacturer. However, in some cases you will need to use tftp or another method, so it's important to check for any issues before flashing your device.
If you're switching over from another version of OpenWRT or another WRT-style command line, copy the binary to the router then install the binary by typing:
%mtd –e linux –r write <filename> linux. This command will erase your earlier firmware and write the new firmware to flash. It's important that you erase the old firmware or you risk creating a conflict between the two versions. You should also check for device-specific instructions on the above wiki page, in case there are special instructions for your device.
Pages: 1, 2