User:CesarB/Using a local overlay

From Openmoko

< User:CesarB(Difference between revisions)
Jump to: navigation, search
(New page on how to use a local overlay. Feel free to move to the main namespace if it's good enough.)
 
(Using a local overlay: add explanation for the FAQ on changing the contents of the rootfs; see also http://blog.haerwu.biz/2007/08/23/why-using-of-distromachine-variables-in-localconf-is-wrong/)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
A local overlay is a way to add your own bitbake recipes (or override the ones from openembedded and openmoko) without having them clobbered when you update these trees.
+
A local overlay is a way to add your own bitbake recipes (or override the ones from openembedded) without having them clobbered when you update these trees.
  
 
== Creating a local overlay ==
 
== Creating a local overlay ==
Line 11: Line 11:
 
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code>
 
* Copy <code>site.conf</code> from the openmoko tree to <code>local/conf</code>
  
  cp oe/conf/site.conf local/conf/site.conf
+
  cp build/conf/site.conf local/conf/site.conf
  
* Edit the local.conf you copied to add the new tree as a source for bitbake recipes. You must change the <code>BBFILES</code> and <code>BBFILE_COLLECTIONS</code> variables and add new <code>BBFILE_PATTERN</code> and <code>BBFILE_PRIORITY</code> variables.
+
* Edit the local.conf you copied to add the new tree as a source for bitbake recipes. You must change the <code>BBFILES</code> variable, and add the <code>BBFILE_COLLECTIONS</code>, <code>BBFILE_PATTERN_*</code> and <code>BBFILE_PRIORITY_*</code> variables:
  
  BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"
+
  BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"
  BBFILE_COLLECTIONS = "upstream local overlay"
+
  BBFILE_COLLECTIONS = "upstream local"
  BBFILE_PATTERN_overlay = "^${OMDIR}/local/"
+
  BBFILE_PATTERN_upstream = "^${OMDIR}/openembedded/packages/"
  BBFILE_PRIORITY_overlay = "20"
+
BBFILE_PATTERN_local = "^${OMDIR}/local/packages/"
 +
BBFILE_PRIORITY_upstream = "5"
 +
  BBFILE_PRIORITY_local = "10"
  
The <code>BBFILE_PRIORITY</code> should be greater than all the other <code>BBFILE_PRIORITY</code> variables on the same file.
+
The <code>BBFILE_PRIORITY_local</code> value should be greater than the <code>BBFILE_PRIORITY_upstream</code> value.
 +
 
 +
While you are at it, you could change the <code>SOURCEFORGE_MIRROR</code> variable to a nearby mirror.
  
 
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others (for [[MokoMakefile]], the variable is on the <code>setup-env</code> file).
 
* Change your <code>BBPATH</code> environment variable to add the new tree ''before'' the two others (for [[MokoMakefile]], the variable is on the <code>setup-env</code> file).
  
  export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"
+
  export BBPATH="${OMDIR}/local:${OMDIR}/build:${OMDIR}/openembedded"
  
 
== Using a local overlay ==
 
== Using a local overlay ==
Line 45: Line 49:
  
 
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.
 
You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.
 +
 +
=== Changing what's included on the build ===
 +
 +
This is a special case of [[#Changing packages|Changing packages]] above. The recipe to copy and modify is <code>packages/images/openmoko-image.bb</code>, and you should also symlink <code>packages/images/openmoko-devel-image.bb</code> and <code>packages/images/openmoko-sdk-image.bb</code>. To add a new package, add it to <code>PACKAGE_INSTALL</code>.

Latest revision as of 06:08, 26 August 2007

A local overlay is a way to add your own bitbake recipes (or override the ones from openembedded) without having them clobbered when you update these trees.

Contents

[edit] Creating a local overlay

To create a local overlay:

  • Create a directory for it and its subdirectories
mkdir local local/conf local/classes local/packages
  • Copy site.conf from the openmoko tree to local/conf
cp build/conf/site.conf local/conf/site.conf
  • Edit the local.conf you copied to add the new tree as a source for bitbake recipes. You must change the BBFILES variable, and add the BBFILE_COLLECTIONS, BBFILE_PATTERN_* and BBFILE_PRIORITY_* variables:
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"
BBFILE_COLLECTIONS = "upstream local"
BBFILE_PATTERN_upstream = "^${OMDIR}/openembedded/packages/"
BBFILE_PATTERN_local = "^${OMDIR}/local/packages/"
BBFILE_PRIORITY_upstream = "5"
BBFILE_PRIORITY_local = "10"

The BBFILE_PRIORITY_local value should be greater than the BBFILE_PRIORITY_upstream value.

While you are at it, you could change the SOURCEFORGE_MIRROR variable to a nearby mirror.

  • Change your BBPATH environment variable to add the new tree before the two others (for MokoMakefile, the variable is on the setup-env file).
export BBPATH="${OMDIR}/local:${OMDIR}/build:${OMDIR}/openembedded"

[edit] Using a local overlay

How you use the local overlay depends on which part of the tree you want to affect.

[edit] Changing files in conf/

To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.

[edit] Changing files in classes/

To change a file in classes/, just copy the file to the overlay tree and edit it.

[edit] Changing packages

Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also all the files it includes with require, and the FILESDIR directories (all directories referred to by FILESDIR, usually named either package-version or files). If you forget one of them, the build will give an error (either when parsing the recipe in the case of require, or when trying to build in the case of the FILESDIR directories).

[edit] Adding a new package

You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.

[edit] Changing what's included on the build

This is a special case of Changing packages above. The recipe to copy and modify is packages/images/openmoko-image.bb, and you should also symlink packages/images/openmoko-devel-image.bb and packages/images/openmoko-sdk-image.bb. To add a new package, add it to PACKAGE_INSTALL.

Personal tools

A local overlay is a way to add your own bitbake recipes (or override the ones from openembedded and openmoko) without having them clobbered when you update these trees.

Creating a local overlay

To create a local overlay:

  • Create a directory for it and its subdirectories
mkdir local local/conf local/classes local/packages
  • Copy site.conf from the openmoko tree to local/conf
cp oe/conf/site.conf local/conf/site.conf
  • Edit the local.conf you copied to add the new tree as a source for bitbake recipes. You must change the BBFILES and BBFILE_COLLECTIONS variables and add new BBFILE_PATTERN and BBFILE_PRIORITY variables.
BBFILES := "${OMDIR}/openembedded/packages/*/*.bb ${OMDIR}/oe/packages/*/*.bb ${OMDIR}/local/packages/*/*.bb"
BBFILE_COLLECTIONS = "upstream local overlay"
BBFILE_PATTERN_overlay = "^${OMDIR}/local/"
BBFILE_PRIORITY_overlay = "20"

The BBFILE_PRIORITY should be greater than all the other BBFILE_PRIORITY variables on the same file.

  • Change your BBPATH environment variable to add the new tree before the two others (for MokoMakefile, the variable is on the setup-env file).
export BBPATH="${OMDIR}/build:${OMDIR}/local:${OMDIR}/oe:${OMDIR}/openembedded"

Using a local overlay

How you use the local overlay depends on which part of the tree you want to affect.

Changing files in conf/

To change a file in conf/, just copy the file to the overlay tree (preserving the directory structure) and edit it.

Changing files in classes/

To change a file in classes/, just copy the file to the overlay tree and edit it.

Changing packages

Changing a package's recipe is a bit more complex. You have to copy over (or symlink) not only the .bb file for the package, but also all the files it includes with require, and the FILESDIR directories (all directories referred to by FILESDIR, usually named either package-version or files). If you forget one of them, the build will give an error (either when parsing the recipe in the case of require, or when trying to build in the case of the FILESDIR directories).

Adding a new package

You can add a new package (or a recipe for a new version of a package) to the overlay tree simply by creating it on the overlay tree.