Propelant Documentation

Trevor Harmon


Table of Contents

1. Introduction
Existing Approaches
The Manual Approach
Proprietary Development Kits
Embedded Gentoo
ELDK
The Propelant Approach
2. Installation
Requirements
First-time Install
Upgrading
3. Configuration
Toolchain Configuration
Kernel Configuration
Root Filesystem Configuration
BusyBox Configuration
System Applications Configuration
User Applications Configuration
Boot Configuration
4. Usage
Kernel Usage
BusyBox Usage
5. Support
A. Helper Macros
B. Copyright, License, and Disclaimer

Chapter 1. Introduction

Linux is becoming increasingly popular in embedded systems. The TiVo digital video recorder, for example, uses a customized version of Linux. Companies like LinkSys are using Linux to power their network routers. And the Nokia 770 Internet Tablet is a portable Internet appliance that runs Linux.

Linux offers several benefits that explain its popularity in embedded systems:

  • Royalty free
  • Open-source; fully customizable
  • Relatively small footprint (about 2MB depending on configuration)
  • Community-based support available from mailing lists and web sites
  • Mature and stable

Despite this maturity, the process of getting a bootable Linux kernel onto an embedded system is still quite complex and labor-intensive. In addition to configuring and compiling Linux itself, there is the added burden of building a toolchain that matches the architecture of the embedded device. A filesystem must also be constructed with the appropriate libraries, initialization scripts, and other files necessary for a fully functional Linux system.

Existing Approaches

The complexity of building Linux for an embedded system is a widely recognized problem, and there are several known methods of dealing with it.

The Manual Approach

For the ultimate in freedom and flexibility, you can build Linux from scratch, tailoring the kernel, the toolchain, and its libraries to your particular needs. This freedom comes at a price, however: Building every component from scratch requires a great deal of knowledge and effort. Although documentation can help (e.g., Building Embedded Linux Systems), the manual approach is tedious and time-consuming.

Proprietary Development Kits

The polar opposite of the manual approach is the proprietary Linux development kit. These commercial products are normally designed for one particular embedded device, usually sold by the same company that created the kit. They offer a turn-key solution: You simply install the kit and you're done. The toolchain and kernel are virtually guaranteed to work.

The drawback to these products is that they severely limit freedom and flexibility. They often lock you into specific versions of compiler, kernel, and libraries. In addition, proprietary development kits are usually very expensive. Price tags often run into the four-digit range.

Embedded Gentoo

An alternative to the proprietary development kit is the open-source development kit. In keeping with the spirit of Linux, such kits can be downloaded for free. An example of such a kit is Embedded Gentoo. It provides a complete infrastructure for creating embedded Linux systems.

Because Embedded Gentoo is based on Gentoo, it is quite large and complex. Its goal is to support every conceivable embedded device, so it consists of many packages and also includes several sub-projects. This complexity can make the kit difficult to learn and use.

For example, Embedded Gentoo relies extensively on the emerge tool. While emerge is suitable for desktop systems that have thousands of packages to manage, it is overkill for developing embedded systems, which normally consist of only a few basic packages. In addition, the dependency on emerge restricts Embedded Gentoo to development hosts that run Gentoo. If you prefer another distribution, you won't be able to use it.

ELDK

Another open-source development kit for embedded Linux is ELDK. Like Embedded Gentoo, it is large and complex. The base installation, for example, is over 700 MB. It, too, relies on a package management system for installing and upgrading packages. Despite this complexity, ELDK's only supports PowerPC targets.

The Propelant Approach

Propelant, or PRogrammable One-step Preparation of Embedded Linux using ANT, shares the same goal as these existing tools: It makes building an embedded Linux system easier. However, the design and implementation of Propelant are quite different from any prior approach, and it offers some unique advantages as a result. Its key features are summarized below:

  • Propelant is simple and small. It consists of nothing more than a few Ant scripts, providing automation and abstraction without the overhead of a complete embedded development kit. One might describe it as “one step above” the manual approach, combining the flexibility of a manual setup with the ease-of-use of a kit.
  • Propelant ships without any packages. Everything is built from scratch by downloading the original sources. There are no package management tools to learn, and you only have to install the software you need for your embedded system. Thus, while other build tools start with a complete system that must be stripped down, Propelant does the opposite: It provides only the bare minimum and lets you add libraries and programs as necessary. This approach lowers complexity and gives you a better understanding of exactly what software you're putting on your embedded device.
  • Propelant is distribution-agnostic. It runs equally well on Red Hat, Gentoo, Ubuntu, and many other Linux distributions.
  • Propelant is open-source and publicly distributed. It is not tied to any particular vendor, architecture, or device.

Chapter 2. Installation

