Angstrom on BeagleBone Black – Part 1: Compile from Source

Standard

BeagleBone is a powerful and versatile single-board computer that will run major operating systems such as Linux and Android. BeagleBone comes in two flavors: BeagleBone White (BBW) and BeagleBone Black (BBB)–the main difference is the speed–BBW clocks at 720MHz, while BBB clocks at 1GHz. BeagleBone has available a wide selection of peripheral cards, dubbed capes. They can be stacked on top of BeagleBone to quickly erect a working system for different applications. However, one should cross check the cape compatibility, as due to the multifunction I/O’s, a cape that worked on BBW may not work with BBB.  This article focuses on Ångström on BBB.

BB

Figure 1: BeagleBone White (left) and BeagleBone Black (right).

Step 1:  Install the prerequisites

This step make sure your Ubuntu Linux has all the packages necessary to build Ångström.  The prerequisites include text parsing tools, version control packages, python, compilers and related build tools, among others.  A key download is the bitbake application, which will be used later to launch the actual Ångström build.

sudo apt-get install sed wget cvs subversion git-core 
sudo apt-get install coreutils unzip texi2html texinfo
sudo apt-get install docbook-utils gawk python-pysqlite2 diffstat 
sudo apt-get install help2man make gcc build-essential g++ 
sudo apt-get install desktop-file-utils chrpath dosfstools kpartx
sudo apt-get install bitbake libsdl1.2-dev liburi-perl

Step 2: Create a working directory

Before we clone the Ångström respository, we must first create a working directory. In this example, we will create the directory, bbone, and do our build in it.

mkdir bbone
cd bbone

Step 3:  Clone the Ångström distribution

While inside the bbone directory, clone the source code from github.

git clone git://github.com/Angstrom-distribution/setup-scripts.git

Step 4: Set up Ångström

The automated build scripts by default will build the binaries and then delete the source code. This makes kernel development difficult. To stop the build script from deleting the kernel source code, comment out the line, INHERIT += "rm_work", from the file local.conf located under the setup-scripts/conf directory:

# INHERIT += "rm_work"

Now, execute the following commands to configure for BeagleBone and check for update, which may take a few minutes to complete:

cd setup-scripts
MACHINE=beaglebone ./oebb.sh config beaglebone
MACHINE=beaglebone ./oebb.sh update

Step 5: Build the Image

The bitbake command will launch the build. There are many possible images. If you have a display, and wants to build an image with IDE, use the cloud9-gnome-image. If you only want a simple serial console, use build the console-image. The build will take several hours, so if you get this far, now is a good time to leave the computer running and do something else, and periodically check on the build progress.

. ~/.oe/environment-angstromv2012.12
bitbake cloud9-gnome-image

The first line execute the script, environment-angstromv2012.12 in the current shell. The second line does the actual build, which may take several hours. Once the build completes, the bootloader, the kernel image and the file system can be found at setup-scripts/build/tmp-angstrom_v2012_12-eglibc/deploy/images/beaglebone.

If the build comes to an error stop, try first review the log files in the build directory. For example, I had an error stop due to the exo-0.8.0-r0 module, I found the detailed build log at

tmp-angstrom_v2012_12-eglibc/work/armv7a-vfp-neon-angstrom-linux-gnueabi/exo-0.8.0-r0/temp

and realized that the error occurred during do_configure.  From there I looked into the log.do_configure file and found the exact error and fixed it.

The build targets, cloud9-gnome-image and console-image, are only two of a plethora of so-called recipes. To see all the available recipes, use the following command:

cd sources
find .|grep image.bb

In Part 2, I will discuss in great detail how to flash this new image onto BBB, which turned out to be quite complex.  The good news is, in that article, I will include a script as well as step-by-step instruction on how to do it.

Further Reading:

(The above article is solely the expressed opinion of the author and does not necessarily reflect the position of his current and past employers)