Building Gumstix-OE on Fedora 11

This article covers building the Gumstix-OE build environment on Fedora 11. Gumstix-OE is a branch of the OpenEmbedded OS, customized for the Gumstix devices. The Gumstix-OE source code lags behind the OpenEmbedded environment quite a bit, so some additional effort is needed to build Gumstix-OE on Fedora 11. Most of these fixes have been applied to the OpenEmbedded git repository.

Prerequisites
Note that the following is straight from the suggestion on the Open Embedded Wiki. The package python-psyco is not required for the build to complete successfully.

su -c "yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip\ ccache perl texinfo texi2html diffstat openjade docbook-style-dsssl docbook-style-xsl\ docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static gcc binutils pcre\ pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools gcc gcc-c++ help2man\ perl-ExtUtils-MakeMaker python-psyco"

Source checkout
The only package that is absolutely required to get started is the subversion source code control package. Check to see if your machine has a working copy of subversion:

$ svn --version

If you see version information printed, you are good to go; if you see a "command not found" message, you must install the subversion package for your distribution.

Unless you are an OpenEmbedded expert, it is highly recommended that you follow the directory conventions outlined in these instructions.

You are now ready to check out the source files for the gumstix build system:

$ mkdir ~/gumstix $ cd ~/gumstix $ svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe

After this command completes you will have a copy of the gumstix build system source code in your home directory in gumstix/gumstix-oe.

Environment setup
Gumstix OE requires some environment setup in order to function properly. There are a couple of ways to handle this requirement.

It is most convenient (and highly recommended) to set this up via your bash profile:

$ cat gumstix-oe/extras/profile >> ~/.bashrc

With most distributions, adding this environment setup to ~/.bashrc will work for both GUI shells and login shells. If your distribution does not source .bashrc for login shells, you may need to use ~/.bash_profile instead of ~/.bashrc (or modify ~/.bash_profile so that it does source ~/.bashrc).

Source code caching
As part of the build process Gumstix OE downloads source code tarballs for the linux kernel and other software packages. This next step sets up a global system cache for these tarballs so that they only need to be downloaded once. Setting up a global cache may seem like a lot of trouble for a single user system, but it is often quite useful to set up an autobuilder that runs as a cron job under a separate user account. Occasionally you may even want to do experimental work under a seperate user account. Setting this up now will save you disk space and download time later.

On most systems you will need to have root privileges for this step. The process below uses sudo, if your current user is not in the sudoers file you will get an error message. If this happens, use su and enter the root password before issuing the commands below (minus the leading sudo of course).

First we create a new group called oe and add your login account to the oe group. In the second command be sure to substitute your login user name where your_username is indicated.

$ sudo groupadd oe $ sudo usermod -a -G oe your_username

Next we create the directory for the source code cache, set the group owner to the newly created oe group, and finally set permissions on the directory:

$ sudo mkdir /usr/share/sources $ sudo chgrp oe /usr/share/sources $ sudo chmod 0775 /usr/share/sources $ sudo chmod ug+s /usr/share/sources

Now log out/log back in so that the environment changes you enabled above will take effect.

Your first build
The build sytem is set up to build for verdex by default. If you want to build for basix or connex you will need to edit ~/gumstix/gumstix-oe/build/conf/auto.conf. Comment out the line that selects verdex and uncomment the line that selects connex.

To build a basic root file system image that includes Linux 2.6.21, boa, cron, and ntp:

$ bitbake gumstix-basic-image

Note: At the time of writing this article, the gumstix subversion project (318) has several bugs that will cause the build to fail at various points during the build process. It is encouraged to check out the lastest copy of the subversion to see if the patches have been merged. In the case that they have not continue to the patches section below for solutions to the bugs.

Patches
Once you get it running, it should go for a while until something breaks.

unifdef
It first complains about a redefinition of getline in a file called unifdef.c.

Cause
As per this link, the new libc contains a lot of new functions that weren't there originally, including getline. So since gumstix doesn't do a sanity check, we'll just rename the function call so it doesn't conflict.

"It is not related to gcc in any way, just the default when you don't select any feature test macros (see info libc 'Feature Test Macros' ) changed in F11 from F10, now you get by default _POSIX_C_SOURCE 200809L stuff, before you got _POSIX_C_SOURCE 200112L. POSIX 2008 newly contains many GNU functions, like getline, fexecve, etc.

So, either fix up the packages to use different names of local functions (preferrable), or use some Feature Test Macro to pick whatever the program expects to be compiled with."

Solution
There are two instances of this file that will need to be changed:

 ~/gumstix/gumstix-oe/tmp/work/x86_64-linux/unifdef-native-2.6.18+git-r0/unifdef.c 

 ~/gumstix/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/linux-libc-headers-2.6.20-r7/linux-2.6.20/scripts/unifdef.c 

The fix for this is relatively easy to perform, simply open each file and replace all instances of "getline" with "parseline". This can easily be done in gedit using CTRL-H. Save the changes to both of these files and restart the bitbake. Wait for the next error.

This solution is consistent with the patch to the Open Embedded project seen at http://patchwork.openembedded.org/patch/427/.

gmp
When it gets to the package gmp, it will fail again.

Cause
It fails with a lot of undefined reference issues due to various changes. Needs updating. Note this is not an issue if you grab a fresh copy of Open Embedded.

Solution
Update to a newer version of gmp and dbus. This site has these directions at the bottom:

Newer bitbake recipes for gmp and dbus can be found at http://www.klc.net.nz/images/. Place them in:

~/gumstix/gumstix-oe/org.openembedded.snapshot/packages

Also, add the following to com.gumstix.collection/conf/machine/include/gumstix.inc PREFERRED_VERSION_gmp = "4.2.2" PREFERRED_VERSION_gmp-native = "4.2.2" PREFERRED_VERSION_dbus = "1.2.1" PREFERRED_VERSION_dbus-native = "1.2.1"

kernel
The kernel will fail compiling.

Cause
Error says that PATH_MAX isn't found. This is because limits.h is no longer automatically included in the newer versions of gcc.

Solution
In ~/gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/scripts/mod/sumversion.c, you need to add
 * 1) include 