Requirements

  • Linux Propelant assumes it is running on a Linux workstation. Any modern distribution should work.
  • GNU toolchain The standard GNU toolchain (gcc, make, autoconf/automake, etc.) is required for building the Linux kernel and other components. Many distributions install this toolchain by default; if not, consult your distribution's documentation on how to install it.
  • Ant 1.6 or higher is needed to run the Propelant scripts. Note that Ant requires Java.
  • Disk space Propelant requires less than 1 MB of disk space. However, Propelant downloads and builds a complete toolchain and other libraries for your embedded system, and this may require 2 GB or more.

First-time Install

Follow these instructions to install Propelant for the first time.

  1. Download Propelant from the project website.
  2. Create a directory that you wish to use as your workspace (e.g., ~/projects/embedded).
  3. Copy all of the Propelant distribution files and directories into this workspace.

Upgrading

If you have already installed an older version Propelant and wish to upgrade a newer version, follow these steps.

  1. Go to your workspace directory and delete the build.xml file and the propelant directory.
  2. Copy all of the new Propelant distribution files and directories into your workspace directory.

Chapter 3. Configuration

Propelant builds an embedded Linux system in seven basic stages:

  1. Toolchain The GNU toolchain (compiler, C library, etc.) designed for your embedded device's architecture
  2. Kernel the Linux kernel
  3. Root filesystem A directory on your host that will eventually appear on your embedded device as its root filesystem. Libraries, init scripts, and any other files that your device requires will be copied here.
  4. BusyBox Common UNIX utilities (ls, sh, etc.) designed for a low-resource environment. (Installation of BusyBox is optional.)
  5. System applications Extra libraries and programs that you may need for your embedded system. Examples: Java virtual machine, CORBA middleware, etc.
  6. User applications These are the applications you write specifically for your embedded system
  7. Boot This step prepares an initial RAM disk for booting your embedded device

Each of these stages must be configured for the needs of your particular embedded device. In most cases, the configuration process is very simple. For example, to configure BusyBox, you simply use BusyBox's built-in configuration program to specify the applets you want to build.

Propelant's settings are stored in two places, each of which belongs in your workspace directory:

  • The build.properties file
  • The settings directory

If you are new to Propelant, you can start with a ready-made configuration for the EP405, located in the templates directory. Simply copy the contents of this directory to your workspace. You can then use the settings as a template, modifying only what is necessary for your particular device.

The following sections describe the settings for each stage in more detail.

Toolchain Configuration

Propelant uses crosstool to build a toolchain for your target. You can specify which version of crosstool to use, as well as which toolchain components crosstool should build, by editing the variables in build.properties. You can find more details about these variables in the crosstool-howto.

crosstool ships with a large number of patches that allow it to build many different combinations of the toolchain. However, there may be some combinations, especially with newer versions of the components, for which crosstool does not have the appropriate patches. In this case, you can supply your own. Simply copy the patches into the patches/crosstool directory of your workspace. For example, a patch for GCC 3.4.6 should be placed into patches/crosstool/gcc-3.4.6. Propelant will automatically find these patches and install them into crosstool. See the templates/patches/crosstool directory of the Propelant distribution for some examples.

Kernel Configuration

You can specify which version of the Linux kernel to build by editing the build.properties file. You can also specify other basic options such as which target to use for cleaning the kernel.

For the finer grained configuration that is necessary for embedded systems, you will need to supply a standard Linux configuration file. This file should be placed in the settings/kernel directory of your workspace. Make sure that the kernel.config.file option of build.properties points to this file.

To create or edit a kernel configuration file, see the section called “Kernel Usage”. An example can be found in the templates/settings/kernel directory of the Propelant distribution.

If the kernel needs to be patched, simply place your patch files into the patches/kernel directory of your workspace. Propelant will automatically apply them before building the kernel. For some examples of kernel patches, see the templates/patches/kernel directory of the Propelant distribution.

Root Filesystem Configuration

The directory structure of the root file system is specified in your build.properties file. You can also specify which libraries should be copied to the root filesystem. See the templates/build.properties file for an example.

Linux needs certain initialization files, such as /etc/inittab, in order to boot properly. To include these initialization files in your root filesystem, simply copy them to the settings/init-scripts directory of your workspace. They will end up in the /etc directory of the root filesystem. See the templates/settings/init-files directory of the Propelant distribution for some sample initialization files.

BusyBox Configuration

Configuration of BusyBox is similar to configuration of the kernel. You can specify the BusyBox version and a configuration file in your build.properties file. (The standard location of the file is the settings/busybox directory of your workspace.)

See the templates/settings/busybox directory of the Propelant distribution for a sample BusyBox configuration file.

For information on how to create and edit a BusyBox configuration file, see the section called “BusyBox Usage”.

System Applications Configuration

System applications are any additional third-party libraries or programs that you may need for your embedded system but are not part of the kernel, the toolchain, or BusyBox. For example, if you need to run Java on your device, a Java virtual machine would be a “system application.

To set up a system application for a Propelant build, follow these steps:

  1. In your workspace, create a directory called scripts/system-apps.
  2. In this directory, create an Ant build script whose filename corresponds to the name of the system application. For example, if you want to build Jam VM, you would create a file called jamvm.xml.
  3. In this file, add targets for getting, building, and installing the system application. For example, if your system application is called “jamvm,” you would create targets called get-jamvm, build-jamvm, and install-jamvm. See the templates/scripts/system-apps directory of the Propelant distribution for examples of system application build scripts. Note that Propelant's helper macros, described in Appendix A, Helper Macros, may help simplify your build script.
  4. In your build.properties file, add a property called system-apps.list. Set this property to a comma-separated list of the system applications you wish to build. Each value in the list must correspond to the name of a build script (minus the extension) in your scripts/system-apps directory.

Once this is done, Propelant will automatically add your system application to the build process.

User Applications Configuration

Configuration of user applications is entirely up to you. Simply create a build.xml script for your application (or applications), and place it in the apps directory of your workspace. Propelant will then call this script during the build process.

Note that all of the Propelant properties, such as the location of the root filesystem (root-filesystem.dir), will be available to your build script.

Boot Configuration

The boot stage requires no special configuration.

Chapter 4. Usage

Table of Contents

Kernel Usage
BusyBox Usage

Once configured, Propelant can build the complete embedded Linux system in one step. Simply type ant at the command line. This will download all of the packages, unpack them, configure them, compile them, and install them.

If at some point you want to start the build over from scratch, simply delete the build directory. This will remove all of the downloaded and generated files while leaving your configuration files intact.

If you want Propelant to perform the build stages one at a time, you can specify the following targets:

  • toolchain
  • kernel
  • root-filesystem
  • busybox
  • system-apps
  • user-apps
  • boot

For example, to build the toolchain only, type ant toolchain at the command line.

Note that some of these targets depend on others having already run. You cannot build the kernel, for instance, without first building the toolchain.

There are additional build targets that offer finer grained control of each stage. (You can see a list of them by typing ant -projecthelp.) For example, if you only want to download and configure the kernel, but not build it, type ant get-kernel patch-kernel configure-kernel-from-file. The following sections describe some of these additional targets in more detail.

Kernel Usage

The kernel stage includes special targets for creating and editing configuration files.

  • configure-kernel-from-file, which is the default for Propelant builds, configures the kernel based on an existing configuration file. This file is specified by the kernel.config.file property.
  • configure-kernel-default configures the kernel using an existing configuration file supplied by the kernel itself. These files have a defconfig suffix and are located in the arch directory of the kernel distribution. To specify the file to be used by this target, set the kernel.default.config property.
  • configure-kernel runs the kernel's built-in configuration editor. You can use this editor to create or edit a configuration file. By default, Propelant runs the text-mode editor, but you can switch to the graphical one by changing the kernel.configure.target property.

You can also “clean” the kernel's generated files using the clean-kernel target. To control which method the kernel uses for cleaning, change the kernel.clean.target property.

BusyBox Usage

The BusyBox stage includes special targets for creating and editing configuration files.

  • configure-busybox-from-file, which is the default for Propelant builds, configures BusyBox based on an existing configuration file. This file is specified by the busybox.config.file property.
  • configure-busybox-default configures BusyBox using an existing configuration file supplied by BusyBox itself. To specify the file to be used by this target, set the busybox.default.config property.
  • configure-busybox runs BusyBox's built-in configuration editor. You can use this editor to create or edit a configuration file.

Chapter 5. Support

To report a bug, request a new feature, or discuss this project with other users, visit the Propelant project page.

Propelant is maintained by Trevor Harmon.

Appendix A. Helper Macros

Propelant includes several helper macros to simplify its work, and these macros are available for writing your own system or user application build scripts.

  • configure runs a GNU Autoconf configure script
  • make runs GNU Make's make command
  • mknod runs the UNIX mknod command
  • ln runs the UNIX ln command
  • cp is a replacement for Ant's built-in Copy task, which does not preserve links or file permissions
  • unpack is a replacement for Ant's built-in UnTar task, which does not preserve file permissions

Appendix B. Copyright, License, and Disclaimer

Copyright © 2006 Trevor Harmon

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  2. Except as contained in this notice, the names of individuals credited with contribution to this software shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the individuals in question.
  3. Any package derived from this Software that is publicly distributed will be identified with a different name and the version strings in any derived Software will be changed so that no possibility of confusion between the derived package and this Software will exist.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TREVOR HARMON OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.