4.04.04 How-To's

4.04.04 How-To's

Capn_Fish's picture
Posted by Capn_Fish on Thu, 01/10/2008 - 07:04

Please disregard any HTML tags present (< HTML_TAG >, is what they look similar to) in this tutorial. They are NOT meant to be there and apparently can't be removed. They are NOT part of the commands and should NOT be typed!

Yes, you DO need a Linux box (not necessarily x86, but I assume the fastest box you have is x86, and that's what you want to use, or at least one with decent specs). I know Ubuntu works for this. Debian Sid had some issues, but sort of worked.

Note that I assume you're following these directions pretty much to the letter (ie, step 2 assumes you are in /OE)

0. Install the necessary stuff:

apt-get install python m4 patch build-essential make python-psyco ccache perl diffstat git bison

You may want to manually make sure you get the right stuff installed:

http://wiki.openembedded.net/index.php/Required_Software

1a. Make the directory /OE (you can use a different directory, but it's something of a pain) and allow normal users to write to it (you could chown it, for example)

sudo mkdir /OE<br />
sudo chown yourusername:users /OE

1b. Download Bitbake:

cd /OE<br />
wget http://download.berlios.de/bitbake/bitbake-1.8.10.tar.gz

2. Install Bitbake:

tar -xf bitbake-1.8.10.tar.gz

3. Get the OE data and update it (you may want to make a script for the last two lines, calling it "update.sh" or something):

git clone git://git.openembedded.net/openembedded.git org.openembedded.stable<br />
cd org.openembedded.stable<br />
git checkout -b org.openembedded.stable origin/org.openembedded.stable<br />
cd /OE/org.openembedded.stable<br />
git pull

4. Set up the environment file:

cd /OE<br />
wget http://www.angstrom-distribution.org/files/source-me.txt

5. Set up the build config (if /OE/build/conf/ doesn't exist, create it):

mkdir -p /OE/build/conf/<br />
yourfavoriteeditor /OE/build/conf/local.conf

Contents:

# Where to store sources<br />
DL_DIR = "/OE/downloads"</p>
<p># Which files do we want to parse<br />
 BBFILES := "/OE/org.openembedded.stable/packages/*/*.bb"<br />
BBMASK = ""</p>
<p># ccache always overfill $HOME....<br />
CCACHE=""</p>
<p># What kind of images do we want?<br />
IMAGE_FSTYPES = "jffs2 tar.gz "</p>
<p># Set TMPDIR instead of defaulting it to $pwd/tmp<br />
TMPDIR = "/OE/${DISTRO}-stable/"</p>
<p># For multicore CPU boxes:<br />
#PARALLEL_MAKE="-j4"<br />
#BB_NUMBER_THREADS = "2"<br />
#for single-core boxes:<br />
PARALLEL_MAKE="-j2"<br />
BB_NUMBER_THREADS = "1"</p>
<p># Set the Distro<br />
DISTRO = "angstrom-2007.1"</p>
<p># 'uclibc' or 'glibc' or 'eglibc'<br />
ANGSTROM_MODE = "glibc"</p>
<p>MACHINE = "akita"

6a. Start building your kernel module:

source /OE/source-me.txt<br />
cd /OE/org.openembedded.stable<br />
./update.sh<br />
bitbake whatever

6b. Wait a good chunk of time (several hours; don't try to do anything useful on this box while it's working)
---------------------------OLD-------------------------------------
I don't know if this should be kept or not....

This is almost a direct copy & paste from the Angstrom website, yet the readability and clarity updates are in progress.

Step 1

Obtain BitBake and OpenEmbedded These (compressed for now) files can go anywhere for now.

Step 2

Install BitBake and OE:

mkdir /OE && cd /OE<br />
tar zxf /path/to/bitbake-1.8.8.tar.gz<br />
bunzip2 /path/to/OE.mtn.bz2<br />
mtn --db=/path/to/OE.mtn pull monotone.openembedded.org org.openembedded.{angstrom-2007.12-stable,dev}<br />
mtn --db=/path/to/OE.mtn checkout --branch=org.openembedded.angstrom-2007.12-stable<br />
cd /path/to/org.openembedded.angstrom-2007.12-stable ; mtn pull monotone.openembedded.org org.openembedded.angstrom-2007.12-stable ; mtn update

Make sure /OE and its subdirectories are read/writable by standard users, as BitBake won't work as root.

You should probably also install psyco (called "python-psyco" in Debian, IIRC, Homepage)

Make a file in /OE to setup the environment variables (ex, /OE/sources-me.txt):

BBPATH=/OE/:/OE/build/:/OE/org.openembedded.angstrom-2007.12-stable/<br />
PKGDIR=/OE/build/<br />
DL_DIR=/OE/downloads<br />
echo Setting up dev env for Ångström</p>
<p>if [ -z ${ORG_PATH} ]<br />
then<br />
 ORG_PATH=${PATH}<br />
  export ORG_PATH<br />
 fi</p>
<p> if [ -z ${ORG_LD_LIBRARY_PATH} ]<br />
  then<br />
   ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}<br />
    export ORG_LD_LIBRARY_PATH<br />
        fi<br />
        PATH=/OE/bitbake-1.8.8/bin:${ORG_PATH}<br />
        cd $PKGDIR<br />
        LD_LIBRARY_PATH=<br />
        export PATH LD_LIBRARY_PATH BBPATH<br />
        export LANG=C<br />
        echo "Altered environment for OE Development"

Step 3

Add the following to your local.conf. It doesn't currently exist. Make it in /OE/build/conf.

# Where to store sources<br />
DL_DIR = "/OE/downloads"</p>
<p># Which files do we want to parse:<br />
BBFILES := "/OE/org.openembedded.angstrom-2007.12-stable/packages/*/*.bb"<br />
BBMASK = ""</p>
<p># ccache always overfill $HOME....<br />
CCACHE=""</p>
<p># What kind of images do we want?<br />
IMAGE_FSTYPES = "jffs2 tar.gz "</p>
<p># Set TMPDIR instead of defaulting it to $pwd/tmp<br />
TMPDIR = "/OE/build/tmp/${DISTRO}"</p>
<p># Uncomment the following two lines if you have a multi-core CPU<br />
#PARALLEL_MAKE="-j4"<br />
#BB_NUMBER_THREADS = "2"</p>
<p># Set the Distro<br />
DISTRO = "angstrom-2007.1"</p>
<p># 'uclibc' or 'glibc' or 'eglibc'<br />
#ANGSTROM_MODE = "glibc"</p>
<p>MACHINE =  "YOURMACHINE" 

Substitute "YOURMACHINE" with the machine you want to build for, e.g.:

* c7x0 - For pxa25x zaurus clamshells (SL-C700, SL-C750, SL-C760, SL-C860, SL-7500)
* spitz - For pxa27x zaurus clamshells with a microdrive (SL-C3000, SL-C3100, SL-C3200)
* akita - For pxa27x zaurus clamshells without a microdrive (SL-C1000)
* tosa - For the SL-C6000

Note that the only difference between Spitz and Akita is that Akita will install to NAND and Spitz will install to the microdrive. You can use an Akita image on C3100 and C3200 machines. Spitz images cannot access the NAND AFAICT.

Step 4

Start building:

source source-me.txt ; cd /path/to/org.openembedded.angstrom-2007.12-stable ; mtn pull ; mtn update ; bitbake IMAGE_OR_PACKAGE_NAME

Where IMAGE_OR_PACKAGE_NAME is the name of the install image or package you want to build. Building the first package/image will take a good while, as EVERYTHING needs to be built (cross tools, all of the packages in the image, deps, etc.)

Step 5

Building for a different machine or C library is just a matter of changing the MACHINE= or ANGSTROM_MODE statement in local.conf to a new value. There is ABSOLUTELY no need for using different directories for that; Angstrom takes care of all the details, it was specifically designed for this.

Other notes
*These files take up a lot of space. If you intend to build more than a couple of packages/images, have some 10-20GB of space available.