An introduction to Embedded Linux, BeagleBoard & its Linux kernel port
Jon Masters takes a break from his usual kernel column format this month to introduce us to the world of embedded Linux with an overview of the BeagleBoard and its Linux kernel port…
These days, many consumer electronics devices run some form of embedded Linux-based environment. There are popular home Wi‑Fi routers from companies like Linksys, Android phones from Google, and TV set-top boxes galore. These devices tend to have two things in common: they run an embedded form of Linux intended for more resource-constrained hardware (less RAM etc), and they often use ARM-based system-on-chip (SoC) processors – combining a CPU with various peripheral devices on a single chip – in place of the Intel x86-based processors found in most consumer PCs.
While popular, many enthusiasts find these devices inaccessible from a development viewpoint, being content to try some well-tested ‘alternative’ firmware in their home router (such as DD-WRT or OpenWRT) but not really feeling empowered to build their own embedded Linux devices or get involved with embedded kernel development. After all, building such a device from scratch is outside of the resources available to or capability of most enthusiasts. Few of us have access to the software and tools required to make complex multi-layered circuit boards, even if we do have the necessary understanding to put it all together. In addition, because consumer electronics hardware is not generally intended to be modified by consumers, many people don’t want to risk ‘bricking’ their expensive gadgets in the process of learning more about how they work, or to enhance their design.
Enter BeagleBoard. This is the brainchild of a small group of volunteers (many of whom are Texas Instruments employees – TI’s chips are used in the design) who were frustrated at the lack of affordable development boards, and with the kinds of concerns faced by those seeking to get involved with embedded development. Their attempt to remove these barriers led to a small, (relatively) low-cost, durable (hard to ‘brick’) ARM-based development platform that couples an open source hardware design that anyone can look at with open source software. The project is supported by a strong community of users and developers who support each other and welcome newcomers. That it also benefits TI to have developers using its parts is obvious, but that in itself isn’t necessary a bad thing as such a project does need some kind of backing.
Physically, the latest ‘xM’ version of the BeagleBoard is an 8.25 x 8.25cm (3.25” x 3.25”) circuit board that includes a powerful 1GHz ARM Cortex-A8 SoC processor, 512MB of DDR RAM, microSD card slot, 4-port USB hub, 100MBit Ethernet, audio input and output, S-video and DVI-D output, and a lot of developer-friendly connections we’ll get on to later in this article. You can pick up a BeagleBoard from a number of suppliers by visiting the project website at beagleboard.org and clicking on the link for a distributor covering your particular world region. The boards retail for around $150 USD, which is a tremendous bargain considering the kinds of application it empowers you to build. These latest-generation ARM Cortex-A8 cores are fundamentally the same design as that used in the Google Nexus S, iPhone (Apple’s A4 processor is effectively a derivative), as well as many other gadgets, and even a new generation of ARM netbooks.
Setting up BeagleBoard
Developing with BeagleBoard, like working with other embedded devices, generally involves the use of two systems: a desktop development system and the board itself. The BeagleBoard is fast by embedded standards. It’ll give your phone a run for its money, but not your fancy desktop or recent laptop.
Therefore, the general established practice for working with embedded Linux devices is to develop and build software on a ‘host’ PC system (on which all of the general tools you are used to having are available) and then copy the results to the BeagleBoard using its network connection, or by removing and directly updating its microSD card. Many developers will use a mixed approach, installing a general-purpose OS onto the BeagleBoard and interfacing with it over the network, running some commands on the device itself, but offloading bigger tasks (like a kernel compile) to a faster desktop development system.
To get going, you will attach the BeagleBoard to a 5V power source. This can be either the 5V connection directly, or the USB OTG mini port from which it can draw enough power just to run the board without external peripherals. In my case, I use an externally powered USB hub and purchased the optional 5V power cable that simply plugs into the external hub for power. You will also need to attach a serial cable to the serial port on the board. This will be used to interact with BeagleBoard on its console, much as you would on a regular desktop not running a graphical environment. Many PCs don’t come with serial ports any more, but an inexpensive USB adaptor can be bought from any PC store. After attaching the serial dongle (which fits directly onto the port on the board without cables), you can configure software such as minicom, screen, or any other terminal emulator that came with your choice of OS on the host system. By default, you will want to use a 115200 baud rate, 8 bits, no parity and one stop bit. The serial device path may vary, but on Linux it will be similar to /dev/ttyUSB0.
BeagleBoard comes with a 4GB microSD card containing validation software that you can use (actually, a release of the Angstrom distribution) and which should boot after you insert the card and power on the board. If you have set things up correctly, you will see a simple banner and be able to type shell commands. There are various alternative images available on the BeagleBoard website, so you can replace the ‘validation’ factory image with a version of Android built for BeagleBoard, or Ubuntu, and so on. I chose to install Debian Squeeze on my BeagleBoard, following instructions on the BeagleBoard wiki and using the updated kernel images available from Robert Nelson to get started. At this point, the latest upstream kernels (from 2.6.38 onwards) support most of the hardware out of the box without requiring patching or modification.