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)

14 thoughts on “Angstrom on BeagleBone Black – Part 1: Compile from Source

  1. John

    HI Larry!
    In your text above you mention that you had a problem with building exo-0.8.0 and that you found it by looking in the log.do_configure. I have a similar (the same?) problem and I can’t pinpoint the problem (not experienced enough I guess).

    You don’t happen to remember what the problem was?

    • John

      I found the problem. It was a perl-module that was missing on the host system.
      On an Ubuntu (and Debian) system, add it by:
      sudo cpan install URI::Escape

  2. Anil kumar

    Hi LarryLisky,
    Thank you for the great post, its very helpful.I have got following error after typing
    bitbake cloud9-gnome-image.please reply how to solve this

    File “/usr/lib/pymodules/python2.7/bb/utils.py”, line 387, in better_eval
    return eval(source, _context, locals)
    File “PN”, line 1, in
    TypeError: getVar() takes exactly 3 arguments (2 given)

    • larrylisky

      I think you should follow the error message’s siggestion and see where the error is happening. I suspect the python version is the issue.

  3. larrylisky

    I am not an aptitude expert, but you might be missing a repository in /etc/apt/source.list. Please compare yours with my below:

    # deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ – Release amd64 (20140204)]/ dists/precise/main/binary-i386/

    # deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ – Release amd64 (20140204)]/ dists/precise/restricted/binary-i386/
    # deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ – Release amd64 (20140204)]/ precise main restricted

    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted

    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://us.archive.ubuntu.com/ubuntu/ precise universe
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
    deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
    deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse

    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

    deb http://security.ubuntu.com/ubuntu precise-security main restricted
    deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
    deb http://security.ubuntu.com/ubuntu precise-security universe
    deb-src http://security.ubuntu.com/ubuntu precise-security universe
    deb http://security.ubuntu.com/ubuntu precise-security multiverse
    deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

    ## Uncomment the following two lines to add software from Canonical’s
    ## ‘partner’ repository.
    ## This software is not part of Ubuntu, but is offered by Canonical and the
    ## respective vendors as a service to Ubuntu users.
    # deb http://archive.canonical.com/ubuntu precise partner
    # deb-src http://archive.canonical.com/ubuntu precise partner

    ## This software is not part of Ubuntu, but is offered by third-party
    ## developers who want to ship their latest software.
    deb http://extras.ubuntu.com/ubuntu precise main
    deb-src http://extras.ubuntu.com/ubuntu precise main

  4. Hmm. bitbake doesn’t seem to exist for Ubuntu 13.10…

    $ sudo apt-get install bitbake
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package bitbake

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s