This tutorial explains how to enable the I2C 2 bus on the BeagleBoard

Requirements

First step is installing open embedded and bitbake.

Create working directory

1. Choose a working directory, for example:
<pre>$ export OEBASE=/oe</pre>
  • '''You must choose a location with no symlinks above it'''
2. Create the directory structure:
<pre>$ mkdir -p $OEBASE/build/conf</pre>

Obtaining Bitbake

  • Bitbake can be run without being installed, so all you have to do is:
<pre>$ cd $OEBASE
$ wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz
$ tar -xvzf bitbake-1.8.18.tar.gz
$ mv bitbake-1.8.18 bitbake
</pre>
  • The $OEBASE directory will now contain a bitbake directory.

Obtaining Open Embedded

1. Install Git if not yet installed:
<pre>$ sudo apt-get install git-core</pre>
2. Download Open Embedded using Git:
<pre>$ cd $OEBASE
$ git clone git://git.openembedded.org/openembedded</pre>

Configuring Open Embedded

Environment Variables

This process is needed each time you open a new shell as the range of these environment variables is limited to the shell you're currently working in.
OR you can edit /etc/profile or ~/.profile to automate this process.
<pre>
$ export OEBASE=/oe
</pre>
  • This has actually been done in the first step of this tutorial
<pre>
$ export PATH=$OEBASE/bitbake/bin:$PATH
$ export BBPATH=$OEBASE/build:$OEBASE/openembedded
$ export BB_ENV_EXTRAWHITE="OEBASE"
</pre>

Local Configuration

Now a configuration file has to be created containing settings about the desired build for the bitbake process.
<pre>vi $OEBASE/build/conf/local.conf</pre>
A sample local.conf file can be found in $OEBASE/openembedded/conf/local.conf.sample. This file contains more settings than needed; we only need:
<pre>
BBFILES = "/oe/openembedded/recipes/*/*.bb"
DISTRO = "angstrom-2008.1"
MACHINE = "beagleboard"
</pre>

Building Software

Building U-boot

First step is building a new u-boot.bin file. This will be done using bitbake.
When running bitbake in Ubuntu, it will complain: "Using dash as /bin/sh causes various subtle build problems, please use bash instead".
Therefore we have to change the /bin/sh to bash:
<pre>$ sudo dpkg-reconfigure dash
Choose <No> when prompted</pre>

Now run:
<pre>$ cd $OEBASE
$ bitbake u-boot</pre>
  • If bitbake complains about missing packages, install them and run the above command again.
This command downloads the u-boot source and builds it. When completed we have to change the pin mux configuration.
Open /oe/tmp/work/beagleboard-angstrom-linux-gnueabi/{gitubootdir}/git/board/ti/beagle/beagle.h and look for these lines:
<pre>MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M4)) /*GPIO_168*/\
MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M4)) /*GPIO_183*/\ </pre>
Replace them by:
<pre>MUX_VAL(CP(I2C2_SCL), (IEN | PTU | DIS | M0)) /*I2C2_SCL*/\
MUX_VAL(CP(I2C2_SDA), (IEN | PTU | DIS | M0)) /*I2C2_SDA3*/\ </pre>

So now rebuild u-boot and deploy it to get the image.
<pre>
$ cd $OEBASE
$ bitbake -f -c compile u-boot
$ bitbake -f -c deploy u-boot
</pre>
Your new u-boot file can be found at $OEBASE/tmp/deploy/glibc/images/beagleboard/u-boot-beagleboard.bin

Building Kernel

Now we modify the kernel. Developers have disabled the I2C 2 bus because it threw a lot of errors when no hardware was connected to the bus.

Run:
<pre>
$ cd $OEBASE
$ bitbake virtual/kernel
</pre>

...

References