Tips and Tricks for Linux Admins: The State of the Tiny
There is a distinct sub-culture in the Unix-type operating universe made up of gnarly old geekbeards who were raised up in the green-screen command-prompt era. They think X Window is for amateurs and any executable over 100K is bloatware. These are the wizened gurus who can touch-type 100 words per minute, remember every option for hundreds of commands, and who take pride at keeping antique hardware in service. Throw away an old 386 or 486? Never. Not when it makes a perfectly good firewall, printer server, Ethernet bridge, or network router. Keeping such antiques in service might require soldering some salvaged motherboard components, or re-wiring the power supply, or crawling through bins of spare parts to find compatible memory modules, but that's routine stuff for these folks.
Me, I have a life. I like modern hardware that works without needing an electrical engineer to keep it going. But I also like the anti-bloat attitude. The great thing about Linux is it can be tailored to fit any hardware for any job. Linux on small form-factor computers fits into all kinds of useful niches in your network. Unlike old PCs, small form-factor computers are quiet, take up less space, and use a lot less power. So let's take a look at some of the small form-factor devices that we can stuff Linux into.
Gumstix Way Small Computer
The Gumstix computers are cute little things about the size of granola bars. There are two models, the WaySmall and the Netstix, and a nice assortment of expansion boards and accessories. You can get a Robostix, which is a robotics microcontroller, a GPSstix, which includes a GPS (global positioning system) module plus sound, and WiFiStix, for (what else) wireless applications.
In this era of multi-core gigaherz processors you might not be impressed by these little devices. They are powered by Intel XScale 200 MHz and 400 MHz processors, have 64 megabytes of RAM, and 4-16 megabytes of storage provided by Intel Strataflash modules. Their little operating systems, which are customized Linux images with 2.6 kernels, take up just over three megabytes. There is a Compact Flash card slot for additional storage, and they'll take either AC or battery power. What can you do with such tiny, feeble computers that neither blink nor whir? Quite a bit. These are prime hacker's tools for building devices of all kinds, such as sneaky wireless surveillance devices, Bluetooth sniper rifles, flashy programmable signs, robot dogs that don't make messes, VoIP servers, or a portable Linux PC that travels with you anywhere. And ordinary mundane things like LAN servers and routers.
Little Blue Boxes
The OpenWRT project, which is open source firmware for the Linksys WRT54G, has grown a lot from its humble beginnings. Initially it took a combination of prodding Linksys to honor its legal obligations under the GPL and release the WRT54G source code, which used GPL software, and the exploitation of an obscure firmware bug. The firmware bug provided a less-risky path for flashing the OpenWRT image to the device than using the Linksys Web interface.
OpenWRT long ago left the original Linksys code behind, and the latest incarnations of the WRT54G don't depend on a firmware bug, but can be reflashed via either a Web interface, or with a TFTP boot server. There are several related firmware projects now, like DD-WRT, HyperWRT, Tomato, and Sveasoft. You're not limited to Linksys boxes, because these firmwares run on many brands of hardware: Allnet, Belkin, Buffalo, Dell, Linksys, US Robotics and several more.
The chief attraction of using these little devices is the cost, which runs from around $55 to $125. This buys you a wireless access point with a WAN port and four-port wired switch, for sharing broadband Internet and LAN services. Replacing the stock firmware with OpenWRT or one of its cousins gives you considerably more features and stability, which is a more attractive option than spending a few hundred dollars on a higher-end router. OpenWRT goes beyond the usual static, inflexible firmware design and comes with a package manager so you can easily add or remove software.
Even if you don't want advanced functionality, the stock firmware in most of these devices is, in a word, poo. Replacing it with OpenWRT means far fewer bugs, better performance, and superior stability.
Linux cannot turn low-end hardware into high-end hardware. The specs are dinky- some devices have as little as 2 megabytes Flash and 8 megabytes RAM. The best you'll find is 8/32. They are not expandable without being handy with a soldering iron, and will crumble under high loads, especially peer protocols like Bittorrent. But they're fine for small networks sharing DSL or cable Internet, or in more specialized roles such as bridges, wireless repeaters, traffic shaping, or wireless hotspot portals.
The Picotux claims to be the smallest Linux computer in the world. It's barely big enough to plug an RJ45 connector into. It boasts proudly of these specs:
- 55-MHz ARM CPU
- 10/100 Ethernet
- 2 megabytes Flash, 8 megabytes RAM
- LEDs, two, count 'em, and the green one is programmable
Embedded Linux Programming
All of these devices are great for learning how to do embedded programming. OpenWRT has an ingenious approach to setting up a build environment. The OpenWRT build system is template-based and highly automated, so you can get down to the work of building the firmware image you want, instead of spending a lot of time on housekeeping. Rather than mucking with raw masses of source code, verifying versions, deciphering changes, and hassling with patching, just edit Makefiles and the build system does the rest. It downloads the correct sources, and does the work of patching and compiling for your platform.
Gumstix offers a free-of-cost software developer's kit. It is based on the usual GNU and Linux suspects: the Linux kernel, gcc, busybox, uClibc, binutils, gdb, and so on. They also provide a decent amount of documentation for getting started, and a pretty good user's mailing list. What a refreshing change of pace from vendors who are terrified by the notion of us awful customers doing what we want with our own property.