I recently bought a BeagleBone, and one of the first things I attempted right away was to build the Angtsrom embedded Linux distribution, which is the most popular embedded Linux distribution for this platform. There are both a lot of information and very few guides on how to tackle this, and I ended up writing this guide, more as a way to make sure I would be able to reproduce image building from scratch in case I had to at some point.
Important note: this guide was written on 2011.01.08. Since the OE repository evolves every day, your experience may change slightly…
Here is what I documented, starting from a brand new Ubuntu vmware image. Let me know if this helps others!
1. Install an Ubuntu 11.10, 64bits desktop distribution on a VM. On my setup, I used 4 virtual CPUs, 4096MB or RAM and a 40GB HDD, with bridged networking. The only important parameter as far as I can tell is disk size, you will most probably need more than 20GB.
2. Setup your environment:
- Login (on your Ubuntu image)
- On a terminal, add yourself to the “disk” group: adduser your_username disk
- Logout, then login again to refresh group permissions for your user.
- Make sure /bin/sh points to bash and not dash! This is a nasty one, thanks to Leigh Klotz for pointing it out, this made me waste several evenings! (use sudo dpkg-reconfigure bash if necessary, or update the symbolic link manually).
- cd Documents
- mkdir Beaglebone
- cd Beaglebone
Then add the various packages required to compile the Angstrom cloud9 image. This is the exact minimum list I needed when I did the compilation on the 8th of January 2011:
sudo apt-get install git build-essential diffstat texi2html texinfo subversion chrpath ncurses-dev
Last, get the Angstrom build scripts:
git clone git://git.angstrom-distribution.org/setup-scripts cd setup-scripts git checkout origin/oe-core -b oe-core
At this stage, If you need a proxy, edit oebb.sh and input your proxy configuration at the beginning of the file. Don’t forget to delete the empty PROXYHOST definition. You will also have to apt-get install corkscrew . If at a later stage you need to add/modify the proxy information, the best is still to delete ~/.oe, as well as setup-scripts/git_config and setup-scripts/subversion_config as the git and subversion config dirs are never rebuilt when the proxy information is modified.
Now, configure for your machine, and source the configuration in your shell session:
./oebb.sh config beaglebone ~/.oe/environment-oecore
- bitbake systemd-image will build a minimum bootable image
- bitbake cloud9-image will build the complete cloud9 demo image that is shipped with the BBone. The first attempt will fail, and bitbake will give you instructions to add a line in /etc/fstab (on you Ubuntu host, not on the rootfs of your target!).
If you followed those instructions thoroughly, nothing should go wrong (famous last words 😉 ).
Issues your can encounter, and a few questions I had:
- My compilation stops with an error at nodejs: this means that your shell is still dash, not bash, double-check!
- I am lost, everything is going pear-shaped, how do I start over?: delete your “build” directory, delete ~/.oe/, delete git_config and subversion_config if those directories exist in setup-scripts, logout, login again, and start over. Avoid deleting the “sources” directory and in particular the sources/download which contains a cache of all the archives that have already been downloaded, this will save you a lot of bandwidth and time when starting over.
- By the way… where are the results of those bitbake commands? They are in build/tmp-angstrom_2010_x-eglibc/deploy and its subdirectories: images, ipk, licenses. The cloud9-image target creates a “.img” file which you can zcat to your microSD device directly. The systemd-image target creates a bunch of pieces you have to assemble to create the disk image, this goes beyond the scope of this post.