BeagleBoardOpenEmbeddedDevelopment

From eLinux.org
Revision as of 15:47, 6 January 2009 by Atin (Talk | contribs) (Added some more information about SRC_URI and the S variable)

Jump to: navigation, search

This guide briefly describes one way to modify packages contained within OpenEmbedded (OE) for the BeagleBoard.

Prerequisites

You should set up the OpenEmbedded environment for the BeagleBoard by following the BeagleBoardAndOpenEmbeddedGit guide first before using this guide.

Local Overlay Setup

Many of us have installed OpenEmbedded to allow us to make BeagleBoard specific modifications to the official packages that are already in OpenEmbedded. One way to accomplish this is to use a local overlay tree that contains a copy of the openembedded.dev tree that was created in the BeagleBoardAndOpenEmbeddedGit guide. The local overlay packages will override the packages contained in the openembedded.dev tree, with the recipes in the local copy of the package being preferred over the recipes in the openembedded.dev tree. You could even have a full copy of the openembedded.dev/packages tree under the local directory, and each package will override the one in the openembedded.dev/package tree.

This guide assumes that the openembedded.dev tree was created under $HOME/oe/openembedded, or /home/you/oe/openembedded and the local overlay tree you will be using will be under /home/you/oe/local. It also assumes that the package you are modifying is the u-boot package. Change the path names and the name of the package as appropriate for your installation and package.

Edit the profile.sh file that was created in the BeagleBoardAndOpenEmbeddedGit guide under the /home/you/oe/beagleboard/beagleboard directory to look like:

export OE_HOME="${HOME}/oe"
export OE_TOP="${OE_HOME}/openembedded"

export MY_OE_CONF="beagleboard"
export USERBRANCH="${OE_HOME}/local" 

export BBPATH="${OE_HOME}/beagleboard/:${OE_HOME}/beagleboard/${MY_OE_CONF}:${OE_HOME}/openembedded"
export PATH="${OE_HOME}/opt/bitbake/bin:$PATH"
if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    export PS1="\[\033[01;32m\]OE:$MY_OE_CONF\[\033[00m\] ${PS1}"
  fi
fi

Assuming the angstrom-2008.1 distribution, edit the /home/you/oe/beagleboard/beagleboard/conf/local.conf file (you may need to create it) to look like:

DISTRO = "angstrom-2008.1"
ENABLE_BINARY_LOCALE_GENERATION = "0"

Edit the /home/you/oe/beagleboard/beagleboard/conf/auto.conf file (you may need to create it) to look like:

MACHINE = "beagleboard"

Edit the /home/you/oe/beagleboard/beagleboard/conf/site.conf file (you may need to create it) to look like:

# collection setup
BBFILES="/home/you/oe/openembedded/packages/*/*.bb /home/you/oe/local/packages/*/*.bb"
BBFILE_COLLECTIONS="oe user"
BBFILE_PATTERN_oe="^${OE_TOP}/packages"
BBFILE_PATTERN_user="^${USERBRANCH}/packages"

BBFILE_PRIORITY_oe="5"
BBFILE_PRIORITY_user="15"

For some reason, using the symbolic names ${OE_TOP} and ${USERBRANCH} did not work in BBFILES so I just used the full paths in my site.conf file. The priority for the _user has to be higher than the priority for _oe to make bitbake prefer the user packages over the openembedded packages.

The final directory structure would look something like:

oe
|-- beagleboard
|   |-- beagleboard
|       |-- profile.sh
|       |-- conf
|           |-- auto.conf
|           |-- local.conf
|           |-- site.conf
|-- local
|   |-- packages
|   |   `-- u-boot
|   |       |-- u-boot_git.bb (local copy of the recipe)
.   |       .-- ...
.   .
.   .
|   |-- sources
|        `-- u-boot
|            |-- ... local copy of the sources for u-boot
.
.
.
| -- openembedded
|    `-- packages
|        `-- u-boot
|            | -- u-boot_git.bb (official recipe)
.            . -- ...
.            .
.            .

In my case, the files under /home/you/oe/local/packages/u-boot are the same as those in /home/you/oe/openemedded/packages/u-boot, with the u-boot-git.bb recipe changed to use the local sources or some other git repository than the one specified in the official upstream u-boot_git.bb that is present in the openembedded/packages/u-boot directory. If you want to specify another public repository in the .bb file, you can change the SRC_URI in the local package's version to point to it. If you just want to use a local copy of the sources, without using a public repository, you can change the S variable in the .bb file from:

S = "${WORKDIR}/git"

or whatever S is set to in the recipe, to point to your local directory that contains your copy of the sources like:

S = "/home/you/oe/local/sources/u-boot"

Overriding S will still download the repository specified in SRC_URI, but you can change that to point to a local file://dummy.txt file you create in the files folder of the local copy of your package files. Then, a build will use the sources specified in S without going through the step of downloading the files specified in SRC_URI in the original recipe. Now, you will be sourcing the profile.sh file to set up your build environment before you start your build:

source /home/oe/beagleboard/beaglboard/profile.sh

Now when you call:

bitbake u-boot 

it will use the /home/you/oe/local/packages/u-boot/u-boot_git.bb recipe instead of the one in the openembedded tree (u-boot_git.bb is the recipe for the u-boot package).

If you modified S = to point to your own local copy of the sources, and modified SRC_URI such that it points to a dummy file in the files directory in your local copy of the package, you could call:

bitbake -c compile -f u-boot

to force a compile, or you could just:

touch dummy.txt
bitbake u-boot

to build from your local copy of the sources pointed to by S.