Variables

One of the most confusing part of bitbake recipes for new users is the large amount of variables that appear to be available to change and/or control the behaviour of some aspect of the recipe. Some variables, such as those derived from the file name are reasonably obvious, others are not at all obvious.

There are several places where these variables are derived from and/or used:

  1. A large number of variables are defined in the bitbake configuration file conf/bitbake.conf - it's often a good idea to look through that file when trying to determine what a particular variable means.

  2. Machine and distribution configuration files in conf/machine and conf/distro will sometimes define some variables specific to the machine and/or distribution. You should look at the appropriate files for your targets to see if anything is being defined that effects the recipes you are building.

  3. Bitbake itself will define some variables. The FILE variables that defines the name of the bitbake recipe being processed is set by bitbake itself for example. Refer to the bitbake manual for more information on the variables that bitbake sets.

  4. The classes, that are used via the inherit keyword, define and/or use the majority of the remaining variables. A class is a like a library that contain parts of a bitbake recipe that are used by multiple recipes. To make them usable in more situations they often include a large number of variables to control how the class operates.

Another important aspect is that there are three different types of things that binaries and libraries are used for and they often have different variables for each. These include:

target

Refers to things built for the target are expected to be run on the target device itself.

native

Refers to things built to run natively on the build host itself.

cross

Refers to things built to run natively on the build host itself, but produce output which is suitable for the target device. Cross versions of packages usually only exist for things like compilers and assemblers - i.e. things which are used to produce binary applications themselves.