Customizing Bitbake Recipes

To customize a bitbake recipe, such as lighttpd, you can create a bbappend file in ${OETREE}/user-layer. Bbappend files may be used to make changes/additions to an existing recipe without having to modify the original or having to duplicate it. Look at the bbappend files in the multitech layer for examples. Bbappend files located in user-layer will be parsed after the openembedded and multitech layers.

The following example shows how to use a bbappend file to provide a custom config file for lighttpd that overrides the OpenEmbedded and CoreCDP versions.

You can use the CoreCDP bbappend and config for lighttpd as a starting point.

cd ${OETREE}

# make a spot for your bbappend and custom files
mkdir user-layer/recipes/lighttpd
mkdir user-layer/recipes/lighttpd/lighttpd-1.4.28

# copy over the multitech lighttpd bbappend
cp multitech/recipes/lighttpd/lighttpd_1.4.28.bbappend user-layer/recipes/lighttpd/

# copy over the config
cp multitech/recipes/lighttpd/lighttpd-1.4.28/corecdp/lighttpd.conf \
   user-layer/recipes/lighttpd/lighttpd-1.4.28/

(edit user-layer/recipes/lighttpd/lighttpd-1.4.28/lighttpd.conf)

# rebuild lighttpd
bitbake lighttpd -c clean
bitbake lighttpd

Contents of lighttpd_1.4.28.bbappend:

FILESEXTRA := "${THISDIR}"
FILESPATHBASE =. "${FILESEXTRA}:"

FILESPATHBASE is a ‘:’ separated list of paths from which to search for non-source-code files needed by a recipe, such as config files, patches, etc. The above bbappend adds the directory that the bbappend file is in to FILESPATHBASE.

The THISDIR variable is provided by the CoreCDP layer in multitech/classes/thisdir.bbclass. Setting FILESEXTRA using the ‘:=’ operator is required because the expression must be evaluated and expanded at the time of parsing the file or the wrong path will end up in FILESEXTRA and hence FILESPATHBASE.

If you add a new bbappend file to your layer and it seems as though it isn’t being parsed, try forcing a Bitbake cache rebuild by updating the time stamp on the config for your layer. Run touch user-layer/conf/layer.conf and then build again.

Explanation of the Bitbake syntax in the above example can be found in the Bitbake User Manual

For more information, please see the OpenEmbedded User Manual
The section regarding how bitbake searches for local files is here