April 27, 2010
This article was contributed by Tom Parkin
The deployment of Linux on the desktop and in the server room is well served by the general-purpose
distribution. In the embedded world things are very different: although Linux is used widely,
the concept of the general-purpose distribution is much less in evidence.
Many vendors rely on forked board support packages or home-grown builds to create
their systems, effectively creating their own customized distribution in the process.
While embedded platforms represent a challenge to the traditional Linux distribution,
there is no shortage of community projects to support the development of embedded Linux systems.
What makes embedded systems different?
The primary challenge presented by embedded systems is their diversity. Embedded device
hardware tends to vary both in terms of design and capability.
Even between generations of the same product, it is not unusual for a major system component
such as the CPU to change completely. In addition, most embedded devices
contain a fair
amount of custom, closed-source software which is not packaged by a distribution.
The combined effect of this hardware and software diversity is that most embedded
devices are unique in one way or another, meaning it is difficult to design an embedded
distribution which is simultaneously general enough to be useful and targeted enough to be
efficient across a range of embedded platforms.
To make matters worse, embedded Linux development often takes place behind closed doors.
In some cases this is due to
a lack of hardware to support wider community involvement, since development platforms
for many embedded devices will only exist within the labs of the companies manufacturing
them. In other cases, manufacturers of embedded Linux devices rely on keeping their
designs as secret as possible in order to keep ahead of the competition.
This secrecy tends to stifle the community engagement that helps fuel the development
of many desktop and server distributions.
In addition to the closed nature of many embedded projects, embedded Linux distributions
face a challenge of a lack of perceived utility within developer communities. Given
the heavily customized nature of much of the software within a given device, developers
tend to view any external software as a starting point rather than a completed product.
Rather than a distribution being a central provider, it is simply another component in
a larger project.
Meeting the challenge
Despite the challenges of the embedded Linux ecosystem, embedded Linux tools
and distributions can offer real value to developers working within that space.
Various approaches are being developed by a number of embedded Linux projects,
generating a suite of tools which may be brought to bear on a particular project
according to its needs.
Dispensing with tools: the DIY approach
If complete control over configuration is important to
an embedded developer, then the most efficacious approach is to build the
whole system manually. This would typically involve hand-crafting
a cross-compilation toolchain targeting the embedded device, then downloading
and building the individual packages required to make up the software stack.
Although a somewhat arduous
process, the DIY approach to embedded Linux offers several key benefits, including
the ability to fine-tune packages to requirements, an enforced understanding of
the precise contents of the embedded root file system, and the ability to pick and
choose system components in order to meet project goals.
The basics of putting together a DIY embedded Linux system are
illustrated in Karim Yaghmour's book Building Embedded Linux Systems.
In addition, the Cross Linux From
Scratch guide covers the creation a completely DIY cross-compiled
Linux installation in greater detail.
Meta-distributions and configurable build architectures
The DIY approach to an embedded distribution offers the greatest control and flexibility,
but it does require a large investment of time and no small amount of expertise to get a
basic system up and running. To help mitigate this, a number of configurable build
tools exist which simplify the process.
This approach combines the flexibility of selecting, configuring, and building sources
by hand with the convenience of a framework which hides much of that detail until a
developer needs it. At the time of this writing, several different build architectures are
in active development.
Buildroot is perhaps the simplest of the
build framework projects. Buildroot provides a menu-driven configuration similar to that used
by the Linux kernel, and an automated build based around makefiles. It can be used
to build anything from a cross-compilation toolchain right up to a complete
root filesystem for the device. It also provides a simple mechanism for developers to patch software
packages as they are built. Since its initial release in 2005, Buildroot has achieved
considerable popularity in a range of applications, which can include anything from
chip manufacturer
board support packages to embedded firmware for
rugged displays.
OpenEmbedded is a
more complex system which utilizes a custom build tool, Bitbake, to provide
information on how to build individual packages. Bitbake is derived from Gentoo's portage
system, and many of the concepts utilized in Bitbake will be familiar to Gentoo users.
OpenEmbedded provides Bitbake build recipes for many packages, from cross-compilation
tools to the Qt framework and X. It is used as the build tool for a number of Linux
distributions, including Ångström
and Openmoko, and is also used by
Gumstix to create firmware for their devices.
In contrast, Scratchbox takes a
different approach from both OpenEmbedded
and Buildroot. Rather than providing build instructions for the cross-compilation of packages,
Scratchbox provides a chrooted environment in which the default build tools produce
cross-compiled code. In this environment, packages may be built as though they were being built natively,
thereby avoiding much of the hassle of configuring packages for cross-compilation. In addition
to providing a compilation environment, Scratchbox also integrates Qemu to provide an emulated
platform for running cross-compiled code. This could be a useful feature early in the development
of a new embedded device when the actual hardware is not yet available. Scratchbox has been used
by the Maemo project, which is used in
Nokia's Internet Tablet products—and the N900 phone.
Finally, Firmware Linux marries the simplicity
of Buildroot to the native compilation approach of Scratchbox. Starting life in
2001 as a means of automating a Linux From Scratch build, Firmware Linux has developed into
a general set of scripts for the creation of a native development environment for the
target hardware.
Similar to Scratchbox, Firmware Linux supports the use of Qemu as an
emulation environment for running target binaries and compiling code.
Miniature desktop distributions
Automated build environments allow developers to build complete embedded systems from
source. At the same time, a number of projects are developing
distributions which approach embedded software from the opposite direction, by slimming
down general-purpose distributions to fit the embedded space.
Emdebian aims to make Debian suitable for embedded
devices. So far, this effort has taken two complementary paths. Firstly, Emdebian Crush
provides a heavily modified set of packages based around a Busybox root filesystem to
provide the smallest possible installation of Debian. At the time of this writing, Crush
supports ARM platforms only. Parallel to working on Crush, the Emdebian
team has been developing Emdebian Grip, a low-fat install which tracks the
development of the forthcoming stable release of Debian.
Emdebian Grip has been used in
Toby Churchill's SL40 Lightwriter, and some of Digi's
ARM-based embedded modules, as well as various silicon provider board support packages.
Similar to Emdebian, Gentoo Embedded
(aka Embedded Gentoo)
works to make the Gentoo distribution more suitable for embedded devices. This brings Gentoo's
portage package management tool to bear on the embedded space, and also provides a
handbook which guides users through the process of putting together a Gentoo Embedded system;
a process which will be generally familiar to users of the Gentoo handbook
for desktop and server systems. Readers may be familiar with
Gentoo Embedded through its use in Google's Chromium OS
project, where it has been employed as a cross-compilation tool to build AMD64 binaries on an x86 host.
Commercial offerings
Alongside freely available open source embedded Linux tools and distributions, there
are a number of commercial embedded Linux distributions available. Just as with desktop Linux,
a commercial agreement with a vendor may offer various incentives to reassure pointy-haired
bosses: guaranteed integration support, a quicker time-to-market, enhanced development tools, etc.
MontaVista Linux is one of the most prominent
offerings in this space, however a number of other commercial embedded distributions exist including
Wind River Linux and
BlueCat Linux.
Complete software stacks
Recent initiatives have seen the development of complete, application-specific software stacks for embedded
platforms. Examples include Google's Android and Nokia's Maemo project, which are geared
toward mobile phones and internet tablets; or one of the many network router
firmware projects (e.g. FreeWRT,
Tomato, or OpenWrt).
These projects can offer a complete solution for certain developments, although it is
more likely that they are employed as a foundation to build upon. For example, Android is in use in
the Archos 5 internet tablet and
Barnes and Noble's "nook" e-book reader,
and Maemo has been merged with Intel's Moblin to form
MeeGo.
Many paths to enlightenment
Although the nature of embedded devices makes a general-purpose Linux distribution difficult
to develop there are nonetheless a range of projects which support embedded Linux development
at every level. The Cross Linux From Scratch project provides a simple guide to hand-crafting
a system, the various build frameworks and slimline versions of desktop distributions provide
a sliding scale of automation for the creation of a distribution, and
the complete stacks provided by the likes of Android and MeeGo provide an integrated foundation
for further development.
Of the range of embedded Linux tools, the projects generating the most press are the likes
of Android and MeeGo. This is partially due to the large corporate sponsors behind these
projects, but it may also be because they are starting to change the face of embedded Linux
by commoditizing the software stack for subsets of embedded devices. In so doing, Android and MeeGo
may suggest a possible future development path for embedded Linux as a whole: for many
applications, an off-the-shelf stack could deliver an enticingly short time-to-market along
with the added incentive of high community involvement in the wider project.
Whether or not this model can support enough diversity to make it appropriate
across the embedded ecosystem is not clear, but the potential benefits to manufacturers and
end users may make it an attractive way to deliver Linux in a range of other embedded markets.
(
Log in to post comments)