Build Environment Ubuntu 9.10

From Gumstix User Wiki
Jump to: navigation, search

Build Environment Ubuntu 9.10 (Karmic Koala)

Despite the assertion on Build_Environment_Ubuntu_9.04, I was unable to build the basic gumstix image using the svn trunk. It seems the trunk uses some deprecated features of gcc. I would suggest trying to change symbolic links for gcc, g++, etc to point to version 4.1 instead of 4.4. If that works, then all is good. As an alternative, what you can do is install an older version of Ubuntu that is known to work in a chroot. Any program that is run in the chroot cannot "see" the real root file system, so all of the build tools it find will be the ones installed in that chroot directory. This HOWTO describes how to setup the build system with such a method.

Install debootstrap chroot

The first thing we need to do is install the chroot program that we'll be using. You can install these programs with the following two commands

       sudo apt-get install dchroot debootstrap

Create a Chroot Directory for Older Distro

Now we need to create a new directory that will act as the root for the older distribution's file system. Do this with the following command

       sudo mkdir /var/chroot

Edit Configuration

We now edit the configuration file for the chroot program. The file is found in /etc/schroot/schroot.conf, so open it with the following commands

       cd /etc/schroot
       sudo gedit schroot.conf

Since the build tools from the Gutsy distribution are known to work, I opted to install that distribution in my chroot. So add the following lines to the end of schroot.conf, replacing "YourUserName" with your actual user name

       description=Ubuntu 7.10 (Gutsy Gibbon)

Install Gutsy

Now we need to install the older distribution into this chroot. Do this with the following command

       sudo debootstrap --variant=buildd --arch i386 gutsy /var/chroot/

If you would like to use a different distribution, just change "gutsy" to whichever distribution you want. Note you may have to use if the distribution isn't that old.

Login to Gutsy

Now login to the chroot-ed distribution with

       sudo chroot /var/chroot

Install Dependencies

Below is a list of all the dependencies I had to install in order to get bitbake to make the gumstix-basic-image. wget and groff weren't reported by bitbake as required packages but I encountered build errors if they weren't present.

       apt-get install help2man diffstat texi2html cvs subversion bzip2 gawk texinfo wget groff python-dev python-pysqlite2

Download Build Files

Now we can download the build environment from gumstix. First create a directory to download them into. Note that we're still in the chroot-ed environment so when we say "/home/YourUserName" it will actually be installed in "/var/chroot/home/YourUserName". As always, replace "YourUserName" with your actual user name.

       mkdir /home/YourUserName
       cd /home/YourUserName
       mkdir gumstix
       cd gumstix

Then we can download the environment from subversion

       svn co gumstix-oe

Make a "new" user

We can't run bitbake as root so we need to create a user in this chroot. I suggest using the same user name that you use in your "real" system.

       useradd  YourUserName -s /bin/bash
       passwd  YourUserName
       chown -R YourUserName /home/YourUserName

Edit extras/profile

If you installed into a directory other than ~/gumstix/gumstix-oe then you'll need to edit a line in extras/profile to point to the right directory

       gedit gumstix-oe

Setup the Environment

To setup the environment so that the bitbake install script can find everything correctly we need to execute the profile script

       . /home/YourUserName/gumstix/gumstix-oe/extras/profile


       source /home/YourUserName/gumstix/gumstix-oe/extras/profile

Install the Included Bitbake

Now we can install bitbake with the setup script.

       cd /home/YourUserName/gumstix/gumstix-oe/bitbake
       ./ install

Create Source Code Cache

We need to create the "global" source code cache for the chroot system. Start by creating a group called "oe"

       groupadd oe

Then add yourself to it

       usermod -a -G oe YourUserName

Then create the directory for caching source code

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


We can't run bitbake as root so let's login

       su - YourUserName

Setup Build Environment

We need to setup the build environment again by executing the profile script.

       cd gumstix/gumstix-oe
       . extras/profile

Edit auto.conf

If building for something older than verdex, we need to edit the auto.conf file.

       gedit conf/auto.conf

Build Basic Image

And now we're ready to build the basic image.

       bitbake gumstix-basic-image