Building with Arago

Building using Arago
This sections covers using OpenEmbedded and the Arago overlay to build the entire distribution.

Install Required Packages
For an Ubuntu 10.04 host you should install the following packages:
 * build-essential
 * subversion
 * ccache
 * sed
 * wget
 * cvs
 * git-core
 * coreutils
 * unzip
 * texinfo
 * docbook-utils
 * gawk
 * help2man
 * diffstat
 * file
 * g++
 * texi2html
 * bison
 * flex
 * htmldoc
 * chrpath
 * libxext-dev
 * xserver-xorg-dev
 * doxygen
 * corkscrew

You can use the following command to install all of these package:

sudo apt-get install build-essential subversion ccache sed wget cvs git-core coreutils unzip texinfo docbook-utils gawk help2man diffstat file g++ texi2html bison flex htmldoc chrpath libxext-dev xserver-xorg-dev doxygen corkscrew

Install the Toolchain
You will also need to install the codesourcery toolchain. The normal toolchain location to install to is in /opt/arm-2009q1. You can find information on installing the toolchain at this link

NOTE: you may need to install the toolchain using sudo or change permissions of /opt/arm-2009q1 to allow you to write to that directory.

Change Default Shell
OpenEmbedded contains packages that may have shell script that is not Dash shell compliant. To avoid possible issues it is best to change your /bin/sh shell to bash using the following command:

sudo dpkg-reconfigure dash

Select No when prompted

Disk Space Requirements
Building an entire distribution can require a sizeable amount of disk space (Minimum of 19GB).

Obtain the Sources
In order to build with OpenEmbedded you will need to clone three repositories that contain the metadata (recipes) used to build all the packages. NOTE: OpenEmbedded contains recipes for more packages than are required by the average distribution. These packages can be used to add additional functionality to your system but are not built by default.

git clone git://arago-project.org/git/arago.git git clone git://arago-project.org/git/arago-oe-dev.git git clone git://arago-project.org/git/arago-bitbake.git

Setup the Environment File
cd arago cp setenv.sample setenv

Edit setenv and set OEBASE to the location where you cloned the arago repositories above. For example if you made a directory in /home/user/build and cloned the repositories in this directory then OEBASE should be set to:

export OEBASE=/home/user/build

Setup the Configuration File
cd arago/conf cp local.conf.sample local.conf

Change MACHINE ?= “arago” to MACHINE ?= “xxxx”

Where xxxx is the machine name of the device you want to build a distribution for

You can find a listing of machine config files in the directory arago/conf/machine. The machine name is the portion of the file name before the ".conf"

If you have more than 1 CPU Uncomment the PARALLEL_MAKE and BB_NUMBER_THREADS lines and set the value to the number of CPUs you have

NOTE: If you want to preserve disk space you can also uncomment the line INHERIT += "rm_work". However, if you do this then using the method described below to do custom one-off builds without updating recipes will no longer work since your work directories will be cleaned after each package is built.

Source Environment Script
In the terminal you are going to use for building you will need to source the environment script to set the required variables. This can be done using:

source arago/setenv

Build the Distribution
Using the following command will build the kernel, bootloader, and file system with all required packages for the tisdk base distribution.

bitbake arago-base-tisdk-image

You can choose any of the images from the following directories (NOTE: not all images are appropriate for every device).:
 * arago/recipes/images
 * arago-oe-dev/recipes/images

To create your own image it is easiest to start with an existing image that has most of the features you want and then add or remove packages to customize it to your needs.

NOTE: It can take a long time to do the initial build of the file system depending on your system resources. During this time the build system is downloading the package sources and compiling the packages that make up the system. As long as you do not delete your arago-tmp and downloads directories which are created during the build process, subsequent builds will be done much faster because they will only have to build the delta changes.

Building Tips/Tricks
Often times you may want to make a simple modification an application to test changes you are developing. You could create a new repository with your version of the test application and modify the recipe to pull from your repository. You could then keep bumping the SRCREV value for each small change you make to the application and rebuilding, but this is often more work than is required. One of the simplest ways to make a change to any of the software is to use the files in the work directory (NOTE: This assumes you did not uncomment the rm_work line in your local.conf file).

In OpenEmbedded each package that is build gets its own unique work directory. This directory can be found in the:

arago-tmp/work/ / directory, where is the architecture of the package. For generic packages this is usually -none-linux-gnueabi, whereas for machine specific packages like the Linux kernel this is the -none-linux-gnueabi directory.  corresponds to the name of the recipe in Arago.

Once the sources have been modified the next step is to build them. Since most applications also require linking against additional libraries and headers this is where things would normally get complicated. Fortunately OpenEmbedded has saved the command that was used to build the application the first time. Inside of the temp directory you will find a script named something like:

run.do_compile.xxxxx

where xxxxx is some number. By executing this script you will get a properly configured cross compile environment and be able to recompile the application properly.