|
|
Subscribe / Log in / New account

Tools and distributions for embedded Linux development

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.


Index entries for this article
GuestArticlesParkin, Tom


to post comments

Tools and distributions for embedded Linux development

Posted Apr 27, 2010 19:31 UTC (Tue) by warmcat (guest, #26416) [Link] (9 responses)

I certainly agree with your conclusion that prebuilt, packaged OSes are going to be the future, but you missed something interesting.

Most of the distros you mentioned are cross-built which has quite some costs associated with it for a large packageset.

Fedora on ARM

https://fedoraproject.org/wiki/Architectures/ARM

has been available for over a year now and has a native-build approach.

Since its (yum) repos provide a large package universe already, typically you are only into native-building your own packages on top of the distro that's specific to your device; there's no need to build the bulk of the packages you use.

Increasingly the glue between a stock rootfs package set and the specialized device function is being done in interpreted scripting languages which also goes to make the developer build action redundant.

Quality of the results is also critical; Fedora provides really high quality packages prebuilt.

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 7:48 UTC (Wed) by tzafrir (subscriber, #11501) [Link] (5 responses)

Emdebian, that is mentioned there, is also for this mode of operations.

Indeed Emdebian Grip strives to maintain compatibility with the rest of the Debian archive. There should be no issue in mixing packages from Grip and original Debian packages.

http://emdebian.org/grip/

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 8:04 UTC (Wed) by warmcat (guest, #26416) [Link] (4 responses)

> Emdebian, that is mentioned there, is also for this mode of operations.

Sure, I actually use Fedora on ARM so I noticed it missing. I'm sure people would also get a good experience with Debian based stuff from the same principle.

A lot of people are still in the mindset that because it's embedded you have to cook everything yourself and minimize footprint and so on; that mass build mindset pushes them towards cross.

That is still required for weaker chips but it's now common that ARM-based chips are more than strong enough (say, 400MHz ARM9+; Cortex A8 and 1.2GHz Marvell chips are now in real devices) and have enough resources to host their own build. In the case you're using a normal distro, you don't care much anyway because you just use the packaged binaries for almost everything same as you would on a desktop.

I found it's a real breakthrough to be able to look at the embedded device same as a - in my case - Fedora server or desktop device and manage it by yum, have full bash, sysvinit if you want it, all the full strength servers. If you have the appropriate CPU and storage - I have SD Card rootfs on my devices - then this tradeoff can be a huge advantage in quality and time to market.

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 9:23 UTC (Wed) by tzafrir (subscriber, #11501) [Link] (3 responses)

There's a different limitation: disk space.

I have a nice little SheevaPlug based on the same Marvell CPU you mentioned. It's an ARM device with 512MB of RAM and 512MB of flash. That CPU and 512MB of RAM is more than enough for for building. But 512MB of flash is practically nothing if you also want to keep a build environment around.

I actually run it from a 4GB SD card. This gives a bit more space for a build system, but still, not as much as I'd like.

Being able to build packages on a stronger x86 system I have around is also useful.

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 14:19 UTC (Wed) by zlynx (guest, #2285) [Link]

If you have networking you can always use NFS.

Tools and distributions for embedded Linux development

Posted Apr 29, 2010 11:36 UTC (Thu) by warmcat (guest, #26416) [Link] (1 responses)

> I actually run it from a 4GB SD card.

I can absolutely recommend that approach... unlike the on-PCB flash you can put a normal filesystem on it (we use ext4 with great results) and you can upgrade it any time, 16GB SD Cards are now available and 32GB will be along soon. You can pop it out and use on a host via SD slot as well.

On the device I am working on we go a bit further and do true SD Card boot (the bootloader is on the SD Card, ROM on the CPU fetches and runs it) which has the advantage the whole this is unbrickable.

BTW for Fedora, we use a 2GB root partition to hold all the -devel and rootfs files and it's enough for our purposes so far.

Tools and distributions for embedded Linux development

Posted May 6, 2010 14:31 UTC (Thu) by dominosrob (guest, #63549) [Link]

From what I've read the write speed performance of the SD card will gradually degrade due to the lack of a TRIM function. This has become a big enough issue that Windows Vista and newer Linux kernels utilize the TRIM function on SSD drives that support it. But this function has yet to be put on SD cards (probably cause their designed for digital cameras!)

NAND flash may be better suited since the wear-leveling is integrated into the filesystem software (Flash Translation Layer).

Tools and distributions for embedded Linux development

Posted Apr 29, 2010 11:06 UTC (Thu) by eru (subscriber, #2753) [Link] (1 responses)

Most of the distros you mentioned are cross-built which has quite some costs associated with it for a large packageset.

Based on my experiences (which involved cross-building on Linux for a funny embedded BSD-derivative), by far the biggest grief with cross-building was that most packages use "autoconfiguring" that pokes around the build environment and assumes the target is the same. Software with the old-school "manually edit the makefile and then build" approach is much easier to deal with. Another source of frustration was build processes that create binaries and then run them as part of the building.

Software projects could make things much easier for cross-builders by avoiding the abovementioned things. Linuxes are now so like each other that a makefile with no autoconfigure step would work in most cases. at least is should exist as an alternate build method.

Tools and distributions for embedded Linux development

Posted Apr 29, 2010 11:32 UTC (Thu) by warmcat (guest, #26416) [Link]

> by far the biggest grief with cross-building was that most packages use "autoconfiguring"

Right I also spent a lot of time getting a few dozen basic packages to crossbuild in the past (good luck with perl!), that's part of the reason I am such an enthusiastic convert to native build approach.

The autoblah stuff did get better over time, if the project came ready to work with newer autoblah it was possible to inform ./configure that you were building cross and it might even take care of most things. A lot of projects come with their own build approaches, eg webkit, sometimes they can be coerced into doing cross but each time it's a new different mountain to climb to understand exactly "how".

Native build eliminates all that and you can just do ./configure again because you're not having to trick anything. Combined with realizing you don't have to put up with cut-down anything any more like busybox ash vs actual bash, most of the special-case magic about "embedded" disappears and it's like working on a normal box with corresponding smoothing of development process and increase in dev speed.

yum RAM requirements

Posted May 4, 2010 18:47 UTC (Tue) by hollis (subscriber, #6768) [Link]

I have one of the original Kuroboxes: basically PowerPC 603e with (non-upgradeable) 64MB of RAM. I tried to use Fedora, but after going through an agonizing process of actually installing it, I discovered that yum needed at least 128MB (don't remember the exact number now). :(

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 0:15 UTC (Wed) by nbd (subscriber, #14393) [Link] (1 responses)

OpenWrt isn't just a router firmware distro anymore. It's also used for some mobile devices, such as the NanoNote from Qi Hardware.

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 4:28 UTC (Wed) by jebba (guest, #4439) [Link]

...and this cute wifi thermometer:
http://www.temperaturealert.com/Remote-Temperature/Temper...

Also, now that MeeGo is around, (Maemo) scratchbox is being dropped in favor of OpenSUSE's Build Service:
http://en.opensuse.org/Build_Service

Poky Platform Builder

Posted Apr 28, 2010 2:30 UTC (Wed) by HappyCamp (guest, #29230) [Link]

I didn't see mention of the Poky Platform Builder. Though I believe it is based on OpenEmbedded:

http://www.pokylinux.org/

Tools and distributions for embedded Linux development

Posted Apr 28, 2010 16:06 UTC (Wed) by alison (subscriber, #63752) [Link]

Excellent, informative article. I am using it to make a case that my project should purchase a group subscription to LWN.

Crossplex

Posted Apr 28, 2010 21:08 UTC (Wed) by dkg (subscriber, #55359) [Link]

Another tool worth mentioning: crossplex, a library of Make macros for building GNU/Linux embedded systems.

Tools and distributions for embedded Linux development

Posted May 2, 2010 14:31 UTC (Sun) by dmag (guest, #17775) [Link]

First, thanks for the overview. Are there any databases of devices out there that record how open or closed the device is? i.e. Can you run your own programs? Are there binary-only drivers in the kernel? Are there proprietary userspace drivers? Has anyone ever upgraded the kernel? etc.

Background:
I used to buy devices and put Linux on them. That was fun, but frustrating, since the result wasn't always feature-complete.

Then companies started shipping Linux directly on their devices. That saved me a lot of time, so I decided to buy only devices with Linux on them from now on. But then I realised it's still not "my" device if I can't upgrade it.

So now I am changing my rule to be "must be upgradeable" (i.e. no proprietary drivers, ideally able to run kernel.org Linux.) I'm not so militant about user-space stuff. But I'm tired of companies that use Linux, but don't want the community to maintain it for them. (It's also a nice quality filter, as the recent Android debacle shows. Why settle for a quick hack when you can fit in with the existing functions just as easily?)

Also, I'd like to mention that Ubuntu also ships 2 ARM versions (dove and imx51).

ptxdist was forgotten

Posted May 6, 2010 13:47 UTC (Thu) by jpfrancois (subscriber, #65948) [Link] (1 responses)

You did not mention PTXdist, which is a great tool.
See http://www.pengutronix.de/software/ptxdist/index_en.html

I find it more powerful than buildroot, yet less complex than buildroot.
You have a menuconfig based system, with rules for many packages , but adding packages, or customizing existing ones through new rules and patches is really easy.

ptxdist was forgotten

Posted May 7, 2010 6:36 UTC (Fri) by bohansen (guest, #65968) [Link]

I agree, PTXDist is a great tool. Add to this the OSELAS.toolchain (http://www.oselas.com/oselas/toolchain/index_en.html) and you have a cross compiling environment running out of the box in very short time.
The good thing is that you actually don't need to learn that many new tools. If you are used to make files and kernel config from linux then you just need to get used to the ptxdist commands.

They have some good tutorials to get started (http://www.ptxdist.org/software/ptxdist/appnotes_en.html) if anybody is interested.

Tools and distributions for embedded Linux development

Posted May 7, 2010 10:58 UTC (Fri) by HIGHGuY (subscriber, #62277) [Link]

Another good observation to make is that embedded linux vendors are moving away from pre-built RPM systems in favor of the listed open-source build systems.

MontaVista and Mentor Graphics are both based on OpenEmbedded (while WindRiver still uses it's proprietary LDAT). That might definately close the gap and improve the embedded ecosystem.

Tools and distributions for embedded Linux development

Posted Dec 18, 2019 15:33 UTC (Wed) by jgrossholtz (guest, #118253) [Link]

10 years after this post has been published, it remains valid. The main distro to do embedded Linux development are all fully usable for this purpose. The easiest way to ensure a given system is suitable for development is to try to use Buildroot or Yocto: often there are a few packages missing, but it is easy to begin with.


Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds