Building Software

From HBMobile
Jump to navigationJump to search

While it is not the only option, Linux is a strong contender for the OS on phones. However, this is just the kernel and needs additional software to make a useful phone. This section describes the various options available to people wanting to build software for their device.

Toolchains

A tool chain is basically defined as a compiler, linker and C library (I.e. GCC, binutils & glibc/uClibc). Optionally, a tool chain may contain a C++ compiler and debugger. Typically, the tool chain used for phones is a cross toolchain. All the programs (like GCC) run on a PC but produce binary code to run on a different architecture (e.g. ARM). This is called cross compilation and is assumed to be what you want to do. It is possible to compile natively, running gcc on your phone, however this means you need a tool chain on your phone, which eats up your flash and will also take far longer to compile things than your far more powerful PC.

Note About C Libraries

Realistically, there are two options for the C Library: uClibc & glibc. GLibc is what your PC is probably using. It's a bit of a bruit, very powerful but a bit bloated. If flash space and memory footprint is an issue, using uClibc is likely to be the better option. However, the space advantages gained using uClibc are becoming more and more insignificant as the available flash & memory on phones increases. There are a few "gotcha"s when using uClibc. At time of writing, locales are not well supported and the new Application Binary Interface (ABI) for ARM architectures (EABI) introduced with GCC 4.1.1 requires patches to be applied to compile. This situation is likely to get better quickly as uClibc is under heavy development.

Available Toolchains

Creating a cross development toolchain from the GCC source can be a real pain. There are version dependency issues, patches required to make something work etc. etc. Check out the build matrix for crosstool and look at all the red "failed" entries. Fortunately, there are several groups of people who have done all the hard work for you, producing scripts to create a toolchain or releases of binary toolchains.

Buildroot

Scratchbox

Crossdev

Crosstool

Code Sourcery

Distributions

Ok, so you have a nice shiny toolchain which generates code for your phone's architecture. What you need now is some software to compile.

Buildroot

OpenEmbedded

Gentoo

Debian ARM

Meamo

Familiar

Intimate