Setting the DEFAULT_PREFERENCE to "1" makes it likely the recipe is used. PREFERRED_VERSION
overrides any DEFAULT_PREFERENCE setting. DEFAULT_PREFERENCE is often used to mark newer
and more experimental recipe versions until they have undergone sufficient testing to be considered stable.
When there are multiple “versions” of a given recipe, BitBake defaults to selecting the most recent version,
unless otherwise specified. If the recipe in question has a DEFAULT_PREFERENCE set lower than the
other recipes (default is 0), then it will not be selected. This allows the person or persons maintaining the
repository of recipe files to specify their preference for the default selected version. In addition, the user can
specify their preferred version.
If the first recipe is named a_1.1.bb, then the PN variable will be set to “a”, and the PV variable will be set
to 1.1.
If we then have a recipe named a_1.2.bb, BitBake will choose 1.2 by default. However, if we define the
following variable in a .conf file that BitBake parses, we can change that.
PREFERRED_VERSION_a = "1.1"
In summary, BitBake has created a list of providers, which is prioritized, for each target.
2.4. Dependencies
Each target BitBake builds consists of multiple tasks such as fetch, unpack, patch, configure, and
compile. For best performance on multi-core systems, BitBake considers each task as an independent
entity with its own set of dependencies.
Dependencies are defined through several variables. You can find information about variables BitBake uses in
the Variables Glossary near the end of this manual. At a basic level, it is sufficient to know that BitBake uses
the DEPENDS and RDEPENDS variables when calculating dependencies.
For more information on how BitBake handles dependencies, see the "Dependencies" section.
2.5. The Task List
Based on the generated list of providers and the dependency information, BitBake can now calculate exactly
what tasks it needs to run and in what order it needs to run them. The "Executing Tasks" section has more
information on how BitBake chooses which task to execute next.
The build now starts with BitBake forking off threads up to the limit set in the BB_NUMBER_THREADS
variable. BitBake continues to fork threads as long as there are tasks ready to run, those tasks have all their
dependencies met, and the thread threshold has not been exceeded.
It is worth noting that you can greatly speed up the build time by properly setting the
BB_NUMBER_THREADS variable.
As each task completes, a timestamp is written to the directory specified by the STAMP variable. On
subsequent runs, BitBake looks in the build directory within tmp/stampsand does not rerun tasks that are
already completed unless a timestamp is found to be invalid. Currently, invalid timestamps are only considered
on a per recipe file basis. So, for example, if the configure stamp has a timestamp greater than the compile
timestamp for a given target, then the compile task would rerun. Running the compile task again, however,
has no effect on other providers that depend on that target.
The exact format of the stamps is partly configurable. In modern versions of BitBake, a hash is appended to
the stamp so that if the configuration changes, the stamp becomes invalid and the task is automatically rerun.
This hash, or signature used, is governed by the signature policy that is configured (see the "Checksums
(Signatures)" section for information). It is also possible to append extra metadata to the stamp using the
"stamp-extra-info" task flag. For example, OpenEmbedded uses this flag to make some tasks machine-specific.
Note
Some tasks are marked as "nostamp" tasks. No timestamp file is created when these
tasks are run. Consequently, "nostamp" tasks are always rerun.
For more information on tasks, see the "Tasks" section.
2.6. Executing Tasks
Tasks can either be a shell task or a Python task. For shell tasks, BitBake writes a shell script to
${T}/run.do_taskname.pid and then executes the script. The generated shell script contains all the
exported variables, and the shell functions with all variables expanded. Output from the shell script goes to the
file ${T}/log.do_taskname.pid. Looking at the expanded shell functions in the run file and the
output in the log files is a useful debugging technique.