Minnowboard:Building Angstrom Linux for the MinnowBoard

Building Angstrom is not a typical build process, and requires some nuanced understanding of the bitbake internals. Seemingly, there's a lot of changes happening to bitbake, as well as to the Angstrom project, and there's a lot of inconsistent documentation on the Internet about what parameters and commands to use to achieve a build. At the end of this guide you will have a complete Angstrom minnowboard system installed onto a microsd card.

Requirements:
 * 1) Ubuntu 12.10 (other versions may work) installed on an Intel-compatible laptop/desktop (Other platforms may work just fine)
 * 2) Internet connection
 * 3) 8 hours for a build to compile (YMMV)
 * 4) Access to your minnowboard console (I use the USB-cable based "screen /dev/ttyUSB0  115200")

Prepping Your ubuntu
Most of the bitbake platform is completely self-contained, however there's a couple of Ubuntu-specific setup nuances that will cause you problems if you're unlucky (They're noted throughout the document). Other distributions may have similar caveats. See this for more tips if you're having problems compiling : http://www.openembedded.org/wiki/OEandYourDistro#Ubuntu

Installing Package Requirements
First Install the following packages to satisfy most, if not all, of the bitbake toolchain requirements: sudo apt-get install gawk wget git-core diffstat unzip build-essential chrpath libsdl1.2-dev xterm unzip texinfo \ git texi2html subversion ncurses-dev sed cvs git-core coreutils docbook-utils python-pysqlite2 help2man make \ gcc g++ desktop-file-utils chrpath dosfstools kpartx

Using the required shell
Make sure your /bin/sh points to bash. Probably this is the best way to do this: sudo dpkg-reconfigure bash

Preparing Bitbake
Important NOTE:  Do not try building Angstrom in an ecryptfs filesystem. The bitbake toolchain will crash due to an inability to support huge directory/file names with ecryptfs. For this reason, in the examples that follow "/opt/minnowboard" was choosen as a build directory, which was on an ext4 filesystem.

Create a build directiory
The build directory can get pretty large (6 GiB?) So be sure you pick a filesystem with enough space on it. We chose "/opt/minnowboard". As such, here's a few commands to get you started: mkdir -p /opt/minnowboard/ourbuild cd /opt/minnowboard/ourbuild git clone git://github.com/Angstrom-distribution/setup-scripts.git cd setup-scripts/

Mandatory local.conf adjustments
As bitbake supports a number of distributions and platforms, a default build doesn't seem to work the way that the minnowboard developers intended, without a couple of small adjustments to your "/opt/minnowboard/ourbuild/setup-scripts/conf/local.conf". Here's what I used on my system: BB_NUMBER_THREADS = "2" PARALLEL_MAKE = "-j 2"
 * 1) Adjust this number to match the number of 'cores' on your system.
 * 2) Alas, mine is but a lowly Core-2 Duo.

MACHINE ?= "minnow" LICENSE_FLAGS_WHITELIST = "license_emgd-driver-bin commercial" NOISO = "1" Of course, you may want to adjust the BB_NUMBER_THREADS and PARALLEL_MAKE to match the number of cores on your system, for a faster build time.
 * 1) Add this to the bottom:

Setup the minnowboard environment
At this point, it's important that you're using the bash shell (if you weren't already). Run the following to setup the minnowboard build environment: MACHINE=minnow ./oebb.sh config minnow

Important NOTE:  oebb.sh is a little picky about paths. If you've gotten this far, and later choose to move your build directory to another location (or even attempt to delete this location and start a build again from scratch) you'll notice that oebb.sh will operate, and fail, based off the directory in which it was first run. This is due to the configuration persisting in your ~/.oe directory. Be sure to delete this directory if you decide to move your build environment around.

Customize your build
You're almost ready to start building Angstrom, but chances are that you came to this page looking to do some modifications. If so, now's the time to make these changes.


 * Adding USB 802.11 Support To Your Kernel
 * Adding Bluetooth Support To Your Kernel
 * Adding Additional Packages To Your Build

Compile Time
There's a one final adjustment that needs to be made to the build directory in order to successfully complete this build. Run the following command inside your "/opt/minnowboard/ourbuild/setup-scripts" directory: ln -s $(pwd)/sources/bitbake sources/openembedded-core/ Seemingly that link isn't always there, and needs to be.

Pick a build
There's a number of package selection sets to choose from which offer everything from a complete desktop environment (systemd-gnome-image), down to a *spartan* busybox environment (core-image-minimal). For most embedded developers, I'd suggest that the "systemd-image" is where you want to be. This target seems to be the easiest to compile, that offers a working opkg from which you can add the packages you need on top of a 'minimal' install. To build this image, run the following from inside your "/opt/minnowboard/ourbuild/setup-scripts" directory: source sources/openembedded-core/oe-init-build-env cd .. # Seemingly you cd into the 'build' directory after the above command finishes MACHINE=minnow ./oebb.sh bitbake systemd-image Note that you can replace "systemd-image" with whatever target image you'd like.

At this point, be prepared to wait! Compiling all the packages that you need can take half a day (or more). Fortunately, bitbake is really good about telling you where it's at in the process. (Though don't let the task completion/remaining count lead you on, it's not a great way to estimate the time remaining)

Installing your Image
When your compile's done, there's only a few short steps remaining in order for you to boot it up.

Writing to your microSD card
Insert a microsd card into your computer. I have a small usb-> microsd adapter that sets the card up as a block device at /dev/sdc. Probably that's what you're using too. Though you don't have to have a blank card, it's probably worth erasing before writing the image (dd if=/dev/zero of=/dev/sdc). Regardless, the following command should erase the card with the contents of your newly built filesystem. This should be run inside the "/opt/minnowboard/ourbuild/setup-scripts" directory on your computer: sudo ./sources/meta-minnow/scripts/mkefidisk.sh /dev/sdc ./build/tmp-angstrom_v2012_12-eglibc/deploy/images/minnow/systemd-image-minnow.hddimg /dev/mmcblk0

Note for people building the systedmd-gnome-image: I had a weird problem getting this to install, specifically: (Error: Can't have the end before the start! (start sector=39062 length=-39061)) The solution seemed to be to merely hit ctrl-c after the partitions were setup, and re-running the mkefidisk.sh command again.

Booting and EFI setup
That's it for your computer. Now you can insert the microSD card into your minnowboard, and power it on. Attach to the minnowboard console (I used the USB cable and the "screen /dev/ttyUSB0  115200" command, but conceivably you could connect a USB keyboard and monitor as well).

You'll notice that the system boots, albeit does not make it past the EFI boot. This is because we still have to configure the bootable partition with the system firmware. To do so, type: connect -r map -r bcfg boot add 0 fs0:\efi\boot\bootia32.efi "Default Boot" reset Note that these commands came from the following document: http://git.yoctoproject.org/cgit/cgit.cgi/meta-minnow/tree/README

From there your minnowboard will restart, and hopefully boot successfully!