The OpenEmbedded project is a combination of toolset and packages to be able to cross-compile Linux distributions for platforms other than the normal PC architectures. I’m using a Gumstix Overo Earth COM which is built with the Angstrom uCLinux distribution. Once you have the COM properly powered and running, you deal with the Angstrom distribution just like any other distribution. You log in to the console and start in your home user account. You have the standard Linux file directories and a package manager so to start customizing your install you go through the same motions as any other Linux distro. I didn’t get the Gumstix attachment to allow display connections so I’m running with just the console-only build of Angstrom, but you can build the Angstrom distro to run a GUI so it looks just like any other Linux distro on the PC.
Ok, so enough of the overview of the final product. I’m more interested in putting notes down on the workflow needed to add my own applications to the distro build. I’ll be using this hello-world example from the Gumstix wiki as my example program. As my starting point I have already built an up-to-date Angstrom console-only image (omap3-console-image) and have loaded that onto my Earth COM. (I followed these instructions.) For OpenEmbedded I followed the Gumstix notes on downloading and setting up the OpenEmbedded toolchain. I’ll point out here that the Gumstix notes seem a little out-of-date as I have found the Overo recipes directly inside the OpenEmbedded recipes folder for the TI OMAP arch recipes. The notes say the Gumstix-specific recipes are in their own directories outside the OpenEmbedded directory. Looks like they changed their minds sometime after those instructions were posted.
So the first step toward building my hello-world example is to cd into my top-level directory for my Overo build (I called it overo-oe) and get the sources:
git clone git://github.com/ashcharles/oe-usercollection.git user.collection
I now have a new directory called user.collection in my top-level directory. Inside the new user.collection directory I have these subdirectories:
- extras – Extra stuff… (?)
- recipes – BitBake recipes for each hello-world example (there are six of them).
Since I now have a user directory I need to make sure that the BitBake tool can find it. From the Gumstix/OpenEmbedded setup steps earlier, I know that the environment variable USERBRANCH denotes where the user files are. Just like how the variable OEBRANCH denotes where the OpenEmbedded core files are. I think USERBRANCH already came pre-set but I’ll just make sure by checking my environment variables:
spade78@ubuntu:~/Desktop/overo-oe/user.collection$ env | grep "\<USERBRANCH"
And I get the result:
Next I need to find the name of the recipe I want to build. According to the OpenEmbedded user manual, BitBake recipe files follow the convention:
Inside the recipes folder of the hello-world example we cloned, there’s a myhelloworld folder and inside that is this file:
So on the console, I will invoke BitBake to build the myhelloworld recipe:
spade78@ubuntu:~/Desktop/overo-oe/user.collection$ bitbake myhelloworld
And after some wait the recipe output appears in OVEROTOP/tmp/deploy/glibc/ipk directory:
spade78@ubuntu:~/Desktop/overo-oe/tmp/deploy/glibc/ipk$ find | grep myhelloworld ./armv7a/myhelloworld-doc_0.0.1-r0.6_armv7a.ipk ./armv7a/myhelloworld-dev_0.0.1-r0.6_armv7a.ipk ./armv7a/myhelloworld_0.0.1-r0.6_armv7a.ipk ./armv7a/myhelloworld-dbg_0.0.1-r0.6_armv7a.ipk
But wait, wasn’t my platform target an Overo (uses an ARM Cortex A8 by the way) which is also a sub directory in this folder? Yeah, not sure about that quite yet. There’s probably a config step I must’ve missed. Had the armv7a been my target, I then would’ve installed the package by copying the package files to my COM and invoking the package manager on the COM to install it. But I haven’t tried that part yet as I want to create a more sophisticated program to build and run on my COM.
That’s enough for now. I now have a clear path between creating source files, where to put them (user.collections/<MyProjectName>), making sure BitBake can find them (via the USERBRANCH environment variable), and where the output is put (the deploy directory) when the build is complete.