summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2020-11-13 00:21:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-04 10:55:00 +0000
commit22384b2fe567406b3c318b2edd0d23dee0d72023 (patch)
treeb19414c699324722f371d4138c305e925a43da95 /bitbake/doc/bitbake-user-manual
parent16d477fa5d2bec49ccd83ede8249431d30e0c80c (diff)
downloadpoky-22384b2fe567406b3c318b2edd0d23dee0d72023.tar.gz
bitbake: sphinx: import sphinx docs
The Bitbake manual was migrated to Sphinx in Yocto Project 3.2. Since the docs between 3.2 and 3.1 are "similar", and since 3.1 is an LTS release, we agreed to backport the documentation onto 3.1. If we look at all docs changes in 3.1 and 3.2, we have the following: === Changes in 3.1 git log --oneline b94dec477a8d48ebceec91952ba290798c56c1f5..origin/1.46 -- doc/ ==== 324aaa7f bitbake-user-manual-metadata.xml: fix a minor error f92e19a3 doc: More explanation to tasks that recursively depend on themselves e4695176 doc: Clarify how task dependencies relate to RDEPENDS 25c5c79b user manual: properly tag content as <replaceable> be367887 docs: delete reference to obsolete recipe-depends.dot === Changes in 3.2/master git log --oneline b94dec477a8d48ebceec91952ba290798c56c1f5..origin/master -- doc/ ==== a7c47f1e sphinx: rename Makefile.sphinx 427721d8 sphinx: remove DocBook files d52190ea docs: static: theme_overrides.css: fix responsive design on <640px screens 9ae5cce7 docs: sphinx: report errors when dependencies are not met ec4c481a docs: update README file after migrationg to Sphinx c87cc35a docs: sphinx: replace special quotes with double quotes ebdeef2c docs: ref-variables: add links to terms in glossary 29081375 bitbake-user-manual: fix bad links a0f37789 sphinx: theme_override: Use bold for emphasis text cbc5ca48 sphinx: theme_override: properly set font for verbatim text 08b1ae23 sphinx: remove leading '/' 99ba6fe9 sphinx: update style for important, caution and warnings d99760cc sphinx: last manual round of fixes/improvements 4f94633a sphinx: bitbake-user-manual: insert additional blank line after title 63adcaa5 sphinx: add releases page 3e940d93 sphinx: conf: enable extlinks extension 9921c652 sphinx: index: move the boilerplate at the end of the page 4e461224 sphinx: add SPDX headers cb19159c sphinx: Enhance the sphinx experience/nagivation with: 10a54678 sphinx: tweak html output a bit 219b2348 sphinx: Makefile.sphinx: add clean and publish targets 35fdc185 sphinx: fixes all remaining warnings e11d2dd1 sphinx: fix links inside notes 57300955 sphinx: fixup for links fa304c01 sphinx: override theme CSS 29af1cd2 sphinx: switch to readthedocs theme e8359fd8 sphinx: bitbake-user-manual: use builtin sphinx glossary 6bf6c8d6 sphinx: initial sphinx support 84ccba0f sphinx: add initial build infrastructure 44b57216 bitbake-user-manual: update perforce fetcher docs 9186ca47 bitbake-user-manual: Add BBFILES_DYNAMIC 7689fa78 bitbake-user-manual: Remove TERM from BB_HASHBASE_WHITELIST example 06b5cf0a bitbake-user-manual-metadata.xml: fix a minor error c92a266c doc: More explanation to tasks that recursively depend on themselves caf42243 doc: Clarify how task dependencies relate to RDEPENDS 647c13d4 user manual: properly tag content as <replaceable> 2effbb6e docs: delete reference to obsolete recipe-depends.dot We can conclude the following commits exist in 3.2 and not in 3.1 (if we filter out sphinx changes) 44b57216 bitbake-user-manual: update perforce fetcher docs 9186ca47 bitbake-user-manual: Add BBFILES_DYNAMIC 7689fa78 bitbake-user-manual: Remove TERM from BB_HASHBASE_WHITELIST example Out of these 3 changes, the following patches are for 3.2 only: 44b57216 bitbake-user-manual: update perforce fetcher docs 7689fa78 bitbake-user-manual: Remove TERM from BB_HASHBASE_WHITELIST example To backport the Sphinx docs, we then need to cherry-pick all docs patches from 3.2/1.48 and 'undo' the two patches above. This first patch is the first step that imports all Sphinx files, and remove Docbook files. It was done with the following command: git cherry-pick -n \ $(git log --reverse --oneline \ b94dec477a8d48ebceec91952ba290798c56c1f5..origin/master -- doc/ \ | cut -f1 -d' ') (Bitbake rev: cd68f14031eb45006b44d10b348e35c69ac21ad0) Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/doc/bitbake-user-manual')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-customization.xsl29
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst733
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml1029
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst652
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml868
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst415
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml513
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst651
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.xml891
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst1969
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml2862
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst1372
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml2537
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-style.css984
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual.xml88
-rw-r--r--bitbake/doc/bitbake-user-manual/html.css281
16 files changed, 5792 insertions, 10082 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-customization.xsl b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-customization.xsl
deleted file mode 100644
index 5985ea783f..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-customization.xsl
+++ /dev/null
@@ -1,29 +0,0 @@
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
3
4 <xsl:import href="http://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-xsl-1.76.1/xhtml/docbook.xsl" />
5
6<!--
7
8 <xsl:import href="../template/1.76.1/docbook-xsl-1.76.1/xhtml/docbook.xsl" />
9
10 <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.76.1/xhtml/docbook.xsl" />
11
12-->
13
14 <xsl:include href="../template/permalinks.xsl"/>
15 <xsl:include href="../template/section.title.xsl"/>
16 <xsl:include href="../template/component.title.xsl"/>
17 <xsl:include href="../template/division.title.xsl"/>
18 <xsl:include href="../template/formal.object.heading.xsl"/>
19 <xsl:include href="../template/gloss-permalinks.xsl"/>
20
21 <xsl:param name="html.stylesheet" select="'user-manual-style.css'" />
22 <xsl:param name="chapter.autolabel" select="1" />
23 <xsl:param name="section.autolabel" select="1" />
24 <xsl:param name="section.label.includes.component.label" select="1" />
25 <xsl:param name="appendix.autolabel">A</xsl:param>
26
27<!-- <xsl:param name="generate.toc" select="'article nop'"></xsl:param> -->
28
29</xsl:stylesheet>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
new file mode 100644
index 0000000000..d74e768f69
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
@@ -0,0 +1,733 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3=========
4Execution
5=========
6
7|
8
9The primary purpose for running BitBake is to produce some kind of
10output such as a single installable package, a kernel, a software
11development kit, or even a full, board-specific bootable Linux image,
12complete with bootloader, kernel, and root filesystem. Of course, you
13can execute the ``bitbake`` command with options that cause it to
14execute single tasks, compile single recipe files, capture or clear
15data, or simply return information about the execution environment.
16
17This chapter describes BitBake's execution process from start to finish
18when you use it to create an image. The execution process is launched
19using the following command form: ::
20
21 $ bitbake target
22
23For information on
24the BitBake command and its options, see ":ref:`The BitBake Command
25<bitbake-user-manual-command>`" section.
26
27.. note::
28
29 Prior to executing BitBake, you should take advantage of available
30 parallel thread execution on your build host by setting the
31 :term:`BB_NUMBER_THREADS` variable in
32 your project's ``local.conf`` configuration file.
33
34 A common method to determine this value for your build host is to run
35 the following: ::
36
37 $ grep processor /proc/cpuinfo
38
39 This command returns
40 the number of processors, which takes into account hyper-threading.
41 Thus, a quad-core build host with hyper-threading most likely shows
42 eight processors, which is the value you would then assign to
43 ``BB_NUMBER_THREADS``.
44
45 A possibly simpler solution is that some Linux distributions (e.g.
46 Debian and Ubuntu) provide the ``ncpus`` command.
47
48Parsing the Base Configuration Metadata
49=======================================
50
51The first thing BitBake does is parse base configuration metadata. Base
52configuration metadata consists of your project's ``bblayers.conf`` file
53to determine what layers BitBake needs to recognize, all necessary
54``layer.conf`` files (one from each layer), and ``bitbake.conf``. The
55data itself is of various types:
56
57- **Recipes:** Details about particular pieces of software.
58
59- **Class Data:** An abstraction of common build information (e.g. how to
60 build a Linux kernel).
61
62- **Configuration Data:** Machine-specific settings, policy decisions,
63 and so forth. Configuration data acts as the glue to bind everything
64 together.
65
66The ``layer.conf`` files are used to construct key variables such as
67:term:`BBPATH` and :term:`BBFILES`.
68``BBPATH`` is used to search for configuration and class files under the
69``conf`` and ``classes`` directories, respectively. ``BBFILES`` is used
70to locate both recipe and recipe append files (``.bb`` and
71``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the
72user has set the ``BBPATH`` and ``BBFILES`` directly in the environment.
73
74Next, the ``bitbake.conf`` file is located using the ``BBPATH`` variable
75that was just constructed. The ``bitbake.conf`` file may also include
76other configuration files using the ``include`` or ``require``
77directives.
78
79Prior to parsing configuration files, BitBake looks at certain
80variables, including:
81
82- :term:`BB_ENV_WHITELIST`
83- :term:`BB_ENV_EXTRAWHITE`
84- :term:`BB_PRESERVE_ENV`
85- :term:`BB_ORIGENV`
86- :term:`BITBAKE_UI`
87
88The first four variables in this list relate to how BitBake treats shell
89environment variables during task execution. By default, BitBake cleans
90the environment variables and provides tight control over the shell
91execution environment. However, through the use of these first four
92variables, you can apply your control regarding the environment
93variables allowed to be used by BitBake in the shell during execution of
94tasks. See the
95":ref:`bitbake-user-manual/bitbake-user-manual-metadata:Passing Information Into the Build Task Environment`"
96section and the information about these variables in the variable
97glossary for more information on how they work and on how to use them.
98
99The base configuration metadata is global and therefore affects all
100recipes and tasks that are executed.
101
102BitBake first searches the current working directory for an optional
103``conf/bblayers.conf`` configuration file. This file is expected to
104contain a :term:`BBLAYERS` variable that is a
105space-delimited list of 'layer' directories. Recall that if BitBake
106cannot find a ``bblayers.conf`` file, then it is assumed the user has
107set the ``BBPATH`` and ``BBFILES`` variables directly in the
108environment.
109
110For each directory (layer) in this list, a ``conf/layer.conf`` file is
111located and parsed with the :term:`LAYERDIR` variable
112being set to the directory where the layer was found. The idea is these
113files automatically set up :term:`BBPATH` and other
114variables correctly for a given build directory.
115
116BitBake then expects to find the ``conf/bitbake.conf`` file somewhere in
117the user-specified ``BBPATH``. That configuration file generally has
118include directives to pull in any other metadata such as files specific
119to the architecture, the machine, the local environment, and so forth.
120
121Only variable definitions and include directives are allowed in BitBake
122``.conf`` files. Some variables directly influence BitBake's behavior.
123These variables might have been set from the environment depending on
124the environment variables previously mentioned or set in the
125configuration files. The ":ref:`bitbake-user-manual/bitbake-user-manual-ref-variables:Variables Glossary`"
126chapter presents a full list of
127variables.
128
129After parsing configuration files, BitBake uses its rudimentary
130inheritance mechanism, which is through class files, to inherit some
131standard classes. BitBake parses a class when the inherit directive
132responsible for getting that class is encountered.
133
134The ``base.bbclass`` file is always included. Other classes that are
135specified in the configuration using the
136:term:`INHERIT` variable are also included. BitBake
137searches for class files in a ``classes`` subdirectory under the paths
138in ``BBPATH`` in the same way as configuration files.
139
140A good way to get an idea of the configuration files and the class files
141used in your execution environment is to run the following BitBake
142command: ::
143
144 $ bitbake -e > mybb.log
145
146Examining the top of the ``mybb.log``
147shows you the many configuration files and class files used in your
148execution environment.
149
150.. note::
151
152 You need to be aware of how BitBake parses curly braces. If a recipe
153 uses a closing curly brace within the function and the character has
154 no leading spaces, BitBake produces a parsing error. If you use a
155 pair of curly braces in a shell function, the closing curly brace
156 must not be located at the start of the line without leading spaces.
157
158 Here is an example that causes BitBake to produce a parsing error: ::
159
160 fakeroot create_shar() {
161 cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
162 usage()
163 {
164 echo "test"
165 ###### The following "}" at the start of the line causes a parsing error ######
166 }
167 EOF
168 }
169
170 Writing the recipe this way avoids the error:
171 fakeroot create_shar() {
172 cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
173 usage()
174 {
175 echo "test"
176 ###### The following "}" with a leading space at the start of the line avoids the error ######
177 }
178 EOF
179 }
180
181Locating and Parsing Recipes
182============================
183
184During the configuration phase, BitBake will have set
185:term:`BBFILES`. BitBake now uses it to construct a
186list of recipes to parse, along with any append files (``.bbappend``) to
187apply. ``BBFILES`` is a space-separated list of available files and
188supports wildcards. An example would be: ::
189
190 BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend"
191
192BitBake parses each
193recipe and append file located with ``BBFILES`` and stores the values of
194various variables into the datastore.
195
196.. note::
197
198 Append files are applied in the order they are encountered in BBFILES.
199
200For each file, a fresh copy of the base configuration is made, then the
201recipe is parsed line by line. Any inherit statements cause BitBake to
202find and then parse class files (``.bbclass``) using
203:term:`BBPATH` as the search path. Finally, BitBake
204parses in order any append files found in ``BBFILES``.
205
206One common convention is to use the recipe filename to define pieces of
207metadata. For example, in ``bitbake.conf`` the recipe name and version
208are used to set the variables :term:`PN` and
209:term:`PV`: ::
210
211 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
212 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
213
214In this example, a recipe called "something_1.2.3.bb" would set
215``PN`` to "something" and ``PV`` to "1.2.3".
216
217By the time parsing is complete for a recipe, BitBake has a list of
218tasks that the recipe defines and a set of data consisting of keys and
219values as well as dependency information about the tasks.
220
221BitBake does not need all of this information. It only needs a small
222subset of the information to make decisions about the recipe.
223Consequently, BitBake caches the values in which it is interested and
224does not store the rest of the information. Experience has shown it is
225faster to re-parse the metadata than to try and write it out to the disk
226and then reload it.
227
228Where possible, subsequent BitBake commands reuse this cache of recipe
229information. The validity of this cache is determined by first computing
230a checksum of the base configuration data (see
231:term:`BB_HASHCONFIG_WHITELIST`) and
232then checking if the checksum matches. If that checksum matches what is
233in the cache and the recipe and class files have not changed, BitBake is
234able to use the cache. BitBake then reloads the cached information about
235the recipe instead of reparsing it from scratch.
236
237Recipe file collections exist to allow the user to have multiple
238repositories of ``.bb`` files that contain the same exact package. For
239example, one could easily use them to make one's own local copy of an
240upstream repository, but with custom modifications that one does not
241want upstream. Here is an example: ::
242
243 BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
244 BBFILE_COLLECTIONS = "upstream local"
245 BBFILE_PATTERN_upstream = "^/stuff/openembedded/"
246 BBFILE_PATTERN_local = "^/stuff/openembedded.modified/"
247 BBFILE_PRIORITY_upstream = "5" BBFILE_PRIORITY_local = "10"
248
249.. note::
250
251 The layers mechanism is now the preferred method of collecting code.
252 While the collections code remains, its main use is to set layer
253 priorities and to deal with overlap (conflicts) between layers.
254
255.. _bb-bitbake-providers:
256
257Providers
258=========
259
260Assuming BitBake has been instructed to execute a target and that all
261the recipe files have been parsed, BitBake starts to figure out how to
262build the target. BitBake looks through the ``PROVIDES`` list for each
263of the recipes. A ``PROVIDES`` list is the list of names by which the
264recipe can be known. Each recipe's ``PROVIDES`` list is created
265implicitly through the recipe's :term:`PN` variable and
266explicitly through the recipe's :term:`PROVIDES`
267variable, which is optional.
268
269When a recipe uses ``PROVIDES``, that recipe's functionality can be
270found under an alternative name or names other than the implicit ``PN``
271name. As an example, suppose a recipe named ``keyboard_1.0.bb``
272contained the following: ::
273
274 PROVIDES += "fullkeyboard"
275
276The ``PROVIDES``
277list for this recipe becomes "keyboard", which is implicit, and
278"fullkeyboard", which is explicit. Consequently, the functionality found
279in ``keyboard_1.0.bb`` can be found under two different names.
280
281.. _bb-bitbake-preferences:
282
283Preferences
284===========
285
286The ``PROVIDES`` list is only part of the solution for figuring out a
287target's recipes. Because targets might have multiple providers, BitBake
288needs to prioritize providers by determining provider preferences.
289
290A common example in which a target has multiple providers is
291"virtual/kernel", which is on the ``PROVIDES`` list for each kernel
292recipe. Each machine often selects the best kernel provider by using a
293line similar to the following in the machine configuration file: ::
294
295 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
296
297The default :term:`PREFERRED_PROVIDER` is the provider
298with the same name as the target. BitBake iterates through each target
299it needs to build and resolves them and their dependencies using this
300process.
301
302Understanding how providers are chosen is made complicated by the fact
303that multiple versions might exist for a given provider. BitBake
304defaults to the highest version of a provider. Version comparisons are
305made using the same method as Debian. You can use the
306:term:`PREFERRED_VERSION` variable to
307specify a particular version. You can influence the order by using the
308:term:`DEFAULT_PREFERENCE` variable.
309
310By default, files have a preference of "0". Setting
311``DEFAULT_PREFERENCE`` to "-1" makes the recipe unlikely to be used
312unless it is explicitly referenced. Setting ``DEFAULT_PREFERENCE`` to
313"1" makes it likely the recipe is used. ``PREFERRED_VERSION`` overrides
314any ``DEFAULT_PREFERENCE`` setting. ``DEFAULT_PREFERENCE`` is often used
315to mark newer and more experimental recipe versions until they have
316undergone sufficient testing to be considered stable.
317
318When there are multiple "versions" of a given recipe, BitBake defaults
319to selecting the most recent version, unless otherwise specified. If the
320recipe in question has a
321:term:`DEFAULT_PREFERENCE` set lower than
322the other recipes (default is 0), then it will not be selected. This
323allows the person or persons maintaining the repository of recipe files
324to specify their preference for the default selected version.
325Additionally, the user can specify their preferred version.
326
327If the first recipe is named ``a_1.1.bb``, then the
328:term:`PN` variable will be set to "a", and the
329:term:`PV` variable will be set to 1.1.
330
331Thus, if a recipe named ``a_1.2.bb`` exists, BitBake will choose 1.2 by
332default. However, if you define the following variable in a ``.conf``
333file that BitBake parses, you can change that preference: ::
334
335 PREFERRED_VERSION_a = "1.1"
336
337.. note::
338
339 It is common for a recipe to provide two versions -- a stable,
340 numbered (and preferred) version, and a version that is automatically
341 checked out from a source code repository that is considered more
342 "bleeding edge" but can be selected only explicitly.
343
344 For example, in the OpenEmbedded codebase, there is a standard,
345 versioned recipe file for BusyBox, ``busybox_1.22.1.bb``, but there
346 is also a Git-based version, ``busybox_git.bb``, which explicitly
347 contains the line ::
348
349 DEFAULT_PREFERENCE = "-1"
350
351 to ensure that the
352 numbered, stable version is always preferred unless the developer
353 selects otherwise.
354
355.. _bb-bitbake-dependencies:
356
357Dependencies
358============
359
360Each target BitBake builds consists of multiple tasks such as ``fetch``,
361``unpack``, ``patch``, ``configure``, and ``compile``. For best
362performance on multi-core systems, BitBake considers each task as an
363independent entity with its own set of dependencies.
364
365Dependencies are defined through several variables. You can find
366information about variables BitBake uses in the
367:doc:`bitbake-user-manual-ref-variables` near the end of this manual. At a
368basic level, it is sufficient to know that BitBake uses the
369:term:`DEPENDS` and
370:term:`RDEPENDS` variables when calculating
371dependencies.
372
373For more information on how BitBake handles dependencies, see the
374:ref:`bitbake-user-manual/bitbake-user-manual-metadata:Dependencies`
375section.
376
377.. _ref-bitbake-tasklist:
378
379The Task List
380=============
381
382Based on the generated list of providers and the dependency information,
383BitBake can now calculate exactly what tasks it needs to run and in what
384order it needs to run them. The
385:ref:`bitbake-user-manual/bitbake-user-manual-execution:executing tasks`
386section has more information on how BitBake chooses which task to
387execute next.
388
389The build now starts with BitBake forking off threads up to the limit
390set in the :term:`BB_NUMBER_THREADS`
391variable. BitBake continues to fork threads as long as there are tasks
392ready to run, those tasks have all their dependencies met, and the
393thread threshold has not been exceeded.
394
395It is worth noting that you can greatly speed up the build time by
396properly setting the ``BB_NUMBER_THREADS`` variable.
397
398As each task completes, a timestamp is written to the directory
399specified by the :term:`STAMP` variable. On subsequent
400runs, BitBake looks in the build directory within ``tmp/stamps`` and
401does not rerun tasks that are already completed unless a timestamp is
402found to be invalid. Currently, invalid timestamps are only considered
403on a per recipe file basis. So, for example, if the configure stamp has
404a timestamp greater than the compile timestamp for a given target, then
405the compile task would rerun. Running the compile task again, however,
406has no effect on other providers that depend on that target.
407
408The exact format of the stamps is partly configurable. In modern
409versions of BitBake, a hash is appended to the stamp so that if the
410configuration changes, the stamp becomes invalid and the task is
411automatically rerun. This hash, or signature used, is governed by the
412signature policy that is configured (see the
413:ref:`bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`
414section for information). It is also
415possible to append extra metadata to the stamp using the
416``[stamp-extra-info]`` task flag. For example, OpenEmbedded uses this
417flag to make some tasks machine-specific.
418
419.. note::
420
421 Some tasks are marked as "nostamp" tasks. No timestamp file is
422 created when these tasks are run. Consequently, "nostamp" tasks are
423 always rerun.
424
425For more information on tasks, see the
426:ref:`bitbake-user-manual/bitbake-user-manual-metadata:tasks` section.
427
428Executing Tasks
429===============
430
431Tasks can be either a shell task or a Python task. For shell tasks,
432BitBake writes a shell script to
433``${``\ :term:`T`\ ``}/run.do_taskname.pid`` and then
434executes the script. The generated shell script contains all the
435exported variables, and the shell functions with all variables expanded.
436Output from the shell script goes to the file
437``${T}/log.do_taskname.pid``. Looking at the expanded shell functions in
438the run file and the output in the log files is a useful debugging
439technique.
440
441For Python tasks, BitBake executes the task internally and logs
442information to the controlling terminal. Future versions of BitBake will
443write the functions to files similar to the way shell tasks are handled.
444Logging will be handled in a way similar to shell tasks as well.
445
446The order in which BitBake runs the tasks is controlled by its task
447scheduler. It is possible to configure the scheduler and define custom
448implementations for specific use cases. For more information, see these
449variables that control the behavior:
450
451- :term:`BB_SCHEDULER`
452
453- :term:`BB_SCHEDULERS`
454
455It is possible to have functions run before and after a task's main
456function. This is done using the ``[prefuncs]`` and ``[postfuncs]``
457flags of the task that lists the functions to run.
458
459.. _checksums:
460
461Checksums (Signatures)
462======================
463
464A checksum is a unique signature of a task's inputs. The signature of a
465task can be used to determine if a task needs to be run. Because it is a
466change in a task's inputs that triggers running the task, BitBake needs
467to detect all the inputs to a given task. For shell tasks, this turns
468out to be fairly easy because BitBake generates a "run" shell script for
469each task and it is possible to create a checksum that gives you a good
470idea of when the task's data changes.
471
472To complicate the problem, some things should not be included in the
473checksum. First, there is the actual specific build path of a given task
474- the working directory. It does not matter if the working directory
475changes because it should not affect the output for target packages. The
476simplistic approach for excluding the working directory is to set it to
477some fixed value and create the checksum for the "run" script. BitBake
478goes one step better and uses the
479:term:`BB_HASHBASE_WHITELIST` variable
480to define a list of variables that should never be included when
481generating the signatures.
482
483Another problem results from the "run" scripts containing functions that
484might or might not get called. The incremental build solution contains
485code that figures out dependencies between shell functions. This code is
486used to prune the "run" scripts down to the minimum set, thereby
487alleviating this problem and making the "run" scripts much more readable
488as a bonus.
489
490So far we have solutions for shell scripts. What about Python tasks? The
491same approach applies even though these tasks are more difficult. The
492process needs to figure out what variables a Python function accesses
493and what functions it calls. Again, the incremental build solution
494contains code that first figures out the variable and function
495dependencies, and then creates a checksum for the data used as the input
496to the task.
497
498Like the working directory case, situations exist where dependencies
499should be ignored. For these cases, you can instruct the build process
500to ignore a dependency by using a line like the following: ::
501
502 PACKAGE_ARCHS[vardepsexclude] = "MACHINE"
503
504This example ensures that the
505``PACKAGE_ARCHS`` variable does not depend on the value of ``MACHINE``,
506even if it does reference it.
507
508Equally, there are cases where we need to add dependencies BitBake is
509not able to find. You can accomplish this by using a line like the
510following: ::
511
512 PACKAGE_ARCHS[vardeps] = "MACHINE"
513
514This example explicitly
515adds the ``MACHINE`` variable as a dependency for ``PACKAGE_ARCHS``.
516
517Consider a case with in-line Python, for example, where BitBake is not
518able to figure out dependencies. When running in debug mode (i.e. using
519``-DDD``), BitBake produces output when it discovers something for which
520it cannot figure out dependencies.
521
522Thus far, this section has limited discussion to the direct inputs into
523a task. Information based on direct inputs is referred to as the
524"basehash" in the code. However, there is still the question of a task's
525indirect inputs - the things that were already built and present in the
526build directory. The checksum (or signature) for a particular task needs
527to add the hashes of all the tasks on which the particular task depends.
528Choosing which dependencies to add is a policy decision. However, the
529effect is to generate a master checksum that combines the basehash and
530the hashes of the task's dependencies.
531
532At the code level, there are a variety of ways both the basehash and the
533dependent task hashes can be influenced. Within the BitBake
534configuration file, we can give BitBake some extra information to help
535it construct the basehash. The following statement effectively results
536in a list of global variable dependency excludes - variables never
537included in any checksum. This example uses variables from OpenEmbedded
538to help illustrate the concept: ::
539
540 BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \
541 SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL \
542 USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \
543 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
544 CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX"
545
546The previous example excludes the work directory, which is part of
547``TMPDIR``.
548
549The rules for deciding which hashes of dependent tasks to include
550through dependency chains are more complex and are generally
551accomplished with a Python function. The code in
552``meta/lib/oe/sstatesig.py`` shows two examples of this and also
553illustrates how you can insert your own policy into the system if so
554desired. This file defines the two basic signature generators
555OpenEmbedded-Core uses: "OEBasic" and "OEBasicHash". By default, there
556is a dummy "noop" signature handler enabled in BitBake. This means that
557behavior is unchanged from previous versions. ``OE-Core`` uses the
558"OEBasicHash" signature handler by default through this setting in the
559``bitbake.conf`` file: ::
560
561 BB_SIGNATURE_HANDLER ?= "OEBasicHash"
562
563The "OEBasicHash" ``BB_SIGNATURE_HANDLER`` is the same as the "OEBasic"
564version but adds the task hash to the stamp files. This results in any
565metadata change that changes the task hash, automatically causing the
566task to be run again. This removes the need to bump
567:term:`PR` values, and changes to metadata automatically
568ripple across the build.
569
570It is also worth noting that the end result of these signature
571generators is to make some dependency and hash information available to
572the build. This information includes:
573
574- ``BB_BASEHASH_task-``\ *taskname*: The base hashes for each task in the
575 recipe.
576
577- ``BB_BASEHASH_``\ *filename:taskname*: The base hashes for each
578 dependent task.
579
580- ``BBHASHDEPS_``\ *filename:taskname*: The task dependencies for
581 each task.
582
583- ``BB_TASKHASH``: The hash of the currently running task.
584
585It is worth noting that BitBake's "-S" option lets you debug BitBake's
586processing of signatures. The options passed to -S allow different
587debugging modes to be used, either using BitBake's own debug functions
588or possibly those defined in the metadata/signature handler itself. The
589simplest parameter to pass is "none", which causes a set of signature
590information to be written out into ``STAMPS_DIR`` corresponding to the
591targets specified. The other currently available parameter is
592"printdiff", which causes BitBake to try to establish the closest
593signature match it can (e.g. in the sstate cache) and then run
594``bitbake-diffsigs`` over the matches to determine the stamps and delta
595where these two stamp trees diverge.
596
597.. note::
598
599 It is likely that future versions of BitBake will provide other
600 signature handlers triggered through additional "-S" parameters.
601
602You can find more information on checksum metadata in the
603:ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene`
604section.
605
606Setscene
607========
608
609The setscene process enables BitBake to handle "pre-built" artifacts.
610The ability to handle and reuse these artifacts allows BitBake the
611luxury of not having to build something from scratch every time.
612Instead, BitBake can use, when possible, existing build artifacts.
613
614BitBake needs to have reliable data indicating whether or not an
615artifact is compatible. Signatures, described in the previous section,
616provide an ideal way of representing whether an artifact is compatible.
617If a signature is the same, an object can be reused.
618
619If an object can be reused, the problem then becomes how to replace a
620given task or set of tasks with the pre-built artifact. BitBake solves
621the problem with the "setscene" process.
622
623When BitBake is asked to build a given target, before building anything,
624it first asks whether cached information is available for any of the
625targets it's building, or any of the intermediate targets. If cached
626information is available, BitBake uses this information instead of
627running the main tasks.
628
629BitBake first calls the function defined by the
630:term:`BB_HASHCHECK_FUNCTION` variable
631with a list of tasks and corresponding hashes it wants to build. This
632function is designed to be fast and returns a list of the tasks for
633which it believes in can obtain artifacts.
634
635Next, for each of the tasks that were returned as possibilities, BitBake
636executes a setscene version of the task that the possible artifact
637covers. Setscene versions of a task have the string "_setscene" appended
638to the task name. So, for example, the task with the name ``xxx`` has a
639setscene task named ``xxx_setscene``. The setscene version of the task
640executes and provides the necessary artifacts returning either success
641or failure.
642
643As previously mentioned, an artifact can cover more than one task. For
644example, it is pointless to obtain a compiler if you already have the
645compiled binary. To handle this, BitBake calls the
646:term:`BB_SETSCENE_DEPVALID` function for
647each successful setscene task to know whether or not it needs to obtain
648the dependencies of that task.
649
650Finally, after all the setscene tasks have executed, BitBake calls the
651function listed in
652:term:`BB_SETSCENE_VERIFY_FUNCTION2`
653with the list of tasks BitBake thinks has been "covered". The metadata
654can then ensure that this list is correct and can inform BitBake that it
655wants specific tasks to be run regardless of the setscene result.
656
657You can find more information on setscene metadata in the
658:ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene`
659section.
660
661Logging
662=======
663
664In addition to the standard command line option to control how verbose
665builds are when execute, bitbake also supports user defined
666configuration of the `Python
667logging <https://docs.python.org/3/library/logging.html>`__ facilities
668through the :term:`BB_LOGCONFIG` variable. This
669variable defines a json or yaml `logging
670configuration <https://docs.python.org/3/library/logging.config.html>`__
671that will be intelligently merged into the default configuration. The
672logging configuration is merged using the following rules:
673
674- The user defined configuration will completely replace the default
675 configuration if top level key ``bitbake_merge`` is set to the value
676 ``False``. In this case, all other rules are ignored.
677
678- The user configuration must have a top level ``version`` which must
679 match the value of the default configuration.
680
681- Any keys defined in the ``handlers``, ``formatters``, or ``filters``,
682 will be merged into the same section in the default configuration,
683 with the user specified keys taking replacing a default one if there
684 is a conflict. In practice, this means that if both the default
685 configuration and user configuration specify a handler named
686 ``myhandler``, the user defined one will replace the default. To
687 prevent the user from inadvertently replacing a default handler,
688 formatter, or filter, all of the default ones are named with a prefix
689 of "``BitBake.``"
690
691- If a logger is defined by the user with the key ``bitbake_merge`` set
692 to ``False``, that logger will be completely replaced by user
693 configuration. In this case, no other rules will apply to that
694 logger.
695
696- All user defined ``filter`` and ``handlers`` properties for a given
697 logger will be merged with corresponding properties from the default
698 logger. For example, if the user configuration adds a filter called
699 ``myFilter`` to the ``BitBake.SigGen``, and the default configuration
700 adds a filter called ``BitBake.defaultFilter``, both filters will be
701 applied to the logger
702
703As an example, consider the following user logging configuration file
704which logs all Hash Equivalence related messages of VERBOSE or higher to
705a file called ``hashequiv.log`` ::
706
707 {
708 "version": 1,
709 "handlers": {
710 "autobuilderlog": {
711 "class": "logging.FileHandler",
712 "formatter": "logfileFormatter",
713 "level": "DEBUG",
714 "filename": "hashequiv.log",
715 "mode": "w"
716 }
717 },
718 "formatters": {
719 "logfileFormatter": {
720 "format": "%(name)s: %(levelname)s: %(message)s"
721 }
722 },
723 "loggers": {
724 "BitBake.SigGen.HashEquiv": {
725 "level": "VERBOSE",
726 "handlers": ["autobuilderlog"]
727 },
728 "BitBake.RunQueue.HashEquiv": {
729 "level": "VERBOSE",
730 "handlers": ["autobuilderlog"]
731 }
732 }
733 }
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
deleted file mode 100644
index e4251dff56..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
+++ /dev/null
@@ -1,1029 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<chapter id="bitbake-user-manual-execution">
5 <title>Execution</title>
6
7 <para>
8 The primary purpose for running BitBake is to produce some kind
9 of output such as a single installable package, a kernel, a software
10 development kit, or even a full, board-specific bootable Linux image,
11 complete with bootloader, kernel, and root filesystem.
12 Of course, you can execute the <filename>bitbake</filename>
13 command with options that cause it to execute single tasks,
14 compile single recipe files, capture or clear data, or simply
15 return information about the execution environment.
16 </para>
17
18 <para>
19 This chapter describes BitBake's execution process from start
20 to finish when you use it to create an image.
21 The execution process is launched using the following command
22 form:
23 <literallayout class='monospaced'>
24 $ bitbake <replaceable>target</replaceable>
25 </literallayout>
26 For information on the BitBake command and its options,
27 see
28 "<link linkend='bitbake-user-manual-command'>The BitBake Command</link>"
29 section.
30 <note>
31 <para>
32 Prior to executing BitBake, you should take advantage of available
33 parallel thread execution on your build host by setting the
34 <link linkend='var-bb-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>
35 variable in your project's <filename>local.conf</filename>
36 configuration file.
37 </para>
38
39 <para>
40 A common method to determine this value for your build host is to run
41 the following:
42 <literallayout class='monospaced'>
43 $ grep processor /proc/cpuinfo
44 </literallayout>
45 This command returns the number of processors, which takes into
46 account hyper-threading.
47 Thus, a quad-core build host with hyper-threading most likely
48 shows eight processors, which is the value you would then assign to
49 <filename>BB_NUMBER_THREADS</filename>.
50 </para>
51
52 <para>
53 A possibly simpler solution is that some Linux distributions
54 (e.g. Debian and Ubuntu) provide the <filename>ncpus</filename> command.
55 </para>
56 </note>
57 </para>
58
59 <section id='parsing-the-base-configuration-metadata'>
60 <title>Parsing the Base Configuration Metadata</title>
61
62 <para>
63 The first thing BitBake does is parse base configuration
64 metadata.
65 Base configuration metadata consists of your project's
66 <filename>bblayers.conf</filename> file to determine what
67 layers BitBake needs to recognize, all necessary
68 <filename>layer.conf</filename> files (one from each layer),
69 and <filename>bitbake.conf</filename>.
70 The data itself is of various types:
71 <itemizedlist>
72 <listitem><para><emphasis>Recipes:</emphasis>
73 Details about particular pieces of software.
74 </para></listitem>
75 <listitem><para><emphasis>Class Data:</emphasis>
76 An abstraction of common build information
77 (e.g. how to build a Linux kernel).
78 </para></listitem>
79 <listitem><para><emphasis>Configuration Data:</emphasis>
80 Machine-specific settings, policy decisions,
81 and so forth.
82 Configuration data acts as the glue to bind everything
83 together.</para></listitem>
84 </itemizedlist>
85 </para>
86
87 <para>
88 The <filename>layer.conf</filename> files are used to
89 construct key variables such as
90 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>
91 and
92 <link linkend='var-bb-BBFILES'><filename>BBFILES</filename></link>.
93 <filename>BBPATH</filename> is used to search for
94 configuration and class files under the
95 <filename>conf</filename> and <filename>classes</filename>
96 directories, respectively.
97 <filename>BBFILES</filename> is used to locate both recipe
98 and recipe append files
99 (<filename>.bb</filename> and <filename>.bbappend</filename>).
100 If there is no <filename>bblayers.conf</filename> file,
101 it is assumed the user has set the <filename>BBPATH</filename>
102 and <filename>BBFILES</filename> directly in the environment.
103 </para>
104
105 <para>
106 Next, the <filename>bitbake.conf</filename> file is located
107 using the <filename>BBPATH</filename> variable that was
108 just constructed.
109 The <filename>bitbake.conf</filename> file may also include other
110 configuration files using the
111 <filename>include</filename> or
112 <filename>require</filename> directives.
113 </para>
114
115 <para>
116 Prior to parsing configuration files, BitBake looks
117 at certain variables, including:
118 <itemizedlist>
119 <listitem><para>
120 <link linkend='var-bb-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link>
121 </para></listitem>
122 <listitem><para>
123 <link linkend='var-bb-BB_ENV_EXTRAWHITE'><filename>BB_ENV_EXTRAWHITE</filename></link>
124 </para></listitem>
125 <listitem><para>
126 <link linkend='var-bb-BB_PRESERVE_ENV'><filename>BB_PRESERVE_ENV</filename></link>
127 </para></listitem>
128 <listitem><para>
129 <link linkend='var-bb-BB_ORIGENV'><filename>BB_ORIGENV</filename></link>
130 </para></listitem>
131 <listitem><para>
132 <link linkend='var-bb-BITBAKE_UI'><filename>BITBAKE_UI</filename></link>
133 </para></listitem>
134 </itemizedlist>
135 The first four variables in this list relate to how BitBake treats shell
136 environment variables during task execution.
137 By default, BitBake cleans the environment variables and provides tight
138 control over the shell execution environment.
139 However, through the use of these first four variables, you can
140 apply your control regarding the
141 environment variables allowed to be used by BitBake in the shell
142 during execution of tasks.
143 See the
144 "<link linkend='passing-information-into-the-build-task-environment'>Passing Information Into the Build Task Environment</link>"
145 section and the information about these variables in the
146 variable glossary for more information on how they work and
147 on how to use them.
148 </para>
149
150 <para>
151 The base configuration metadata is global
152 and therefore affects all recipes and tasks that are executed.
153 </para>
154
155 <para>
156 BitBake first searches the current working directory for an
157 optional <filename>conf/bblayers.conf</filename> configuration file.
158 This file is expected to contain a
159 <link linkend='var-bb-BBLAYERS'><filename>BBLAYERS</filename></link>
160 variable that is a space-delimited list of 'layer' directories.
161 Recall that if BitBake cannot find a <filename>bblayers.conf</filename>
162 file, then it is assumed the user has set the <filename>BBPATH</filename>
163 and <filename>BBFILES</filename> variables directly in the environment.
164 </para>
165
166 <para>
167 For each directory (layer) in this list, a <filename>conf/layer.conf</filename>
168 file is located and parsed with the
169 <link linkend='var-bb-LAYERDIR'><filename>LAYERDIR</filename></link>
170 variable being set to the directory where the layer was found.
171 The idea is these files automatically set up
172 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>
173 and other variables correctly for a given build directory.
174 </para>
175
176 <para>
177 BitBake then expects to find the <filename>conf/bitbake.conf</filename>
178 file somewhere in the user-specified <filename>BBPATH</filename>.
179 That configuration file generally has include directives to pull
180 in any other metadata such as files specific to the architecture,
181 the machine, the local environment, and so forth.
182 </para>
183
184 <para>
185 Only variable definitions and include directives are allowed
186 in BitBake <filename>.conf</filename> files.
187 Some variables directly influence BitBake's behavior.
188 These variables might have been set from the environment
189 depending on the environment variables previously
190 mentioned or set in the configuration files.
191 The
192 "<link linkend='ref-bb-variables-glos'>Variables Glossary</link>"
193 chapter presents a full list of variables.
194 </para>
195
196 <para>
197 After parsing configuration files, BitBake uses its rudimentary
198 inheritance mechanism, which is through class files, to inherit
199 some standard classes.
200 BitBake parses a class when the inherit directive responsible
201 for getting that class is encountered.
202 </para>
203
204 <para>
205 The <filename>base.bbclass</filename> file is always included.
206 Other classes that are specified in the configuration using the
207 <link linkend='var-bb-INHERIT'><filename>INHERIT</filename></link>
208 variable are also included.
209 BitBake searches for class files in a
210 <filename>classes</filename> subdirectory under
211 the paths in <filename>BBPATH</filename> in the same way as
212 configuration files.
213 </para>
214
215 <para>
216 A good way to get an idea of the configuration files and
217 the class files used in your execution environment is to
218 run the following BitBake command:
219 <literallayout class='monospaced'>
220 $ bitbake -e > mybb.log
221 </literallayout>
222 Examining the top of the <filename>mybb.log</filename>
223 shows you the many configuration files and class files
224 used in your execution environment.
225 </para>
226
227 <note>
228 <para>
229 You need to be aware of how BitBake parses curly braces.
230 If a recipe uses a closing curly brace within the function and
231 the character has no leading spaces, BitBake produces a parsing
232 error.
233 If you use a pair of curly braces in a shell function, the
234 closing curly brace must not be located at the start of the line
235 without leading spaces.
236 </para>
237
238 <para>
239 Here is an example that causes BitBake to produce a parsing
240 error:
241 <literallayout class='monospaced'>
242 fakeroot create_shar() {
243 cat &lt;&lt; "EOF" &gt; ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
244 usage()
245 {
246 echo "test"
247 ###### The following "}" at the start of the line causes a parsing error ######
248 }
249 EOF
250 }
251 </literallayout>
252 Writing the recipe this way avoids the error:
253 <literallayout class='monospaced'>
254 fakeroot create_shar() {
255 cat &lt;&lt; "EOF" &gt; ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
256 usage()
257 {
258 echo "test"
259 ######The following "}" with a leading space at the start of the line avoids the error ######
260 }
261 EOF
262 }
263 </literallayout>
264 </para>
265 </note>
266 </section>
267
268 <section id='locating-and-parsing-recipes'>
269 <title>Locating and Parsing Recipes</title>
270
271 <para>
272 During the configuration phase, BitBake will have set
273 <link linkend='var-bb-BBFILES'><filename>BBFILES</filename></link>.
274 BitBake now uses it to construct a list of recipes to parse,
275 along with any append files (<filename>.bbappend</filename>)
276 to apply.
277 <filename>BBFILES</filename> is a space-separated list of
278 available files and supports wildcards.
279 An example would be:
280 <literallayout class='monospaced'>
281 BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend"
282 </literallayout>
283 BitBake parses each recipe and append file located
284 with <filename>BBFILES</filename> and stores the values of
285 various variables into the datastore.
286 <note>
287 Append files are applied in the order they are encountered in
288 <filename>BBFILES</filename>.
289 </note>
290 For each file, a fresh copy of the base configuration is
291 made, then the recipe is parsed line by line.
292 Any inherit statements cause BitBake to find and
293 then parse class files (<filename>.bbclass</filename>)
294 using
295 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>
296 as the search path.
297 Finally, BitBake parses in order any append files found in
298 <filename>BBFILES</filename>.
299 </para>
300
301 <para>
302 One common convention is to use the recipe filename to define
303 pieces of metadata.
304 For example, in <filename>bitbake.conf</filename> the recipe
305 name and version are used to set the variables
306 <link linkend='var-bb-PN'><filename>PN</filename></link> and
307 <link linkend='var-bb-PV'><filename>PV</filename></link>:
308 <literallayout class='monospaced'>
309 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
310 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
311 </literallayout>
312 In this example, a recipe called "something_1.2.3.bb" would set
313 <filename>PN</filename> to "something" and
314 <filename>PV</filename> to "1.2.3".
315 </para>
316
317 <para>
318 By the time parsing is complete for a recipe, BitBake
319 has a list of tasks that the recipe defines and a set of
320 data consisting of keys and values as well as
321 dependency information about the tasks.
322 </para>
323
324 <para>
325 BitBake does not need all of this information.
326 It only needs a small subset of the information to make
327 decisions about the recipe.
328 Consequently, BitBake caches the values in which it is
329 interested and does not store the rest of the information.
330 Experience has shown it is faster to re-parse the metadata than to
331 try and write it out to the disk and then reload it.
332 </para>
333
334 <para>
335 Where possible, subsequent BitBake commands reuse this cache of
336 recipe information.
337 The validity of this cache is determined by first computing a
338 checksum of the base configuration data (see
339 <link linkend='var-bb-BB_HASHCONFIG_WHITELIST'><filename>BB_HASHCONFIG_WHITELIST</filename></link>)
340 and then checking if the checksum matches.
341 If that checksum matches what is in the cache and the recipe
342 and class files have not changed, BitBake is able to use
343 the cache.
344 BitBake then reloads the cached information about the recipe
345 instead of reparsing it from scratch.
346 </para>
347
348 <para>
349 Recipe file collections exist to allow the user to
350 have multiple repositories of
351 <filename>.bb</filename> files that contain the same
352 exact package.
353 For example, one could easily use them to make one's
354 own local copy of an upstream repository, but with
355 custom modifications that one does not want upstream.
356 Here is an example:
357 <literallayout class='monospaced'>
358 BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
359 BBFILE_COLLECTIONS = "upstream local"
360 BBFILE_PATTERN_upstream = "^/stuff/openembedded/"
361 BBFILE_PATTERN_local = "^/stuff/openembedded.modified/"
362 BBFILE_PRIORITY_upstream = "5"
363 BBFILE_PRIORITY_local = "10"
364 </literallayout>
365 <note>
366 The layers mechanism is now the preferred method of collecting
367 code.
368 While the collections code remains, its main use is to set layer
369 priorities and to deal with overlap (conflicts) between layers.
370 </note>
371 </para>
372 </section>
373
374 <section id='bb-bitbake-providers'>
375 <title>Providers</title>
376
377 <para>
378 Assuming BitBake has been instructed to execute a target
379 and that all the recipe files have been parsed, BitBake
380 starts to figure out how to build the target.
381 BitBake looks through the <filename>PROVIDES</filename> list
382 for each of the recipes.
383 A <filename>PROVIDES</filename> list is the list of names by which
384 the recipe can be known.
385 Each recipe's <filename>PROVIDES</filename> list is created
386 implicitly through the recipe's
387 <link linkend='var-bb-PN'><filename>PN</filename></link> variable
388 and explicitly through the recipe's
389 <link linkend='var-bb-PROVIDES'><filename>PROVIDES</filename></link>
390 variable, which is optional.
391 </para>
392
393 <para>
394 When a recipe uses <filename>PROVIDES</filename>, that recipe's
395 functionality can be found under an alternative name or names other
396 than the implicit <filename>PN</filename> name.
397 As an example, suppose a recipe named <filename>keyboard_1.0.bb</filename>
398 contained the following:
399 <literallayout class='monospaced'>
400 PROVIDES += "fullkeyboard"
401 </literallayout>
402 The <filename>PROVIDES</filename> list for this recipe becomes
403 "keyboard", which is implicit, and "fullkeyboard", which is explicit.
404 Consequently, the functionality found in
405 <filename>keyboard_1.0.bb</filename> can be found under two
406 different names.
407 </para>
408 </section>
409
410 <section id='bb-bitbake-preferences'>
411 <title>Preferences</title>
412
413 <para>
414 The <filename>PROVIDES</filename> list is only part of the solution
415 for figuring out a target's recipes.
416 Because targets might have multiple providers, BitBake needs
417 to prioritize providers by determining provider preferences.
418 </para>
419
420 <para>
421 A common example in which a target has multiple providers
422 is "virtual/kernel", which is on the
423 <filename>PROVIDES</filename> list for each kernel recipe.
424 Each machine often selects the best kernel provider by using a
425 line similar to the following in the machine configuration file:
426 <literallayout class='monospaced'>
427 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
428 </literallayout>
429 The default
430 <link linkend='var-bb-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></link>
431 is the provider with the same name as the target.
432 BitBake iterates through each target it needs to build and
433 resolves them and their dependencies using this process.
434 </para>
435
436 <para>
437 Understanding how providers are chosen is made complicated by the fact
438 that multiple versions might exist for a given provider.
439 BitBake defaults to the highest version of a provider.
440 Version comparisons are made using the same method as Debian.
441 You can use the
442 <link linkend='var-bb-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></link>
443 variable to specify a particular version.
444 You can influence the order by using the
445 <link linkend='var-bb-DEFAULT_PREFERENCE'><filename>DEFAULT_PREFERENCE</filename></link>
446 variable.
447 </para>
448
449 <para>
450 By default, files have a preference of "0".
451 Setting <filename>DEFAULT_PREFERENCE</filename> to "-1" makes the
452 recipe unlikely to be used unless it is explicitly referenced.
453 Setting <filename>DEFAULT_PREFERENCE</filename> to "1" makes it
454 likely the recipe is used.
455 <filename>PREFERRED_VERSION</filename> overrides any
456 <filename>DEFAULT_PREFERENCE</filename> setting.
457 <filename>DEFAULT_PREFERENCE</filename> is often used to mark newer
458 and more experimental recipe versions until they have undergone
459 sufficient testing to be considered stable.
460 </para>
461
462 <para>
463 When there are multiple “versions†of a given recipe,
464 BitBake defaults to selecting the most recent
465 version, unless otherwise specified.
466 If the recipe in question has a
467 <link linkend='var-bb-DEFAULT_PREFERENCE'><filename>DEFAULT_PREFERENCE</filename></link>
468 set lower than the other recipes (default is 0), then
469 it will not be selected.
470 This allows the person or persons maintaining
471 the repository of recipe files to specify
472 their preference for the default selected version.
473 Additionally, the user can specify their preferred version.
474 </para>
475
476 <para>
477 If the first recipe is named <filename>a_1.1.bb</filename>, then the
478 <link linkend='var-bb-PN'><filename>PN</filename></link> variable
479 will be set to “aâ€, and the
480 <link linkend='var-bb-PV'><filename>PV</filename></link>
481 variable will be set to 1.1.
482 </para>
483
484 <para>
485 Thus, if a recipe named <filename>a_1.2.bb</filename> exists, BitBake
486 will choose 1.2 by default.
487 However, if you define the following variable in a
488 <filename>.conf</filename> file that BitBake parses, you
489 can change that preference:
490 <literallayout class='monospaced'>
491 PREFERRED_VERSION_a = "1.1"
492 </literallayout>
493 </para>
494
495 <note>
496 <para>
497 It is common for a recipe to provide two versions -- a stable,
498 numbered (and preferred) version, and a version that is
499 automatically checked out from a source code repository that
500 is considered more "bleeding edge" but can be selected only
501 explicitly.
502 </para>
503
504 <para>
505 For example, in the OpenEmbedded codebase, there is a standard,
506 versioned recipe file for BusyBox,
507 <filename>busybox_1.22.1.bb</filename>,
508 but there is also a Git-based version,
509 <filename>busybox_git.bb</filename>, which explicitly contains the line
510 <literallayout class='monospaced'>
511 DEFAULT_PREFERENCE = "-1"
512 </literallayout>
513 to ensure that the numbered, stable version is always preferred
514 unless the developer selects otherwise.
515 </para>
516 </note>
517 </section>
518
519 <section id='bb-bitbake-dependencies'>
520 <title>Dependencies</title>
521
522 <para>
523 Each target BitBake builds consists of multiple tasks such as
524 <filename>fetch</filename>, <filename>unpack</filename>,
525 <filename>patch</filename>, <filename>configure</filename>,
526 and <filename>compile</filename>.
527 For best performance on multi-core systems, BitBake considers each
528 task as an independent
529 entity with its own set of dependencies.
530 </para>
531
532 <para>
533 Dependencies are defined through several variables.
534 You can find information about variables BitBake uses in
535 the <link linkend='ref-bb-variables-glos'>Variables Glossary</link>
536 near the end of this manual.
537 At a basic level, it is sufficient to know that BitBake uses the
538 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link> and
539 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link> variables when
540 calculating dependencies.
541 </para>
542
543 <para>
544 For more information on how BitBake handles dependencies, see the
545 "<link linkend='dependencies'>Dependencies</link>" section.
546 </para>
547 </section>
548
549 <section id='ref-bitbake-tasklist'>
550 <title>The Task List</title>
551
552 <para>
553 Based on the generated list of providers and the dependency information,
554 BitBake can now calculate exactly what tasks it needs to run and in what
555 order it needs to run them.
556 The
557 "<link linkend='executing-tasks'>Executing Tasks</link>" section has more
558 information on how BitBake chooses which task to execute next.
559 </para>
560
561 <para>
562 The build now starts with BitBake forking off threads up to the limit set in the
563 <link linkend='var-bb-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>
564 variable.
565 BitBake continues to fork threads as long as there are tasks ready to run,
566 those tasks have all their dependencies met, and the thread threshold has not been
567 exceeded.
568 </para>
569
570 <para>
571 It is worth noting that you can greatly speed up the build time by properly setting
572 the <filename>BB_NUMBER_THREADS</filename> variable.
573 </para>
574
575 <para>
576 As each task completes, a timestamp is written to the directory specified by the
577 <link linkend='var-bb-STAMP'><filename>STAMP</filename></link> variable.
578 On subsequent runs, BitBake looks in the build directory within
579 <filename>tmp/stamps</filename> and does not rerun
580 tasks that are already completed unless a timestamp is found to be invalid.
581 Currently, invalid timestamps are only considered on a per
582 recipe file basis.
583 So, for example, if the configure stamp has a timestamp greater than the
584 compile timestamp for a given target, then the compile task would rerun.
585 Running the compile task again, however, has no effect on other providers
586 that depend on that target.
587 </para>
588
589 <para>
590 The exact format of the stamps is partly configurable.
591 In modern versions of BitBake, a hash is appended to the
592 stamp so that if the configuration changes, the stamp becomes
593 invalid and the task is automatically rerun.
594 This hash, or signature used, is governed by the signature policy
595 that is configured (see the
596 "<link linkend='checksums'>Checksums (Signatures)</link>"
597 section for information).
598 It is also possible to append extra metadata to the stamp using
599 the <filename>[stamp-extra-info]</filename> task flag.
600 For example, OpenEmbedded uses this flag to make some tasks machine-specific.
601 </para>
602
603 <note>
604 Some tasks are marked as "nostamp" tasks.
605 No timestamp file is created when these tasks are run.
606 Consequently, "nostamp" tasks are always rerun.
607 </note>
608
609 <para>
610 For more information on tasks, see the
611 "<link linkend='tasks'>Tasks</link>" section.
612 </para>
613 </section>
614
615 <section id='executing-tasks'>
616 <title>Executing Tasks</title>
617
618 <para>
619 Tasks can be either a shell task or a Python task.
620 For shell tasks, BitBake writes a shell script to
621 <filename>${</filename><link linkend='var-bb-T'><filename>T</filename></link><filename>}/run.do_taskname.<replaceable>pid</replaceable></filename>
622 and then executes the script.
623 The generated shell script contains all the exported variables,
624 and the shell functions with all variables expanded.
625 Output from the shell script goes to the file
626 <filename>${T}/log.do_taskname.<replaceable>pid</replaceable></filename>.
627 Looking at the expanded shell functions in the run file and
628 the output in the log files is a useful debugging technique.
629 </para>
630
631 <para>
632 For Python tasks, BitBake executes the task internally and logs
633 information to the controlling terminal.
634 Future versions of BitBake will write the functions to files
635 similar to the way shell tasks are handled.
636 Logging will be handled in a way similar to shell tasks as well.
637 </para>
638
639 <para>
640 The order in which BitBake runs the tasks is controlled by its
641 task scheduler.
642 It is possible to configure the scheduler and define custom
643 implementations for specific use cases.
644 For more information, see these variables that control the
645 behavior:
646 <itemizedlist>
647 <listitem><para>
648 <link linkend='var-bb-BB_SCHEDULER'><filename>BB_SCHEDULER</filename></link>
649 </para></listitem>
650 <listitem><para>
651 <link linkend='var-bb-BB_SCHEDULERS'><filename>BB_SCHEDULERS</filename></link>
652 </para></listitem>
653 </itemizedlist>
654 It is possible to have functions run before and after a task's main
655 function.
656 This is done using the <filename>[prefuncs]</filename>
657 and <filename>[postfuncs]</filename> flags of the task
658 that lists the functions to run.
659 </para>
660 </section>
661
662 <section id='checksums'>
663 <title>Checksums (Signatures)</title>
664
665 <para>
666 A checksum is a unique signature of a task's inputs.
667 The signature of a task can be used to determine if a task
668 needs to be run.
669 Because it is a change in a task's inputs that triggers running
670 the task, BitBake needs to detect all the inputs to a given task.
671 For shell tasks, this turns out to be fairly easy because
672 BitBake generates a "run" shell script for each task and
673 it is possible to create a checksum that gives you a good idea of when
674 the task's data changes.
675 </para>
676
677 <para>
678 To complicate the problem, some things should not be included in
679 the checksum.
680 First, there is the actual specific build path of a given task -
681 the working directory.
682 It does not matter if the working directory changes because it should not
683 affect the output for target packages.
684 The simplistic approach for excluding the working directory is to set
685 it to some fixed value and create the checksum for the "run" script.
686 BitBake goes one step better and uses the
687 <link linkend='var-bb-BB_HASHBASE_WHITELIST'><filename>BB_HASHBASE_WHITELIST</filename></link>
688 variable to define a list of variables that should never be included
689 when generating the signatures.
690 </para>
691
692 <para>
693 Another problem results from the "run" scripts containing functions that
694 might or might not get called.
695 The incremental build solution contains code that figures out dependencies
696 between shell functions.
697 This code is used to prune the "run" scripts down to the minimum set,
698 thereby alleviating this problem and making the "run" scripts much more
699 readable as a bonus.
700 </para>
701
702 <para>
703 So far we have solutions for shell scripts.
704 What about Python tasks?
705 The same approach applies even though these tasks are more difficult.
706 The process needs to figure out what variables a Python function accesses
707 and what functions it calls.
708 Again, the incremental build solution contains code that first figures out
709 the variable and function dependencies, and then creates a checksum for the data
710 used as the input to the task.
711 </para>
712
713 <para>
714 Like the working directory case, situations exist where dependencies
715 should be ignored.
716 For these cases, you can instruct the build process to ignore a dependency
717 by using a line like the following:
718 <literallayout class='monospaced'>
719 PACKAGE_ARCHS[vardepsexclude] = "MACHINE"
720 </literallayout>
721 This example ensures that the <filename>PACKAGE_ARCHS</filename> variable does not
722 depend on the value of <filename>MACHINE</filename>, even if it does reference it.
723 </para>
724
725 <para>
726 Equally, there are cases where we need to add dependencies BitBake
727 is not able to find.
728 You can accomplish this by using a line like the following:
729 <literallayout class='monospaced'>
730 PACKAGE_ARCHS[vardeps] = "MACHINE"
731 </literallayout>
732 This example explicitly adds the <filename>MACHINE</filename> variable as a
733 dependency for <filename>PACKAGE_ARCHS</filename>.
734 </para>
735
736 <para>
737 Consider a case with in-line Python, for example, where BitBake is not
738 able to figure out dependencies.
739 When running in debug mode (i.e. using <filename>-DDD</filename>), BitBake
740 produces output when it discovers something for which it cannot figure out
741 dependencies.
742 </para>
743
744 <para>
745 Thus far, this section has limited discussion to the direct inputs into a task.
746 Information based on direct inputs is referred to as the "basehash" in the
747 code.
748 However, there is still the question of a task's indirect inputs - the
749 things that were already built and present in the build directory.
750 The checksum (or signature) for a particular task needs to add the hashes
751 of all the tasks on which the particular task depends.
752 Choosing which dependencies to add is a policy decision.
753 However, the effect is to generate a master checksum that combines the basehash
754 and the hashes of the task's dependencies.
755 </para>
756
757 <para>
758 At the code level, there are a variety of ways both the basehash and the
759 dependent task hashes can be influenced.
760 Within the BitBake configuration file, we can give BitBake some extra information
761 to help it construct the basehash.
762 The following statement effectively results in a list of global variable
763 dependency excludes - variables never included in any checksum.
764 This example uses variables from OpenEmbedded to help illustrate
765 the concept:
766 <literallayout class='monospaced'>
767 BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \
768 SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM \
769 USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \
770 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
771 CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX"
772 </literallayout>
773 The previous example excludes the work directory, which is part of
774 <filename>TMPDIR</filename>.
775 </para>
776
777 <para>
778 The rules for deciding which hashes of dependent tasks to include through
779 dependency chains are more complex and are generally accomplished with a
780 Python function.
781 The code in <filename>meta/lib/oe/sstatesig.py</filename> shows two examples
782 of this and also illustrates how you can insert your own policy into the system
783 if so desired.
784 This file defines the two basic signature generators OpenEmbedded-Core
785 uses: "OEBasic" and "OEBasicHash".
786 By default, there is a dummy "noop" signature handler enabled in BitBake.
787 This means that behavior is unchanged from previous versions.
788 <filename>OE-Core</filename> uses the "OEBasicHash" signature handler by default
789 through this setting in the <filename>bitbake.conf</filename> file:
790 <literallayout class='monospaced'>
791 BB_SIGNATURE_HANDLER ?= "OEBasicHash"
792 </literallayout>
793 The "OEBasicHash" <filename>BB_SIGNATURE_HANDLER</filename> is the same as the
794 "OEBasic" version but adds the task hash to the stamp files.
795 This results in any metadata change that changes the task hash, automatically
796 causing the task to be run again.
797 This removes the need to bump
798 <link linkend='var-bb-PR'><filename>PR</filename></link>
799 values, and changes to metadata automatically ripple across the build.
800 </para>
801
802 <para>
803 It is also worth noting that the end result of these signature generators is to
804 make some dependency and hash information available to the build.
805 This information includes:
806 <itemizedlist>
807 <listitem><para><filename>BB_BASEHASH_task-</filename><replaceable>taskname</replaceable>:
808 The base hashes for each task in the recipe.
809 </para></listitem>
810 <listitem><para><filename>BB_BASEHASH_</filename><replaceable>filename</replaceable><filename>:</filename><replaceable>taskname</replaceable>:
811 The base hashes for each dependent task.
812 </para></listitem>
813 <listitem><para><filename>BBHASHDEPS_</filename><replaceable>filename</replaceable><filename>:</filename><replaceable>taskname</replaceable>:
814 The task dependencies for each task.
815 </para></listitem>
816 <listitem><para><filename>BB_TASKHASH</filename>:
817 The hash of the currently running task.
818 </para></listitem>
819 </itemizedlist>
820 </para>
821
822 <para>
823 It is worth noting that BitBake's "-S" option lets you
824 debug BitBake's processing of signatures.
825 The options passed to -S allow different debugging modes
826 to be used, either using BitBake's own debug functions
827 or possibly those defined in the metadata/signature handler
828 itself.
829 The simplest parameter to pass is "none", which causes a
830 set of signature information to be written out into
831 <filename>STAMPS_DIR</filename>
832 corresponding to the targets specified.
833 The other currently available parameter is "printdiff",
834 which causes BitBake to try to establish the closest
835 signature match it can (e.g. in the sstate cache) and then
836 run <filename>bitbake-diffsigs</filename> over the matches
837 to determine the stamps and delta where these two
838 stamp trees diverge.
839 <note>
840 It is likely that future versions of BitBake will
841 provide other signature handlers triggered through
842 additional "-S" parameters.
843 </note>
844 </para>
845
846 <para>
847 You can find more information on checksum metadata in the
848 "<link linkend='task-checksums-and-setscene'>Task Checksums and Setscene</link>"
849 section.
850 </para>
851 </section>
852
853 <section id='setscene'>
854 <title>Setscene</title>
855
856 <para>
857 The setscene process enables BitBake to handle "pre-built" artifacts.
858 The ability to handle and reuse these artifacts allows BitBake
859 the luxury of not having to build something from scratch every time.
860 Instead, BitBake can use, when possible, existing build artifacts.
861 </para>
862
863 <para>
864 BitBake needs to have reliable data indicating whether or not an
865 artifact is compatible.
866 Signatures, described in the previous section, provide an ideal
867 way of representing whether an artifact is compatible.
868 If a signature is the same, an object can be reused.
869 </para>
870
871 <para>
872 If an object can be reused, the problem then becomes how to
873 replace a given task or set of tasks with the pre-built artifact.
874 BitBake solves the problem with the "setscene" process.
875 </para>
876
877 <para>
878 When BitBake is asked to build a given target, before building anything,
879 it first asks whether cached information is available for any of the
880 targets it's building, or any of the intermediate targets.
881 If cached information is available, BitBake uses this information instead of
882 running the main tasks.
883 </para>
884
885 <para>
886 BitBake first calls the function defined by the
887 <link linkend='var-bb-BB_HASHCHECK_FUNCTION'><filename>BB_HASHCHECK_FUNCTION</filename></link>
888 variable with a list of tasks and corresponding
889 hashes it wants to build.
890 This function is designed to be fast and returns a list
891 of the tasks for which it believes in can obtain artifacts.
892 </para>
893
894 <para>
895 Next, for each of the tasks that were returned as possibilities,
896 BitBake executes a setscene version of the task that the possible
897 artifact covers.
898 Setscene versions of a task have the string "_setscene" appended to the
899 task name.
900 So, for example, the task with the name <filename>xxx</filename> has
901 a setscene task named <filename>xxx_setscene</filename>.
902 The setscene version of the task executes and provides the necessary
903 artifacts returning either success or failure.
904 </para>
905
906 <para>
907 As previously mentioned, an artifact can cover more than one task.
908 For example, it is pointless to obtain a compiler if you
909 already have the compiled binary.
910 To handle this, BitBake calls the
911 <link linkend='var-bb-BB_SETSCENE_DEPVALID'><filename>BB_SETSCENE_DEPVALID</filename></link>
912 function for each successful setscene task to know whether or not it needs
913 to obtain the dependencies of that task.
914 </para>
915
916 <para>
917 Finally, after all the setscene tasks have executed, BitBake calls the
918 function listed in
919 <link linkend='var-bb-BB_SETSCENE_VERIFY_FUNCTION2'><filename>BB_SETSCENE_VERIFY_FUNCTION2</filename></link>
920 with the list of tasks BitBake thinks has been "covered".
921 The metadata can then ensure that this list is correct and can
922 inform BitBake that it wants specific tasks to be run regardless
923 of the setscene result.
924 </para>
925
926 <para>
927 You can find more information on setscene metadata in the
928 "<link linkend='task-checksums-and-setscene'>Task Checksums and Setscene</link>"
929 section.
930 </para>
931 </section>
932
933 <section id="logging">
934 <title>Logging</title>
935 <para>
936 In addition to the standard command line option to control how
937 verbose builds are when execute, bitbake also supports user defined
938 configuration of the
939 <ulink url='https://docs.python.org/3/library/logging.html'>Python logging</ulink>
940 facilities through the
941 <link linkend="var-bb-BB_LOGCONFIG"><filename>BB_LOGCONFIG</filename></link>
942 variable. This variable defines a json or yaml
943 <ulink url='https://docs.python.org/3/library/logging.config.html'>logging configuration</ulink>
944 that will be intelligently merged into the default configuration.
945 The logging configuration is merged using the following rules:
946 <itemizedlist>
947 <listitem><para>
948 The user defined configuration will completely replace the default
949 configuration if top level key
950 <filename>bitbake_merge</filename> is set to the value
951 <filename>False</filename>. In this case, all other rules
952 are ignored.
953 </para></listitem>
954 <listitem><para>
955 The user configuration must have a top level
956 <filename>version</filename> which must match the value of
957 the default configuration.
958 </para></listitem>
959 <listitem><para>
960 Any keys defined in the <filename>handlers</filename>,
961 <filename>formatters</filename>, or <filename>filters</filename>,
962 will be merged into the same section in the default
963 configuration, with the user specified keys taking
964 replacing a default one if there is a conflict. In
965 practice, this means that if both the default configuration
966 and user configuration specify a handler named
967 <filename>myhandler</filename>, the user defined one will
968 replace the default. To prevent the user from inadvertently
969 replacing a default handler, formatter, or filter, all of
970 the default ones are named with a prefix of
971 "<filename>BitBake.</filename>"
972 </para></listitem>
973 <listitem><para>
974 If a logger is defined by the user with the key
975 <filename>bitbake_merge</filename> set to
976 <filename>False</filename>, that logger will be completely
977 replaced by user configuration. In this case, no other
978 rules will apply to that logger.
979 </para></listitem>
980 <listitem><para>
981 All user defined <filename>filter</filename> and
982 <filename>handlers</filename> properties for a given logger
983 will be merged with corresponding properties from the
984 default logger. For example, if the user configuration adds
985 a filter called <filename>myFilter</filename> to the
986 <filename>BitBake.SigGen</filename>, and the default
987 configuration adds a filter called
988 <filename>BitBake.defaultFilter</filename>, both filters
989 will be applied to the logger
990 </para></listitem>
991 </itemizedlist>
992 </para>
993
994 <para>
995 As an example, consider the following user logging configuration
996 file which logs all Hash Equivalence related messages of VERBOSE or
997 higher to a file called <filename>hashequiv.log</filename>
998 <literallayout class='monospaced'>
999 {
1000 "version": 1,
1001 "handlers": {
1002 "autobuilderlog": {
1003 "class": "logging.FileHandler",
1004 "formatter": "logfileFormatter",
1005 "level": "DEBUG",
1006 "filename": "hashequiv.log",
1007 "mode": "w"
1008 }
1009 },
1010 "formatters": {
1011 "logfileFormatter": {
1012 "format": "%(name)s: %(levelname)s: %(message)s"
1013 }
1014 },
1015 "loggers": {
1016 "BitBake.SigGen.HashEquiv": {
1017 "level": "VERBOSE",
1018 "handlers": ["autobuilderlog"]
1019 },
1020 "BitBake.RunQueue.HashEquiv": {
1021 "level": "VERBOSE",
1022 "handlers": ["autobuilderlog"]
1023 }
1024 }
1025 }
1026 </literallayout>
1027 </para>
1028 </section>
1029</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
new file mode 100644
index 0000000000..6760b10828
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -0,0 +1,652 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3=====================
4File Download Support
5=====================
6
7|
8
9BitBake's fetch module is a standalone piece of library code that deals
10with the intricacies of downloading source code and files from remote
11systems. Fetching source code is one of the cornerstones of building
12software. As such, this module forms an important part of BitBake.
13
14The current fetch module is called "fetch2" and refers to the fact that
15it is the second major version of the API. The original version is
16obsolete and has been removed from the codebase. Thus, in all cases,
17"fetch" refers to "fetch2" in this manual.
18
19The Download (Fetch)
20====================
21
22BitBake takes several steps when fetching source code or files. The
23fetcher codebase deals with two distinct processes in order: obtaining
24the files from somewhere (cached or otherwise) and then unpacking those
25files into a specific location and perhaps in a specific way. Getting
26and unpacking the files is often optionally followed by patching.
27Patching, however, is not covered by this module.
28
29The code to execute the first part of this process, a fetch, looks
30something like the following: ::
31
32 src_uri = (d.getVar('SRC_URI') or "").split()
33 fetcher = bb.fetch2.Fetch(src_uri, d)
34 fetcher.download()
35
36This code sets up an instance of the fetch class. The instance uses a
37space-separated list of URLs from the :term:`SRC_URI`
38variable and then calls the ``download`` method to download the files.
39
40The instantiation of the fetch class is usually followed by: ::
41
42 rootdir = l.getVar('WORKDIR')
43 fetcher.unpack(rootdir)
44
45This code unpacks the downloaded files to the specified by ``WORKDIR``.
46
47.. note::
48
49 For convenience, the naming in these examples matches the variables
50 used by OpenEmbedded. If you want to see the above code in action,
51 examine the OpenEmbedded class file ``base.bbclass``
52 .
53
54The ``SRC_URI`` and ``WORKDIR`` variables are not hardcoded into the
55fetcher, since those fetcher methods can be (and are) called with
56different variable names. In OpenEmbedded for example, the shared state
57(sstate) code uses the fetch module to fetch the sstate files.
58
59When the ``download()`` method is called, BitBake tries to resolve the
60URLs by looking for source files in a specific search order:
61
62- *Pre-mirror Sites:* BitBake first uses pre-mirrors to try and find
63 source files. These locations are defined using the
64 :term:`PREMIRRORS` variable.
65
66- *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g
67 from ``SRC_URI``).
68
69- *Mirror Sites:* If fetch failures occur, BitBake next uses mirror
70 locations as defined by the :term:`MIRRORS` variable.
71
72For each URL passed to the fetcher, the fetcher calls the submodule that
73handles that particular URL type. This behavior can be the source of
74some confusion when you are providing URLs for the ``SRC_URI`` variable.
75Consider the following two URLs: ::
76
77 http://git.yoctoproject.org/git/poky;protocol=git
78 git://git.yoctoproject.org/git/poky;protocol=http
79
80In the former case, the URL is passed to the ``wget`` fetcher, which does not
81understand "git". Therefore, the latter case is the correct form since the Git
82fetcher does know how to use HTTP as a transport.
83
84Here are some examples that show commonly used mirror definitions: ::
85
86 PREMIRRORS ?= "\
87 bzr://.*/.\* http://somemirror.org/sources/ \\n \
88 cvs://.*/.\* http://somemirror.org/sources/ \\n \
89 git://.*/.\* http://somemirror.org/sources/ \\n \
90 hg://.*/.\* http://somemirror.org/sources/ \\n \
91 osc://.*/.\* http://somemirror.org/sources/ \\n \
92 p4://.*/.\* http://somemirror.org/sources/ \\n \
93 svn://.*/.\* http://somemirror.org/sources/ \\n"
94
95 MIRRORS =+ "\
96 ftp://.*/.\* http://somemirror.org/sources/ \\n \
97 http://.*/.\* http://somemirror.org/sources/ \\n \
98 https://.*/.\* http://somemirror.org/sources/ \\n"
99
100It is useful to note that BitBake
101supports cross-URLs. It is possible to mirror a Git repository on an
102HTTP server as a tarball. This is what the ``git://`` mapping in the
103previous example does.
104
105Since network accesses are slow, BitBake maintains a cache of files
106downloaded from the network. Any source files that are not local (i.e.
107downloaded from the Internet) are placed into the download directory,
108which is specified by the :term:`DL_DIR` variable.
109
110File integrity is of key importance for reproducing builds. For
111non-local archive downloads, the fetcher code can verify SHA-256 and MD5
112checksums to ensure the archives have been downloaded correctly. You can
113specify these checksums by using the ``SRC_URI`` variable with the
114appropriate varflags as follows: ::
115
116 SRC_URI[md5sum] = "value"
117 SRC_URI[sha256sum] = "value"
118
119You can also specify the checksums as
120parameters on the ``SRC_URI`` as shown below: ::
121
122 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
123
124If multiple URIs exist, you can specify the checksums either directly as
125in the previous example, or you can name the URLs. The following syntax
126shows how you name the URIs: ::
127
128 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
129 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
130
131After a file has been downloaded and
132has had its checksum checked, a ".done" stamp is placed in ``DL_DIR``.
133BitBake uses this stamp during subsequent builds to avoid downloading or
134comparing a checksum for the file again.
135
136.. note::
137
138 It is assumed that local storage is safe from data corruption. If
139 this were not the case, there would be bigger issues to worry about.
140
141If :term:`BB_STRICT_CHECKSUM` is set, any
142download without a checksum triggers an error message. The
143:term:`BB_NO_NETWORK` variable can be used to
144make any attempted network access a fatal error, which is useful for
145checking that mirrors are complete as well as other things.
146
147.. _bb-the-unpack:
148
149The Unpack
150==========
151
152The unpack process usually immediately follows the download. For all
153URLs except Git URLs, BitBake uses the common ``unpack`` method.
154
155A number of parameters exist that you can specify within the URL to
156govern the behavior of the unpack stage:
157
158- *unpack:* Controls whether the URL components are unpacked. If set to
159 "1", which is the default, the components are unpacked. If set to
160 "0", the unpack stage leaves the file alone. This parameter is useful
161 when you want an archive to be copied in and not be unpacked.
162
163- *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether
164 to use DOS line ending conversion on text files.
165
166- *basepath:* Instructs the unpack stage to strip the specified
167 directories from the source path when unpacking.
168
169- *subdir:* Unpacks the specific URL to the specified subdirectory
170 within the root directory.
171
172The unpack call automatically decompresses and extracts files with ".Z",
173".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm", ".deb" and
174".bz2" extensions as well as various combinations of tarball extensions.
175
176As mentioned, the Git fetcher has its own unpack method that is
177optimized to work with Git trees. Basically, this method works by
178cloning the tree into the final directory. The process is completed
179using references so that there is only one central copy of the Git
180metadata needed.
181
182.. _bb-fetchers:
183
184Fetchers
185========
186
187As mentioned earlier, the URL prefix determines which fetcher submodule
188BitBake uses. Each submodule can support different URL parameters, which
189are described in the following sections.
190
191.. _local-file-fetcher:
192
193Local file fetcher (``file://``)
194--------------------------------
195
196This submodule handles URLs that begin with ``file://``. The filename
197you specify within the URL can be either an absolute or relative path to
198a file. If the filename is relative, the contents of the
199:term:`FILESPATH` variable is used in the same way
200``PATH`` is used to find executables. If the file cannot be found, it is
201assumed that it is available in :term:`DL_DIR` by the
202time the ``download()`` method is called.
203
204If you specify a directory, the entire directory is unpacked.
205
206Here are a couple of example URLs, the first relative and the second
207absolute: ::
208
209 SRC_URI = "file://relativefile.patch"
210 SRC_URI = "file:///Users/ich/very_important_software"
211
212.. _http-ftp-fetcher:
213
214HTTP/FTP wget fetcher (``http://``, ``ftp://``, ``https://``)
215-------------------------------------------------------------
216
217This fetcher obtains files from web and FTP servers. Internally, the
218fetcher uses the wget utility.
219
220The executable and parameters used are specified by the
221``FETCHCMD_wget`` variable, which defaults to sensible values. The
222fetcher supports a parameter "downloadfilename" that allows the name of
223the downloaded file to be specified. Specifying the name of the
224downloaded file is useful for avoiding collisions in
225:term:`DL_DIR` when dealing with multiple files that
226have the same name.
227
228Some example URLs are as follows: ::
229
230 SRC_URI = "http://oe.handhelds.org/not_there.aac"
231 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
232 SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan"
233
234.. note::
235
236 Because URL parameters are delimited by semi-colons, this can
237 introduce ambiguity when parsing URLs that also contain semi-colons,
238 for example:
239 ::
240
241 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
242
243
244 Such URLs should should be modified by replacing semi-colons with '&'
245 characters:
246 ::
247
248 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47"
249
250
251 In most cases this should work. Treating semi-colons and '&' in
252 queries identically is recommended by the World Wide Web Consortium
253 (W3C). Note that due to the nature of the URL, you may have to
254 specify the name of the downloaded file as well:
255 ::
256
257 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2"
258
259
260.. _cvs-fetcher:
261
262CVS fetcher (``(cvs://``)
263-------------------------
264
265This submodule handles checking out files from the CVS version control
266system. You can configure it using a number of different variables:
267
268- :term:`FETCHCMD_cvs <FETCHCMD>`: The name of the executable to use when running
269 the ``cvs`` command. This name is usually "cvs".
270
271- :term:`SRCDATE`: The date to use when fetching the CVS source code. A
272 special value of "now" causes the checkout to be updated on every
273 build.
274
275- :term:`CVSDIR`: Specifies where a temporary
276 checkout is saved. The location is often ``DL_DIR/cvs``.
277
278- CVS_PROXY_HOST: The name to use as a "proxy=" parameter to the
279 ``cvs`` command.
280
281- CVS_PROXY_PORT: The port number to use as a "proxyport="
282 parameter to the ``cvs`` command.
283
284As well as the standard username and password URL syntax, you can also
285configure the fetcher with various URL parameters:
286
287The supported parameters are as follows:
288
289- *"method":* The protocol over which to communicate with the CVS
290 server. By default, this protocol is "pserver". If "method" is set to
291 "ext", BitBake examines the "rsh" parameter and sets ``CVS_RSH``. You
292 can use "dir" for local directories.
293
294- *"module":* Specifies the module to check out. You must supply this
295 parameter.
296
297- *"tag":* Describes which CVS TAG should be used for the checkout. By
298 default, the TAG is empty.
299
300- *"date":* Specifies a date. If no "date" is specified, the
301 :term:`SRCDATE` of the configuration is used to
302 checkout a specific date. The special value of "now" causes the
303 checkout to be updated on every build.
304
305- *"localdir":* Used to rename the module. Effectively, you are
306 renaming the output directory to which the module is unpacked. You
307 are forcing the module into a special directory relative to
308 :term:`CVSDIR`.
309
310- *"rsh":* Used in conjunction with the "method" parameter.
311
312- *"scmdata":* Causes the CVS metadata to be maintained in the tarball
313 the fetcher creates when set to "keep". The tarball is expanded into
314 the work directory. By default, the CVS metadata is removed.
315
316- *"fullpath":* Controls whether the resulting checkout is at the
317 module level, which is the default, or is at deeper paths.
318
319- *"norecurse":* Causes the fetcher to only checkout the specified
320 directory with no recurse into any subdirectories.
321
322- *"port":* The port to which the CVS server connects.
323
324Some example URLs are as follows: ::
325
326 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
327 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
328
329.. _svn-fetcher:
330
331Subversion (SVN) Fetcher (``svn://``)
332-------------------------------------
333
334This fetcher submodule fetches code from the Subversion source control
335system. The executable used is specified by ``FETCHCMD_svn``, which
336defaults to "svn". The fetcher's temporary working directory is set by
337:term:`SVNDIR`, which is usually ``DL_DIR/svn``.
338
339The supported parameters are as follows:
340
341- *"module":* The name of the svn module to checkout. You must provide
342 this parameter. You can think of this parameter as the top-level
343 directory of the repository data you want.
344
345- *"path_spec":* A specific directory in which to checkout the
346 specified svn module.
347
348- *"protocol":* The protocol to use, which defaults to "svn". If
349 "protocol" is set to "svn+ssh", the "ssh" parameter is also used.
350
351- *"rev":* The revision of the source code to checkout.
352
353- *"scmdata":* Causes the ".svn" directories to be available during
354 compile-time when set to "keep". By default, these directories are
355 removed.
356
357- *"ssh":* An optional parameter used when "protocol" is set to
358 "svn+ssh". You can use this parameter to specify the ssh program used
359 by svn.
360
361- *"transportuser":* When required, sets the username for the
362 transport. By default, this parameter is empty. The transport
363 username is different than the username used in the main URL, which
364 is passed to the subversion command.
365
366Following are three examples using svn: ::
367
368 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
369 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
370 SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1"
371
372.. _git-fetcher:
373
374Git Fetcher (``git://``)
375------------------------
376
377This fetcher submodule fetches code from the Git source control system.
378The fetcher works by creating a bare clone of the remote into
379:term:`GITDIR`, which is usually ``DL_DIR/git2``. This
380bare clone is then cloned into the work directory during the unpack
381stage when a specific tree is checked out. This is done using alternates
382and by reference to minimize the amount of duplicate data on the disk
383and make the unpack process fast. The executable used can be set with
384``FETCHCMD_git``.
385
386This fetcher supports the following parameters:
387
388- *"protocol":* The protocol used to fetch the files. The default is
389 "git" when a hostname is set. If a hostname is not set, the Git
390 protocol is "file". You can also use "http", "https", "ssh" and
391 "rsync".
392
393- *"nocheckout":* Tells the fetcher to not checkout source code when
394 unpacking when set to "1". Set this option for the URL where there is
395 a custom routine to checkout code. The default is "0".
396
397- *"rebaseable":* Indicates that the upstream Git repository can be
398 rebased. You should set this parameter to "1" if revisions can become
399 detached from branches. In this case, the source mirror tarball is
400 done per revision, which has a loss of efficiency. Rebasing the
401 upstream Git repository could cause the current revision to disappear
402 from the upstream repository. This option reminds the fetcher to
403 preserve the local cache carefully for future use. The default value
404 for this parameter is "0".
405
406- *"nobranch":* Tells the fetcher to not check the SHA validation for
407 the branch when set to "1". The default is "0". Set this option for
408 the recipe that refers to the commit that is valid for a tag instead
409 of the branch.
410
411- *"bareclone":* Tells the fetcher to clone a bare clone into the
412 destination directory without checking out a working tree. Only the
413 raw Git metadata is provided. This parameter implies the "nocheckout"
414 parameter as well.
415
416- *"branch":* The branch(es) of the Git tree to clone. If unset, this
417 is assumed to be "master". The number of branch parameters much match
418 the number of name parameters.
419
420- *"rev":* The revision to use for the checkout. The default is
421 "master".
422
423- *"tag":* Specifies a tag to use for the checkout. To correctly
424 resolve tags, BitBake must access the network. For that reason, tags
425 are often not used. As far as Git is concerned, the "tag" parameter
426 behaves effectively the same as the "rev" parameter.
427
428- *"subpath":* Limits the checkout to a specific subpath of the tree.
429 By default, the whole tree is checked out.
430
431- *"destsuffix":* The name of the path in which to place the checkout.
432 By default, the path is ``git/``.
433
434- *"usehead":* Enables local ``git://`` URLs to use the current branch
435 HEAD as the revision for use with ``AUTOREV``. The "usehead"
436 parameter implies no branch and only works when the transfer protocol
437 is ``file://``.
438
439Here are some example URLs: ::
440
441 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
442 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
443
444.. _gitsm-fetcher:
445
446Git Submodule Fetcher (``gitsm://``)
447------------------------------------
448
449This fetcher submodule inherits from the :ref:`Git
450fetcher<bitbake-user-manual/bitbake-user-manual-fetching:git fetcher
451(\`\`git://\`\`)>` and extends that fetcher's behavior by fetching a
452repository's submodules. :term:`SRC_URI` is passed to the Git fetcher as
453described in the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:git
454fetcher (\`\`git://\`\`)` section.
455
456.. note::
457
458 You must clean a recipe when switching between '``git://``' and
459 '``gitsm://``' URLs.
460
461 The Git Submodules fetcher is not a complete fetcher implementation.
462 The fetcher has known issues where it does not use the normal source
463 mirroring infrastructure properly. Further, the submodule sources it
464 fetches are not visible to the licensing and source archiving
465 infrastructures.
466
467.. _clearcase-fetcher:
468
469ClearCase Fetcher (``ccrc://``)
470-------------------------------
471
472This fetcher submodule fetches code from a
473`ClearCase <http://en.wikipedia.org/wiki/Rational_ClearCase>`__
474repository.
475
476To use this fetcher, make sure your recipe has proper
477:term:`SRC_URI`, :term:`SRCREV`, and
478:term:`PV` settings. Here is an example: ::
479
480 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
481 SRCREV = "EXAMPLE_CLEARCASE_TAG"
482 PV = "${@d.getVar("SRCREV", False).replace("/", "+")}"
483
484The fetcher uses the ``rcleartool`` or
485``cleartool`` remote client, depending on which one is available.
486
487Following are options for the ``SRC_URI`` statement:
488
489- *vob*: The name, which must include the prepending "/" character,
490 of the ClearCase VOB. This option is required.
491
492- *module*: The module, which must include the prepending "/"
493 character, in the selected VOB.
494
495 .. note::
496
497 The module and vob options are combined to create the load rule in the
498 view config spec. As an example, consider the vob and module values from
499 the SRC_URI statement at the start of this section. Combining those values
500 results in the following: ::
501
502 load /example_vob/example_module
503
504- *proto*: The protocol, which can be either ``http`` or ``https``.
505
506By default, the fetcher creates a configuration specification. If you
507want this specification written to an area other than the default, use
508the ``CCASE_CUSTOM_CONFIG_SPEC`` variable in your recipe to define where
509the specification is written.
510
511.. note::
512
513 the SRCREV loses its functionality if you specify this variable. However,
514 SRCREV is still used to label the archive after a fetch even though it does
515 not define what is fetched.
516
517Here are a couple of other behaviors worth mentioning:
518
519- When using ``cleartool``, the login of ``cleartool`` is handled by
520 the system. The login require no special steps.
521
522- In order to use ``rcleartool`` with authenticated users, an
523 "rcleartool login" is necessary before using the fetcher.
524
525.. _perforce-fetcher:
526
527Perforce Fetcher (``p4://``)
528----------------------------
529
530This fetcher submodule fetches code from the
531`Perforce <https://www.perforce.com/>`__ source control system. The
532executable used is specified by ``FETCHCMD_p4``, which defaults to "p4".
533The fetcher's temporary working directory is set by
534:term:`P4DIR`, which defaults to "DL_DIR/p4".
535The fetcher does not make use of a perforce client, instead it
536relies on ``p4 files`` to retrieve a list of
537files and ``p4 print`` to transfer the content
538of those files locally.
539
540To use this fetcher, make sure your recipe has proper
541:term:`SRC_URI`, :term:`SRCREV`, and
542:term:`PV` values. The p4 executable is able to use the
543config file defined by your system's ``P4CONFIG`` environment variable
544in order to define the Perforce server URL and port, username, and
545password if you do not wish to keep those values in a recipe itself. If
546you choose not to use ``P4CONFIG``, or to explicitly set variables that
547``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is
548the server's URL and port number, and you can specify a username and
549password directly in your recipe within ``SRC_URI``.
550
551Here is an example that relies on ``P4CONFIG`` to specify the server URL
552and port, username, and password, and fetches the Head Revision: ::
553
554 SRC_URI = "p4://example-depot/main/source/..."
555 SRCREV = "${AUTOREV}"
556 PV = "p4-${SRCPV}"
557 S = "${WORKDIR}/p4"
558
559Here is an example that specifies the server URL and port, username, and
560password, and fetches a Revision based on a Label: ::
561
562 P4PORT = "tcp:p4server.example.net:1666"
563 SRC_URI = "p4://user:passwd@example-depot/main/source/..."
564 SRCREV = "release-1.0"
565 PV = "p4-${SRCPV}"
566 S = "${WORKDIR}/p4"
567
568.. note::
569
570 You should always set S to "${WORKDIR}/p4" in your recipe.
571
572By default, the fetcher strips the depot location from the local file paths. In
573the above example, the content of ``example-depot/main/source/`` will be placed
574in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot
575paths locally is desirable, the fetcher supports two parameters:
576
577- *"module":*
578 The top-level depot location or directory to fetch. The value of this
579 parameter can also point to a single file within the depot, in which case
580 the local file path will include the module path.
581- *"remotepath":*
582 When used with the value "``keep``", the fetcher will mirror the full depot
583 paths locally for the specified location, even in combination with the
584 ``module`` parameter.
585
586Here is an example use of the the ``module`` parameter: ::
587
588 SRC_URI = "p4://user:passwd@example-depot/main;module=source/..."
589
590In this case, the content of the top-level directory ``source/`` will be fetched
591to ``${P4DIR}``, including the directory itself. The top-level directory will
592be accesible at ``${P4DIR}/source/``.
593
594Here is an example use of the the ``remotepath`` parameter: ::
595
596 SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep"
597
598In this case, the content of the top-level directory ``source/`` will be fetched
599to ``${P4DIR}``, but the complete depot paths will be mirrored locally. The
600top-level directory will be accessible at
601``${P4DIR}/example-depot/main/source/``.
602
603.. _repo-fetcher:
604
605Repo Fetcher (``repo://``)
606--------------------------
607
608This fetcher submodule fetches code from ``google-repo`` source control
609system. The fetcher works by initiating and syncing sources of the
610repository into :term:`REPODIR`, which is usually
611``${DL_DIR}/repo``.
612
613This fetcher supports the following parameters:
614
615- *"protocol":* Protocol to fetch the repository manifest (default:
616 git).
617
618- *"branch":* Branch or tag of repository to get (default: master).
619
620- *"manifest":* Name of the manifest file (default: ``default.xml``).
621
622Here are some example URLs: ::
623
624 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml"
625 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml"
626
627Other Fetchers
628--------------
629
630Fetch submodules also exist for the following:
631
632- Bazaar (``bzr://``)
633
634- Mercurial (``hg://``)
635
636- npm (``npm://``)
637
638- OSC (``osc://``)
639
640- Secure FTP (``sftp://``)
641
642- Secure Shell (``ssh://``)
643
644- Trees using Git Annex (``gitannex://``)
645
646No documentation currently exists for these lesser used fetcher
647submodules. However, you might find the code helpful and readable.
648
649Auto Revisions
650==============
651
652We need to document ``AUTOREV`` and ``SRCREV_FORMAT`` here.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
deleted file mode 100644
index d1bfc23362..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
+++ /dev/null
@@ -1,868 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<chapter>
5<title>File Download Support</title>
6
7 <para>
8 BitBake's fetch module is a standalone piece of library code
9 that deals with the intricacies of downloading source code
10 and files from remote systems.
11 Fetching source code is one of the cornerstones of building software.
12 As such, this module forms an important part of BitBake.
13 </para>
14
15 <para>
16 The current fetch module is called "fetch2" and refers to the
17 fact that it is the second major version of the API.
18 The original version is obsolete and has been removed from the codebase.
19 Thus, in all cases, "fetch" refers to "fetch2" in this
20 manual.
21 </para>
22
23 <section id='the-download-fetch'>
24 <title>The Download (Fetch)</title>
25
26 <para>
27 BitBake takes several steps when fetching source code or files.
28 The fetcher codebase deals with two distinct processes in order:
29 obtaining the files from somewhere (cached or otherwise)
30 and then unpacking those files into a specific location and
31 perhaps in a specific way.
32 Getting and unpacking the files is often optionally followed
33 by patching.
34 Patching, however, is not covered by this module.
35 </para>
36
37 <para>
38 The code to execute the first part of this process, a fetch,
39 looks something like the following:
40 <literallayout class='monospaced'>
41 src_uri = (d.getVar('SRC_URI') or "").split()
42 fetcher = bb.fetch2.Fetch(src_uri, d)
43 fetcher.download()
44 </literallayout>
45 This code sets up an instance of the fetch class.
46 The instance uses a space-separated list of URLs from the
47 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>
48 variable and then calls the <filename>download</filename>
49 method to download the files.
50 </para>
51
52 <para>
53 The instantiation of the fetch class is usually followed by:
54 <literallayout class='monospaced'>
55 rootdir = l.getVar('WORKDIR')
56 fetcher.unpack(rootdir)
57 </literallayout>
58 This code unpacks the downloaded files to the
59 specified by <filename>WORKDIR</filename>.
60 <note>
61 For convenience, the naming in these examples matches
62 the variables used by OpenEmbedded.
63 If you want to see the above code in action, examine
64 the OpenEmbedded class file <filename>base.bbclass</filename>.
65 </note>
66 The <filename>SRC_URI</filename> and <filename>WORKDIR</filename>
67 variables are not hardcoded into the fetcher, since those fetcher
68 methods can be (and are) called with different variable names.
69 In OpenEmbedded for example, the shared state (sstate) code uses
70 the fetch module to fetch the sstate files.
71 </para>
72
73 <para>
74 When the <filename>download()</filename> method is called,
75 BitBake tries to resolve the URLs by looking for source files
76 in a specific search order:
77 <itemizedlist>
78 <listitem><para><emphasis>Pre-mirror Sites:</emphasis>
79 BitBake first uses pre-mirrors to try and find source files.
80 These locations are defined using the
81 <link linkend='var-bb-PREMIRRORS'><filename>PREMIRRORS</filename></link>
82 variable.
83 </para></listitem>
84 <listitem><para><emphasis>Source URI:</emphasis>
85 If pre-mirrors fail, BitBake uses the original URL (e.g from
86 <filename>SRC_URI</filename>).
87 </para></listitem>
88 <listitem><para><emphasis>Mirror Sites:</emphasis>
89 If fetch failures occur, BitBake next uses mirror locations as
90 defined by the
91 <link linkend='var-bb-MIRRORS'><filename>MIRRORS</filename></link>
92 variable.
93 </para></listitem>
94 </itemizedlist>
95 </para>
96
97 <para>
98 For each URL passed to the fetcher, the fetcher
99 calls the submodule that handles that particular URL type.
100 This behavior can be the source of some confusion when you
101 are providing URLs for the <filename>SRC_URI</filename>
102 variable.
103 Consider the following two URLs:
104 <literallayout class='monospaced'>
105 http://git.yoctoproject.org/git/poky;protocol=git
106 git://git.yoctoproject.org/git/poky;protocol=http
107 </literallayout>
108 In the former case, the URL is passed to the
109 <filename>wget</filename> fetcher, which does not
110 understand "git".
111 Therefore, the latter case is the correct form since the
112 Git fetcher does know how to use HTTP as a transport.
113 </para>
114
115 <para>
116 Here are some examples that show commonly used mirror
117 definitions:
118 <literallayout class='monospaced'>
119 PREMIRRORS ?= "\
120 bzr://.*/.* http://somemirror.org/sources/ \n \
121 cvs://.*/.* http://somemirror.org/sources/ \n \
122 git://.*/.* http://somemirror.org/sources/ \n \
123 hg://.*/.* http://somemirror.org/sources/ \n \
124 osc://.*/.* http://somemirror.org/sources/ \n \
125 p4://.*/.* http://somemirror.org/sources/ \n \
126 svn://.*/.* http://somemirror.org/sources/ \n"
127
128 MIRRORS =+ "\
129 ftp://.*/.* http://somemirror.org/sources/ \n \
130 http://.*/.* http://somemirror.org/sources/ \n \
131 https://.*/.* http://somemirror.org/sources/ \n"
132 </literallayout>
133 It is useful to note that BitBake supports
134 cross-URLs.
135 It is possible to mirror a Git repository on an HTTP
136 server as a tarball.
137 This is what the <filename>git://</filename> mapping in
138 the previous example does.
139 </para>
140
141 <para>
142 Since network accesses are slow, BitBake maintains a
143 cache of files downloaded from the network.
144 Any source files that are not local (i.e.
145 downloaded from the Internet) are placed into the download
146 directory, which is specified by the
147 <link linkend='var-bb-DL_DIR'><filename>DL_DIR</filename></link>
148 variable.
149 </para>
150
151 <para>
152 File integrity is of key importance for reproducing builds.
153 For non-local archive downloads, the fetcher code can verify
154 SHA-256 and MD5 checksums to ensure the archives have been
155 downloaded correctly.
156 You can specify these checksums by using the
157 <filename>SRC_URI</filename> variable with the appropriate
158 varflags as follows:
159 <literallayout class='monospaced'>
160 SRC_URI[md5sum] = "<replaceable>value</replaceable>"
161 SRC_URI[sha256sum] = "<replaceable>value</replaceable>"
162 </literallayout>
163 You can also specify the checksums as parameters on the
164 <filename>SRC_URI</filename> as shown below:
165 <literallayout class='monospaced'>
166 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
167 </literallayout>
168 If multiple URIs exist, you can specify the checksums either
169 directly as in the previous example, or you can name the URLs.
170 The following syntax shows how you name the URIs:
171 <literallayout class='monospaced'>
172 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
173 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
174 </literallayout>
175 After a file has been downloaded and has had its checksum checked,
176 a ".done" stamp is placed in <filename>DL_DIR</filename>.
177 BitBake uses this stamp during subsequent builds to avoid
178 downloading or comparing a checksum for the file again.
179 <note>
180 It is assumed that local storage is safe from data corruption.
181 If this were not the case, there would be bigger issues to worry about.
182 </note>
183 </para>
184
185 <para>
186 If
187 <link linkend='var-bb-BB_STRICT_CHECKSUM'><filename>BB_STRICT_CHECKSUM</filename></link>
188 is set, any download without a checksum triggers an
189 error message.
190 The
191 <link linkend='var-bb-BB_NO_NETWORK'><filename>BB_NO_NETWORK</filename></link>
192 variable can be used to make any attempted network access a fatal
193 error, which is useful for checking that mirrors are complete
194 as well as other things.
195 </para>
196 </section>
197
198 <section id='bb-the-unpack'>
199 <title>The Unpack</title>
200
201 <para>
202 The unpack process usually immediately follows the download.
203 For all URLs except Git URLs, BitBake uses the common
204 <filename>unpack</filename> method.
205 </para>
206
207 <para>
208 A number of parameters exist that you can specify within the
209 URL to govern the behavior of the unpack stage:
210 <itemizedlist>
211 <listitem><para><emphasis>unpack:</emphasis>
212 Controls whether the URL components are unpacked.
213 If set to "1", which is the default, the components
214 are unpacked.
215 If set to "0", the unpack stage leaves the file alone.
216 This parameter is useful when you want an archive to be
217 copied in and not be unpacked.
218 </para></listitem>
219 <listitem><para><emphasis>dos:</emphasis>
220 Applies to <filename>.zip</filename> and
221 <filename>.jar</filename> files and specifies whether to
222 use DOS line ending conversion on text files.
223 </para></listitem>
224 <listitem><para><emphasis>basepath:</emphasis>
225 Instructs the unpack stage to strip the specified
226 directories from the source path when unpacking.
227 </para></listitem>
228 <listitem><para><emphasis>subdir:</emphasis>
229 Unpacks the specific URL to the specified subdirectory
230 within the root directory.
231 </para></listitem>
232 </itemizedlist>
233 The unpack call automatically decompresses and extracts files
234 with ".Z", ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm".
235 ".srpm", ".deb" and ".bz2" extensions as well as various combinations
236 of tarball extensions.
237 </para>
238
239 <para>
240 As mentioned, the Git fetcher has its own unpack method that
241 is optimized to work with Git trees.
242 Basically, this method works by cloning the tree into the final
243 directory.
244 The process is completed using references so that there is
245 only one central copy of the Git metadata needed.
246 </para>
247 </section>
248
249 <section id='bb-fetchers'>
250 <title>Fetchers</title>
251
252 <para>
253 As mentioned earlier, the URL prefix determines which
254 fetcher submodule BitBake uses.
255 Each submodule can support different URL parameters,
256 which are described in the following sections.
257 </para>
258
259 <section id='local-file-fetcher'>
260 <title>Local file fetcher (<filename>file://</filename>)</title>
261
262 <para>
263 This submodule handles URLs that begin with
264 <filename>file://</filename>.
265 The filename you specify within the URL can be
266 either an absolute or relative path to a file.
267 If the filename is relative, the contents of the
268 <link linkend='var-bb-FILESPATH'><filename>FILESPATH</filename></link>
269 variable is used in the same way
270 <filename>PATH</filename> is used to find executables.
271 If the file cannot be found, it is assumed that it is available in
272 <link linkend='var-bb-DL_DIR'><filename>DL_DIR</filename></link>
273 by the time the <filename>download()</filename> method is called.
274 </para>
275
276 <para>
277 If you specify a directory, the entire directory is
278 unpacked.
279 </para>
280
281 <para>
282 Here are a couple of example URLs, the first relative and
283 the second absolute:
284 <literallayout class='monospaced'>
285 SRC_URI = "file://relativefile.patch"
286 SRC_URI = "file:///Users/ich/very_important_software"
287 </literallayout>
288 </para>
289 </section>
290
291 <section id='http-ftp-fetcher'>
292 <title>HTTP/FTP wget fetcher (<filename>http://</filename>, <filename>ftp://</filename>, <filename>https://</filename>)</title>
293
294 <para>
295 This fetcher obtains files from web and FTP servers.
296 Internally, the fetcher uses the wget utility.
297 </para>
298
299 <para>
300 The executable and parameters used are specified by the
301 <filename>FETCHCMD_wget</filename> variable, which defaults
302 to sensible values.
303 The fetcher supports a parameter "downloadfilename" that
304 allows the name of the downloaded file to be specified.
305 Specifying the name of the downloaded file is useful
306 for avoiding collisions in
307 <link linkend='var-bb-DL_DIR'><filename>DL_DIR</filename></link>
308 when dealing with multiple files that have the same name.
309 </para>
310
311 <para>
312 Some example URLs are as follows:
313 <literallayout class='monospaced'>
314 SRC_URI = "http://oe.handhelds.org/not_there.aac"
315 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
316 SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan"
317 </literallayout>
318 </para>
319 <note>
320 Because URL parameters are delimited by semi-colons, this can
321 introduce ambiguity when parsing URLs that also contain semi-colons,
322 for example:
323 <literallayout class='monospaced'>
324 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
325 </literallayout>
326 Such URLs should should be modified by replacing semi-colons with '&amp;' characters:
327 <literallayout class='monospaced'>
328 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&amp;a=snapshot&amp;h=a5dd47"
329 </literallayout>
330 In most cases this should work. Treating semi-colons and '&amp;' in queries
331 identically is recommended by the World Wide Web Consortium (W3C).
332 Note that due to the nature of the URL, you may have to specify the name
333 of the downloaded file as well:
334 <literallayout class='monospaced'>
335 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&amp;a=snapshot&amp;h=a5dd47;downloadfilename=myfile.bz2"
336 </literallayout>
337 </note>
338 </section>
339
340 <section id='cvs-fetcher'>
341 <title>CVS fetcher (<filename>(cvs://</filename>)</title>
342
343 <para>
344 This submodule handles checking out files from the
345 CVS version control system.
346 You can configure it using a number of different variables:
347 <itemizedlist>
348 <listitem><para><emphasis><filename>FETCHCMD_cvs</filename>:</emphasis>
349 The name of the executable to use when running
350 the <filename>cvs</filename> command.
351 This name is usually "cvs".
352 </para></listitem>
353 <listitem><para><emphasis><filename>SRCDATE</filename>:</emphasis>
354 The date to use when fetching the CVS source code.
355 A special value of "now" causes the checkout to
356 be updated on every build.
357 </para></listitem>
358 <listitem><para><emphasis><link linkend='var-bb-CVSDIR'><filename>CVSDIR</filename></link>:</emphasis>
359 Specifies where a temporary checkout is saved.
360 The location is often <filename>DL_DIR/cvs</filename>.
361 </para></listitem>
362 <listitem><para><emphasis><filename>CVS_PROXY_HOST</filename>:</emphasis>
363 The name to use as a "proxy=" parameter to the
364 <filename>cvs</filename> command.
365 </para></listitem>
366 <listitem><para><emphasis><filename>CVS_PROXY_PORT</filename>:</emphasis>
367 The port number to use as a "proxyport=" parameter to
368 the <filename>cvs</filename> command.
369 </para></listitem>
370 </itemizedlist>
371 As well as the standard username and password URL syntax,
372 you can also configure the fetcher with various URL parameters:
373 </para>
374
375 <para>
376 The supported parameters are as follows:
377 <itemizedlist>
378 <listitem><para><emphasis>"method":</emphasis>
379 The protocol over which to communicate with the CVS
380 server.
381 By default, this protocol is "pserver".
382 If "method" is set to "ext", BitBake examines the
383 "rsh" parameter and sets <filename>CVS_RSH</filename>.
384 You can use "dir" for local directories.
385 </para></listitem>
386 <listitem><para><emphasis>"module":</emphasis>
387 Specifies the module to check out.
388 You must supply this parameter.
389 </para></listitem>
390 <listitem><para><emphasis>"tag":</emphasis>
391 Describes which CVS TAG should be used for
392 the checkout.
393 By default, the TAG is empty.
394 </para></listitem>
395 <listitem><para><emphasis>"date":</emphasis>
396 Specifies a date.
397 If no "date" is specified, the
398 <link linkend='var-bb-SRCDATE'><filename>SRCDATE</filename></link>
399 of the configuration is used to checkout a specific date.
400 The special value of "now" causes the checkout to be
401 updated on every build.
402 </para></listitem>
403 <listitem><para><emphasis>"localdir":</emphasis>
404 Used to rename the module.
405 Effectively, you are renaming the output directory
406 to which the module is unpacked.
407 You are forcing the module into a special
408 directory relative to
409 <link linkend='var-bb-CVSDIR'><filename>CVSDIR</filename></link>.
410 </para></listitem>
411 <listitem><para><emphasis>"rsh"</emphasis>
412 Used in conjunction with the "method" parameter.
413 </para></listitem>
414 <listitem><para><emphasis>"scmdata":</emphasis>
415 Causes the CVS metadata to be maintained in the tarball
416 the fetcher creates when set to "keep".
417 The tarball is expanded into the work directory.
418 By default, the CVS metadata is removed.
419 </para></listitem>
420 <listitem><para><emphasis>"fullpath":</emphasis>
421 Controls whether the resulting checkout is at the
422 module level, which is the default, or is at deeper
423 paths.
424 </para></listitem>
425 <listitem><para><emphasis>"norecurse":</emphasis>
426 Causes the fetcher to only checkout the specified
427 directory with no recurse into any subdirectories.
428 </para></listitem>
429 <listitem><para><emphasis>"port":</emphasis>
430 The port to which the CVS server connects.
431 </para></listitem>
432 </itemizedlist>
433 Some example URLs are as follows:
434 <literallayout class='monospaced'>
435 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
436 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
437 </literallayout>
438 </para>
439 </section>
440
441 <section id='svn-fetcher'>
442 <title>Subversion (SVN) Fetcher (<filename>svn://</filename>)</title>
443
444 <para>
445 This fetcher submodule fetches code from the
446 Subversion source control system.
447 The executable used is specified by
448 <filename>FETCHCMD_svn</filename>, which defaults
449 to "svn".
450 The fetcher's temporary working directory is set by
451 <link linkend='var-bb-SVNDIR'><filename>SVNDIR</filename></link>,
452 which is usually <filename>DL_DIR/svn</filename>.
453 </para>
454
455 <para>
456 The supported parameters are as follows:
457 <itemizedlist>
458 <listitem><para><emphasis>"module":</emphasis>
459 The name of the svn module to checkout.
460 You must provide this parameter.
461 You can think of this parameter as the top-level
462 directory of the repository data you want.
463 </para></listitem>
464 <listitem><para><emphasis>"path_spec":</emphasis>
465 A specific directory in which to checkout the
466 specified svn module.
467 </para></listitem>
468 <listitem><para><emphasis>"protocol":</emphasis>
469 The protocol to use, which defaults to "svn".
470 If "protocol" is set to "svn+ssh", the "ssh"
471 parameter is also used.
472 </para></listitem>
473 <listitem><para><emphasis>"rev":</emphasis>
474 The revision of the source code to checkout.
475 </para></listitem>
476 <listitem><para><emphasis>"scmdata":</emphasis>
477 Causes the “.svn†directories to be available during
478 compile-time when set to "keep".
479 By default, these directories are removed.
480 </para></listitem>
481 <listitem><para><emphasis>"ssh":</emphasis>
482 An optional parameter used when "protocol" is set
483 to "svn+ssh".
484 You can use this parameter to specify the ssh
485 program used by svn.
486 </para></listitem>
487 <listitem><para><emphasis>"transportuser":</emphasis>
488 When required, sets the username for the transport.
489 By default, this parameter is empty.
490 The transport username is different than the username
491 used in the main URL, which is passed to the subversion
492 command.
493 </para></listitem>
494 </itemizedlist>
495 Following are three examples using svn:
496 <literallayout class='monospaced'>
497 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
498 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
499 SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1"
500 </literallayout>
501 </para>
502 </section>
503
504 <section id='git-fetcher'>
505 <title>Git Fetcher (<filename>git://</filename>)</title>
506
507 <para>
508 This fetcher submodule fetches code from the Git
509 source control system.
510 The fetcher works by creating a bare clone of the
511 remote into
512 <link linkend='var-bb-GITDIR'><filename>GITDIR</filename></link>,
513 which is usually <filename>DL_DIR/git2</filename>.
514 This bare clone is then cloned into the work directory during the
515 unpack stage when a specific tree is checked out.
516 This is done using alternates and by reference to
517 minimize the amount of duplicate data on the disk and
518 make the unpack process fast.
519 The executable used can be set with
520 <filename>FETCHCMD_git</filename>.
521 </para>
522
523 <para>
524 This fetcher supports the following parameters:
525 <itemizedlist>
526 <listitem><para><emphasis>"protocol":</emphasis>
527 The protocol used to fetch the files.
528 The default is "git" when a hostname is set.
529 If a hostname is not set, the Git protocol is "file".
530 You can also use "http", "https", "ssh" and "rsync".
531 </para></listitem>
532 <listitem><para><emphasis>"nocheckout":</emphasis>
533 Tells the fetcher to not checkout source code when
534 unpacking when set to "1".
535 Set this option for the URL where there is a custom
536 routine to checkout code.
537 The default is "0".
538 </para></listitem>
539 <listitem><para><emphasis>"rebaseable":</emphasis>
540 Indicates that the upstream Git repository can be rebased.
541 You should set this parameter to "1" if
542 revisions can become detached from branches.
543 In this case, the source mirror tarball is done per
544 revision, which has a loss of efficiency.
545 Rebasing the upstream Git repository could cause the
546 current revision to disappear from the upstream repository.
547 This option reminds the fetcher to preserve the local cache
548 carefully for future use.
549 The default value for this parameter is "0".
550 </para></listitem>
551 <listitem><para><emphasis>"nobranch":</emphasis>
552 Tells the fetcher to not check the SHA validation
553 for the branch when set to "1".
554 The default is "0".
555 Set this option for the recipe that refers to
556 the commit that is valid for a tag instead of
557 the branch.
558 </para></listitem>
559 <listitem><para><emphasis>"bareclone":</emphasis>
560 Tells the fetcher to clone a bare clone into the
561 destination directory without checking out a working tree.
562 Only the raw Git metadata is provided.
563 This parameter implies the "nocheckout" parameter as well.
564 </para></listitem>
565 <listitem><para><emphasis>"branch":</emphasis>
566 The branch(es) of the Git tree to clone.
567 If unset, this is assumed to be "master".
568 The number of branch parameters much match the number of
569 name parameters.
570 </para></listitem>
571 <listitem><para><emphasis>"rev":</emphasis>
572 The revision to use for the checkout.
573 The default is "master".
574 </para></listitem>
575 <listitem><para><emphasis>"tag":</emphasis>
576 Specifies a tag to use for the checkout.
577 To correctly resolve tags, BitBake must access the
578 network.
579 For that reason, tags are often not used.
580 As far as Git is concerned, the "tag" parameter behaves
581 effectively the same as the "rev" parameter.
582 </para></listitem>
583 <listitem><para><emphasis>"subpath":</emphasis>
584 Limits the checkout to a specific subpath of the tree.
585 By default, the whole tree is checked out.
586 </para></listitem>
587 <listitem><para><emphasis>"destsuffix":</emphasis>
588 The name of the path in which to place the checkout.
589 By default, the path is <filename>git/</filename>.
590 </para></listitem>
591 <listitem><para><emphasis>"usehead":</emphasis>
592 Enables local <filename>git://</filename> URLs to use the
593 current branch HEAD as the revision for use with
594 <filename>AUTOREV</filename>.
595 The "usehead" parameter implies no branch and only works
596 when the transfer protocol is
597 <filename>file://</filename>.
598 </para></listitem>
599 </itemizedlist>
600 Here are some example URLs:
601 <literallayout class='monospaced'>
602 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
603 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
604 </literallayout>
605 </para>
606 </section>
607
608 <section id='gitsm-fetcher'>
609 <title>Git Submodule Fetcher (<filename>gitsm://</filename>)</title>
610
611 <para>
612 This fetcher submodule inherits from the
613 <link linkend='git-fetcher'>Git fetcher</link> and extends
614 that fetcher's behavior by fetching a repository's submodules.
615 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>
616 is passed to the Git fetcher as described in the
617 "<link linkend='git-fetcher'>Git Fetcher (<filename>git://</filename>)</link>"
618 section.
619 <note>
620 <title>Notes and Warnings</title>
621 <para>
622 You must clean a recipe when switching between
623 '<filename>git://</filename>' and
624 '<filename>gitsm://</filename>' URLs.
625 </para>
626
627 <para>
628 The Git Submodules fetcher is not a complete fetcher
629 implementation.
630 The fetcher has known issues where it does not use the
631 normal source mirroring infrastructure properly. Further,
632 the submodule sources it fetches are not visible to the
633 licensing and source archiving infrastructures.
634 </para>
635 </note>
636 </para>
637 </section>
638
639 <section id='clearcase-fetcher'>
640 <title>ClearCase Fetcher (<filename>ccrc://</filename>)</title>
641
642 <para>
643 This fetcher submodule fetches code from a
644 <ulink url='http://en.wikipedia.org/wiki/Rational_ClearCase'>ClearCase</ulink>
645 repository.
646 </para>
647
648 <para>
649 To use this fetcher, make sure your recipe has proper
650 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>,
651 <link linkend='var-bb-SRCREV'><filename>SRCREV</filename></link>, and
652 <link linkend='var-bb-PV'><filename>PV</filename></link> settings.
653 Here is an example:
654 <literallayout class='monospaced'>
655 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
656 SRCREV = "EXAMPLE_CLEARCASE_TAG"
657 PV = "${@d.getVar("SRCREV", False).replace("/", "+")}"
658 </literallayout>
659 The fetcher uses the <filename>rcleartool</filename> or
660 <filename>cleartool</filename> remote client, depending on
661 which one is available.
662 </para>
663
664 <para>
665 Following are options for the <filename>SRC_URI</filename>
666 statement:
667 <itemizedlist>
668 <listitem><para><emphasis><filename>vob</filename></emphasis>:
669 The name, which must include the
670 prepending "/" character, of the ClearCase VOB.
671 This option is required.
672 </para></listitem>
673 <listitem><para><emphasis><filename>module</filename></emphasis>:
674 The module, which must include the
675 prepending "/" character, in the selected VOB.
676 <note>
677 The <filename>module</filename> and <filename>vob</filename>
678 options are combined to create the <filename>load</filename> rule in
679 the view config spec.
680 As an example, consider the <filename>vob</filename> and
681 <filename>module</filename> values from the
682 <filename>SRC_URI</filename> statement at the start of this section.
683 Combining those values results in the following:
684 <literallayout class='monospaced'>
685 load /example_vob/example_module
686 </literallayout>
687 </note>
688 </para></listitem>
689 <listitem><para><emphasis><filename>proto</filename></emphasis>:
690 The protocol, which can be either <filename>http</filename> or
691 <filename>https</filename>.
692 </para></listitem>
693 </itemizedlist>
694 </para>
695
696 <para>
697 By default, the fetcher creates a configuration specification.
698 If you want this specification written to an area other than the default,
699 use the <filename>CCASE_CUSTOM_CONFIG_SPEC</filename> variable
700 in your recipe to define where the specification is written.
701 <note>
702 the <filename>SRCREV</filename> loses its functionality if you
703 specify this variable.
704 However, <filename>SRCREV</filename> is still used to label the
705 archive after a fetch even though it does not define what is
706 fetched.
707 </note>
708 </para>
709
710 <para>
711 Here are a couple of other behaviors worth mentioning:
712 <itemizedlist>
713 <listitem><para>
714 When using <filename>cleartool</filename>, the login of
715 <filename>cleartool</filename> is handled by the system.
716 The login require no special steps.
717 </para></listitem>
718 <listitem><para>
719 In order to use <filename>rcleartool</filename> with authenticated
720 users, an "rcleartool login" is necessary before using the fetcher.
721 </para></listitem>
722 </itemizedlist>
723 </para>
724 </section>
725
726 <section id='perforce-fetcher'>
727 <title>Perforce Fetcher (<filename>p4://</filename>)</title>
728
729 <para>
730 This fetcher submodule fetches code from the
731 <ulink url='https://www.perforce.com/'>Perforce</ulink>
732 source control system.
733 The executable used is specified by
734 <filename>FETCHCMD_p4</filename>, which defaults
735 to "p4".
736 The fetcher's temporary working directory is set by
737 <link linkend='var-bb-P4DIR'><filename>P4DIR</filename></link>,
738 which defaults to "DL_DIR/p4".
739 </para>
740
741 <para>
742 To use this fetcher, make sure your recipe has proper
743 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>,
744 <link linkend='var-bb-SRCREV'><filename>SRCREV</filename></link>, and
745 <link linkend='var-bb-PV'><filename>PV</filename></link> values.
746 The p4 executable is able to use the config file defined by your
747 system's <filename>P4CONFIG</filename> environment variable in
748 order to define the Perforce server URL and port, username, and
749 password if you do not wish to keep those values in a recipe
750 itself.
751 If you choose not to use <filename>P4CONFIG</filename>,
752 or to explicitly set variables that <filename>P4CONFIG</filename>
753 can contain, you can specify the <filename>P4PORT</filename> value,
754 which is the server's URL and port number, and you can
755 specify a username and password directly in your recipe within
756 <filename>SRC_URI</filename>.
757 </para>
758
759 <para>
760 Here is an example that relies on <filename>P4CONFIG</filename>
761 to specify the server URL and port, username, and password, and
762 fetches the Head Revision:
763 <literallayout class='monospaced'>
764 SRC_URI = "p4://example-depot/main/source/..."
765 SRCREV = "${AUTOREV}"
766 PV = "p4-${SRCPV}"
767 S = "${WORKDIR}/p4"
768 </literallayout>
769 </para>
770
771 <para>
772 Here is an example that specifies the server URL and port,
773 username, and password, and fetches a Revision based on a Label:
774 <literallayout class='monospaced'>
775 P4PORT = "tcp:p4server.example.net:1666"
776 SRC_URI = "p4://user:passwd@example-depot/main/source/..."
777 SRCREV = "release-1.0"
778 PV = "p4-${SRCPV}"
779 S = "${WORKDIR}/p4"
780 </literallayout>
781 <note>
782 You should always set <filename>S</filename>
783 to <filename>"${WORKDIR}/p4"</filename> in your recipe.
784 </note>
785 </para>
786 </section>
787
788 <section id='repo-fetcher'>
789 <title>Repo Fetcher (<filename>repo://</filename>)</title>
790
791 <para>
792 This fetcher submodule fetches code from
793 <filename>google-repo</filename> source control system.
794 The fetcher works by initiating and syncing sources of the
795 repository into
796 <link linkend='var-bb-REPODIR'><filename>REPODIR</filename></link>,
797 which is usually
798 <link linkend='var-bb-DL_DIR'><filename>DL_DIR</filename></link><filename>/repo</filename>.
799 </para>
800
801 <para>
802 This fetcher supports the following parameters:
803 <itemizedlist>
804 <listitem><para>
805 <emphasis>"protocol":</emphasis>
806 Protocol to fetch the repository manifest (default: git).
807 </para></listitem>
808 <listitem><para>
809 <emphasis>"branch":</emphasis>
810 Branch or tag of repository to get (default: master).
811 </para></listitem>
812 <listitem><para>
813 <emphasis>"manifest":</emphasis>
814 Name of the manifest file (default: <filename>default.xml</filename>).
815 </para></listitem>
816 </itemizedlist>
817 Here are some example URLs:
818 <literallayout class='monospaced'>
819 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml"
820 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml"
821 </literallayout>
822 </para>
823 </section>
824
825 <section id='other-fetchers'>
826 <title>Other Fetchers</title>
827
828 <para>
829 Fetch submodules also exist for the following:
830 <itemizedlist>
831 <listitem><para>
832 Bazaar (<filename>bzr://</filename>)
833 </para></listitem>
834 <listitem><para>
835 Mercurial (<filename>hg://</filename>)
836 </para></listitem>
837 <listitem><para>
838 npm (<filename>npm://</filename>)
839 </para></listitem>
840 <listitem><para>
841 OSC (<filename>osc://</filename>)
842 </para></listitem>
843 <listitem><para>
844 Secure FTP (<filename>sftp://</filename>)
845 </para></listitem>
846 <listitem><para>
847 Secure Shell (<filename>ssh://</filename>)
848 </para></listitem>
849 <listitem><para>
850 Trees using Git Annex (<filename>gitannex://</filename>)
851 </para></listitem>
852 </itemizedlist>
853 No documentation currently exists for these lesser used
854 fetcher submodules.
855 However, you might find the code helpful and readable.
856 </para>
857 </section>
858 </section>
859
860 <section id='auto-revisions'>
861 <title>Auto Revisions</title>
862
863 <para>
864 We need to document <filename>AUTOREV</filename> and
865 <filename>SRCREV_FORMAT</filename> here.
866 </para>
867 </section>
868</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
new file mode 100644
index 0000000000..e3fd321588
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
@@ -0,0 +1,415 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3===================
4Hello World Example
5===================
6
7BitBake Hello World
8===================
9
10The simplest example commonly used to demonstrate any new programming
11language or tool is the "`Hello
12World <http://en.wikipedia.org/wiki/Hello_world_program>`__" example.
13This appendix demonstrates, in tutorial form, Hello World within the
14context of BitBake. The tutorial describes how to create a new project
15and the applicable metadata files necessary to allow BitBake to build
16it.
17
18Obtaining BitBake
19=================
20
21See the :ref:`bitbake-user-manual/bitbake-user-manual-hello:obtaining bitbake` section for
22information on how to obtain BitBake. Once you have the source code on
23your machine, the BitBake directory appears as follows: ::
24
25 $ ls -al
26 total 100
27 drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 .
28 drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 ..
29 -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS
30 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin
31 drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build
32 -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog
33 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes
34 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf
35 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib
36 -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING
37 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc
38 -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore
39 -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER
40 drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib
41 -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in
42 -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO
43
44At this point, you should have BitBake cloned to a directory that
45matches the previous listing except for dates and user names.
46
47Setting Up the BitBake Environment
48==================================
49
50First, you need to be sure that you can run BitBake. Set your working
51directory to where your local BitBake files are and run the following
52command: ::
53
54 $ ./bin/bitbake --version
55 BitBake Build Tool Core version 1.23.0, bitbake version 1.23.0
56
57The console output tells you what version
58you are running.
59
60The recommended method to run BitBake is from a directory of your
61choice. To be able to run BitBake from any directory, you need to add
62the executable binary to your binary to your shell's environment
63``PATH`` variable. First, look at your current ``PATH`` variable by
64entering the following: ::
65
66 $ echo $PATH
67
68Next, add the directory location
69for the BitBake binary to the ``PATH``. Here is an example that adds the
70``/home/scott-lenovo/bitbake/bin`` directory to the front of the
71``PATH`` variable: ::
72
73 $ export PATH=/home/scott-lenovo/bitbake/bin:$PATH
74
75You should now be able to enter the ``bitbake`` command from the command
76line while working from any directory.
77
78The Hello World Example
79=======================
80
81The overall goal of this exercise is to build a complete "Hello World"
82example utilizing task and layer concepts. Because this is how modern
83projects such as OpenEmbedded and the Yocto Project utilize BitBake, the
84example provides an excellent starting point for understanding BitBake.
85
86To help you understand how to use BitBake to build targets, the example
87starts with nothing but the ``bitbake`` command, which causes BitBake to
88fail and report problems. The example progresses by adding pieces to the
89build to eventually conclude with a working, minimal "Hello World"
90example.
91
92While every attempt is made to explain what is happening during the
93example, the descriptions cannot cover everything. You can find further
94information throughout this manual. Also, you can actively participate
95in the :oe_lists:`/g/bitbake-devel`
96discussion mailing list about the BitBake build tool.
97
98.. note::
99
100 This example was inspired by and drew heavily from
101 `Mailing List post - The BitBake equivalent of "Hello, World!"
102 <http://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_.
103
104As stated earlier, the goal of this example is to eventually compile
105"Hello World". However, it is unknown what BitBake needs and what you
106have to provide in order to achieve that goal. Recall that BitBake
107utilizes three types of metadata files:
108:ref:`bitbake-user-manual/bitbake-user-manual-intro:configuration files`,
109:ref:`bitbake-user-manual/bitbake-user-manual-intro:classes`, and
110:ref:`bitbake-user-manual/bitbake-user-manual-intro:recipes`.
111But where do they go? How does BitBake find
112them? BitBake's error messaging helps you answer these types of
113questions and helps you better understand exactly what is going on.
114
115Following is the complete "Hello World" example.
116
117#. **Create a Project Directory:** First, set up a directory for the
118 "Hello World" project. Here is how you can do so in your home
119 directory: ::
120
121 $ mkdir ~/hello
122 $ cd ~/hello
123
124 This is the directory that
125 BitBake will use to do all of its work. You can use this directory
126 to keep all the metafiles needed by BitBake. Having a project
127 directory is a good way to isolate your project.
128
129#. **Run BitBake:** At this point, you have nothing but a project
130 directory. Run the ``bitbake`` command and see what it does: ::
131
132 $ bitbake
133 The BBPATH variable is not set and bitbake did not
134 find a conf/bblayers.conf file in the expected location.
135 Maybe you accidentally invoked bitbake from the wrong directory?
136 DEBUG: Removed the following variables from the environment:
137 GNOME_DESKTOP_SESSION_ID, XDG_CURRENT_DESKTOP,
138 GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, no_proxy,
139 XDG_SESSION_PATH, XAUTHORITY, SESSION_MANAGER, SHLVL,
140 MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, WINDOWID, EDITOR,
141 GPG_AGENT_INFO, SSH_AUTH_SOCK, GDMSESSION, GNOME_KEYRING_PID,
142 XDG_SEAT_PATH, XDG_CONFIG_DIRS, LESSOPEN, DBUS_SESSION_BUS_ADDRESS,
143 _, XDG_SESSION_COOKIE, DESKTOP_SESSION, LESSCLOSE, DEFAULTS_PATH,
144 UBUNTU_MENUPROXY, OLDPWD, XDG_DATA_DIRS, COLORTERM, LS_COLORS
145
146 The majority of this output is specific to environment variables that
147 are not directly relevant to BitBake. However, the very first
148 message regarding the ``BBPATH`` variable and the
149 ``conf/bblayers.conf`` file is relevant.
150
151 When you run BitBake, it begins looking for metadata files. The
152 :term:`BBPATH` variable is what tells BitBake where
153 to look for those files. ``BBPATH`` is not set and you need to set
154 it. Without ``BBPATH``, BitBake cannot find any configuration files
155 (``.conf``) or recipe files (``.bb``) at all. BitBake also cannot
156 find the ``bitbake.conf`` file.
157
158#. **Setting BBPATH:** For this example, you can set ``BBPATH`` in
159 the same manner that you set ``PATH`` earlier in the appendix. You
160 should realize, though, that it is much more flexible to set the
161 ``BBPATH`` variable up in a configuration file for each project.
162
163 From your shell, enter the following commands to set and export the
164 ``BBPATH`` variable: ::
165
166 $ BBPATH="projectdirectory"
167 $ export BBPATH
168
169 Use your actual project directory in the command. BitBake uses that
170 directory to find the metadata it needs for your project.
171
172 .. note::
173
174 When specifying your project directory, do not use the tilde
175 ("~") character as BitBake does not expand that character as the
176 shell would.
177
178#. **Run BitBake:** Now that you have ``BBPATH`` defined, run the
179 ``bitbake`` command again: ::
180
181 $ bitbake
182 ERROR: Traceback (most recent call last):
183 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
184 return func(fn, *args)
185 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 173, in parse_config_file
186 return bb.parse.handle(fn, data, include)
187 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 99, in handle
188 return h['handle'](fn, data, include)
189 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 120, in handle
190 abs_fn = resolve_file(fn, data)
191 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 117, in resolve_file
192 raise IOError("file %s not found in %s" % (fn, bbpath))
193 IOError: file conf/bitbake.conf not found in /home/scott-lenovo/hello
194
195 ERROR: Unable to parse conf/bitbake.conf: file conf/bitbake.conf not found in /home/scott-lenovo/hello
196
197 This sample output shows that BitBake could not find the
198 ``conf/bitbake.conf`` file in the project directory. This file is
199 the first thing BitBake must find in order to build a target. And,
200 since the project directory for this example is empty, you need to
201 provide a ``conf/bitbake.conf`` file.
202
203#. **Creating conf/bitbake.conf:** The ``conf/bitbake.conf`` includes
204 a number of configuration variables BitBake uses for metadata and
205 recipe files. For this example, you need to create the file in your
206 project directory and define some key BitBake variables. For more
207 information on the ``bitbake.conf`` file, see
208 http://git.openembedded.org/bitbake/tree/conf/bitbake.conf.
209
210 Use the following commands to create the ``conf`` directory in the
211 project directory: ::
212
213 $ mkdir conf
214
215 From within the ``conf`` directory,
216 use some editor to create the ``bitbake.conf`` so that it contains
217 the following: ::
218
219 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
220
221 TMPDIR = "${TOPDIR}/tmp"
222 CACHE = "${TMPDIR}/cache"
223 STAMP = "${TMPDIR}/${PN}/stamps"
224 T = "${TMPDIR}/${PN}/work"
225 B = "${TMPDIR}/${PN}"
226
227 .. note::
228
229 Without a value for PN , the variables STAMP , T , and B , prevent more
230 than one recipe from working. You can fix this by either setting PN to
231 have a value similar to what OpenEmbedded and BitBake use in the default
232 bitbake.conf file (see previous example). Or, by manually updating each
233 recipe to set PN . You will also need to include PN as part of the STAMP
234 , T , and B variable definitions in the local.conf file.
235
236 The ``TMPDIR`` variable establishes a directory that BitBake uses
237 for build output and intermediate files other than the cached
238 information used by the
239 :ref:`bitbake-user-manual/bitbake-user-manual-execution:setscene`
240 process. Here, the ``TMPDIR`` directory is set to ``hello/tmp``.
241
242 .. tip::
243
244 You can always safely delete the tmp directory in order to rebuild a
245 BitBake target. The build process creates the directory for you when you
246 run BitBake.
247
248 For information about each of the other variables defined in this
249 example, check :term:`PN`, :term:`TOPDIR`, :term:`CACHE`, :term:`STAMP`,
250 :term:`T` or :term:`B` to take you to the definitions in the
251 glossary.
252
253#. **Run BitBake:** After making sure that the ``conf/bitbake.conf`` file
254 exists, you can run the ``bitbake`` command again: ::
255
256 $ bitbake
257 ERROR: Traceback (most recent call last):
258 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
259 return func(fn, *args)
260 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 177, in _inherit
261 bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data)
262 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 92, in inherit
263 include(fn, file, lineno, d, "inherit")
264 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 100, in include
265 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
266 ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
267
268 ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
269
270 In the sample output,
271 BitBake could not find the ``classes/base.bbclass`` file. You need
272 to create that file next.
273
274#. **Creating classes/base.bbclass:** BitBake uses class files to
275 provide common code and functionality. The minimally required class
276 for BitBake is the ``classes/base.bbclass`` file. The ``base`` class
277 is implicitly inherited by every recipe. BitBake looks for the class
278 in the ``classes`` directory of the project (i.e ``hello/classes``
279 in this example).
280
281 Create the ``classes`` directory as follows: ::
282
283 $ cd $HOME/hello
284 $ mkdir classes
285
286 Move to the ``classes`` directory and then create the
287 ``base.bbclass`` file by inserting this single line: addtask build
288 The minimal task that BitBake runs is the ``do_build`` task. This is
289 all the example needs in order to build the project. Of course, the
290 ``base.bbclass`` can have much more depending on which build
291 environments BitBake is supporting.
292
293#. **Run BitBake:** After making sure that the ``classes/base.bbclass``
294 file exists, you can run the ``bitbake`` command again: ::
295
296 $ bitbake
297 Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.
298
299 BitBake is finally reporting
300 no errors. However, you can see that it really does not have
301 anything to do. You need to create a recipe that gives BitBake
302 something to do.
303
304#. **Creating a Layer:** While it is not really necessary for such a
305 small example, it is good practice to create a layer in which to
306 keep your code separate from the general metadata used by BitBake.
307 Thus, this example creates and uses a layer called "mylayer".
308
309 .. note::
310
311 You can find additional information on layers in the
312 ":ref:`bitbake-user-manual/bitbake-user-manual-intro:Layers`" section.
313
314 Minimally, you need a recipe file and a layer configuration file in
315 your layer. The configuration file needs to be in the ``conf``
316 directory inside the layer. Use these commands to set up the layer
317 and the ``conf`` directory: ::
318
319 $ cd $HOME
320 $ mkdir mylayer
321 $ cd mylayer
322 $ mkdir conf
323
324 Move to the ``conf`` directory and create a ``layer.conf`` file that has the
325 following: ::
326
327 BBPATH .= ":${LAYERDIR}"
328 BBFILES += "${LAYERDIR}/\*.bb"
329 BBFILE_COLLECTIONS += "mylayer"
330 `BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/"
331
332 For information on these variables, click on :term:`BBFILES`,
333 :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS` or :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>`
334 to go to the definitions in the glossary.
335
336 You need to create the recipe file next. Inside your layer at the
337 top-level, use an editor and create a recipe file named
338 ``printhello.bb`` that has the following: ::
339
340 DESCRIPTION = "Prints Hello World"
341 PN = 'printhello'
342 PV = '1'
343
344 python do_build() {
345 bb.plain("********************");
346 bb.plain("* *");
347 bb.plain("* Hello, World! *");
348 bb.plain("* *");
349 bb.plain("********************");
350 }
351
352 The recipe file simply provides
353 a description of the recipe, the name, version, and the ``do_build``
354 task, which prints out "Hello World" to the console. For more
355 information on :term:`DESCRIPTION`, :term:`PN` or :term:`PV`
356 follow the links to the glossary.
357
358#. **Run BitBake With a Target:** Now that a BitBake target exists, run
359 the command and provide that target: ::
360
361 $ cd $HOME/hello
362 $ bitbake printhello
363 ERROR: no recipe files to build, check your BBPATH and BBFILES?
364
365 Summary: There was 1 ERROR message shown, returning a non-zero exit code.
366
367 We have created the layer with the recipe and
368 the layer configuration file but it still seems that BitBake cannot
369 find the recipe. BitBake needs a ``conf/bblayers.conf`` that lists
370 the layers for the project. Without this file, BitBake cannot find
371 the recipe.
372
373#. **Creating conf/bblayers.conf:** BitBake uses the
374 ``conf/bblayers.conf`` file to locate layers needed for the project.
375 This file must reside in the ``conf`` directory of the project (i.e.
376 ``hello/conf`` for this example).
377
378 Set your working directory to the ``hello/conf`` directory and then
379 create the ``bblayers.conf`` file so that it contains the following: ::
380
381 BBLAYERS ?= " \
382 /home/<you>/mylayer \
383 "
384
385 You need to provide your own information for ``you`` in the file.
386
387#. **Run BitBake With a Target:** Now that you have supplied the
388 ``bblayers.conf`` file, run the ``bitbake`` command and provide the
389 target: ::
390
391 $ bitbake printhello
392 Parsing recipes: 100% |##################################################################################|
393 Time: 00:00:00
394 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors.
395 NOTE: Resolving any missing task queue dependencies
396 NOTE: Preparing RunQueue
397 NOTE: Executing RunQueue Tasks
398 ********************
399 * *
400 * Hello, World! *
401 * *
402 ********************
403 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.
404
405 .. note::
406
407 After the first execution, re-running bitbake printhello again will not
408 result in a BitBake run that prints the same console output. The reason
409 for this is that the first time the printhello.bb recipe's do_build task
410 executes successfully, BitBake writes a stamp file for the task. Thus,
411 the next time you attempt to run the task using that same bitbake
412 command, BitBake notices the stamp and therefore determines that the task
413 does not need to be re-run. If you delete the tmp directory or run
414 bitbake -c clean printhello and then re-run the build, the "Hello,
415 World!" message will be printed again.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
deleted file mode 100644
index 11eb36aaf8..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
+++ /dev/null
@@ -1,513 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<appendix id='hello-world-example'>
5 <title>Hello World Example</title>
6
7 <section id='bitbake-hello-world'>
8 <title>BitBake Hello World</title>
9
10 <para>
11 The simplest example commonly used to demonstrate any new
12 programming language or tool is the
13 "<ulink url="http://en.wikipedia.org/wiki/Hello_world_program">Hello World</ulink>"
14 example.
15 This appendix demonstrates, in tutorial form, Hello
16 World within the context of BitBake.
17 The tutorial describes how to create a new project
18 and the applicable metadata files necessary to allow
19 BitBake to build it.
20 </para>
21 </section>
22
23 <section id='example-obtaining-bitbake'>
24 <title>Obtaining BitBake</title>
25
26 <para>
27 See the
28 "<link linkend='obtaining-bitbake'>Obtaining BitBake</link>"
29 section for information on how to obtain BitBake.
30 Once you have the source code on your machine, the BitBake directory
31 appears as follows:
32 <literallayout class='monospaced'>
33 $ ls -al
34 total 100
35 drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 .
36 drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 ..
37 -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS
38 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin
39 drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build
40 -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog
41 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes
42 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf
43 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib
44 -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING
45 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc
46 -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore
47 -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER
48 drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib
49 -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in
50 -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO
51 </literallayout>
52 </para>
53
54 <para>
55 At this point, you should have BitBake cloned to
56 a directory that matches the previous listing except for
57 dates and user names.
58 </para>
59 </section>
60
61 <section id='setting-up-the-bitbake-environment'>
62 <title>Setting Up the BitBake Environment</title>
63
64 <para>
65 First, you need to be sure that you can run BitBake.
66 Set your working directory to where your local BitBake
67 files are and run the following command:
68 <literallayout class='monospaced'>
69 $ ./bin/bitbake --version
70 BitBake Build Tool Core version 1.23.0, bitbake version 1.23.0
71 </literallayout>
72 The console output tells you what version you are running.
73 </para>
74
75 <para>
76 The recommended method to run BitBake is from a directory of your
77 choice.
78 To be able to run BitBake from any directory, you need to add the
79 executable binary to your binary to your shell's environment
80 <filename>PATH</filename> variable.
81 First, look at your current <filename>PATH</filename> variable
82 by entering the following:
83 <literallayout class='monospaced'>
84 $ echo $PATH
85 </literallayout>
86 Next, add the directory location for the BitBake binary to the
87 <filename>PATH</filename>.
88 Here is an example that adds the
89 <filename>/home/scott-lenovo/bitbake/bin</filename> directory
90 to the front of the <filename>PATH</filename> variable:
91 <literallayout class='monospaced'>
92 $ export PATH=/home/scott-lenovo/bitbake/bin:$PATH
93 </literallayout>
94 You should now be able to enter the <filename>bitbake</filename>
95 command from the command line while working from any directory.
96 </para>
97 </section>
98
99 <section id='the-hello-world-example'>
100 <title>The Hello World Example</title>
101
102 <para>
103 The overall goal of this exercise is to build a
104 complete "Hello World" example utilizing task and layer
105 concepts.
106 Because this is how modern projects such as OpenEmbedded and
107 the Yocto Project utilize BitBake, the example
108 provides an excellent starting point for understanding
109 BitBake.
110 </para>
111
112 <para>
113 To help you understand how to use BitBake to build targets,
114 the example starts with nothing but the <filename>bitbake</filename>
115 command, which causes BitBake to fail and report problems.
116 The example progresses by adding pieces to the build to
117 eventually conclude with a working, minimal "Hello World"
118 example.
119 </para>
120
121 <para>
122 While every attempt is made to explain what is happening during
123 the example, the descriptions cannot cover everything.
124 You can find further information throughout this manual.
125 Also, you can actively participate in the
126 <ulink url='http://lists.openembedded.org/mailman/listinfo/bitbake-devel'></ulink>
127 discussion mailing list about the BitBake build tool.
128 </para>
129
130 <note>
131 This example was inspired by and drew heavily from
132 <ulink url="http://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html">Mailing List post - The BitBake equivalent of "Hello, World!"</ulink>.
133 </note>
134
135 <para>
136 As stated earlier, the goal of this example
137 is to eventually compile "Hello World".
138 However, it is unknown what BitBake needs and what you have
139 to provide in order to achieve that goal.
140 Recall that BitBake utilizes three types of metadata files:
141 <link linkend='configuration-files'>Configuration Files</link>,
142 <link linkend='classes'>Classes</link>, and
143 <link linkend='recipes'>Recipes</link>.
144 But where do they go?
145 How does BitBake find them?
146 BitBake's error messaging helps you answer these types of questions
147 and helps you better understand exactly what is going on.
148 </para>
149
150 <para>
151 Following is the complete "Hello World" example.
152 </para>
153
154 <orderedlist>
155 <listitem><para><emphasis>Create a Project Directory:</emphasis>
156 First, set up a directory for the "Hello World" project.
157 Here is how you can do so in your home directory:
158 <literallayout class='monospaced'>
159 $ mkdir ~/hello
160 $ cd ~/hello
161 </literallayout>
162 This is the directory that BitBake will use to do all of
163 its work.
164 You can use this directory to keep all the metafiles needed
165 by BitBake.
166 Having a project directory is a good way to isolate your
167 project.
168 </para></listitem>
169 <listitem><para><emphasis>Run BitBake:</emphasis>
170 At this point, you have nothing but a project directory.
171 Run the <filename>bitbake</filename> command and see what
172 it does:
173 <literallayout class='monospaced'>
174 $ bitbake
175 The BBPATH variable is not set and bitbake did not
176 find a conf/bblayers.conf file in the expected location.
177 Maybe you accidentally invoked bitbake from the wrong directory?
178 DEBUG: Removed the following variables from the environment:
179 GNOME_DESKTOP_SESSION_ID, XDG_CURRENT_DESKTOP,
180 GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, no_proxy,
181 XDG_SESSION_PATH, XAUTHORITY, SESSION_MANAGER, SHLVL,
182 MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, WINDOWID, EDITOR,
183 GPG_AGENT_INFO, SSH_AUTH_SOCK, GDMSESSION, GNOME_KEYRING_PID,
184 XDG_SEAT_PATH, XDG_CONFIG_DIRS, LESSOPEN, DBUS_SESSION_BUS_ADDRESS,
185 _, XDG_SESSION_COOKIE, DESKTOP_SESSION, LESSCLOSE, DEFAULTS_PATH,
186 UBUNTU_MENUPROXY, OLDPWD, XDG_DATA_DIRS, COLORTERM, LS_COLORS
187 </literallayout>
188 The majority of this output is specific to environment variables
189 that are not directly relevant to BitBake.
190 However, the very first message regarding the
191 <filename>BBPATH</filename> variable and the
192 <filename>conf/bblayers.conf</filename> file
193 is relevant.</para>
194 <para>
195 When you run BitBake, it begins looking for metadata files.
196 The
197 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>
198 variable is what tells BitBake where to look for those files.
199 <filename>BBPATH</filename> is not set and you need to set it.
200 Without <filename>BBPATH</filename>, BitBake cannot
201 find any configuration files (<filename>.conf</filename>)
202 or recipe files (<filename>.bb</filename>) at all.
203 BitBake also cannot find the <filename>bitbake.conf</filename>
204 file.
205 </para></listitem>
206 <listitem><para><emphasis>Setting <filename>BBPATH</filename>:</emphasis>
207 For this example, you can set <filename>BBPATH</filename>
208 in the same manner that you set <filename>PATH</filename>
209 earlier in the appendix.
210 You should realize, though, that it is much more flexible to set the
211 <filename>BBPATH</filename> variable up in a configuration
212 file for each project.</para>
213 <para>From your shell, enter the following commands to set and
214 export the <filename>BBPATH</filename> variable:
215 <literallayout class='monospaced'>
216 $ BBPATH="<replaceable>projectdirectory</replaceable>"
217 $ export BBPATH
218 </literallayout>
219 Use your actual project directory in the command.
220 BitBake uses that directory to find the metadata it needs for
221 your project.
222 <note>
223 When specifying your project directory, do not use the
224 tilde ("~") character as BitBake does not expand that character
225 as the shell would.
226 </note>
227 </para></listitem>
228 <listitem><para><emphasis>Run BitBake:</emphasis>
229 Now that you have <filename>BBPATH</filename> defined, run
230 the <filename>bitbake</filename> command again:
231 <literallayout class='monospaced'>
232 $ bitbake
233 ERROR: Traceback (most recent call last):
234 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
235 return func(fn, *args)
236 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 173, in parse_config_file
237 return bb.parse.handle(fn, data, include)
238 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 99, in handle
239 return h['handle'](fn, data, include)
240 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 120, in handle
241 abs_fn = resolve_file(fn, data)
242 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 117, in resolve_file
243 raise IOError("file %s not found in %s" % (fn, bbpath))
244 IOError: file conf/bitbake.conf not found in /home/scott-lenovo/hello
245
246 ERROR: Unable to parse conf/bitbake.conf: file conf/bitbake.conf not found in /home/scott-lenovo/hello
247 </literallayout>
248 This sample output shows that BitBake could not find the
249 <filename>conf/bitbake.conf</filename> file in the project
250 directory.
251 This file is the first thing BitBake must find in order
252 to build a target.
253 And, since the project directory for this example is
254 empty, you need to provide a <filename>conf/bitbake.conf</filename>
255 file.
256 </para></listitem>
257 <listitem><para><emphasis>Creating <filename>conf/bitbake.conf</filename>:</emphasis>
258 The <filename>conf/bitbake.conf</filename> includes a number of
259 configuration variables BitBake uses for metadata and recipe
260 files.
261 For this example, you need to create the file in your project directory
262 and define some key BitBake variables.
263 For more information on the <filename>bitbake.conf</filename> file,
264 see
265 <ulink url='http://git.openembedded.org/bitbake/tree/conf/bitbake.conf'></ulink>.
266 </para>
267 <para>Use the following commands to create the <filename>conf</filename>
268 directory in the project directory:
269 <literallayout class='monospaced'>
270 $ mkdir conf
271 </literallayout>
272 From within the <filename>conf</filename> directory, use
273 some editor to create the <filename>bitbake.conf</filename>
274 so that it contains the following:
275 <literallayout class='monospaced'>
276 <link linkend='var-bb-PN'>PN</link> = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
277 </literallayout>
278 <literallayout class='monospaced'>
279 TMPDIR = "${<link linkend='var-bb-TOPDIR'>TOPDIR</link>}/tmp"
280 <link linkend='var-bb-CACHE'>CACHE</link> = "${TMPDIR}/cache"
281 <link linkend='var-bb-STAMP'>STAMP</link> = "${TMPDIR}/${PN}/stamps"
282 <link linkend='var-bb-T'>T</link> = "${TMPDIR}/${PN}/work"
283 <link linkend='var-bb-B'>B</link> = "${TMPDIR}/${PN}"
284 </literallayout>
285 <note>
286 Without a value for <filename>PN</filename>, the
287 variables <filename>STAMP</filename>,
288 <filename>T</filename>, and <filename>B</filename>,
289 prevent more than one recipe from working. You can fix
290 this by either setting <filename>PN</filename> to have
291 a value similar to what OpenEmbedded and BitBake use
292 in the default <filename>bitbake.conf</filename> file
293 (see previous example). Or, by manually updating each
294 recipe to set <filename>PN</filename>. You will also
295 need to include <filename>PN</filename> as part of the
296 <filename>STAMP</filename>, <filename>T</filename>, and
297 <filename>B</filename> variable definitions in the
298 <filename>local.conf</filename> file.
299 </note>
300 The <filename>TMPDIR</filename> variable establishes a directory
301 that BitBake uses for build output and intermediate files other
302 than the cached information used by the
303 <link linkend='setscene'>Setscene</link> process.
304 Here, the <filename>TMPDIR</filename> directory is set to
305 <filename>hello/tmp</filename>.
306 <note><title>Tip</title>
307 You can always safely delete the <filename>tmp</filename>
308 directory in order to rebuild a BitBake target.
309 The build process creates the directory for you
310 when you run BitBake.
311 </note></para>
312 <para>For information about each of the other variables defined in this
313 example, click on the links to take you to the definitions in
314 the glossary.
315 </para></listitem>
316 <listitem><para><emphasis>Run BitBake:</emphasis>
317 After making sure that the <filename>conf/bitbake.conf</filename>
318 file exists, you can run the <filename>bitbake</filename>
319 command again:
320 <literallayout class='monospaced'>
321 $ bitbake
322 ERROR: Traceback (most recent call last):
323 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
324 return func(fn, *args)
325 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 177, in _inherit
326 bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data)
327 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 92, in inherit
328 include(fn, file, lineno, d, "inherit")
329 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 100, in include
330 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
331 ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
332
333 ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
334 </literallayout>
335 In the sample output, BitBake could not find the
336 <filename>classes/base.bbclass</filename> file.
337 You need to create that file next.
338 </para></listitem>
339 <listitem><para><emphasis>Creating <filename>classes/base.bbclass</filename>:</emphasis>
340 BitBake uses class files to provide common code and functionality.
341 The minimally required class for BitBake is the
342 <filename>classes/base.bbclass</filename> file.
343 The <filename>base</filename> class is implicitly inherited by
344 every recipe.
345 BitBake looks for the class in the <filename>classes</filename>
346 directory of the project (i.e <filename>hello/classes</filename>
347 in this example).
348 </para>
349 <para>Create the <filename>classes</filename> directory as follows:
350 <literallayout class='monospaced'>
351 $ cd $HOME/hello
352 $ mkdir classes
353 </literallayout>
354 Move to the <filename>classes</filename> directory and then
355 create the <filename>base.bbclass</filename> file by inserting
356 this single line:
357 <literallayout class='monospaced'>
358 addtask build
359 </literallayout>
360 The minimal task that BitBake runs is the
361 <filename>do_build</filename> task.
362 This is all the example needs in order to build the project.
363 Of course, the <filename>base.bbclass</filename> can have much
364 more depending on which build environments BitBake is
365 supporting.
366 </para></listitem>
367 <listitem><para><emphasis>Run BitBake:</emphasis>
368 After making sure that the <filename>classes/base.bbclass</filename>
369 file exists, you can run the <filename>bitbake</filename>
370 command again:
371 <literallayout class='monospaced'>
372 $ bitbake
373 Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.
374 </literallayout>
375 BitBake is finally reporting no errors.
376 However, you can see that it really does not have anything
377 to do.
378 You need to create a recipe that gives BitBake something to do.
379 </para></listitem>
380 <listitem><para><emphasis>Creating a Layer:</emphasis>
381 While it is not really necessary for such a small example,
382 it is good practice to create a layer in which to keep your
383 code separate from the general metadata used by BitBake.
384 Thus, this example creates and uses a layer called "mylayer".
385 <note>
386 You can find additional information on layers in the
387 "<link linkend='layers'>Layers</link>" section.
388 </note></para>
389
390 <para>Minimally, you need a recipe file and a layer configuration
391 file in your layer.
392 The configuration file needs to be in the <filename>conf</filename>
393 directory inside the layer.
394 Use these commands to set up the layer and the <filename>conf</filename>
395 directory:
396 <literallayout class='monospaced'>
397 $ cd $HOME
398 $ mkdir mylayer
399 $ cd mylayer
400 $ mkdir conf
401 </literallayout>
402 Move to the <filename>conf</filename> directory and create a
403 <filename>layer.conf</filename> file that has the following:
404 <literallayout class='monospaced'>
405 BBPATH .= ":${<link linkend='var-bb-LAYERDIR'>LAYERDIR</link>}"
406
407 <link linkend='var-bb-BBFILES'>BBFILES</link> += "${LAYERDIR}/*.bb"
408
409 <link linkend='var-bb-BBFILE_COLLECTIONS'>BBFILE_COLLECTIONS</link> += "mylayer"
410 <link linkend='var-bb-BBFILE_PATTERN'>BBFILE_PATTERN_mylayer</link> := "^${LAYERDIR_RE}/"
411 </literallayout>
412 For information on these variables, click the links
413 to go to the definitions in the glossary.</para>
414 <para>You need to create the recipe file next.
415 Inside your layer at the top-level, use an editor and create
416 a recipe file named <filename>printhello.bb</filename> that
417 has the following:
418 <literallayout class='monospaced'>
419 <link linkend='var-bb-DESCRIPTION'>DESCRIPTION</link> = "Prints Hello World"
420 <link linkend='var-bb-PN'>PN</link> = 'printhello'
421 <link linkend='var-bb-PV'>PV</link> = '1'
422
423 python do_build() {
424 bb.plain("********************");
425 bb.plain("* *");
426 bb.plain("* Hello, World! *");
427 bb.plain("* *");
428 bb.plain("********************");
429 }
430 </literallayout>
431 The recipe file simply provides a description of the
432 recipe, the name, version, and the <filename>do_build</filename>
433 task, which prints out "Hello World" to the console.
434 For more information on these variables, follow the links
435 to the glossary.
436 </para></listitem>
437 <listitem><para><emphasis>Run BitBake With a Target:</emphasis>
438 Now that a BitBake target exists, run the command and provide
439 that target:
440 <literallayout class='monospaced'>
441 $ cd $HOME/hello
442 $ bitbake printhello
443 ERROR: no recipe files to build, check your BBPATH and BBFILES?
444
445 Summary: There was 1 ERROR message shown, returning a non-zero exit code.
446 </literallayout>
447 We have created the layer with the recipe and the layer
448 configuration file but it still seems that BitBake cannot
449 find the recipe.
450 BitBake needs a <filename>conf/bblayers.conf</filename> that
451 lists the layers for the project.
452 Without this file, BitBake cannot find the recipe.
453 </para></listitem>
454 <listitem><para><emphasis>Creating <filename>conf/bblayers.conf</filename>:</emphasis>
455 BitBake uses the <filename>conf/bblayers.conf</filename> file
456 to locate layers needed for the project.
457 This file must reside in the <filename>conf</filename> directory
458 of the project (i.e. <filename>hello/conf</filename> for this
459 example).</para>
460 <para>Set your working directory to the <filename>hello/conf</filename>
461 directory and then create the <filename>bblayers.conf</filename>
462 file so that it contains the following:
463 <literallayout class='monospaced'>
464 BBLAYERS ?= " \
465 /home/&lt;you&gt;/mylayer \
466 "
467 </literallayout>
468 You need to provide your own information for
469 <filename>you</filename> in the file.
470 </para></listitem>
471 <listitem><para><emphasis>Run BitBake With a Target:</emphasis>
472 Now that you have supplied the <filename>bblayers.conf</filename>
473 file, run the <filename>bitbake</filename> command and provide
474 the target:
475 <literallayout class='monospaced'>
476 $ bitbake printhello
477 Parsing recipes: 100% |##################################################################################|
478 Time: 00:00:00
479 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors.
480 NOTE: Resolving any missing task queue dependencies
481 NOTE: Preparing RunQueue
482 NOTE: Executing RunQueue Tasks
483 ********************
484 * *
485 * Hello, World! *
486 * *
487 ********************
488 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.
489 </literallayout>
490 BitBake finds the <filename>printhello</filename> recipe and
491 successfully runs the task.
492 <note>
493 After the first execution, re-running
494 <filename>bitbake printhello</filename> again will not
495 result in a BitBake run that prints the same console
496 output.
497 The reason for this is that the first time the
498 <filename>printhello.bb</filename> recipe's
499 <filename>do_build</filename> task executes
500 successfully, BitBake writes a stamp file for the task.
501 Thus, the next time you attempt to run the task
502 using that same <filename>bitbake</filename> command,
503 BitBake notices the stamp and therefore determines
504 that the task does not need to be re-run.
505 If you delete the <filename>tmp</filename> directory
506 or run <filename>bitbake -c clean printhello</filename>
507 and then re-run the build, the "Hello, World!" message will
508 be printed again.
509 </note>
510 </para></listitem>
511 </orderedlist>
512 </section>
513</appendix>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst
new file mode 100644
index 0000000000..6f9d392935
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst
@@ -0,0 +1,651 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3========
4Overview
5========
6
7|
8
9Welcome to the BitBake User Manual. This manual provides information on
10the BitBake tool. The information attempts to be as independent as
11possible regarding systems that use BitBake, such as OpenEmbedded and
12the Yocto Project. In some cases, scenarios or examples within the
13context of a build system are used in the manual to help with
14understanding. For these cases, the manual clearly states the context.
15
16.. _intro:
17
18Introduction
19============
20
21Fundamentally, BitBake is a generic task execution engine that allows
22shell and Python tasks to be run efficiently and in parallel while
23working within complex inter-task dependency constraints. One of
24BitBake's main users, OpenEmbedded, takes this core and builds embedded
25Linux software stacks using a task-oriented approach.
26
27Conceptually, BitBake is similar to GNU Make in some regards but has
28significant differences:
29
30- BitBake executes tasks according to provided metadata that builds up
31 the tasks. Metadata is stored in recipe (``.bb``) and related recipe
32 "append" (``.bbappend``) files, configuration (``.conf``) and
33 underlying include (``.inc``) files, and in class (``.bbclass``)
34 files. The metadata provides BitBake with instructions on what tasks
35 to run and the dependencies between those tasks.
36
37- BitBake includes a fetcher library for obtaining source code from
38 various places such as local files, source control systems, or
39 websites.
40
41- The instructions for each unit to be built (e.g. a piece of software)
42 are known as "recipe" files and contain all the information about the
43 unit (dependencies, source file locations, checksums, description and
44 so on).
45
46- BitBake includes a client/server abstraction and can be used from a
47 command line or used as a service over XML-RPC and has several
48 different user interfaces.
49
50History and Goals
51=================
52
53BitBake was originally a part of the OpenEmbedded project. It was
54inspired by the Portage package management system used by the Gentoo
55Linux distribution. On December 7, 2004, OpenEmbedded project team
56member Chris Larson split the project into two distinct pieces:
57
58- BitBake, a generic task executor
59
60- OpenEmbedded, a metadata set utilized by BitBake
61
62Today, BitBake is the primary basis of the
63`OpenEmbedded <http://www.openembedded.org/>`__ project, which is being
64used to build and maintain Linux distributions such as the `Angstrom
65Distribution <http://www.angstrom-distribution.org/>`__, and which is
66also being used as the build tool for Linux projects such as the `Yocto
67Project <http://www.yoctoproject.org>`__.
68
69Prior to BitBake, no other build tool adequately met the needs of an
70aspiring embedded Linux distribution. All of the build systems used by
71traditional desktop Linux distributions lacked important functionality,
72and none of the ad hoc Buildroot-based systems, prevalent in the
73embedded space, were scalable or maintainable.
74
75Some important original goals for BitBake were:
76
77- Handle cross-compilation.
78
79- Handle inter-package dependencies (build time on target architecture,
80 build time on native architecture, and runtime).
81
82- Support running any number of tasks within a given package,
83 including, but not limited to, fetching upstream sources, unpacking
84 them, patching them, configuring them, and so forth.
85
86- Be Linux distribution agnostic for both build and target systems.
87
88- Be architecture agnostic.
89
90- Support multiple build and target operating systems (e.g. Cygwin, the
91 BSDs, and so forth).
92
93- Be self-contained, rather than tightly integrated into the build
94 machine's root filesystem.
95
96- Handle conditional metadata on the target architecture, operating
97 system, distribution, and machine.
98
99- Be easy to use the tools to supply local metadata and packages
100 against which to operate.
101
102- Be easy to use BitBake to collaborate between multiple projects for
103 their builds.
104
105- Provide an inheritance mechanism to share common metadata between
106 many packages.
107
108Over time it became apparent that some further requirements were
109necessary:
110
111- Handle variants of a base recipe (e.g. native, sdk, and multilib).
112
113- Split metadata into layers and allow layers to enhance or override
114 other layers.
115
116- Allow representation of a given set of input variables to a task as a
117 checksum. Based on that checksum, allow acceleration of builds with
118 prebuilt components.
119
120BitBake satisfies all the original requirements and many more with
121extensions being made to the basic functionality to reflect the
122additional requirements. Flexibility and power have always been the
123priorities. BitBake is highly extensible and supports embedded Python
124code and execution of any arbitrary tasks.
125
126.. _Concepts:
127
128Concepts
129========
130
131BitBake is a program written in the Python language. At the highest
132level, BitBake interprets metadata, decides what tasks are required to
133run, and executes those tasks. Similar to GNU Make, BitBake controls how
134software is built. GNU Make achieves its control through "makefiles",
135while BitBake uses "recipes".
136
137BitBake extends the capabilities of a simple tool like GNU Make by
138allowing for the definition of much more complex tasks, such as
139assembling entire embedded Linux distributions.
140
141The remainder of this section introduces several concepts that should be
142understood in order to better leverage the power of BitBake.
143
144Recipes
145-------
146
147BitBake Recipes, which are denoted by the file extension ``.bb``, are
148the most basic metadata files. These recipe files provide BitBake with
149the following:
150
151- Descriptive information about the package (author, homepage, license,
152 and so on)
153
154- The version of the recipe
155
156- Existing dependencies (both build and runtime dependencies)
157
158- Where the source code resides and how to fetch it
159
160- Whether the source code requires any patches, where to find them, and
161 how to apply them
162
163- How to configure and compile the source code
164
165- How to assemble the generated artifacts into one or more installable
166 packages
167
168- Where on the target machine to install the package or packages
169 created
170
171Within the context of BitBake, or any project utilizing BitBake as its
172build system, files with the ``.bb`` extension are referred to as
173recipes.
174
175.. note::
176
177 The term "package" is also commonly used to describe recipes.
178 However, since the same word is used to describe packaged output from
179 a project, it is best to maintain a single descriptive term -
180 "recipes". Put another way, a single "recipe" file is quite capable
181 of generating a number of related but separately installable
182 "packages". In fact, that ability is fairly common.
183
184Configuration Files
185-------------------
186
187Configuration files, which are denoted by the ``.conf`` extension,
188define various configuration variables that govern the project's build
189process. These files fall into several areas that define machine
190configuration, distribution configuration, possible compiler tuning,
191general common configuration, and user configuration. The main
192configuration file is the sample ``bitbake.conf`` file, which is located
193within the BitBake source tree ``conf`` directory.
194
195Classes
196-------
197
198Class files, which are denoted by the ``.bbclass`` extension, contain
199information that is useful to share between metadata files. The BitBake
200source tree currently comes with one class metadata file called
201``base.bbclass``. You can find this file in the ``classes`` directory.
202The ``base.bbclass`` class files is special since it is always included
203automatically for all recipes and classes. This class contains
204definitions for standard basic tasks such as fetching, unpacking,
205configuring (empty by default), compiling (runs any Makefile present),
206installing (empty by default) and packaging (empty by default). These
207tasks are often overridden or extended by other classes added during the
208project development process.
209
210Layers
211------
212
213Layers allow you to isolate different types of customizations from each
214other. While you might find it tempting to keep everything in one layer
215when working on a single project, the more modular your metadata, the
216easier it is to cope with future changes.
217
218To illustrate how you can use layers to keep things modular, consider
219customizations you might make to support a specific target machine.
220These types of customizations typically reside in a special layer,
221rather than a general layer, called a Board Support Package (BSP) layer.
222Furthermore, the machine customizations should be isolated from recipes
223and metadata that support a new GUI environment, for example. This
224situation gives you a couple of layers: one for the machine
225configurations and one for the GUI environment. It is important to
226understand, however, that the BSP layer can still make machine-specific
227additions to recipes within the GUI environment layer without polluting
228the GUI layer itself with those machine-specific changes. You can
229accomplish this through a recipe that is a BitBake append
230(``.bbappend``) file.
231
232.. _append-bbappend-files:
233
234Append Files
235------------
236
237Append files, which are files that have the ``.bbappend`` file
238extension, extend or override information in an existing recipe file.
239
240BitBake expects every append file to have a corresponding recipe file.
241Furthermore, the append file and corresponding recipe file must use the
242same root filename. The filenames can differ only in the file type
243suffix used (e.g. ``formfactor_0.0.bb`` and
244``formfactor_0.0.bbappend``).
245
246Information in append files extends or overrides the information in the
247underlying, similarly-named recipe files.
248
249When you name an append file, you can use the "``%``" wildcard character
250to allow for matching recipe names. For example, suppose you have an
251append file named as follows: ::
252
253 busybox_1.21.%.bbappend
254
255That append file
256would match any ``busybox_1.21.``\ x\ ``.bb`` version of the recipe. So,
257the append file would match the following recipe names: ::
258
259 busybox_1.21.1.bb
260 busybox_1.21.2.bb
261 busybox_1.21.3.bb
262
263.. note::
264
265 The use of the " % " character is limited in that it only works directly in
266 front of the .bbappend portion of the append file's name. You cannot use the
267 wildcard character in any other location of the name.
268
269If the ``busybox`` recipe was updated to ``busybox_1.3.0.bb``, the
270append name would not match. However, if you named the append file
271``busybox_1.%.bbappend``, then you would have a match.
272
273In the most general case, you could name the append file something as
274simple as ``busybox_%.bbappend`` to be entirely version independent.
275
276Obtaining BitBake
277=================
278
279You can obtain BitBake several different ways:
280
281- **Cloning BitBake:** Using Git to clone the BitBake source code
282 repository is the recommended method for obtaining BitBake. Cloning
283 the repository makes it easy to get bug fixes and have access to
284 stable branches and the master branch. Once you have cloned BitBake,
285 you should use the latest stable branch for development since the
286 master branch is for BitBake development and might contain less
287 stable changes.
288
289 You usually need a version of BitBake that matches the metadata you
290 are using. The metadata is generally backwards compatible but not
291 forward compatible.
292
293 Here is an example that clones the BitBake repository: ::
294
295 $ git clone git://git.openembedded.org/bitbake
296
297 This command clones the BitBake
298 Git repository into a directory called ``bitbake``. Alternatively,
299 you can designate a directory after the ``git clone`` command if you
300 want to call the new directory something other than ``bitbake``. Here
301 is an example that names the directory ``bbdev``: ::
302
303 $ git clone git://git.openembedded.org/bitbake bbdev
304
305- **Installation using your Distribution Package Management System:**
306 This method is not recommended because the BitBake version that is
307 provided by your distribution, in most cases, is several releases
308 behind a snapshot of the BitBake repository.
309
310- **Taking a snapshot of BitBake:** Downloading a snapshot of BitBake
311 from the source code repository gives you access to a known branch or
312 release of BitBake.
313
314 .. note::
315
316 Cloning the Git repository, as described earlier, is the preferred
317 method for getting BitBake. Cloning the repository makes it easier
318 to update as patches are added to the stable branches.
319
320 The following example downloads a snapshot of BitBake version 1.17.0: ::
321
322 $ wget http://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz
323 $ tar zxpvf bitbake-1.17.0.tar.gz
324
325 After extraction of the tarball using
326 the tar utility, you have a directory entitled ``bitbake-1.17.0``.
327
328- **Using the BitBake that Comes With Your Build Checkout:** A final
329 possibility for getting a copy of BitBake is that it already comes
330 with your checkout of a larger BitBake-based build system, such as
331 Poky. Rather than manually checking out individual layers and gluing
332 them together yourself, you can check out an entire build system. The
333 checkout will already include a version of BitBake that has been
334 thoroughly tested for compatibility with the other components. For
335 information on how to check out a particular BitBake-based build
336 system, consult that build system's supporting documentation.
337
338.. _bitbake-user-manual-command:
339
340The BitBake Command
341===================
342
343The ``bitbake`` command is the primary interface to the BitBake tool.
344This section presents the BitBake command syntax and provides several
345execution examples.
346
347Usage and syntax
348----------------
349
350Following is the usage and syntax for BitBake: ::
351
352 $ bitbake -h
353 Usage: bitbake [options] [recipename/target recipe:do_task ...]
354
355 Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
356 It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
357 will provide the layer, BBFILES and other configuration information.
358
359 Options:
360 --version show program's version number and exit
361 -h, --help show this help message and exit
362 -b BUILDFILE, --buildfile=BUILDFILE
363 Execute tasks from a specific .bb recipe directly.
364 WARNING: Does not handle any dependencies from other
365 recipes.
366 -k, --continue Continue as much as possible after an error. While the
367 target that failed and anything depending on it cannot
368 be built, as much as possible will be built before
369 stopping.
370 -f, --force Force the specified targets/task to run (invalidating
371 any existing stamp file).
372 -c CMD, --cmd=CMD Specify the task to execute. The exact options
373 available depend on the metadata. Some examples might
374 be 'compile' or 'populate_sysroot' or 'listtasks' may
375 give a list of the tasks available.
376 -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP
377 Invalidate the stamp for the specified task such as
378 'compile' and then run the default task for the
379 specified target(s).
380 -r PREFILE, --read=PREFILE
381 Read the specified file before bitbake.conf.
382 -R POSTFILE, --postread=POSTFILE
383 Read the specified file after bitbake.conf.
384 -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also
385 print bb.note(...) messages to stdout (in addition to
386 writing them to ${T}/log.do_&lt;task&gt;).
387 -D, --debug Increase the debug level. You can specify this more
388 than once. -D sets the debug level to 1, where only
389 bb.debug(1, ...) messages are printed to stdout; -DD
390 sets the debug level to 2, where both bb.debug(1, ...)
391 and bb.debug(2, ...) messages are printed; etc.
392 Without -D, no debug messages are printed. Note that
393 -D only affects output to stdout. All debug messages
394 are written to ${T}/log.do_taskname, regardless of the
395 debug level.
396 -q, --quiet Output less log message data to the terminal. You can
397 specify this more than once.
398 -n, --dry-run Don't execute, just go through the motions.
399 -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER
400 Dump out the signature construction information, with
401 no task execution. The SIGNATURE_HANDLER parameter is
402 passed to the handler. Two common values are none and
403 printdiff but the handler may define more/less. none
404 means only dump the signature, printdiff means compare
405 the dumped signature with the cached one.
406 -p, --parse-only Quit after parsing the BB recipes.
407 -s, --show-versions Show current and preferred versions of all recipes.
408 -e, --environment Show the global or per-recipe environment complete
409 with information about where variables were
410 set/changed.
411 -g, --graphviz Save dependency tree information for the specified
412 targets in the dot syntax.
413 -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED
414 Assume these dependencies don't exist and are already
415 provided (equivalent to ASSUME_PROVIDED). Useful to
416 make dependency graphs more appealing
417 -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS
418 Show debug logging for the specified logging domains
419 -P, --profile Profile the command and save reports.
420 -u UI, --ui=UI The user interface to use (knotty, ncurses or taskexp
421 - default knotty).
422 --token=XMLRPCTOKEN Specify the connection token to be used when
423 connecting to a remote server.
424 --revisions-changed Set the exit code depending on whether upstream
425 floating revisions have changed or not.
426 --server-only Run bitbake without a UI, only starting a server
427 (cooker) process.
428 -B BIND, --bind=BIND The name/address for the bitbake xmlrpc server to bind
429 to.
430 -T SERVER_TIMEOUT, --idle-timeout=SERVER_TIMEOUT
431 Set timeout to unload bitbake server due to
432 inactivity, set to -1 means no unload, default:
433 Environment variable BB_SERVER_TIMEOUT.
434 --no-setscene Do not run any setscene tasks. sstate will be ignored
435 and everything needed, built.
436 --setscene-only Only run setscene tasks, don't run any real tasks.
437 --remote-server=REMOTE_SERVER
438 Connect to the specified server.
439 -m, --kill-server Terminate any running bitbake server.
440 --observe-only Connect to a server as an observing-only client.
441 --status-only Check the status of the remote bitbake server.
442 -w WRITEEVENTLOG, --write-log=WRITEEVENTLOG
443 Writes the event log of the build to a bitbake event
444 json file. Use '' (empty string) to assign the name
445 automatically.
446 --runall=RUNALL Run the specified task for any recipe in the taskgraph
447 of the specified target (even if it wouldn't otherwise
448 have run).
449 --runonly=RUNONLY Run only the specified task within the taskgraph of
450 the specified targets (and any task dependencies those
451 tasks may have).
452
453.. _bitbake-examples:
454
455Examples
456--------
457
458This section presents some examples showing how to use BitBake.
459
460.. _example-executing-a-task-against-a-single-recipe:
461
462Executing a Task Against a Single Recipe
463~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464
465Executing tasks for a single recipe file is relatively simple. You
466specify the file in question, and BitBake parses it and executes the
467specified task. If you do not specify a task, BitBake executes the
468default task, which is "build". BitBake obeys inter-task dependencies
469when doing so.
470
471The following command runs the build task, which is the default task, on
472the ``foo_1.0.bb`` recipe file: ::
473
474 $ bitbake -b foo_1.0.bb
475
476The following command runs the clean task on the ``foo.bb`` recipe file: ::
477
478 $ bitbake -b foo.bb -c clean
479
480.. note::
481
482 The "-b" option explicitly does not handle recipe dependencies. Other
483 than for debugging purposes, it is instead recommended that you use
484 the syntax presented in the next section.
485
486Executing Tasks Against a Set of Recipe Files
487~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
488
489There are a number of additional complexities introduced when one wants
490to manage multiple ``.bb`` files. Clearly there needs to be a way to
491tell BitBake what files are available and, of those, which you want to
492execute. There also needs to be a way for each recipe to express its
493dependencies, both for build-time and runtime. There must be a way for
494you to express recipe preferences when multiple recipes provide the same
495functionality, or when there are multiple versions of a recipe.
496
497The ``bitbake`` command, when not using "--buildfile" or "-b" only
498accepts a "PROVIDES". You cannot provide anything else. By default, a
499recipe file generally "PROVIDES" its "packagename" as shown in the
500following example: ::
501
502 $ bitbake foo
503
504This next example "PROVIDES" the
505package name and also uses the "-c" option to tell BitBake to just
506execute the ``do_clean`` task: ::
507
508 $ bitbake -c clean foo
509
510Executing a List of Task and Recipe Combinations
511~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
512
513The BitBake command line supports specifying different tasks for
514individual targets when you specify multiple targets. For example,
515suppose you had two targets (or recipes) ``myfirstrecipe`` and
516``mysecondrecipe`` and you needed BitBake to run ``taskA`` for the first
517recipe and ``taskB`` for the second recipe: ::
518
519 $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB
520
521Generating Dependency Graphs
522~~~~~~~~~~~~~~~~~~~~~~~~~~~~
523
524BitBake is able to generate dependency graphs using the ``dot`` syntax.
525You can convert these graphs into images using the ``dot`` tool from
526`Graphviz <http://www.graphviz.org>`__.
527
528When you generate a dependency graph, BitBake writes two files to the
529current working directory:
530
531- ``task-depends.dot``: Shows dependencies between tasks. These
532 dependencies match BitBake's internal task execution list.
533
534- ``pn-buildlist``: Shows a simple list of targets that are to be
535 built.
536
537To stop depending on common depends, use the "-I" depend option and
538BitBake omits them from the graph. Leaving this information out can
539produce more readable graphs. This way, you can remove from the graph
540``DEPENDS`` from inherited classes such as ``base.bbclass``.
541
542Here are two examples that create dependency graphs. The second example
543omits depends common in OpenEmbedded from the graph: ::
544
545 $ bitbake -g foo
546
547 $ bitbake -g -I virtual/kernel -I eglibc foo
548
549Executing a Multiple Configuration Build
550~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
551
552BitBake is able to build multiple images or packages using a single
553command where the different targets require different configurations
554(multiple configuration builds). Each target, in this scenario, is
555referred to as a "multiconfig".
556
557To accomplish a multiple configuration build, you must define each
558target's configuration separately using a parallel configuration file in
559the build directory. The location for these multiconfig configuration
560files is specific. They must reside in the current build directory in a
561sub-directory of ``conf`` named ``multiconfig``. Following is an example
562for two separate targets:
563
564.. image:: figures/bb_multiconfig_files.png
565 :align: center
566
567The reason for this required file hierarchy is because the ``BBPATH``
568variable is not constructed until the layers are parsed. Consequently,
569using the configuration file as a pre-configuration file is not possible
570unless it is located in the current working directory.
571
572Minimally, each configuration file must define the machine and the
573temporary directory BitBake uses for the build. Suggested practice
574dictates that you do not overlap the temporary directories used during
575the builds.
576
577Aside from separate configuration files for each target, you must also
578enable BitBake to perform multiple configuration builds. Enabling is
579accomplished by setting the
580:term:`BBMULTICONFIG` variable in the
581``local.conf`` configuration file. As an example, suppose you had
582configuration files for ``target1`` and ``target2`` defined in the build
583directory. The following statement in the ``local.conf`` file both
584enables BitBake to perform multiple configuration builds and specifies
585the two extra multiconfigs: ::
586
587 BBMULTICONFIG = "target1 target2"
588
589Once the target configuration files are in place and BitBake has been
590enabled to perform multiple configuration builds, use the following
591command form to start the builds: ::
592
593 $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ]
594
595Here is an example for two extra multiconfigs: ``target1`` and ``target2``: ::
596
597 $ bitbake mc::target mc:target1:target mc:target2:target
598
599.. _bb-enabling-multiple-configuration-build-dependencies:
600
601Enabling Multiple Configuration Build Dependencies
602~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
603
604Sometimes dependencies can exist between targets (multiconfigs) in a
605multiple configuration build. For example, suppose that in order to
606build an image for a particular architecture, the root filesystem of
607another build for a different architecture needs to exist. In other
608words, the image for the first multiconfig depends on the root
609filesystem of the second multiconfig. This dependency is essentially
610that the task in the recipe that builds one multiconfig is dependent on
611the completion of the task in the recipe that builds another
612multiconfig.
613
614To enable dependencies in a multiple configuration build, you must
615declare the dependencies in the recipe using the following statement
616form: ::
617
618 task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend"
619
620To better show how to use this statement, consider an example with two
621multiconfigs: ``target1`` and ``target2``: ::
622
623 image_task[mcdepends] = "mc:target1:target2:image2:rootfs_task"
624
625In this example, the
626``from_multiconfig`` is "target1" and the ``to_multiconfig`` is "target2". The
627task on which the image whose recipe contains image_task depends on the
628completion of the rootfs_task used to build out image2, which is
629associated with the "target2" multiconfig.
630
631Once you set up this dependency, you can build the "target1" multiconfig
632using a BitBake command as follows: ::
633
634 $ bitbake mc:target1:image1
635
636This command executes all the tasks needed to create ``image1`` for the "target1"
637multiconfig. Because of the dependency, BitBake also executes through
638the ``rootfs_task`` for the "target2" multiconfig build.
639
640Having a recipe depend on the root filesystem of another build might not
641seem that useful. Consider this change to the statement in the image1
642recipe: ::
643
644 image_task[mcdepends] = "mc:target1:target2:image2:image_task"
645
646In this case, BitBake must create ``image2`` for the "target2" build since
647the "target1" build depends on it.
648
649Because "target1" and "target2" are enabled for multiple configuration
650builds and have separate configuration files, BitBake places the
651artifacts for each build in the respective temporary build directories.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.xml
deleted file mode 100644
index 995c2fa7bf..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.xml
+++ /dev/null
@@ -1,891 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<chapter id="bitbake-user-manual-intro">
5 <title>Overview</title>
6
7 <para>
8 Welcome to the BitBake User Manual.
9 This manual provides information on the BitBake tool.
10 The information attempts to be as independent as possible regarding
11 systems that use BitBake, such as OpenEmbedded and the
12 Yocto Project.
13 In some cases, scenarios or examples within the context of
14 a build system are used in the manual to help with understanding.
15 For these cases, the manual clearly states the context.
16 </para>
17
18 <section id="intro">
19 <title>Introduction</title>
20
21 <para>
22 Fundamentally, BitBake is a generic task execution
23 engine that allows shell and Python tasks to be run
24 efficiently and in parallel while working within
25 complex inter-task dependency constraints.
26 One of BitBake's main users, OpenEmbedded, takes this core
27 and builds embedded Linux software stacks using
28 a task-oriented approach.
29 </para>
30
31 <para>
32 Conceptually, BitBake is similar to GNU Make in
33 some regards but has significant differences:
34 <itemizedlist>
35 <listitem><para>
36 BitBake executes tasks according to provided
37 metadata that builds up the tasks.
38 Metadata is stored in recipe (<filename>.bb</filename>)
39 and related recipe "append" (<filename>.bbappend</filename>)
40 files, configuration (<filename>.conf</filename>) and
41 underlying include (<filename>.inc</filename>) files, and
42 in class (<filename>.bbclass</filename>) files.
43 The metadata provides
44 BitBake with instructions on what tasks to run and
45 the dependencies between those tasks.
46 </para></listitem>
47 <listitem><para>
48 BitBake includes a fetcher library for obtaining source
49 code from various places such as local files, source control
50 systems, or websites.
51 </para></listitem>
52 <listitem><para>
53 The instructions for each unit to be built (e.g. a piece
54 of software) are known as "recipe" files and
55 contain all the information about the unit
56 (dependencies, source file locations, checksums, description
57 and so on).
58 </para></listitem>
59 <listitem><para>
60 BitBake includes a client/server abstraction and can
61 be used from a command line or used as a service over
62 XML-RPC and has several different user interfaces.
63 </para></listitem>
64 </itemizedlist>
65 </para>
66 </section>
67
68 <section id="history-and-goals">
69 <title>History and Goals</title>
70
71 <para>
72 BitBake was originally a part of the OpenEmbedded project.
73 It was inspired by the Portage package management system
74 used by the Gentoo Linux distribution.
75 On December 7, 2004, OpenEmbedded project team member
76 Chris Larson split the project into two distinct pieces:
77 <itemizedlist>
78 <listitem><para>BitBake, a generic task executor</para></listitem>
79 <listitem><para>OpenEmbedded, a metadata set utilized by
80 BitBake</para></listitem>
81 </itemizedlist>
82 Today, BitBake is the primary basis of the
83 <ulink url="http://www.openembedded.org/">OpenEmbedded</ulink>
84 project, which is being used to build and maintain Linux
85 distributions such as the
86 <ulink url='http://www.angstrom-distribution.org/'>Angstrom Distribution</ulink>,
87 and which is also being used as the build tool for Linux projects
88 such as the
89 <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink>.
90 </para>
91
92 <para>
93 Prior to BitBake, no other build tool adequately met the needs of
94 an aspiring embedded Linux distribution.
95 All of the build systems used by traditional desktop Linux
96 distributions lacked important functionality, and none of the
97 ad hoc Buildroot-based systems, prevalent in the
98 embedded space, were scalable or maintainable.
99 </para>
100
101 <para>
102 Some important original goals for BitBake were:
103 <itemizedlist>
104 <listitem><para>
105 Handle cross-compilation.
106 </para></listitem>
107 <listitem><para>
108 Handle inter-package dependencies (build time on
109 target architecture, build time on native
110 architecture, and runtime).
111 </para></listitem>
112 <listitem><para>
113 Support running any number of tasks within a given
114 package, including, but not limited to, fetching
115 upstream sources, unpacking them, patching them,
116 configuring them, and so forth.
117 </para></listitem>
118 <listitem><para>
119 Be Linux distribution agnostic for both build and
120 target systems.
121 </para></listitem>
122 <listitem><para>
123 Be architecture agnostic.
124 </para></listitem>
125 <listitem><para>
126 Support multiple build and target operating systems
127 (e.g. Cygwin, the BSDs, and so forth).
128 </para></listitem>
129 <listitem><para>
130 Be self-contained, rather than tightly
131 integrated into the build machine's root
132 filesystem.
133 </para></listitem>
134 <listitem><para>
135 Handle conditional metadata on the target architecture,
136 operating system, distribution, and machine.
137 </para></listitem>
138 <listitem><para>
139 Be easy to use the tools to supply local metadata and packages
140 against which to operate.
141 </para></listitem>
142 <listitem><para>
143 Be easy to use BitBake to collaborate between multiple
144 projects for their builds.
145 </para></listitem>
146 <listitem><para>
147 Provide an inheritance mechanism to share
148 common metadata between many packages.
149 </para></listitem>
150 </itemizedlist>
151 Over time it became apparent that some further requirements
152 were necessary:
153 <itemizedlist>
154 <listitem><para>
155 Handle variants of a base recipe (e.g. native, sdk,
156 and multilib).
157 </para></listitem>
158 <listitem><para>
159 Split metadata into layers and allow layers
160 to enhance or override other layers.
161 </para></listitem>
162 <listitem><para>
163 Allow representation of a given set of input variables
164 to a task as a checksum.
165 Based on that checksum, allow acceleration of builds
166 with prebuilt components.
167 </para></listitem>
168 </itemizedlist>
169 BitBake satisfies all the original requirements and many more
170 with extensions being made to the basic functionality to
171 reflect the additional requirements.
172 Flexibility and power have always been the priorities.
173 BitBake is highly extensible and supports embedded Python code and
174 execution of any arbitrary tasks.
175 </para>
176 </section>
177
178 <section id="Concepts">
179 <title>Concepts</title>
180
181 <para>
182 BitBake is a program written in the Python language.
183 At the highest level, BitBake interprets metadata, decides
184 what tasks are required to run, and executes those tasks.
185 Similar to GNU Make, BitBake controls how software is
186 built.
187 GNU Make achieves its control through "makefiles", while
188 BitBake uses "recipes".
189 </para>
190
191 <para>
192 BitBake extends the capabilities of a simple
193 tool like GNU Make by allowing for the definition of much more
194 complex tasks, such as assembling entire embedded Linux
195 distributions.
196 </para>
197
198 <para>
199 The remainder of this section introduces several concepts
200 that should be understood in order to better leverage
201 the power of BitBake.
202 </para>
203
204 <section id='recipes'>
205 <title>Recipes</title>
206
207 <para>
208 BitBake Recipes, which are denoted by the file extension
209 <filename>.bb</filename>, are the most basic metadata files.
210 These recipe files provide BitBake with the following:
211 <itemizedlist>
212 <listitem><para>Descriptive information about the
213 package (author, homepage, license, and so on)</para></listitem>
214 <listitem><para>The version of the recipe</para></listitem>
215 <listitem><para>Existing dependencies (both build
216 and runtime dependencies)</para></listitem>
217 <listitem><para>Where the source code resides and
218 how to fetch it</para></listitem>
219 <listitem><para>Whether the source code requires
220 any patches, where to find them, and how to apply
221 them</para></listitem>
222 <listitem><para>How to configure and compile the
223 source code</para></listitem>
224 <listitem><para>How to assemble the generated artifacts into
225 one or more installable packages</para></listitem>
226 <listitem><para>Where on the target machine to install the
227 package or packages created</para></listitem>
228 </itemizedlist>
229 </para>
230
231 <para>
232 Within the context of BitBake, or any project utilizing BitBake
233 as its build system, files with the <filename>.bb</filename>
234 extension are referred to as <firstterm>recipes</firstterm>.
235 <note>
236 The term "package" is also commonly used to describe recipes.
237 However, since the same word is used to describe packaged
238 output from a project, it is best to maintain a single
239 descriptive term - "recipes".
240 Put another way, a single "recipe" file is quite capable
241 of generating a number of related but separately installable
242 "packages".
243 In fact, that ability is fairly common.
244 </note>
245 </para>
246 </section>
247
248 <section id='configuration-files'>
249 <title>Configuration Files</title>
250
251 <para>
252 Configuration files, which are denoted by the
253 <filename>.conf</filename> extension, define
254 various configuration variables that govern the project's build
255 process.
256 These files fall into several areas that define
257 machine configuration, distribution configuration,
258 possible compiler tuning, general common
259 configuration, and user configuration.
260 The main configuration file is the sample
261 <filename>bitbake.conf</filename> file, which is
262 located within the BitBake source tree
263 <filename>conf</filename> directory.
264 </para>
265 </section>
266
267 <section id='classes'>
268 <title>Classes</title>
269
270 <para>
271 Class files, which are denoted by the
272 <filename>.bbclass</filename> extension, contain
273 information that is useful to share between metadata files.
274 The BitBake source tree currently comes with one class metadata file
275 called <filename>base.bbclass</filename>.
276 You can find this file in the
277 <filename>classes</filename> directory.
278 The <filename>base.bbclass</filename> class files is special since it
279 is always included automatically for all recipes
280 and classes.
281 This class contains definitions for standard basic tasks such
282 as fetching, unpacking, configuring (empty by default),
283 compiling (runs any Makefile present), installing (empty by
284 default) and packaging (empty by default).
285 These tasks are often overridden or extended by other classes
286 added during the project development process.
287 </para>
288 </section>
289
290 <section id='layers'>
291 <title>Layers</title>
292
293 <para>
294 Layers allow you to isolate different types of
295 customizations from each other.
296 While you might find it tempting to keep everything in one layer
297 when working on a single project, the more modular
298 your metadata, the easier it is to cope with future changes.
299 </para>
300
301 <para>
302 To illustrate how you can use layers to keep things modular,
303 consider customizations you might make to support a specific target machine.
304 These types of customizations typically reside in a special layer,
305 rather than a general layer, called a <firstterm>Board Support Package</firstterm> (BSP)
306 layer.
307 Furthermore, the machine customizations should be isolated from
308 recipes and metadata that support a new GUI environment, for
309 example.
310 This situation gives you a couple of layers: one for the machine
311 configurations and one for the GUI environment.
312 It is important to understand, however, that the BSP layer can still
313 make machine-specific additions to recipes within
314 the GUI environment layer without polluting the GUI layer itself
315 with those machine-specific changes.
316 You can accomplish this through a recipe that is a BitBake append
317 (<filename>.bbappend</filename>) file.
318 </para>
319 </section>
320
321 <section id='append-bbappend-files'>
322 <title>Append Files</title>
323
324 <para>
325 Append files, which are files that have the
326 <filename>.bbappend</filename> file extension, extend or
327 override information in an existing recipe file.
328 </para>
329
330 <para>
331 BitBake expects every append file to have a corresponding recipe file.
332 Furthermore, the append file and corresponding recipe file
333 must use the same root filename.
334 The filenames can differ only in the file type suffix used
335 (e.g. <filename>formfactor_0.0.bb</filename> and
336 <filename>formfactor_0.0.bbappend</filename>).
337 </para>
338
339 <para>
340 Information in append files extends or
341 overrides the information in the underlying,
342 similarly-named recipe files.
343 </para>
344
345 <para>
346 When you name an append file, you can use the
347 "<filename>%</filename>" wildcard character to allow for matching
348 recipe names.
349 For example, suppose you have an append file named
350 as follows:
351 <literallayout class='monospaced'>
352 busybox_1.21.%.bbappend
353 </literallayout>
354 That append file would match any <filename>busybox_1.21.</filename><replaceable>x</replaceable><filename>.bb</filename>
355 version of the recipe.
356 So, the append file would match the following recipe names:
357 <literallayout class='monospaced'>
358 busybox_1.21.1.bb
359 busybox_1.21.2.bb
360 busybox_1.21.3.bb
361 </literallayout>
362 <note><title>Important</title>
363 The use of the "<filename>%</filename>" character
364 is limited in that it only works directly in front of the
365 <filename>.bbappend</filename> portion of the append file's
366 name.
367 You cannot use the wildcard character in any other
368 location of the name.
369 </note>
370 If the <filename>busybox</filename> recipe was updated to
371 <filename>busybox_1.3.0.bb</filename>, the append name would not
372 match.
373 However, if you named the append file
374 <filename>busybox_1.%.bbappend</filename>, then you would have a match.
375 </para>
376
377 <para>
378 In the most general case, you could name the append file something as
379 simple as <filename>busybox_%.bbappend</filename> to be entirely
380 version independent.
381 </para>
382 </section>
383 </section>
384
385 <section id='obtaining-bitbake'>
386 <title>Obtaining BitBake</title>
387
388 <para>
389 You can obtain BitBake several different ways:
390 <itemizedlist>
391 <listitem><para><emphasis>Cloning BitBake:</emphasis>
392 Using Git to clone the BitBake source code repository
393 is the recommended method for obtaining BitBake.
394 Cloning the repository makes it easy to get bug fixes
395 and have access to stable branches and the master
396 branch.
397 Once you have cloned BitBake, you should use
398 the latest stable
399 branch for development since the master branch is for
400 BitBake development and might contain less stable changes.
401 </para>
402 <para>You usually need a version of BitBake
403 that matches the metadata you are using.
404 The metadata is generally backwards compatible but
405 not forward compatible.</para>
406 <para>Here is an example that clones the BitBake repository:
407 <literallayout class='monospaced'>
408 $ git clone git://git.openembedded.org/bitbake
409 </literallayout>
410 This command clones the BitBake Git repository into a
411 directory called <filename>bitbake</filename>.
412 Alternatively, you can
413 designate a directory after the
414 <filename>git clone</filename> command
415 if you want to call the new directory something
416 other than <filename>bitbake</filename>.
417 Here is an example that names the directory
418 <filename>bbdev</filename>:
419 <literallayout class='monospaced'>
420 $ git clone git://git.openembedded.org/bitbake bbdev
421 </literallayout></para></listitem>
422 <listitem><para><emphasis>Installation using your Distribution
423 Package Management System:</emphasis>
424 This method is not
425 recommended because the BitBake version that is
426 provided by your distribution, in most cases,
427 is several
428 releases behind a snapshot of the BitBake repository.
429 </para></listitem>
430 <listitem><para><emphasis>Taking a snapshot of BitBake:</emphasis>
431 Downloading a snapshot of BitBake from the
432 source code repository gives you access to a known
433 branch or release of BitBake.
434 <note>
435 Cloning the Git repository, as described earlier,
436 is the preferred method for getting BitBake.
437 Cloning the repository makes it easier to update as
438 patches are added to the stable branches.
439 </note></para>
440 <para>The following example downloads a snapshot of
441 BitBake version 1.17.0:
442 <literallayout class='monospaced'>
443 $ wget http://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz
444 $ tar zxpvf bitbake-1.17.0.tar.gz
445 </literallayout>
446 After extraction of the tarball using the tar utility,
447 you have a directory entitled
448 <filename>bitbake-1.17.0</filename>.
449 </para></listitem>
450 <listitem><para><emphasis>Using the BitBake that Comes With Your
451 Build Checkout:</emphasis>
452 A final possibility for getting a copy of BitBake is that it
453 already comes with your checkout of a larger BitBake-based build
454 system, such as Poky.
455 Rather than manually checking out individual layers and
456 gluing them together yourself, you can check
457 out an entire build system.
458 The checkout will already include a version of BitBake that
459 has been thoroughly tested for compatibility with the other
460 components.
461 For information on how to check out a particular BitBake-based
462 build system, consult that build system's supporting documentation.
463 </para></listitem>
464 </itemizedlist>
465 </para>
466 </section>
467
468 <section id="bitbake-user-manual-command">
469 <title>The BitBake Command</title>
470
471 <para>
472 The <filename>bitbake</filename> command is the primary interface
473 to the BitBake tool.
474 This section presents the BitBake command syntax and provides
475 several execution examples.
476 </para>
477
478 <section id='usage-and-syntax'>
479 <title>Usage and syntax</title>
480
481 <para>
482 Following is the usage and syntax for BitBake:
483 <literallayout class='monospaced'>
484 $ bitbake -h
485 Usage: bitbake [options] [recipename/target recipe:do_task ...]
486
487 Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
488 It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
489 will provide the layer, BBFILES and other configuration information.
490
491 Options:
492 --version show program's version number and exit
493 -h, --help show this help message and exit
494 -b BUILDFILE, --buildfile=BUILDFILE
495 Execute tasks from a specific .bb recipe directly.
496 WARNING: Does not handle any dependencies from other
497 recipes.
498 -k, --continue Continue as much as possible after an error. While the
499 target that failed and anything depending on it cannot
500 be built, as much as possible will be built before
501 stopping.
502 -f, --force Force the specified targets/task to run (invalidating
503 any existing stamp file).
504 -c CMD, --cmd=CMD Specify the task to execute. The exact options
505 available depend on the metadata. Some examples might
506 be 'compile' or 'populate_sysroot' or 'listtasks' may
507 give a list of the tasks available.
508 -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP
509 Invalidate the stamp for the specified task such as
510 'compile' and then run the default task for the
511 specified target(s).
512 -r PREFILE, --read=PREFILE
513 Read the specified file before bitbake.conf.
514 -R POSTFILE, --postread=POSTFILE
515 Read the specified file after bitbake.conf.
516 -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also
517 print bb.note(...) messages to stdout (in addition to
518 writing them to ${T}/log.do_&lt;task&gt;).
519 -D, --debug Increase the debug level. You can specify this more
520 than once. -D sets the debug level to 1, where only
521 bb.debug(1, ...) messages are printed to stdout; -DD
522 sets the debug level to 2, where both bb.debug(1, ...)
523 and bb.debug(2, ...) messages are printed; etc.
524 Without -D, no debug messages are printed. Note that
525 -D only affects output to stdout. All debug messages
526 are written to ${T}/log.do_taskname, regardless of the
527 debug level.
528 -q, --quiet Output less log message data to the terminal. You can
529 specify this more than once.
530 -n, --dry-run Don't execute, just go through the motions.
531 -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER
532 Dump out the signature construction information, with
533 no task execution. The SIGNATURE_HANDLER parameter is
534 passed to the handler. Two common values are none and
535 printdiff but the handler may define more/less. none
536 means only dump the signature, printdiff means compare
537 the dumped signature with the cached one.
538 -p, --parse-only Quit after parsing the BB recipes.
539 -s, --show-versions Show current and preferred versions of all recipes.
540 -e, --environment Show the global or per-recipe environment complete
541 with information about where variables were
542 set/changed.
543 -g, --graphviz Save dependency tree information for the specified
544 targets in the dot syntax.
545 -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED
546 Assume these dependencies don't exist and are already
547 provided (equivalent to ASSUME_PROVIDED). Useful to
548 make dependency graphs more appealing
549 -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS
550 Show debug logging for the specified logging domains
551 -P, --profile Profile the command and save reports.
552 -u UI, --ui=UI The user interface to use (knotty, ncurses or taskexp
553 - default knotty).
554 --token=XMLRPCTOKEN Specify the connection token to be used when
555 connecting to a remote server.
556 --revisions-changed Set the exit code depending on whether upstream
557 floating revisions have changed or not.
558 --server-only Run bitbake without a UI, only starting a server
559 (cooker) process.
560 -B BIND, --bind=BIND The name/address for the bitbake xmlrpc server to bind
561 to.
562 -T SERVER_TIMEOUT, --idle-timeout=SERVER_TIMEOUT
563 Set timeout to unload bitbake server due to
564 inactivity, set to -1 means no unload, default:
565 Environment variable BB_SERVER_TIMEOUT.
566 --no-setscene Do not run any setscene tasks. sstate will be ignored
567 and everything needed, built.
568 --setscene-only Only run setscene tasks, don't run any real tasks.
569 --remote-server=REMOTE_SERVER
570 Connect to the specified server.
571 -m, --kill-server Terminate any running bitbake server.
572 --observe-only Connect to a server as an observing-only client.
573 --status-only Check the status of the remote bitbake server.
574 -w WRITEEVENTLOG, --write-log=WRITEEVENTLOG
575 Writes the event log of the build to a bitbake event
576 json file. Use '' (empty string) to assign the name
577 automatically.
578 --runall=RUNALL Run the specified task for any recipe in the taskgraph
579 of the specified target (even if it wouldn't otherwise
580 have run).
581 --runonly=RUNONLY Run only the specified task within the taskgraph of
582 the specified targets (and any task dependencies those
583 tasks may have).
584 </literallayout>
585 </para>
586 </section>
587
588 <section id='bitbake-examples'>
589 <title>Examples</title>
590
591 <para>
592 This section presents some examples showing how to use BitBake.
593 </para>
594
595 <section id='example-executing-a-task-against-a-single-recipe'>
596 <title>Executing a Task Against a Single Recipe</title>
597
598 <para>
599 Executing tasks for a single recipe file is relatively simple.
600 You specify the file in question, and BitBake parses
601 it and executes the specified task.
602 If you do not specify a task, BitBake executes the default
603 task, which is "buildâ€.
604 BitBake obeys inter-task dependencies when doing
605 so.
606 </para>
607
608 <para>
609 The following command runs the build task, which is
610 the default task, on the <filename>foo_1.0.bb</filename>
611 recipe file:
612 <literallayout class='monospaced'>
613 $ bitbake -b foo_1.0.bb
614 </literallayout>
615 The following command runs the clean task on the
616 <filename>foo.bb</filename> recipe file:
617 <literallayout class='monospaced'>
618 $ bitbake -b foo.bb -c clean
619 </literallayout>
620 <note>
621 The "-b" option explicitly does not handle recipe
622 dependencies.
623 Other than for debugging purposes, it is instead
624 recommended that you use the syntax presented in the
625 next section.
626 </note>
627 </para>
628 </section>
629
630 <section id='executing-tasks-against-a-set-of-recipe-files'>
631 <title>Executing Tasks Against a Set of Recipe Files</title>
632
633 <para>
634 There are a number of additional complexities introduced
635 when one wants to manage multiple <filename>.bb</filename>
636 files.
637 Clearly there needs to be a way to tell BitBake what
638 files are available and, of those, which you
639 want to execute.
640 There also needs to be a way for each recipe
641 to express its dependencies, both for build-time and
642 runtime.
643 There must be a way for you to express recipe preferences
644 when multiple recipes provide the same functionality, or when
645 there are multiple versions of a recipe.
646 </para>
647
648 <para>
649 The <filename>bitbake</filename> command, when not using
650 "--buildfile" or "-b" only accepts a "PROVIDES".
651 You cannot provide anything else.
652 By default, a recipe file generally "PROVIDES" its
653 "packagename" as shown in the following example:
654 <literallayout class='monospaced'>
655 $ bitbake foo
656 </literallayout>
657 This next example "PROVIDES" the package name and also uses
658 the "-c" option to tell BitBake to just execute the
659 <filename>do_clean</filename> task:
660 <literallayout class='monospaced'>
661 $ bitbake -c clean foo
662 </literallayout>
663 </para>
664 </section>
665
666 <section id='executing-a-list-of-task-and-recipe-combinations'>
667 <title>Executing a List of Task and Recipe Combinations</title>
668
669 <para>
670 The BitBake command line supports specifying different
671 tasks for individual targets when you specify multiple
672 targets.
673 For example, suppose you had two targets (or recipes)
674 <filename>myfirstrecipe</filename> and
675 <filename>mysecondrecipe</filename> and you needed
676 BitBake to run <filename>taskA</filename> for the first
677 recipe and <filename>taskB</filename> for the second
678 recipe:
679 <literallayout class='monospaced'>
680 $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB
681 </literallayout>
682 </para>
683 </section>
684
685 <section id='generating-dependency-graphs'>
686 <title>Generating Dependency Graphs</title>
687
688 <para>
689 BitBake is able to generate dependency graphs using
690 the <filename>dot</filename> syntax.
691 You can convert these graphs into images using the
692 <filename>dot</filename> tool from
693 <ulink url='http://www.graphviz.org'>Graphviz</ulink>.
694 </para>
695
696 <para>
697 When you generate a dependency graph, BitBake writes two files
698 to the current working directory:
699 <itemizedlist>
700 <listitem><para>
701 <emphasis><filename>task-depends.dot</filename>:</emphasis>
702 Shows dependencies between tasks.
703 These dependencies match BitBake's internal task execution list.
704 </para></listitem>
705 <listitem><para>
706 <emphasis><filename>pn-buildlist</filename>:</emphasis>
707 Shows a simple list of targets that are to be built.
708 </para></listitem>
709 </itemizedlist>
710 </para>
711
712 <para>
713 To stop depending on common depends, use the "-I" depend
714 option and BitBake omits them from the graph.
715 Leaving this information out can produce more readable graphs.
716 This way, you can remove from the graph
717 <filename>DEPENDS</filename> from inherited classes
718 such as <filename>base.bbclass</filename>.
719 </para>
720
721 <para>
722 Here are two examples that create dependency graphs.
723 The second example omits depends common in OpenEmbedded from
724 the graph:
725 <literallayout class='monospaced'>
726 $ bitbake -g foo
727
728 $ bitbake -g -I virtual/kernel -I eglibc foo
729 </literallayout>
730 </para>
731 </section>
732
733 <section id='executing-a-multiple-configuration-build'>
734 <title>Executing a Multiple Configuration Build</title>
735
736 <para>
737 BitBake is able to build multiple images or packages
738 using a single command where the different targets
739 require different configurations (multiple configuration
740 builds).
741 Each target, in this scenario, is referred to as a
742 "multiconfig".
743 </para>
744
745 <para>
746 To accomplish a multiple configuration build, you must
747 define each target's configuration separately using
748 a parallel configuration file in the build directory.
749 The location for these multiconfig configuration files
750 is specific.
751 They must reside in the current build directory in
752 a sub-directory of <filename>conf</filename> named
753 <filename>multiconfig</filename>.
754 Following is an example for two separate targets:
755 <imagedata fileref="figures/bb_multiconfig_files.png" align="center" width="4in" depth="3in" />
756 </para>
757
758 <para>
759 The reason for this required file hierarchy
760 is because the <filename>BBPATH</filename> variable
761 is not constructed until the layers are parsed.
762 Consequently, using the configuration file as a
763 pre-configuration file is not possible unless it is
764 located in the current working directory.
765 </para>
766
767 <para>
768 Minimally, each configuration file must define the
769 machine and the temporary directory BitBake uses
770 for the build.
771 Suggested practice dictates that you do not
772 overlap the temporary directories used during the
773 builds.
774 </para>
775
776 <para>
777 Aside from separate configuration files for each
778 target, you must also enable BitBake to perform multiple
779 configuration builds.
780 Enabling is accomplished by setting the
781 <link linkend='var-bb-BBMULTICONFIG'><filename>BBMULTICONFIG</filename></link>
782 variable in the <filename>local.conf</filename>
783 configuration file.
784 As an example, suppose you had configuration files
785 for <filename>target1</filename> and
786 <filename>target2</filename> defined in the build
787 directory.
788 The following statement in the
789 <filename>local.conf</filename> file both enables
790 BitBake to perform multiple configuration builds and
791 specifies the two extra multiconfigs:
792 <literallayout class='monospaced'>
793 BBMULTICONFIG = "target1 target2"
794 </literallayout>
795 </para>
796
797 <para>
798 Once the target configuration files are in place and
799 BitBake has been enabled to perform multiple configuration
800 builds, use the following command form to start the
801 builds:
802 <literallayout class='monospaced'>
803 $ bitbake [mc:<replaceable>multiconfigname</replaceable>:]<replaceable>target</replaceable> [[[mc:<replaceable>multiconfigname</replaceable>:]<replaceable>target</replaceable>] ... ]
804 </literallayout>
805 Here is an example for two extra multiconfigs:
806 <filename>target1</filename> and
807 <filename>target2</filename>:
808 <literallayout class='monospaced'>
809 $ bitbake mc::<replaceable>target</replaceable> mc:target1:<replaceable>target</replaceable> mc:target2:<replaceable>target</replaceable>
810 </literallayout>
811 </para>
812 </section>
813
814 <section id='bb-enabling-multiple-configuration-build-dependencies'>
815 <title>Enabling Multiple Configuration Build Dependencies</title>
816
817 <para>
818 Sometimes dependencies can exist between targets
819 (multiconfigs) in a multiple configuration build.
820 For example, suppose that in order to build an image
821 for a particular architecture, the root filesystem of
822 another build for a different architecture needs to
823 exist.
824 In other words, the image for the first multiconfig depends
825 on the root filesystem of the second multiconfig.
826 This dependency is essentially that the task in the recipe
827 that builds one multiconfig is dependent on the
828 completion of the task in the recipe that builds
829 another multiconfig.
830 </para>
831
832 <para>
833 To enable dependencies in a multiple configuration
834 build, you must declare the dependencies in the recipe
835 using the following statement form:
836 <literallayout class='monospaced'>
837 <replaceable>task_or_package</replaceable>[mcdepends] = "mc:<replaceable>from_multiconfig</replaceable>:<replaceable>to_multiconfig</replaceable>:<replaceable>recipe_name</replaceable>:<replaceable>task_on_which_to_depend</replaceable>"
838 </literallayout>
839 To better show how to use this statement, consider an
840 example with two multiconfigs: <filename>target1</filename>
841 and <filename>target2</filename>:
842 <literallayout class='monospaced'>
843 <replaceable>image_task</replaceable>[mcdepends] = "mc:target1:target2:<replaceable>image2</replaceable>:<replaceable>rootfs_task</replaceable>"
844 </literallayout>
845 In this example, the
846 <replaceable>from_multiconfig</replaceable> is "target1" and
847 the <replaceable>to_multiconfig</replaceable> is "target2".
848 The task on which the image whose recipe contains
849 <replaceable>image_task</replaceable> depends on the
850 completion of the <replaceable>rootfs_task</replaceable>
851 used to build out <replaceable>image2</replaceable>, which
852 is associated with the "target2" multiconfig.
853 </para>
854
855 <para>
856 Once you set up this dependency, you can build the
857 "target1" multiconfig using a BitBake command as follows:
858 <literallayout class='monospaced'>
859 $ bitbake mc:target1:<replaceable>image1</replaceable>
860 </literallayout>
861 This command executes all the tasks needed to create
862 <replaceable>image1</replaceable> for the "target1"
863 multiconfig.
864 Because of the dependency, BitBake also executes through
865 the <replaceable>rootfs_task</replaceable> for the "target2"
866 multiconfig build.
867 </para>
868
869 <para>
870 Having a recipe depend on the root filesystem of another
871 build might not seem that useful.
872 Consider this change to the statement in the
873 <replaceable>image1</replaceable> recipe:
874 <literallayout class='monospaced'>
875 <replaceable>image_task</replaceable>[mcdepends] = "mc:target1:target2:<replaceable>image2</replaceable>:<replaceable>image_task</replaceable>"
876 </literallayout>
877 In this case, BitBake must create
878 <replaceable>image2</replaceable> for the "target2"
879 build since the "target1" build depends on it.
880 </para>
881
882 <para>
883 Because "target1" and "target2" are enabled for multiple
884 configuration builds and have separate configuration
885 files, BitBake places the artifacts for each build in the
886 respective temporary build directories.
887 </para>
888 </section>
889 </section>
890 </section>
891</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
new file mode 100644
index 0000000000..7ea68ade72
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -0,0 +1,1969 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3====================
4Syntax and Operators
5====================
6
7|
8
9BitBake files have their own syntax. The syntax has similarities to
10several other languages but also has some unique features. This section
11describes the available syntax and operators as well as provides
12examples.
13
14Basic Syntax
15============
16
17This section provides some basic syntax examples.
18
19Basic Variable Setting
20----------------------
21
22The following example sets ``VARIABLE`` to "value". This assignment
23occurs immediately as the statement is parsed. It is a "hard"
24assignment. ::
25
26 VARIABLE = "value"
27
28As expected, if you include leading or
29trailing spaces as part of an assignment, the spaces are retained: ::
30
31 VARIABLE = " value"
32 VARIABLE = "value "
33
34Setting ``VARIABLE`` to "" sets
35it to an empty string, while setting the variable to " " sets it to a
36blank space (i.e. these are not the same values). ::
37
38 VARIABLE = ""
39 VARIABLE = " "
40
41You can use single quotes instead of double quotes when setting a
42variable's value. Doing so allows you to use values that contain the
43double quote character: ::
44
45 VARIABLE = 'I have a " in my value'
46
47.. note::
48
49 Unlike in Bourne shells, single quotes work identically to double
50 quotes in all other ways. They do not suppress variable expansions.
51
52Modifying Existing Variables
53----------------------------
54
55Sometimes you need to modify existing variables. Following are some
56cases where you might find you want to modify an existing variable:
57
58- Customize a recipe that uses the variable.
59
60- Change a variable's default value used in a ``*.bbclass`` file.
61
62- Change the variable in a ``*.bbappend`` file to override the variable
63 in the original recipe.
64
65- Change the variable in a configuration file so that the value
66 overrides an existing configuration.
67
68Changing a variable value can sometimes depend on how the value was
69originally assigned and also on the desired intent of the change. In
70particular, when you append a value to a variable that has a default
71value, the resulting value might not be what you expect. In this case,
72the value you provide might replace the value rather than append to the
73default value.
74
75If after you have changed a variable's value and something unexplained
76occurs, you can use BitBake to check the actual value of the suspect
77variable. You can make these checks for both configuration and recipe
78level changes:
79
80- For configuration changes, use the following: ::
81
82 $ bitbake -e
83
84 This
85 command displays variable values after the configuration files (i.e.
86 ``local.conf``, ``bblayers.conf``, ``bitbake.conf`` and so forth)
87 have been parsed.
88
89 .. note::
90
91 Variables that are exported to the environment are preceded by the
92 string "export" in the command's output.
93
94- For recipe changes, use the following: ::
95
96 $ bitbake recipe -e \| grep VARIABLE="
97
98 This command checks to see if the variable actually makes
99 it into a specific recipe.
100
101Line Joining
102------------
103
104Outside of :ref:`functions <bitbake-user-manual/bitbake-user-manual-metadata:functions>`,
105BitBake joins any line ending in
106a backslash character ("\") with the following line before parsing
107statements. The most common use for the "\" character is to split
108variable assignments over multiple lines, as in the following example: ::
109
110 FOO = "bar \
111 baz \
112 qaz"
113
114Both the "\" character and the newline
115character that follow it are removed when joining lines. Thus, no
116newline characters end up in the value of ``FOO``.
117
118Consider this additional example where the two assignments both assign
119"barbaz" to ``FOO``: ::
120
121 FOO = "barbaz"
122 FOO = "bar\
123 baz"
124
125.. note::
126
127 BitBake does not interpret escape sequences like "\n" in variable
128 values. For these to have an effect, the value must be passed to some
129 utility that interprets escape sequences, such as
130 ``printf`` or ``echo -n``.
131
132Variable Expansion
133------------------
134
135Variables can reference the contents of other variables using a syntax
136that is similar to variable expansion in Bourne shells. The following
137assignments result in A containing "aval" and B evaluating to
138"preavalpost". ::
139
140 A = "aval"
141 B = "pre${A}post"
142
143.. note::
144
145 Unlike in Bourne shells, the curly braces are mandatory: Only ``${FOO}`` and not
146 ``$FOO`` is recognized as an expansion of ``FOO``.
147
148The "=" operator does not immediately expand variable references in the
149right-hand side. Instead, expansion is deferred until the variable
150assigned to is actually used. The result depends on the current values
151of the referenced variables. The following example should clarify this
152behavior: ::
153
154 A = "${B} baz"
155 B = "${C} bar"
156 C = "foo"
157 *At this point, ${A} equals "foo bar baz"*
158 C = "qux"
159 *At this point, ${A} equals "qux bar baz"*
160 B = "norf"
161 *At this point, ${A} equals "norf baz"\*
162
163Contrast this behavior with the
164:ref:`bitbake-user-manual/bitbake-user-manual-metadata:immediate variable
165expansion (:=)` operator.
166
167If the variable expansion syntax is used on a variable that does not
168exist, the string is kept as is. For example, given the following
169assignment, ``BAR`` expands to the literal string "${FOO}" as long as
170``FOO`` does not exist. ::
171
172 BAR = "${FOO}"
173
174Setting a default value (?=)
175----------------------------
176
177You can use the "?=" operator to achieve a "softer" assignment for a
178variable. This type of assignment allows you to define a variable if it
179is undefined when the statement is parsed, but to leave the value alone
180if the variable has a value. Here is an example: ::
181
182 A ?= "aval"
183
184If ``A`` is
185set at the time this statement is parsed, the variable retains its
186value. However, if ``A`` is not set, the variable is set to "aval".
187
188.. note::
189
190 This assignment is immediate. Consequently, if multiple "?="
191 assignments to a single variable exist, the first of those ends up
192 getting used.
193
194Setting a weak default value (??=)
195----------------------------------
196
197It is possible to use a "weaker" assignment than in the previous section
198by using the "??=" operator. This assignment behaves identical to "?="
199except that the assignment is made at the end of the parsing process
200rather than immediately. Consequently, when multiple "??=" assignments
201exist, the last one is used. Also, any "=" or "?=" assignment will
202override the value set with "??=". Here is an example: ::
203
204 A ??= "somevalue"
205 A ??= "someothervalue"
206
207If ``A`` is set before the above statements are
208parsed, the variable retains its value. If ``A`` is not set, the
209variable is set to "someothervalue".
210
211Again, this assignment is a "lazy" or "weak" assignment because it does
212not occur until the end of the parsing process.
213
214Immediate variable expansion (:=)
215---------------------------------
216
217The ":=" operator results in a variable's contents being expanded
218immediately, rather than when the variable is actually used: ::
219
220 T = "123"
221 A := "test ${T}"
222 T = "456"
223 B := "${T} ${C}"
224 C = "cval"
225 C := "${C}append"
226
227In this example, ``A`` contains "test 123", even though the final value
228of ``T`` is "456". The variable ``B`` will end up containing "456
229cvalappend". This is because references to undefined variables are
230preserved as is during (immediate)expansion. This is in contrast to GNU
231Make, where undefined variables expand to nothing. The variable ``C``
232contains "cvalappend" since ``${C}`` immediately expands to "cval".
233
234.. _appending-and-prepending:
235
236Appending (+=) and prepending (=+) With Spaces
237----------------------------------------------
238
239Appending and prepending values is common and can be accomplished using
240the "+=" and "=+" operators. These operators insert a space between the
241current value and prepended or appended value.
242
243These operators take immediate effect during parsing. Here are some
244examples: ::
245
246 B = "bval"
247 B += "additionaldata"
248 C = "cval"
249 C =+ "test"
250
251The variable ``B`` contains "bval additionaldata" and ``C`` contains "test
252cval".
253
254.. _appending-and-prepending-without-spaces:
255
256Appending (.=) and Prepending (=.) Without Spaces
257-------------------------------------------------
258
259If you want to append or prepend values without an inserted space, use
260the ".=" and "=." operators.
261
262These operators take immediate effect during parsing. Here are some
263examples: ::
264
265 B = "bval"
266 B .= "additionaldata"
267 C = "cval"
268 C =. "test"
269
270The variable ``B`` contains "bvaladditionaldata" and ``C`` contains
271"testcval".
272
273Appending and Prepending (Override Style Syntax)
274------------------------------------------------
275
276You can also append and prepend a variable's value using an override
277style syntax. When you use this syntax, no spaces are inserted.
278
279These operators differ from the ":=", ".=", "=.", "+=", and "=+"
280operators in that their effects are applied at variable expansion time
281rather than being immediately applied. Here are some examples: ::
282
283 B = "bval"
284 B_append = " additional data"
285 C = "cval"
286 C_prepend = "additional data "
287 D = "dval"
288 D_append = "additional data"
289
290The variable ``B``
291becomes "bval additional data" and ``C`` becomes "additional data cval".
292The variable ``D`` becomes "dvaladditional data".
293
294.. note::
295
296 You must control all spacing when you use the override syntax.
297
298It is also possible to append and prepend to shell functions and
299BitBake-style Python functions. See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:shell functions`" and ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions`"
300sections for examples.
301
302.. _removing-override-style-syntax:
303
304Removal (Override Style Syntax)
305-------------------------------
306
307You can remove values from lists using the removal override style
308syntax. Specifying a value for removal causes all occurrences of that
309value to be removed from the variable.
310
311When you use this syntax, BitBake expects one or more strings.
312Surrounding spaces and spacing are preserved. Here is an example: ::
313
314 FOO = "123 456 789 123456 123 456 123 456"
315 FOO_remove = "123"
316 FOO_remove = "456"
317 FOO2 = " abc def ghi abcdef abc def abc def def"
318 FOO2_remove = "\
319 def \
320 abc \
321 ghi \
322 "
323
324The variable ``FOO`` becomes
325" 789 123456 " and ``FOO2`` becomes " abcdef ".
326
327Like "_append" and "_prepend", "_remove" is applied at variable
328expansion time.
329
330Override Style Operation Advantages
331-----------------------------------
332
333An advantage of the override style operations "_append", "_prepend", and
334"_remove" as compared to the "+=" and "=+" operators is that the
335override style operators provide guaranteed operations. For example,
336consider a class ``foo.bbclass`` that needs to add the value "val" to
337the variable ``FOO``, and a recipe that uses ``foo.bbclass`` as follows: ::
338
339 inherit foo
340 FOO = "initial"
341
342If ``foo.bbclass`` uses the "+=" operator,
343as follows, then the final value of ``FOO`` will be "initial", which is
344not what is desired: ::
345
346 FOO += "val"
347
348If, on the other hand, ``foo.bbclass``
349uses the "_append" operator, then the final value of ``FOO`` will be
350"initial val", as intended: ::
351
352 FOO_append = " val"
353
354.. note::
355
356 It is never necessary to use "+=" together with "_append". The following
357 sequence of assignments appends "barbaz" to FOO: ::
358
359 FOO_append = "bar"
360 FOO_append = "baz"
361
362
363 The only effect of changing the second assignment in the previous
364 example to use "+=" would be to add a space before "baz" in the
365 appended value (due to how the "+=" operator works).
366
367Another advantage of the override style operations is that you can
368combine them with other overrides as described in the
369":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax (overrides)`" section.
370
371Variable Flag Syntax
372--------------------
373
374Variable flags are BitBake's implementation of variable properties or
375attributes. It is a way of tagging extra information onto a variable.
376You can find more out about variable flags in general in the
377":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section.
378
379You can define, append, and prepend values to variable flags. All the
380standard syntax operations previously mentioned work for variable flags
381except for override style syntax (i.e. "_prepend", "_append", and
382"_remove").
383
384Here are some examples showing how to set variable flags: ::
385
386 FOO[a] = "abc"
387 FOO[b] = "123"
388 FOO[a] += "456"
389
390The variable ``FOO`` has two flags:
391``[a]`` and ``[b]``. The flags are immediately set to "abc" and "123",
392respectively. The ``[a]`` flag becomes "abc 456".
393
394No need exists to pre-define variable flags. You can simply start using
395them. One extremely common application is to attach some brief
396documentation to a BitBake variable as follows: ::
397
398 CACHE[doc] = "The directory holding the cache of the metadata."
399
400Inline Python Variable Expansion
401--------------------------------
402
403You can use inline Python variable expansion to set variables. Here is
404an example: ::
405
406 DATE = "${@time.strftime('%Y%m%d',time.gmtime())}"
407
408This example results in the ``DATE`` variable being set to the current date.
409
410Probably the most common use of this feature is to extract the value of
411variables from BitBake's internal data dictionary, ``d``. The following
412lines select the values of a package name and its version number,
413respectively: ::
414
415 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
416 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
417
418.. note::
419
420 Inline Python expressions work just like variable expansions insofar as the
421 "=" and ":=" operators are concerned. Given the following assignment, foo()
422 is called each time FOO is expanded: ::
423
424 FOO = "${@foo()}"
425
426 Contrast this with the following immediate assignment, where foo() is only
427 called once, while the assignment is parsed: ::
428
429 FOO := "${@foo()}"
430
431For a different way to set variables with Python code during parsing,
432see the
433":ref:`bitbake-user-manual/bitbake-user-manual-metadata:anonymous python functions`" section.
434
435Unsetting variables
436-------------------
437
438It is possible to completely remove a variable or a variable flag from
439BitBake's internal data dictionary by using the "unset" keyword. Here is
440an example: ::
441
442 unset DATE
443 unset do_fetch[noexec]
444
445These two statements remove the ``DATE`` and the ``do_fetch[noexec]`` flag.
446
447Providing Pathnames
448-------------------
449
450When specifying pathnames for use with BitBake, do not use the tilde
451("~") character as a shortcut for your home directory. Doing so might
452cause BitBake to not recognize the path since BitBake does not expand
453this character in the same way a shell would.
454
455Instead, provide a fuller path as the following example illustrates: ::
456
457 BBLAYERS ?= " \
458 /home/scott-lenovo/LayerA \
459 "
460
461Exporting Variables to the Environment
462======================================
463
464You can export variables to the environment of running tasks by using
465the ``export`` keyword. For example, in the following example, the
466``do_foo`` task prints "value from the environment" when run: ::
467
468 export ENV_VARIABLE
469 ENV_VARIABLE = "value from the environment"
470
471 do_foo() {
472 bbplain "$ENV_VARIABLE"
473 }
474
475.. note::
476
477 BitBake does not expand ``$ENV_VARIABLE`` in this case because it lacks the
478 obligatory ``{}`` . Rather, ``$ENV_VARIABLE`` is expanded by the shell.
479
480It does not matter whether ``export ENV_VARIABLE`` appears before or
481after assignments to ``ENV_VARIABLE``.
482
483It is also possible to combine ``export`` with setting a value for the
484variable. Here is an example: ::
485
486 export ENV_VARIABLE = "variable-value"
487
488In the output of ``bitbake -e``, variables that are exported to the
489environment are preceded by "export".
490
491Among the variables commonly exported to the environment are ``CC`` and
492``CFLAGS``, which are picked up by many build systems.
493
494Conditional Syntax (Overrides)
495==============================
496
497BitBake uses :term:`OVERRIDES` to control what
498variables are overridden after BitBake parses recipes and configuration
499files. This section describes how you can use ``OVERRIDES`` as
500conditional metadata, talks about key expansion in relationship to
501``OVERRIDES``, and provides some examples to help with understanding.
502
503Conditional Metadata
504--------------------
505
506You can use ``OVERRIDES`` to conditionally select a specific version of
507a variable and to conditionally append or prepend the value of a
508variable.
509
510.. note::
511
512 Overrides can only use lower-case characters. Additionally,
513 underscores are not permitted in override names as they are used to
514 separate overrides from each other and from the variable name.
515
516- *Selecting a Variable:* The ``OVERRIDES`` variable is a
517 colon-character-separated list that contains items for which you want
518 to satisfy conditions. Thus, if you have a variable that is
519 conditional on "arm", and "arm" is in ``OVERRIDES``, then the
520 "arm"-specific version of the variable is used rather than the
521 non-conditional version. Here is an example: ::
522
523 OVERRIDES = "architecture:os:machine"
524 TEST = "default"
525 TEST_os = "osspecific"
526 TEST_nooverride = "othercondvalue"
527
528 In this example, the ``OVERRIDES``
529 variable lists three overrides: "architecture", "os", and "machine".
530 The variable ``TEST`` by itself has a default value of "default". You
531 select the os-specific version of the ``TEST`` variable by appending
532 the "os" override to the variable (i.e. ``TEST_os``).
533
534 To better understand this, consider a practical example that assumes
535 an OpenEmbedded metadata-based Linux kernel recipe file. The
536 following lines from the recipe file first set the kernel branch
537 variable ``KBRANCH`` to a default value, then conditionally override
538 that value based on the architecture of the build: ::
539
540 KBRANCH = "standard/base"
541 KBRANCH_qemuarm = "standard/arm-versatile-926ejs"
542 KBRANCH_qemumips = "standard/mti-malta32"
543 KBRANCH_qemuppc = "standard/qemuppc"
544 KBRANCH_qemux86 = "standard/common-pc/base"
545 KBRANCH_qemux86-64 = "standard/common-pc-64/base"
546 KBRANCH_qemumips64 = "standard/mti-malta64"
547
548- *Appending and Prepending:* BitBake also supports append and prepend
549 operations to variable values based on whether a specific item is
550 listed in ``OVERRIDES``. Here is an example: ::
551
552 DEPENDS = "glibc ncurses"
553 OVERRIDES = "machine:local"
554 DEPENDS_append_machine = "libmad"
555
556 In this example, ``DEPENDS`` becomes "glibc ncurses libmad".
557
558 Again, using an OpenEmbedded metadata-based kernel recipe file as an
559 example, the following lines will conditionally append to the
560 ``KERNEL_FEATURES`` variable based on the architecture: ::
561
562 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
563 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
564 KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
565
566- *Setting a Variable for a Single Task:* BitBake supports setting a
567 variable just for the duration of a single task. Here is an example: ::
568
569 FOO_task-configure = "val 1"
570 FOO_task-compile = "val 2"
571
572 In the
573 previous example, ``FOO`` has the value "val 1" while the
574 ``do_configure`` task is executed, and the value "val 2" while the
575 ``do_compile`` task is executed.
576
577 Internally, this is implemented by prepending the task (e.g.
578 "task-compile:") to the value of
579 :term:`OVERRIDES` for the local datastore of the
580 ``do_compile`` task.
581
582 You can also use this syntax with other combinations (e.g.
583 "``_prepend``") as shown in the following example: ::
584
585 EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} "
586
587Key Expansion
588-------------
589
590Key expansion happens when the BitBake datastore is finalized. To better
591understand this, consider the following example: ::
592
593 A${B} = "X"
594 B = "2"
595 A2 = "Y"
596
597In this case, after all the parsing is complete, BitBake expands
598``${B}`` into "2". This expansion causes ``A2``, which was set to "Y"
599before the expansion, to become "X".
600
601.. _variable-interaction-worked-examples:
602
603Examples
604--------
605
606Despite the previous explanations that show the different forms of
607variable definitions, it can be hard to work out exactly what happens
608when variable operators, conditional overrides, and unconditional
609overrides are combined. This section presents some common scenarios
610along with explanations for variable interactions that typically confuse
611users.
612
613There is often confusion concerning the order in which overrides and
614various "append" operators take effect. Recall that an append or prepend
615operation using "_append" and "_prepend" does not result in an immediate
616assignment as would "+=", ".=", "=+", or "=.". Consider the following
617example: ::
618
619 OVERRIDES = "foo"
620 A = "Z"
621 A_foo_append = "X"
622
623For this case,
624``A`` is unconditionally set to "Z" and "X" is unconditionally and
625immediately appended to the variable ``A_foo``. Because overrides have
626not been applied yet, ``A_foo`` is set to "X" due to the append and
627``A`` simply equals "Z".
628
629Applying overrides, however, changes things. Since "foo" is listed in
630``OVERRIDES``, the conditional variable ``A`` is replaced with the "foo"
631version, which is equal to "X". So effectively, ``A_foo`` replaces
632``A``.
633
634This next example changes the order of the override and the append: ::
635
636 OVERRIDES = "foo"
637 A = "Z"
638 A_append_foo = "X"
639
640For this case, before
641overrides are handled, ``A`` is set to "Z" and ``A_append_foo`` is set
642to "X". Once the override for "foo" is applied, however, ``A`` gets
643appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces
644are not appended.
645
646This next example has the order of the appends and overrides reversed
647back as in the first example: ::
648
649 OVERRIDES = "foo"
650 A = "Y"
651 A_foo_append = "Z"
652 A_foo_append = "X"
653
654For this case, before any overrides are resolved,
655``A`` is set to "Y" using an immediate assignment. After this immediate
656assignment, ``A_foo`` is set to "Z", and then further appended with "X"
657leaving the variable set to "ZX". Finally, applying the override for
658"foo" results in the conditional variable ``A`` becoming "ZX" (i.e.
659``A`` is replaced with ``A_foo``).
660
661This final example mixes in some varying operators: ::
662
663 A = "1"
664 A_append = "2"
665 A_append = "3"
666 A += "4"
667 A .= "5"
668
669For this case, the type of append
670operators are affecting the order of assignments as BitBake passes
671through the code multiple times. Initially, ``A`` is set to "1 45"
672because of the three statements that use immediate operators. After
673these assignments are made, BitBake applies the "_append" operations.
674Those operations result in ``A`` becoming "1 4523".
675
676Sharing Functionality
677=====================
678
679BitBake allows for metadata sharing through include files (``.inc``) and
680class files (``.bbclass``). For example, suppose you have a piece of
681common functionality such as a task definition that you want to share
682between more than one recipe. In this case, creating a ``.bbclass`` file
683that contains the common functionality and then using the ``inherit``
684directive in your recipes to inherit the class would be a common way to
685share the task.
686
687This section presents the mechanisms BitBake provides to allow you to
688share functionality between recipes. Specifically, the mechanisms
689include ``include``, ``inherit``, ``INHERIT``, and ``require``
690directives.
691
692Locating Include and Class Files
693--------------------------------
694
695BitBake uses the :term:`BBPATH` variable to locate
696needed include and class files. Additionally, BitBake searches the
697current directory for ``include`` and ``require`` directives.
698
699.. note::
700
701 The BBPATH variable is analogous to the environment variable PATH .
702
703In order for include and class files to be found by BitBake, they need
704to be located in a "classes" subdirectory that can be found in
705``BBPATH``.
706
707``inherit`` Directive
708---------------------
709
710When writing a recipe or class file, you can use the ``inherit``
711directive to inherit the functionality of a class (``.bbclass``).
712BitBake only supports this directive when used within recipe and class
713files (i.e. ``.bb`` and ``.bbclass``).
714
715The ``inherit`` directive is a rudimentary means of specifying
716functionality contained in class files that your recipes require. For
717example, you can easily abstract out the tasks involved in building a
718package that uses Autoconf and Automake and put those tasks into a class
719file and then have your recipe inherit that class file.
720
721As an example, your recipes could use the following directive to inherit
722an ``autotools.bbclass`` file. The class file would contain common
723functionality for using Autotools that could be shared across recipes: ::
724
725 inherit autotools
726
727In this case, BitBake would search for the directory
728``classes/autotools.bbclass`` in ``BBPATH``.
729
730.. note::
731
732 You can override any values and functions of the inherited class
733 within your recipe by doing so after the "inherit" statement.
734
735If you want to use the directive to inherit multiple classes, separate
736them with spaces. The following example shows how to inherit both the
737``buildhistory`` and ``rm_work`` classes: ::
738
739 inherit buildhistory rm_work
740
741An advantage with the inherit directive as compared to both the
742:ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>`
743directives is that you can inherit class files conditionally. You can
744accomplish this by using a variable expression after the ``inherit``
745statement. Here is an example: ::
746
747 inherit ${VARNAME}
748
749If ``VARNAME`` is
750going to be set, it needs to be set before the ``inherit`` statement is
751parsed. One way to achieve a conditional inherit in this case is to use
752overrides: ::
753
754 VARIABLE = ""
755 VARIABLE_someoverride = "myclass"
756
757Another method is by using anonymous Python. Here is an example: ::
758
759 python () {
760 if condition == value:
761 d.setVar('VARIABLE', 'myclass')
762 else:
763 d.setVar('VARIABLE', '')
764 }
765
766Alternatively, you could use an in-line Python expression in the
767following form: ::
768
769 inherit ${@'classname' if condition else ''}
770 inherit ${@functionname(params)}
771
772In all cases, if the expression evaluates to an
773empty string, the statement does not trigger a syntax error because it
774becomes a no-op.
775
776``include`` Directive
777---------------------
778
779BitBake understands the ``include`` directive. This directive causes
780BitBake to parse whatever file you specify, and to insert that file at
781that location. The directive is much like its equivalent in Make except
782that if the path specified on the include line is a relative path,
783BitBake locates the first file it can find within ``BBPATH``.
784
785The include directive is a more generic method of including
786functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>`
787directive, which is restricted to class (i.e. ``.bbclass``) files. The
788include directive is applicable for any other kind of shared or
789encapsulated functionality or configuration that does not suit a
790``.bbclass`` file.
791
792As an example, suppose you needed a recipe to include some self-test
793definitions: ::
794
795 include test_defs.inc
796
797.. note::
798
799 The include directive does not produce an error when the file cannot be
800 found. Consequently, it is recommended that if the file you are including is
801 expected to exist, you should use :ref:`require <require-inclusion>` instead
802 of include . Doing so makes sure that an error is produced if the file cannot
803 be found.
804
805.. _require-inclusion:
806
807``require`` Directive
808---------------------
809
810BitBake understands the ``require`` directive. This directive behaves
811just like the ``include`` directive with the exception that BitBake
812raises a parsing error if the file to be included cannot be found. Thus,
813any file you require is inserted into the file that is being parsed at
814the location of the directive.
815
816The require directive, like the include directive previously described,
817is a more generic method of including functionality as compared to the
818:ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` directive, which is restricted to class
819(i.e. ``.bbclass``) files. The require directive is applicable for any
820other kind of shared or encapsulated functionality or configuration that
821does not suit a ``.bbclass`` file.
822
823Similar to how BitBake handles :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`, if
824the path specified on the require line is a relative path, BitBake
825locates the first file it can find within ``BBPATH``.
826
827As an example, suppose you have two versions of a recipe (e.g.
828``foo_1.2.2.bb`` and ``foo_2.0.0.bb``) where each version contains some
829identical functionality that could be shared. You could create an
830include file named ``foo.inc`` that contains the common definitions
831needed to build "foo". You need to be sure ``foo.inc`` is located in the
832same directory as your two recipe files as well. Once these conditions
833are set up, you can share the functionality using a ``require``
834directive from within each recipe: ::
835
836 require foo.inc
837
838``INHERIT`` Configuration Directive
839-----------------------------------
840
841When creating a configuration file (``.conf``), you can use the
842:term:`INHERIT` configuration directive to inherit a
843class. BitBake only supports this directive when used within a
844configuration file.
845
846As an example, suppose you needed to inherit a class file called
847``abc.bbclass`` from a configuration file as follows: ::
848
849 INHERIT += "abc"
850
851This configuration directive causes the named class to be inherited at
852the point of the directive during parsing. As with the ``inherit``
853directive, the ``.bbclass`` file must be located in a "classes"
854subdirectory in one of the directories specified in ``BBPATH``.
855
856.. note::
857
858 Because .conf files are parsed first during BitBake's execution, using
859 INHERIT to inherit a class effectively inherits the class globally (i.e. for
860 all recipes).
861
862If you want to use the directive to inherit multiple classes, you can
863provide them on the same line in the ``local.conf`` file. Use spaces to
864separate the classes. The following example shows how to inherit both
865the ``autotools`` and ``pkgconfig`` classes: ::
866
867 INHERIT += "autotools pkgconfig"
868
869Functions
870=========
871
872As with most languages, functions are the building blocks that are used
873to build up operations into tasks. BitBake supports these types of
874functions:
875
876- *Shell Functions:* Functions written in shell script and executed
877 either directly as functions, tasks, or both. They can also be called
878 by other shell functions.
879
880- *BitBake-Style Python Functions:* Functions written in Python and
881 executed by BitBake or other Python functions using
882 ``bb.build.exec_func()``.
883
884- *Python Functions:* Functions written in Python and executed by
885 Python.
886
887- *Anonymous Python Functions:* Python functions executed automatically
888 during parsing.
889
890Regardless of the type of function, you can only define them in class
891(``.bbclass``) and recipe (``.bb`` or ``.inc``) files.
892
893Shell Functions
894---------------
895
896Functions written in shell script and executed either directly as
897functions, tasks, or both. They can also be called by other shell
898functions. Here is an example shell function definition: ::
899
900 some_function () {
901 echo "Hello World"
902 }
903
904When you create these types of functions in
905your recipe or class files, you need to follow the shell programming
906rules. The scripts are executed by ``/bin/sh``, which may not be a bash
907shell but might be something such as ``dash``. You should not use
908Bash-specific script (bashisms).
909
910Overrides and override-style operators like ``_append`` and ``_prepend``
911can also be applied to shell functions. Most commonly, this application
912would be used in a ``.bbappend`` file to modify functions in the main
913recipe. It can also be used to modify functions inherited from classes.
914
915As an example, consider the following: ::
916
917 do_foo() {
918 bbplain first
919 fn
920 }
921
922 fn_prepend() {
923 bbplain second
924 }
925
926 fn() {
927 bbplain third
928 }
929
930 do_foo_append() {
931 bbplain fourth
932 }
933
934Running ``do_foo`` prints the following: ::
935
936 recipename do_foo: first
937 recipename do_foo: second
938 recipename do_foo: third
939 recipename do_foo: fourth
940
941.. note::
942
943 Overrides and override-style operators can be applied to any shell
944 function, not just :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`.
945
946You can use the ``bitbake -e`` recipename command to view the final
947assembled function after all overrides have been applied.
948
949BitBake-Style Python Functions
950------------------------------
951
952These functions are written in Python and executed by BitBake or other
953Python functions using ``bb.build.exec_func()``.
954
955An example BitBake function is: ::
956
957 python some_python_function () {
958 d.setVar("TEXT", "Hello World")
959 print d.getVar("TEXT")
960 }
961
962Because the
963Python "bb" and "os" modules are already imported, you do not need to
964import these modules. Also in these types of functions, the datastore
965("d") is a global variable and is always automatically available.
966
967.. note::
968
969 Variable expressions (e.g. ``${X}`` ) are no longer expanded within Python
970 functions. This behavior is intentional in order to allow you to freely set
971 variable values to expandable expressions without having them expanded
972 prematurely. If you do wish to expand a variable within a Python function,
973 use ``d.getVar("X")`` . Or, for more complicated expressions, use ``d.expand()``.
974
975Similar to shell functions, you can also apply overrides and
976override-style operators to BitBake-style Python functions.
977
978As an example, consider the following: ::
979
980 python do_foo_prepend() {
981 bb.plain("first")
982 }
983
984 python do_foo() {
985 bb.plain("second")
986 }
987
988 python do_foo_append() {
989 bb.plain("third")
990 }
991
992Running ``do_foo`` prints the following: ::
993
994 recipename do_foo: first
995 recipename do_foo: second
996 recipename do_foo: third
997
998You can use the ``bitbake -e`` recipename command to view
999the final assembled function after all overrides have been applied.
1000
1001Python Functions
1002----------------
1003
1004These functions are written in Python and are executed by other Python
1005code. Examples of Python functions are utility functions that you intend
1006to call from in-line Python or from within other Python functions. Here
1007is an example: ::
1008
1009 def get_depends(d):
1010 if d.getVar('SOMECONDITION'):
1011 return "dependencywithcond"
1012 else:
1013 return "dependency"
1014
1015 SOMECONDITION = "1"
1016 DEPENDS = "${@get_depends(d)}"
1017
1018This would result in ``DEPENDS`` containing ``dependencywithcond``.
1019
1020Here are some things to know about Python functions:
1021
1022- Python functions can take parameters.
1023
1024- The BitBake datastore is not automatically available. Consequently,
1025 you must pass it in as a parameter to the function.
1026
1027- The "bb" and "os" Python modules are automatically available. You do
1028 not need to import them.
1029
1030BitBake-Style Python Functions Versus Python Functions
1031------------------------------------------------------
1032
1033Following are some important differences between BitBake-style Python
1034functions and regular Python functions defined with "def":
1035
1036- Only BitBake-style Python functions can be :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`.
1037
1038- Overrides and override-style operators can only be applied to
1039 BitBake-style Python functions.
1040
1041- Only regular Python functions can take arguments and return values.
1042
1043- :ref:`Variable flags <bitbake-user-manual/bitbake-user-manual-metadata:variable flags>` such as
1044 ``[dirs]``, ``[cleandirs]``, and ``[lockfiles]`` can be used on BitBake-style
1045 Python functions, but not on regular Python functions.
1046
1047- BitBake-style Python functions generate a separate
1048 ``${``\ :term:`T`\ ``}/run.``\ function-name\ ``.``\ pid
1049 script that is executed to run the function, and also generate a log
1050 file in ``${T}/log.``\ function-name\ ``.``\ pid if they are executed
1051 as tasks.
1052
1053 Regular Python functions execute "inline" and do not generate any
1054 files in ``${T}``.
1055
1056- Regular Python functions are called with the usual Python syntax.
1057 BitBake-style Python functions are usually tasks and are called
1058 directly by BitBake, but can also be called manually from Python code
1059 by using the ``bb.build.exec_func()`` function. Here is an example: ::
1060
1061 bb.build.exec_func("my_bitbake_style_function", d)
1062
1063 .. note::
1064
1065 ``bb.build.exec_func()`` can also be used to run shell functions from Python
1066 code. If you want to run a shell function before a Python function within
1067 the same task, then you can use a parent helper Python function that
1068 starts by running the shell function with ``bb.build.exec_func()`` and then
1069 runs the Python code.
1070
1071 To detect errors from functions executed with
1072 ``bb.build.exec_func()``, you can catch the ``bb.build.FuncFailed``
1073 exception.
1074
1075 .. note::
1076
1077 Functions in metadata (recipes and classes) should not themselves raise
1078 ``bb.build.FuncFailed``. Rather, ``bb.build.FuncFailed`` should be viewed as a
1079 general indicator that the called function failed by raising an
1080 exception. For example, an exception raised by ``bb.fatal()`` will be caught
1081 inside ``bb.build.exec_func()``, and a ``bb.build.FuncFailed`` will be raised in
1082 response.
1083
1084Due to their simplicity, you should prefer regular Python functions over
1085BitBake-style Python functions unless you need a feature specific to
1086BitBake-style Python functions. Regular Python functions in metadata are
1087a more recent invention than BitBake-style Python functions, and older
1088code tends to use ``bb.build.exec_func()`` more often.
1089
1090Anonymous Python Functions
1091--------------------------
1092
1093Sometimes it is useful to set variables or perform other operations
1094programmatically during parsing. To do this, you can define special
1095Python functions, called anonymous Python functions, that run at the end
1096of parsing. For example, the following conditionally sets a variable
1097based on the value of another variable: ::
1098
1099 python () {
1100 if d.getVar('SOMEVAR') == 'value':
1101 d.setVar('ANOTHERVAR', 'value2')
1102 }
1103
1104An equivalent way to mark a function as an anonymous function is to give it
1105the name "__anonymous", rather than no name.
1106
1107Anonymous Python functions always run at the end of parsing, regardless
1108of where they are defined. If a recipe contains many anonymous
1109functions, they run in the same order as they are defined within the
1110recipe. As an example, consider the following snippet: ::
1111
1112 python () {
1113 d.setVar('FOO', 'foo 2')
1114 }
1115
1116 FOO = "foo 1"
1117
1118 python () {
1119 d.appendVar('BAR',' bar 2')
1120 }
1121
1122 BAR = "bar 1"
1123
1124The previous example is conceptually
1125equivalent to the following snippet: ::
1126
1127 FOO = "foo 1"
1128 BAR = "bar 1"
1129 FOO = "foo 2"
1130 BAR += "bar 2"
1131
1132``FOO`` ends up with the value "foo 2", and
1133``BAR`` with the value "bar 1 bar 2". Just as in the second snippet, the
1134values set for the variables within the anonymous functions become
1135available to tasks, which always run after parsing.
1136
1137Overrides and override-style operators such as "``_append``" are applied
1138before anonymous functions run. In the following example, ``FOO`` ends
1139up with the value "foo from anonymous": ::
1140
1141 FOO = "foo"
1142 FOO_append = " from outside"
1143
1144 python () {
1145 d.setVar("FOO", "foo from anonymous")
1146 }
1147
1148For methods
1149you can use with anonymous Python functions, see the
1150":ref:`bitbake-user-manual/bitbake-user-manual-metadata:functions you can call from within python`"
1151section. For a different method to run Python code during parsing, see
1152the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inline python variable expansion`" section.
1153
1154Flexible Inheritance for Class Functions
1155----------------------------------------
1156
1157Through coding techniques and the use of ``EXPORT_FUNCTIONS``, BitBake
1158supports exporting a function from a class such that the class function
1159appears as the default implementation of the function, but can still be
1160called if a recipe inheriting the class needs to define its own version
1161of the function.
1162
1163To understand the benefits of this feature, consider the basic scenario
1164where a class defines a task function and your recipe inherits the
1165class. In this basic scenario, your recipe inherits the task function as
1166defined in the class. If desired, your recipe can add to the start and
1167end of the function by using the "_prepend" or "_append" operations
1168respectively, or it can redefine the function completely. However, if it
1169redefines the function, there is no means for it to call the class
1170version of the function. ``EXPORT_FUNCTIONS`` provides a mechanism that
1171enables the recipe's version of the function to call the original
1172version of the function.
1173
1174To make use of this technique, you need the following things in place:
1175
1176- The class needs to define the function as follows: ::
1177
1178 classname_functionname
1179
1180 For example, if you have a class file
1181 ``bar.bbclass`` and a function named ``do_foo``, the class must
1182 define the function as follows: ::
1183
1184 bar_do_foo
1185
1186- The class needs to contain the ``EXPORT_FUNCTIONS`` statement as
1187 follows: ::
1188
1189 EXPORT_FUNCTIONS functionname
1190
1191 For example, continuing with
1192 the same example, the statement in the ``bar.bbclass`` would be as
1193 follows: ::
1194
1195 EXPORT_FUNCTIONS do_foo
1196
1197- You need to call the function appropriately from within your recipe.
1198 Continuing with the same example, if your recipe needs to call the
1199 class version of the function, it should call ``bar_do_foo``.
1200 Assuming ``do_foo`` was a shell function and ``EXPORT_FUNCTIONS`` was
1201 used as above, the recipe's function could conditionally call the
1202 class version of the function as follows: ::
1203
1204 do_foo() {
1205 if [ somecondition ] ; then
1206 bar_do_foo
1207 else
1208 # Do something else
1209 fi
1210 }
1211
1212 To call your modified version of the function as defined in your recipe,
1213 call it as ``do_foo``.
1214
1215With these conditions met, your single recipe can freely choose between
1216the original function as defined in the class file and the modified
1217function in your recipe. If you do not set up these conditions, you are
1218limited to using one function or the other.
1219
1220Tasks
1221=====
1222
1223Tasks are BitBake execution units that make up the steps that BitBake
1224can run for a given recipe. Tasks are only supported in recipes and
1225classes (i.e. in ``.bb`` files and files included or inherited from
1226``.bb`` files). By convention, tasks have names that start with "do\_".
1227
1228Promoting a Function to a Task
1229------------------------------
1230
1231Tasks are either :ref:`shell functions <bitbake-user-manual/bitbake-user-manual-metadata:shell functions>` or
1232:ref:`BitBake-style Python functions <bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions>`
1233that have been promoted to tasks by using the ``addtask`` command. The
1234``addtask`` command can also optionally describe dependencies between
1235the task and other tasks. Here is an example that shows how to define a
1236task and declare some dependencies: ::
1237
1238 python do_printdate () {
1239 import time
1240 print time.strftime('%Y%m%d', time.gmtime())
1241 }
1242 addtask printdate after do_fetch before do_build
1243
1244The first argument to ``addtask`` is the name
1245of the function to promote to a task. If the name does not start with
1246"do\_", "do\_" is implicitly added, which enforces the convention that all
1247task names start with "do\_".
1248
1249In the previous example, the ``do_printdate`` task becomes a dependency
1250of the ``do_build`` task, which is the default task (i.e. the task run
1251by the ``bitbake`` command unless another task is specified explicitly).
1252Additionally, the ``do_printdate`` task becomes dependent upon the
1253``do_fetch`` task. Running the ``do_build`` task results in the
1254``do_printdate`` task running first.
1255
1256.. note::
1257
1258 If you try out the previous example, you might see that the
1259 ``do_printdate``
1260 task is only run the first time you build the recipe with the
1261 ``bitbake``
1262 command. This is because BitBake considers the task "up-to-date"
1263 after that initial run. If you want to force the task to always be
1264 rerun for experimentation purposes, you can make BitBake always
1265 consider the task "out-of-date" by using the
1266 :ref:`[nostamp] <bitbake-user-manual/bitbake-user-manual-metadata:Variable Flags>`
1267 variable flag, as follows: ::
1268
1269 do_printdate[nostamp] = "1"
1270
1271 You can also explicitly run the task and provide the
1272 -f option as follows: ::
1273
1274 $ bitbake recipe -c printdate -f
1275
1276 When manually selecting a task to run with the bitbake ``recipe
1277 -c task`` command, you can omit the "do\_" prefix as part of the task
1278 name.
1279
1280You might wonder about the practical effects of using ``addtask``
1281without specifying any dependencies as is done in the following example: ::
1282
1283 addtask printdate
1284
1285In this example, assuming dependencies have not been
1286added through some other means, the only way to run the task is by
1287explicitly selecting it with ``bitbake`` recipe ``-c printdate``. You
1288can use the ``do_listtasks`` task to list all tasks defined in a recipe
1289as shown in the following example: ::
1290
1291 $ bitbake recipe -c listtasks
1292
1293For more information on task dependencies, see the
1294":ref:`bitbake-user-manual/bitbake-user-manual-execution:dependencies`" section.
1295
1296See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section for information
1297on variable flags you can use with tasks.
1298
1299Deleting a Task
1300---------------
1301
1302As well as being able to add tasks, you can delete them. Simply use the
1303``deltask`` command to delete a task. For example, to delete the example
1304task used in the previous sections, you would use: ::
1305
1306 deltask printdate
1307
1308If you delete a task using the ``deltask`` command and the task has
1309dependencies, the dependencies are not reconnected. For example, suppose
1310you have three tasks named ``do_a``, ``do_b``, and ``do_c``.
1311Furthermore, ``do_c`` is dependent on ``do_b``, which in turn is
1312dependent on ``do_a``. Given this scenario, if you use ``deltask`` to
1313delete ``do_b``, the implicit dependency relationship between ``do_c``
1314and ``do_a`` through ``do_b`` no longer exists, and ``do_c``
1315dependencies are not updated to include ``do_a``. Thus, ``do_c`` is free
1316to run before ``do_a``.
1317
1318If you want dependencies such as these to remain intact, use the
1319``[noexec]`` varflag to disable the task instead of using the
1320``deltask`` command to delete it: ::
1321
1322 do_b[noexec] = "1"
1323
1324Passing Information Into the Build Task Environment
1325---------------------------------------------------
1326
1327When running a task, BitBake tightly controls the shell execution
1328environment of the build tasks to make sure unwanted contamination from
1329the build machine cannot influence the build.
1330
1331.. note::
1332
1333 By default, BitBake cleans the environment to include only those
1334 things exported or listed in its whitelist to ensure that the build
1335 environment is reproducible and consistent. You can prevent this
1336 "cleaning" by setting the :term:`BB_PRESERVE_ENV` variable.
1337
1338Consequently, if you do want something to get passed into the build task
1339environment, you must take these two steps:
1340
1341#. Tell BitBake to load what you want from the environment into the
1342 datastore. You can do so through the
1343 :term:`BB_ENV_WHITELIST` and
1344 :term:`BB_ENV_EXTRAWHITE` variables. For
1345 example, assume you want to prevent the build system from accessing
1346 your ``$HOME/.ccache`` directory. The following command "whitelists"
1347 the environment variable ``CCACHE_DIR`` causing BitBake to allow that
1348 variable into the datastore: ::
1349
1350 export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"
1351
1352#. Tell BitBake to export what you have loaded into the datastore to the
1353 task environment of every running task. Loading something from the
1354 environment into the datastore (previous step) only makes it
1355 available in the datastore. To export it to the task environment of
1356 every running task, use a command similar to the following in your
1357 local configuration file ``local.conf`` or your distribution
1358 configuration file: ::
1359
1360 export CCACHE_DIR
1361
1362 .. note::
1363
1364 A side effect of the previous steps is that BitBake records the
1365 variable as a dependency of the build process in things like the
1366 setscene checksums. If doing so results in unnecessary rebuilds of
1367 tasks, you can whitelist the variable so that the setscene code
1368 ignores the dependency when it creates checksums.
1369
1370Sometimes, it is useful to be able to obtain information from the
1371original execution environment. BitBake saves a copy of the original
1372environment into a special variable named :term:`BB_ORIGENV`.
1373
1374The ``BB_ORIGENV`` variable returns a datastore object that can be
1375queried using the standard datastore operators such as
1376``getVar(, False)``. The datastore object is useful, for example, to
1377find the original ``DISPLAY`` variable. Here is an example: ::
1378
1379 origenv = d.getVar("BB_ORIGENV", False)
1380 bar = origenv.getVar("BAR", False)
1381
1382The previous example returns ``BAR`` from the original execution
1383environment.
1384
1385Variable Flags
1386==============
1387
1388Variable flags (varflags) help control a task's functionality and
1389dependencies. BitBake reads and writes varflags to the datastore using
1390the following command forms: ::
1391
1392 variable = d.getVarFlags("variable")
1393 self.d.setVarFlags("FOO", {"func": True})
1394
1395When working with varflags, the same syntax, with the exception of
1396overrides, applies. In other words, you can set, append, and prepend
1397varflags just like variables. See the
1398":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flag syntax`" section for details.
1399
1400BitBake has a defined set of varflags available for recipes and classes.
1401Tasks support a number of these flags which control various
1402functionality of the task:
1403
1404- ``[cleandirs]``: Empty directories that should be created before
1405 the task runs. Directories that already exist are removed and
1406 recreated to empty them.
1407
1408- ``[depends]``: Controls inter-task dependencies. See the
1409 :term:`DEPENDS` variable and the
1410 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inter-task
1411 dependencies`" section for more information.
1412
1413- ``[deptask]``: Controls task build-time dependencies. See the
1414 :term:`DEPENDS` variable and the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:build dependencies`" section for more information.
1415
1416- ``[dirs]``: Directories that should be created before the task
1417 runs. Directories that already exist are left as is. The last
1418 directory listed is used as the current working directory for the
1419 task.
1420
1421- ``[lockfiles]``: Specifies one or more lockfiles to lock while the
1422 task executes. Only one task may hold a lockfile, and any task that
1423 attempts to lock an already locked file will block until the lock is
1424 released. You can use this variable flag to accomplish mutual
1425 exclusion.
1426
1427- ``[noexec]``: When set to "1", marks the task as being empty, with
1428 no execution required. You can use the ``[noexec]`` flag to set up
1429 tasks as dependency placeholders, or to disable tasks defined
1430 elsewhere that are not needed in a particular recipe.
1431
1432- ``[nostamp]``: When set to "1", tells BitBake to not generate a
1433 stamp file for a task, which implies the task should always be
1434 executed.
1435
1436 .. caution::
1437
1438 Any task that depends (possibly indirectly) on a ``[nostamp]`` task will
1439 always be executed as well. This can cause unnecessary rebuilding if you
1440 are not careful.
1441
1442- ``[number_threads]``: Limits tasks to a specific number of
1443 simultaneous threads during execution. This varflag is useful when
1444 your build host has a large number of cores but certain tasks need to
1445 be rate-limited due to various kinds of resource constraints (e.g. to
1446 avoid network throttling). ``number_threads`` works similarly to the
1447 :term:`BB_NUMBER_THREADS` variable but is task-specific.
1448
1449 Set the value globally. For example, the following makes sure the
1450 ``do_fetch`` task uses no more than two simultaneous execution
1451 threads: do_fetch[number_threads] = "2"
1452
1453 .. warning::
1454
1455 - Setting the varflag in individual recipes rather than globally
1456 can result in unpredictable behavior.
1457
1458 - Setting the varflag to a value greater than the value used in
1459 the ``BB_NUMBER_THREADS`` variable causes ``number_threads`` to
1460 have no effect.
1461
1462- ``[postfuncs]``: List of functions to call after the completion of
1463 the task.
1464
1465- ``[prefuncs]``: List of functions to call before the task executes.
1466
1467- ``[rdepends]``: Controls inter-task runtime dependencies. See the
1468 :term:`RDEPENDS` variable, the
1469 :term:`RRECOMMENDS` variable, and the
1470 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inter-task dependencies`" section for
1471 more information.
1472
1473- ``[rdeptask]``: Controls task runtime dependencies. See the
1474 :term:`RDEPENDS` variable, the
1475 :term:`RRECOMMENDS` variable, and the
1476 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:runtime dependencies`" section for more
1477 information.
1478
1479- ``[recideptask]``: When set in conjunction with ``recrdeptask``,
1480 specifies a task that should be inspected for additional
1481 dependencies.
1482
1483- ``[recrdeptask]``: Controls task recursive runtime dependencies.
1484 See the :term:`RDEPENDS` variable, the
1485 :term:`RRECOMMENDS` variable, and the
1486 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:recursive dependencies`" section for
1487 more information.
1488
1489- ``[stamp-extra-info]``: Extra stamp information to append to the
1490 task's stamp. As an example, OpenEmbedded uses this flag to allow
1491 machine-specific tasks.
1492
1493- ``[umask]``: The umask to run the task under.
1494
1495Several varflags are useful for controlling how signatures are
1496calculated for variables. For more information on this process, see the
1497":ref:`bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`" section.
1498
1499- ``[vardeps]``: Specifies a space-separated list of additional
1500 variables to add to a variable's dependencies for the purposes of
1501 calculating its signature. Adding variables to this list is useful,
1502 for example, when a function refers to a variable in a manner that
1503 does not allow BitBake to automatically determine that the variable
1504 is referred to.
1505
1506- ``[vardepsexclude]``: Specifies a space-separated list of variables
1507 that should be excluded from a variable's dependencies for the
1508 purposes of calculating its signature.
1509
1510- ``[vardepvalue]``: If set, instructs BitBake to ignore the actual
1511 value of the variable and instead use the specified value when
1512 calculating the variable's signature.
1513
1514- ``[vardepvalueexclude]``: Specifies a pipe-separated list of
1515 strings to exclude from the variable's value when calculating the
1516 variable's signature.
1517
1518Events
1519======
1520
1521BitBake allows installation of event handlers within recipe and class
1522files. Events are triggered at certain points during operation, such as
1523the beginning of operation against a given recipe (i.e. ``*.bb``), the
1524start of a given task, a task failure, a task success, and so forth. The
1525intent is to make it easy to do things like email notification on build
1526failures.
1527
1528Following is an example event handler that prints the name of the event
1529and the content of the ``FILE`` variable: ::
1530
1531 addhandler myclass_eventhandler
1532 python myclass_eventhandler() {
1533 from bb.event import getName
1534 print("The name of the Event is %s" % getName(e))
1535 print("The file we run for is %s" % d.getVar('FILE'))
1536 }
1537 myclass_eventhandler[eventmask] = "bb.event.BuildStarted
1538 bb.event.BuildCompleted"
1539
1540In the previous example, an eventmask has been
1541set so that the handler only sees the "BuildStarted" and
1542"BuildCompleted" events. This event handler gets called every time an
1543event matching the eventmask is triggered. A global variable "e" is
1544defined, which represents the current event. With the ``getName(e)``
1545method, you can get the name of the triggered event. The global
1546datastore is available as "d". In legacy code, you might see "e.data"
1547used to get the datastore. However, realize that "e.data" is deprecated
1548and you should use "d" going forward.
1549
1550The context of the datastore is appropriate to the event in question.
1551For example, "BuildStarted" and "BuildCompleted" events run before any
1552tasks are executed so would be in the global configuration datastore
1553namespace. No recipe-specific metadata exists in that namespace. The
1554"BuildStarted" and "BuildCompleted" events also run in the main
1555cooker/server process rather than any worker context. Thus, any changes
1556made to the datastore would be seen by other cooker/server events within
1557the current build but not seen outside of that build or in any worker
1558context. Task events run in the actual tasks in question consequently
1559have recipe-specific and task-specific contents. These events run in the
1560worker context and are discarded at the end of task execution.
1561
1562During a standard build, the following common events might occur. The
1563following events are the most common kinds of events that most metadata
1564might have an interest in viewing:
1565
1566- ``bb.event.ConfigParsed()``: Fired when the base configuration; which
1567 consists of ``bitbake.conf``, ``base.bbclass`` and any global
1568 ``INHERIT`` statements; has been parsed. You can see multiple such
1569 events when each of the workers parse the base configuration or if
1570 the server changes configuration and reparses. Any given datastore
1571 only has one such event executed against it, however. If
1572 ```BB_INVALIDCONF`` <#>`__ is set in the datastore by the event
1573 handler, the configuration is reparsed and a new event triggered,
1574 allowing the metadata to update configuration.
1575
1576- ``bb.event.HeartbeatEvent()``: Fires at regular time intervals of one
1577 second. You can configure the interval time using the
1578 ``BB_HEARTBEAT_EVENT`` variable. The event's "time" attribute is the
1579 ``time.time()`` value when the event is triggered. This event is
1580 useful for activities such as system state monitoring.
1581
1582- ``bb.event.ParseStarted()``: Fired when BitBake is about to start
1583 parsing recipes. This event's "total" attribute represents the number
1584 of recipes BitBake plans to parse.
1585
1586- ``bb.event.ParseProgress()``: Fired as parsing progresses. This
1587 event's "current" attribute is the number of recipes parsed as well
1588 as the "total" attribute.
1589
1590- ``bb.event.ParseCompleted()``: Fired when parsing is complete. This
1591 event's "cached", "parsed", "skipped", "virtuals", "masked", and
1592 "errors" attributes provide statistics for the parsing results.
1593
1594- ``bb.event.BuildStarted()``: Fired when a new build starts. BitBake
1595 fires multiple "BuildStarted" events (one per configuration) when
1596 multiple configuration (multiconfig) is enabled.
1597
1598- ``bb.build.TaskStarted()``: Fired when a task starts. This event's
1599 "taskfile" attribute points to the recipe from which the task
1600 originates. The "taskname" attribute, which is the task's name,
1601 includes the ``do_`` prefix, and the "logfile" attribute point to
1602 where the task's output is stored. Finally, the "time" attribute is
1603 the task's execution start time.
1604
1605- ``bb.build.TaskInvalid()``: Fired if BitBake tries to execute a task
1606 that does not exist.
1607
1608- ``bb.build.TaskFailedSilent()``: Fired for setscene tasks that fail
1609 and should not be presented to the user verbosely.
1610
1611- ``bb.build.TaskFailed()``: Fired for normal tasks that fail.
1612
1613- ``bb.build.TaskSucceeded()``: Fired when a task successfully
1614 completes.
1615
1616- ``bb.event.BuildCompleted()``: Fired when a build finishes.
1617
1618- ``bb.cooker.CookerExit()``: Fired when the BitBake server/cooker
1619 shuts down. This event is usually only seen by the UIs as a sign they
1620 should also shutdown.
1621
1622This next list of example events occur based on specific requests to the
1623server. These events are often used to communicate larger pieces of
1624information from the BitBake server to other parts of BitBake such as
1625user interfaces:
1626
1627- ``bb.event.TreeDataPreparationStarted()``
1628- ``bb.event.TreeDataPreparationProgress()``
1629- ``bb.event.TreeDataPreparationCompleted()``
1630- ``bb.event.DepTreeGenerated()``
1631- ``bb.event.CoreBaseFilesFound()``
1632- ``bb.event.ConfigFilePathFound()``
1633- ``bb.event.FilesMatchingFound()``
1634- ``bb.event.ConfigFilesFound()``
1635- ``bb.event.TargetsTreeGenerated()``
1636
1637.. _variants-class-extension-mechanism:
1638
1639Variants - Class Extension Mechanism
1640====================================
1641
1642BitBake supports two features that facilitate creating from a single
1643recipe file multiple incarnations of that recipe file where all
1644incarnations are buildable. These features are enabled through the
1645:term:`BBCLASSEXTEND` and :term:`BBVERSIONS` variables.
1646
1647.. note::
1648
1649 The mechanism for this class extension is extremely specific to the
1650 implementation. Usually, the recipe's :term:`PROVIDES` , :term:`PN` , and
1651 :term:`DEPENDS` variables would need to be modified by the extension
1652 class. For specific examples, see the OE-Core native , nativesdk , and
1653 multilib classes.
1654
1655- ``BBCLASSEXTEND``: This variable is a space separated list of
1656 classes used to "extend" the recipe for each variant. Here is an
1657 example that results in a second incarnation of the current recipe
1658 being available. This second incarnation will have the "native" class
1659 inherited. ::
1660
1661 BBCLASSEXTEND = "native"
1662
1663- ``BBVERSIONS``: This variable allows a single recipe to build
1664 multiple versions of a project from a single recipe file. You can
1665 also specify conditional metadata (using the
1666 :term:`OVERRIDES` mechanism) for a single
1667 version, or an optionally named range of versions. Here is an
1668 example: ::
1669
1670 BBVERSIONS = "1.0 2.0 git"
1671 SRC_URI_git = "git://someurl/somepath.git"
1672
1673 BBVERSIONS = "1.0.[0-6]:1.0.0+ 1.0.[7-9]:1.0.7+"
1674 SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"
1675
1676 The name of the range defaults to the original version of the recipe. For
1677 example, in OpenEmbedded, the recipe file ``foo_1.0.0+.bb`` creates a default
1678 name range of ``1.0.0+``. This is useful because the range name is not only
1679 placed into overrides, but it is also made available for the metadata to use
1680 in the variable that defines the base recipe versions for use in ``file://``
1681 search paths (:term:`FILESPATH`).
1682
1683Dependencies
1684============
1685
1686To allow for efficient parallel processing, BitBake handles dependencies
1687at the task level. Dependencies can exist both between tasks within a
1688single recipe and between tasks in different recipes. Following are
1689examples of each:
1690
1691- For tasks within a single recipe, a recipe's ``do_configure`` task
1692 might need to complete before its ``do_compile`` task can run.
1693
1694- For tasks in different recipes, one recipe's ``do_configure`` task
1695 might require another recipe's ``do_populate_sysroot`` task to finish
1696 first such that the libraries and headers provided by the other
1697 recipe are available.
1698
1699This section describes several ways to declare dependencies. Remember,
1700even though dependencies are declared in different ways, they are all
1701simply dependencies between tasks.
1702
1703.. _dependencies-internal-to-the-bb-file:
1704
1705Dependencies Internal to the ``.bb`` File
1706-----------------------------------------
1707
1708BitBake uses the ``addtask`` directive to manage dependencies that are
1709internal to a given recipe file. You can use the ``addtask`` directive
1710to indicate when a task is dependent on other tasks or when other tasks
1711depend on that recipe. Here is an example: ::
1712
1713 addtask printdate after do_fetch before do_build
1714
1715In this example, the ``do_printdate`` task
1716depends on the completion of the ``do_fetch`` task, and the ``do_build``
1717task depends on the completion of the ``do_printdate`` task.
1718
1719.. note::
1720
1721 For a task to run, it must be a direct or indirect dependency of some
1722 other task that is scheduled to run.
1723
1724 For illustration, here are some examples:
1725
1726 - The directive ``addtask mytask before do_configure`` causes
1727 ``do_mytask`` to run before ``do_configure`` runs. Be aware that
1728 ``do_mytask`` still only runs if its :ref:`input
1729 checksum <bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)>` has changed since the last time it was
1730 run. Changes to the input checksum of ``do_mytask`` also
1731 indirectly cause ``do_configure`` to run.
1732
1733 - The directive ``addtask mytask after do_configure`` by itself
1734 never causes ``do_mytask`` to run. ``do_mytask`` can still be run
1735 manually as follows: ::
1736
1737 $ bitbake recipe -c mytask
1738
1739 Declaring ``do_mytask`` as a dependency of some other task that is
1740 scheduled to run also causes it to run. Regardless, the task runs after
1741 ``do_configure``.
1742
1743Build Dependencies
1744------------------
1745
1746BitBake uses the :term:`DEPENDS` variable to manage
1747build time dependencies. The ``[deptask]`` varflag for tasks signifies
1748the task of each item listed in ``DEPENDS`` that must complete before
1749that task can be executed. Here is an example: ::
1750
1751 do_configure[deptask] = "do_populate_sysroot"
1752
1753In this example, the ``do_populate_sysroot`` task
1754of each item in ``DEPENDS`` must complete before ``do_configure`` can
1755execute.
1756
1757Runtime Dependencies
1758--------------------
1759
1760BitBake uses the :term:`PACKAGES`, :term:`RDEPENDS`, and :term:`RRECOMMENDS`
1761variables to manage runtime dependencies.
1762
1763The ``PACKAGES`` variable lists runtime packages. Each of those packages
1764can have ``RDEPENDS`` and ``RRECOMMENDS`` runtime dependencies. The
1765``[rdeptask]`` flag for tasks is used to signify the task of each item
1766runtime dependency which must have completed before that task can be
1767executed. ::
1768
1769 do_package_qa[rdeptask] = "do_packagedata"
1770
1771In the previous
1772example, the ``do_packagedata`` task of each item in ``RDEPENDS`` must
1773have completed before ``do_package_qa`` can execute.
1774Although ``RDEPENDS`` contains entries from the
1775runtime dependency namespace, BitBake knows how to map them back
1776to the build-time dependency namespace, in which the tasks are defined.
1777
1778Recursive Dependencies
1779----------------------
1780
1781BitBake uses the ``[recrdeptask]`` flag to manage recursive task
1782dependencies. BitBake looks through the build-time and runtime
1783dependencies of the current recipe, looks through the task's inter-task
1784dependencies, and then adds dependencies for the listed task. Once
1785BitBake has accomplished this, it recursively works through the
1786dependencies of those tasks. Iterative passes continue until all
1787dependencies are discovered and added.
1788
1789The ``[recrdeptask]`` flag is most commonly used in high-level recipes
1790that need to wait for some task to finish "globally". For example,
1791``image.bbclass`` has the following: ::
1792
1793 do_rootfs[recrdeptask] += "do_packagedata"
1794
1795This statement says that the ``do_packagedata`` task of
1796the current recipe and all recipes reachable (by way of dependencies)
1797from the image recipe must run before the ``do_rootfs`` task can run.
1798
1799BitBake allows a task to recursively depend on itself by
1800referencing itself in the task list: ::
1801
1802 do_a[recrdeptask] = "do_a do_b"
1803
1804In the same way as before, this means that the ``do_a``
1805and ``do_b`` tasks of the current recipe and all
1806recipes reachable (by way of dependencies) from the recipe
1807must run before the ``do_a`` task can run. In this
1808case BitBake will ignore the current recipe's ``do_a``
1809task circular dependency on itself.
1810
1811Inter-Task Dependencies
1812-----------------------
1813
1814BitBake uses the ``[depends]`` flag in a more generic form to manage
1815inter-task dependencies. This more generic form allows for
1816inter-dependency checks for specific tasks rather than checks for the
1817data in ``DEPENDS``. Here is an example: ::
1818
1819 do_patch[depends] = "quilt-native:do_populate_sysroot"
1820
1821In this example, the ``do_populate_sysroot`` task of the target ``quilt-native``
1822must have completed before the ``do_patch`` task can execute.
1823
1824The ``[rdepends]`` flag works in a similar way but takes targets in the
1825runtime namespace instead of the build-time dependency namespace.
1826
1827Functions You Can Call From Within Python
1828=========================================
1829
1830BitBake provides many functions you can call from within Python
1831functions. This section lists the most commonly used functions, and
1832mentions where to find others.
1833
1834Functions for Accessing Datastore Variables
1835-------------------------------------------
1836
1837It is often necessary to access variables in the BitBake datastore using
1838Python functions. The BitBake datastore has an API that allows you this
1839access. Here is a list of available operations:
1840
1841.. list-table::
1842 :widths: auto
1843 :header-rows: 1
1844
1845 * - *Operation*
1846 - *Description*
1847 * - ``d.getVar("X", expand)``
1848 - Returns the value of variable "X". Using "expand=True" expands the
1849 value. Returns "None" if the variable "X" does not exist.
1850 * - ``d.setVar("X", "value")``
1851 - Sets the variable "X" to "value"
1852 * - ``d.appendVar("X", "value")``
1853 - Adds "value" to the end of the variable "X". Acts like ``d.setVar("X",
1854 "value")`` if the variable "X" does not exist.
1855 * - ``d.prependVar("X", "value")``
1856 - Adds "value" to the start of the variable "X". Acts like
1857 ``d.setVar("X","value")`` if the variable "X" does not exist.
1858 * - ``d.delVar("X")``
1859 - Deletes the variable "X" from the datastore. Does nothing if the variable
1860 "X" does not exist.
1861 * - ``d.renameVar("X", "Y")``
1862 - Renames the variable "X" to "Y". Does nothing if the variable "X" does
1863 not exist.
1864 * - ``d.getVarFlag("X", flag, expand)``
1865 - Returns the value of variable "X". Using "expand=True" expands the
1866 value. Returns "None" if either the variable "X" or the named flag does
1867 not exist.
1868 * - ``d.setVarFlag("X", flag, "value")``
1869 - Sets the named flag for variable "X" to "value".
1870 * - ``d.appendVarFlag("X", flag, "value")``
1871 - Appends "value" to the named flag on the variable "X". Acts like
1872 ``d.setVarFlag("X", flag, "value")`` if the named flag does not exist.
1873 * - ``d.prependVarFlag("X", flag, "value")``
1874 - Prepends "value" to the named flag on the variable "X". Acts like
1875 ``d.setVarFlag("X", flag, "value")`` if the named flag does not exist.
1876 * - ``d.delVarFlag("X", flag)``
1877 - Deletes the named flag on the variable "X" from the datastore.
1878 * - ``d.setVarFlags("X", flagsdict)``
1879 - Sets the flags specified in the ``flagsdict()``
1880 parameter. ``setVarFlags`` does not clear previous flags. Think of this
1881 operation as ``addVarFlags``.
1882 * - ``d.getVarFlags("X")``
1883 - Returns a ``flagsdict`` of the flags for the variable "X". Returns "None"
1884 if the variable "X" does not exist.
1885 * - ``d.delVarFlags("X")``
1886 - Deletes all the flags for the variable "X". Does nothing if the variable
1887 "X" does not exist.
1888 * - ``d.expand(expression)``
1889 - Expands variable references in the specified string
1890 expression. References to variables that do not exist are left as is. For
1891 example, ``d.expand("foo ${X}")`` expands to the literal string "foo
1892 ${X}" if the variable "X" does not exist.
1893
1894Other Functions
1895---------------
1896
1897You can find many other functions that can be called from Python by
1898looking at the source code of the ``bb`` module, which is in
1899``bitbake/lib/bb``. For example, ``bitbake/lib/bb/utils.py`` includes
1900the commonly used functions ``bb.utils.contains()`` and
1901``bb.utils.mkdirhier()``, which come with docstrings.
1902
1903Task Checksums and Setscene
1904===========================
1905
1906BitBake uses checksums (or signatures) along with the setscene to
1907determine if a task needs to be run. This section describes the process.
1908To help understand how BitBake does this, the section assumes an
1909OpenEmbedded metadata-based example.
1910
1911These checksums are stored in :term:`STAMP`. You can
1912examine the checksums using the following BitBake command: ::
1913
1914 $ bitbake-dumpsigs
1915
1916This command returns the signature data in a readable
1917format that allows you to examine the inputs used when the OpenEmbedded
1918build system generates signatures. For example, using
1919``bitbake-dumpsigs`` allows you to examine the ``do_compile`` task's
1920"sigdata" for a C application (e.g. ``bash``). Running the command also
1921reveals that the "CC" variable is part of the inputs that are hashed.
1922Any changes to this variable would invalidate the stamp and cause the
1923``do_compile`` task to run.
1924
1925The following list describes related variables:
1926
1927- :term:`BB_HASHCHECK_FUNCTION`:
1928 Specifies the name of the function to call during the "setscene" part
1929 of the task's execution in order to validate the list of task hashes.
1930
1931- :term:`BB_SETSCENE_DEPVALID`:
1932 Specifies a function BitBake calls that determines whether BitBake
1933 requires a setscene dependency to be met.
1934
1935- :term:`BB_SETSCENE_VERIFY_FUNCTION2`:
1936 Specifies a function to call that verifies the list of planned task
1937 execution before the main task execution happens.
1938
1939- :term:`BB_STAMP_POLICY`: Defines the mode
1940 for comparing timestamps of stamp files.
1941
1942- :term:`BB_STAMP_WHITELIST`: Lists stamp
1943 files that are looked at when the stamp policy is "whitelist".
1944
1945- :term:`BB_TASKHASH`: Within an executing task,
1946 this variable holds the hash of the task as returned by the currently
1947 enabled signature generator.
1948
1949- :term:`STAMP`: The base path to create stamp files.
1950
1951- :term:`STAMPCLEAN`: Again, the base path to
1952 create stamp files but can use wildcards for matching a range of
1953 files for clean operations.
1954
1955Wildcard Support in Variables
1956=============================
1957
1958Support for wildcard use in variables varies depending on the context in
1959which it is used. For example, some variables and file names allow
1960limited use of wildcards through the "``%``" and "``*``" characters.
1961Other variables or names support Python's
1962`glob <https://docs.python.org/3/library/glob.html>`_ syntax,
1963`fnmatch <https://docs.python.org/3/library/fnmatch.html#module-fnmatch>`_
1964syntax, or
1965`Regular Expression (re) <https://docs.python.org/3/library/re.html>`_
1966syntax.
1967
1968For variables that have wildcard suport, the documentation describes
1969which form of wildcard, its use, and its limitations.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
deleted file mode 100644
index 0ca5321618..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
+++ /dev/null
@@ -1,2862 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<chapter id="bitbake-user-manual-metadata">
5 <title>Syntax and Operators</title>
6
7 <para>
8 BitBake files have their own syntax.
9 The syntax has similarities to several
10 other languages but also has some unique features.
11 This section describes the available syntax and operators
12 as well as provides examples.
13 </para>
14
15 <section id='basic-syntax'>
16 <title>Basic Syntax</title>
17
18 <para>
19 This section provides some basic syntax examples.
20 </para>
21
22 <section id='basic-variable-setting'>
23 <title>Basic Variable Setting</title>
24
25 <para>
26 The following example sets <filename>VARIABLE</filename> to
27 "value".
28 This assignment occurs immediately as the statement is parsed.
29 It is a "hard" assignment.
30 <literallayout class='monospaced'>
31 VARIABLE = "value"
32 </literallayout>
33 As expected, if you include leading or trailing spaces as part of
34 an assignment, the spaces are retained:
35 <literallayout class='monospaced'>
36 VARIABLE = " value"
37 VARIABLE = "value "
38 </literallayout>
39 Setting <filename>VARIABLE</filename> to "" sets it to an empty string,
40 while setting the variable to " " sets it to a blank space
41 (i.e. these are not the same values).
42 <literallayout class='monospaced'>
43 VARIABLE = ""
44 VARIABLE = " "
45 </literallayout>
46 </para>
47
48 <para>
49 You can use single quotes instead of double quotes
50 when setting a variable's value.
51 Doing so allows you to use values that contain the double
52 quote character:
53 <literallayout class='monospaced'>
54 VARIABLE = 'I have a " in my value'
55 </literallayout>
56 <note>
57 Unlike in Bourne shells, single quotes work identically
58 to double quotes in all other ways.
59 They do not suppress variable expansions.
60 </note>
61 </para>
62 </section>
63
64 <section id='modifying-existing-variables'>
65 <title>Modifying Existing Variables</title>
66
67 <para>
68 Sometimes you need to modify existing variables.
69 Following are some cases where you might find you want to
70 modify an existing variable:
71 <itemizedlist>
72 <listitem><para>
73 Customize a recipe that uses the variable.
74 </para></listitem>
75 <listitem><para>
76 Change a variable's default value used in a
77 <filename>*.bbclass</filename> file.
78 </para></listitem>
79 <listitem><para>
80 Change the variable in a <filename>*.bbappend</filename>
81 file to override the variable in the original recipe.
82 </para></listitem>
83 <listitem><para>
84 Change the variable in a configuration file so that the
85 value overrides an existing configuration.
86 </para></listitem>
87 </itemizedlist>
88 </para>
89
90 <para>
91 Changing a variable value can sometimes depend on how the
92 value was originally assigned and also on the desired
93 intent of the change.
94 In particular, when you append a value to a variable that
95 has a default value, the resulting value might not be what
96 you expect.
97 In this case, the value you provide might replace the value
98 rather than append to the default value.
99 </para>
100
101 <para>
102 If after you have changed a variable's value and something
103 unexplained occurs, you can use BitBake to check the actual
104 value of the suspect variable.
105 You can make these checks for both configuration and recipe
106 level changes:
107 <itemizedlist>
108 <listitem><para>
109 For configuration changes, use the following:
110 <literallayout class='monospaced'>
111 $ bitbake -e
112 </literallayout>
113 This command displays variable values after the
114 configuration files (i.e. <filename>local.conf</filename>,
115 <filename>bblayers.conf</filename>,
116 <filename>bitbake.conf</filename> and so forth) have
117 been parsed.
118 <note>
119 Variables that are exported to the environment are
120 preceded by the string "export" in the command's
121 output.
122 </note>
123 </para></listitem>
124 <listitem><para>
125 For recipe changes, use the following:
126 <literallayout class='monospaced'>
127 $ bitbake <replaceable>recipe</replaceable> -e | grep VARIABLE="
128 </literallayout>
129 This command checks to see if the variable actually
130 makes it into a specific recipe.
131 </para></listitem>
132 </itemizedlist>
133 </para>
134 </section>
135
136 <section id='line-joining'>
137 <title>Line Joining</title>
138
139 <para>
140 Outside of
141 <link linkend='functions'>functions</link>, BitBake joins
142 any line ending in a backslash character ("\")
143 with the following line before parsing statements.
144 The most common use for the "\" character is to split variable
145 assignments over multiple lines, as in the following example:
146 <literallayout class='monospaced'>
147 FOO = "bar \
148 baz \
149 qaz"
150 </literallayout>
151 Both the "\" character and the newline character
152 that follow it are removed when joining lines.
153 Thus, no newline characters end up in the value of
154 <filename>FOO</filename>.
155 </para>
156
157 <para>
158 Consider this additional example where the two
159 assignments both assign "barbaz" to
160 <filename>FOO</filename>:
161 <literallayout class='monospaced'>
162 FOO = "barbaz"
163
164 FOO = "bar\
165 baz"
166 </literallayout>
167 <note>
168 BitBake does not interpret escape sequences like
169 "\n" in variable values.
170 For these to have an effect, the value must be passed
171 to some utility that interprets escape sequences,
172 such as <filename>printf</filename> or
173 <filename>echo -n</filename>.
174 </note>
175 </para>
176 </section>
177
178 <section id='variable-expansion'>
179 <title>Variable Expansion</title>
180
181 <para>
182 Variables can reference the contents of other variables
183 using a syntax that is similar to variable expansion in
184 Bourne shells.
185 The following assignments
186 result in A containing "aval" and B evaluating to "preavalpost".
187 <literallayout class='monospaced'>
188 A = "aval"
189 B = "pre${A}post"
190 </literallayout>
191 <note>
192 Unlike in Bourne shells, the curly braces are mandatory:
193 Only <filename>${FOO}</filename> and not
194 <filename>$FOO</filename> is recognized as an expansion of
195 <filename>FOO</filename>.
196 </note>
197 The "=" operator does not immediately expand variable
198 references in the right-hand side.
199 Instead, expansion is deferred until the variable assigned to
200 is actually used.
201 The result depends on the current values of the referenced
202 variables.
203 The following example should clarify this behavior:
204 <literallayout class='monospaced'>
205 A = "${B} baz"
206 B = "${C} bar"
207 C = "foo"
208 *At this point, ${A} equals "foo bar baz"*
209 C = "qux"
210 *At this point, ${A} equals "qux bar baz"*
211 B = "norf"
212 *At this point, ${A} equals "norf baz"*
213 </literallayout>
214 Contrast this behavior with the
215 <link linkend='immediate-variable-expansion'>immediate variable expansion</link>
216 operator (i.e. ":=").
217 </para>
218
219 <para>
220 If the variable expansion syntax is used on a variable that
221 does not exist, the string is kept as is.
222 For example, given the following assignment,
223 <filename>BAR</filename> expands to the literal string
224 "${FOO}" as long as <filename>FOO</filename> does not exist.
225 <literallayout class='monospaced'>
226 BAR = "${FOO}"
227 </literallayout>
228 </para>
229 </section>
230
231 <section id='setting-a-default-value'>
232 <title>Setting a default value (?=)</title>
233
234 <para>
235 You can use the "?=" operator to achieve a "softer" assignment
236 for a variable.
237 This type of assignment allows you to define a variable if it
238 is undefined when the statement is parsed, but to leave the
239 value alone if the variable has a value.
240 Here is an example:
241 <literallayout class='monospaced'>
242 A ?= "aval"
243 </literallayout>
244 If <filename>A</filename> is set at the time this statement is parsed,
245 the variable retains its value.
246 However, if <filename>A</filename> is not set,
247 the variable is set to "aval".
248 <note>
249 This assignment is immediate.
250 Consequently, if multiple "?=" assignments
251 to a single variable exist, the first of those ends up getting
252 used.
253 </note>
254 </para>
255 </section>
256
257 <section id='setting-a-weak-default-value'>
258 <title>Setting a weak default value (??=)</title>
259
260 <para>
261 It is possible to use a "weaker" assignment than in the
262 previous section by using the "??=" operator.
263 This assignment behaves identical to "?=" except that the
264 assignment is made at the end of the parsing process rather
265 than immediately.
266 Consequently, when multiple "??=" assignments exist, the last
267 one is used.
268 Also, any "=" or "?=" assignment will override the value set with
269 "??=".
270 Here is an example:
271 <literallayout class='monospaced'>
272 A ??= "somevalue"
273 A ??= "someothervalue"
274 </literallayout>
275 If <filename>A</filename> is set before the above statements are parsed,
276 the variable retains its value.
277 If <filename>A</filename> is not set,
278 the variable is set to "someothervalue".
279 </para>
280
281 <para>
282 Again, this assignment is a "lazy" or "weak" assignment
283 because it does not occur until the end
284 of the parsing process.
285 </para>
286 </section>
287
288 <section id='immediate-variable-expansion'>
289 <title>Immediate variable expansion (:=)</title>
290
291 <para>
292 The ":=" operator results in a variable's
293 contents being expanded immediately,
294 rather than when the variable is actually used:
295 <literallayout class='monospaced'>
296 T = "123"
297 A := "test ${T}"
298 T = "456"
299 B := "${T} ${C}"
300 C = "cval"
301 C := "${C}append"
302 </literallayout>
303 In this example, <filename>A</filename> contains
304 "test 123", even though the final value of <filename>T</filename>
305 is "456".
306 The variable <filename>B</filename> will end up containing "456 cvalappend".
307 This is because references to undefined variables are preserved as is
308 during (immediate)expansion. This is in contrast to GNU Make, where undefined
309 variables expand to nothing.
310 The variable <filename>C</filename>
311 contains "cvalappend" since <filename>${C}</filename> immediately
312 expands to "cval".
313 </para>
314 </section>
315
316 <section id='appending-and-prepending'>
317 <title>Appending (+=) and prepending (=+) With Spaces</title>
318
319 <para>
320 Appending and prepending values is common and can be accomplished
321 using the "+=" and "=+" operators.
322 These operators insert a space between the current
323 value and prepended or appended value.
324 </para>
325
326 <para>
327 These operators take immediate effect during parsing.
328 Here are some examples:
329 <literallayout class='monospaced'>
330 B = "bval"
331 B += "additionaldata"
332 C = "cval"
333 C =+ "test"
334 </literallayout>
335 The variable <filename>B</filename> contains
336 "bval additionaldata" and <filename>C</filename>
337 contains "test cval".
338 </para>
339 </section>
340
341 <section id='appending-and-prepending-without-spaces'>
342 <title>Appending (.=) and Prepending (=.) Without Spaces</title>
343
344 <para>
345 If you want to append or prepend values without an
346 inserted space, use the ".=" and "=." operators.
347 </para>
348
349 <para>
350 These operators take immediate effect during parsing.
351 Here are some examples:
352 <literallayout class='monospaced'>
353 B = "bval"
354 B .= "additionaldata"
355 C = "cval"
356 C =. "test"
357 </literallayout>
358 The variable <filename>B</filename> contains
359 "bvaladditionaldata" and
360 <filename>C</filename> contains "testcval".
361 </para>
362 </section>
363
364 <section id='appending-and-prepending-override-style-syntax'>
365 <title>Appending and Prepending (Override Style Syntax)</title>
366
367 <para>
368 You can also append and prepend a variable's value
369 using an override style syntax.
370 When you use this syntax, no spaces are inserted.
371 </para>
372
373 <para>
374 These operators differ from the ":=", ".=", "=.", "+=", and "=+"
375 operators in that their effects are applied at variable
376 expansion time rather than being immediately applied.
377 Here are some examples:
378 <literallayout class='monospaced'>
379 B = "bval"
380 B_append = " additional data"
381 C = "cval"
382 C_prepend = "additional data "
383 D = "dval"
384 D_append = "additional data"
385 </literallayout>
386 The variable <filename>B</filename> becomes
387 "bval additional data" and <filename>C</filename> becomes
388 "additional data cval".
389 The variable <filename>D</filename> becomes
390 "dvaladditional data".
391 <note>
392 You must control all spacing when you use the
393 override syntax.
394 </note>
395 </para>
396
397 <para>
398 It is also possible to append and prepend to shell
399 functions and BitBake-style Python functions.
400 See the
401 "<link linkend='shell-functions'>Shell Functions</link>" and
402 "<link linkend='bitbake-style-python-functions'>BitBake-Style Python Functions</link>
403 sections for examples.
404 </para>
405 </section>
406
407 <section id='removing-override-style-syntax'>
408 <title>Removal (Override Style Syntax)</title>
409
410 <para>
411 You can remove values from lists using the removal
412 override style syntax.
413 Specifying a value for removal causes all occurrences of that
414 value to be removed from the variable.
415 </para>
416
417 <para>
418 When you use this syntax, BitBake expects one or more strings.
419 Surrounding spaces and spacing are preserved.
420 Here is an example:
421 <literallayout class='monospaced'>
422 FOO = "123 456 789 123456 123 456 123 456"
423 FOO_remove = "123"
424 FOO_remove = "456"
425 FOO2 = " abc def ghi abcdef abc def abc def def"
426 FOO2_remove = " \
427 def \
428 abc \
429 ghi \
430 "
431 </literallayout>
432 The variable <filename>FOO</filename> becomes
433 "&nbsp;&nbsp;789&nbsp;123456&nbsp;&nbsp;&nbsp;&nbsp;"
434 and <filename>FOO2</filename> becomes
435 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abcdef&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".
436 </para>
437
438 <para>
439 Like "_append" and "_prepend", "_remove"
440 is applied at variable expansion time.
441 </para>
442 </section>
443
444 <section id='override-style-operation-advantages'>
445 <title>Override Style Operation Advantages</title>
446
447 <para>
448 An advantage of the override style operations
449 "_append", "_prepend", and "_remove" as compared to the
450 "+=" and "=+" operators is that the override style
451 operators provide guaranteed operations.
452 For example, consider a class <filename>foo.bbclass</filename>
453 that needs to add the value "val" to the variable
454 <filename>FOO</filename>, and a recipe that uses
455 <filename>foo.bbclass</filename> as follows:
456 <literallayout class='monospaced'>
457 inherit foo
458
459 FOO = "initial"
460 </literallayout>
461 If <filename>foo.bbclass</filename> uses the "+=" operator,
462 as follows, then the final value of <filename>FOO</filename>
463 will be "initial", which is not what is desired:
464 <literallayout class='monospaced'>
465 FOO += "val"
466 </literallayout>
467 If, on the other hand, <filename>foo.bbclass</filename>
468 uses the "_append" operator, then the final value of
469 <filename>FOO</filename> will be "initial val", as intended:
470 <literallayout class='monospaced'>
471 FOO_append = " val"
472 </literallayout>
473 <note>
474 It is never necessary to use "+=" together with "_append".
475 The following sequence of assignments appends "barbaz" to
476 <filename>FOO</filename>:
477 <literallayout class='monospaced'>
478 FOO_append = "bar"
479 FOO_append = "baz"
480 </literallayout>
481 The only effect of changing the second assignment in the
482 previous example to use "+=" would be to add a space before
483 "baz" in the appended value (due to how the "+=" operator
484 works).
485 </note>
486 Another advantage of the override style operations is that
487 you can combine them with other overrides as described in the
488 "<link linkend='conditional-syntax-overrides'>Conditional Syntax (Overrides)</link>"
489 section.
490 </para>
491 </section>
492
493 <section id='variable-flag-syntax'>
494 <title>Variable Flag Syntax</title>
495
496 <para>
497 Variable flags are BitBake's implementation of variable properties
498 or attributes.
499 It is a way of tagging extra information onto a variable.
500 You can find more out about variable flags in general in the
501 "<link linkend='variable-flags'>Variable Flags</link>"
502 section.
503 </para>
504
505 <para>
506 You can define, append, and prepend values to variable flags.
507 All the standard syntax operations previously mentioned work
508 for variable flags except for override style syntax
509 (i.e. "_prepend", "_append", and "_remove").
510 </para>
511
512 <para>
513 Here are some examples showing how to set variable flags:
514 <literallayout class='monospaced'>
515 FOO[a] = "abc"
516 FOO[b] = "123"
517 FOO[a] += "456"
518 </literallayout>
519 The variable <filename>FOO</filename> has two flags:
520 <filename>[a]</filename> and <filename>[b]</filename>.
521 The flags are immediately set to "abc" and "123", respectively.
522 The <filename>[a]</filename> flag becomes "abc 456".
523 </para>
524
525 <para>
526 No need exists to pre-define variable flags.
527 You can simply start using them.
528 One extremely common application
529 is to attach some brief documentation to a BitBake variable as
530 follows:
531 <literallayout class='monospaced'>
532 CACHE[doc] = "The directory holding the cache of the metadata."
533 </literallayout>
534 </para>
535 </section>
536
537 <section id='inline-python-variable-expansion'>
538 <title>Inline Python Variable Expansion</title>
539
540 <para>
541 You can use inline Python variable expansion to
542 set variables.
543 Here is an example:
544 <literallayout class='monospaced'>
545 DATE = "${@time.strftime('%Y%m%d',time.gmtime())}"
546 </literallayout>
547 This example results in the <filename>DATE</filename>
548 variable being set to the current date.
549 </para>
550
551 <para>
552 Probably the most common use of this feature is to extract
553 the value of variables from BitBake's internal data dictionary,
554 <filename>d</filename>.
555 The following lines select the values of a package name
556 and its version number, respectively:
557 <literallayout class='monospaced'>
558 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
559 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
560 </literallayout>
561 <note>
562 Inline Python expressions work just like variable expansions
563 insofar as the "=" and ":=" operators are concerned.
564 Given the following assignment, <filename>foo()</filename>
565 is called each time <filename>FOO</filename> is expanded:
566 <literallayout class='monospaced'>
567 FOO = "${@foo()}"
568 </literallayout>
569 Contrast this with the following immediate assignment, where
570 <filename>foo()</filename> is only called once, while the
571 assignment is parsed:
572 <literallayout class='monospaced'>
573 FOO := "${@foo()}"
574 </literallayout>
575 </note>
576 For a different way to set variables with Python code during
577 parsing, see the
578 "<link linkend='anonymous-python-functions'>Anonymous Python Functions</link>"
579 section.
580 </para>
581 </section>
582
583 <section id='unsetting-variables'>
584 <title>Unsetting variables</title>
585
586 <para>
587 It is possible to completely remove a variable or a variable flag
588 from BitBake's internal data dictionary by using the "unset" keyword.
589 Here is an example:
590 <literallayout class='monospaced'>
591 unset DATE
592 unset do_fetch[noexec]
593 </literallayout>
594 These two statements remove the <filename>DATE</filename> and the
595 <filename>do_fetch[noexec]</filename> flag.
596 </para>
597
598 </section>
599
600 <section id='providing-pathnames'>
601 <title>Providing Pathnames</title>
602
603 <para>
604 When specifying pathnames for use with BitBake,
605 do not use the tilde ("~") character as a shortcut
606 for your home directory.
607 Doing so might cause BitBake to not recognize the
608 path since BitBake does not expand this character in
609 the same way a shell would.
610 </para>
611
612 <para>
613 Instead, provide a fuller path as the following
614 example illustrates:
615 <literallayout class='monospaced'>
616 BBLAYERS ?= " \
617 /home/scott-lenovo/LayerA \
618 "
619 </literallayout>
620 </para>
621 </section>
622 </section>
623
624 <section id='exporting-variables-to-the-environment'>
625 <title>Exporting Variables to the Environment</title>
626
627 <para>
628 You can export variables to the environment of running
629 tasks by using the <filename>export</filename> keyword.
630 For example, in the following example, the
631 <filename>do_foo</filename> task prints "value from
632 the environment" when run:
633 <literallayout class='monospaced'>
634 export ENV_VARIABLE
635 ENV_VARIABLE = "value from the environment"
636
637 do_foo() {
638 bbplain "$ENV_VARIABLE"
639 }
640 </literallayout>
641 <note>
642 BitBake does not expand <filename>$ENV_VARIABLE</filename>
643 in this case because it lacks the obligatory
644 <filename>{}</filename>.
645 Rather, <filename>$ENV_VARIABLE</filename> is expanded
646 by the shell.
647 </note>
648 It does not matter whether
649 <filename>export ENV_VARIABLE</filename> appears before or
650 after assignments to <filename>ENV_VARIABLE</filename>.
651 </para>
652
653 <para>
654 It is also possible to combine <filename>export</filename>
655 with setting a value for the variable.
656 Here is an example:
657 <literallayout class='monospaced'>
658 export ENV_VARIABLE = "<replaceable>variable-value</replaceable>"
659 </literallayout>
660 In the output of <filename>bitbake -e</filename>, variables
661 that are exported to the environment are preceded by "export".
662 </para>
663
664 <para>
665 Among the variables commonly exported to the environment
666 are <filename>CC</filename> and <filename>CFLAGS</filename>,
667 which are picked up by many build systems.
668 </para>
669 </section>
670
671 <section id='conditional-syntax-overrides'>
672 <title>Conditional Syntax (Overrides)</title>
673
674 <para>
675 BitBake uses
676 <link linkend='var-bb-OVERRIDES'><filename>OVERRIDES</filename></link>
677 to control what variables are overridden after BitBake
678 parses recipes and configuration files.
679 This section describes how you can use
680 <filename>OVERRIDES</filename> as conditional metadata,
681 talks about key expansion in relationship to
682 <filename>OVERRIDES</filename>, and provides some examples
683 to help with understanding.
684 </para>
685
686 <section id='conditional-metadata'>
687 <title>Conditional Metadata</title>
688
689 <para>
690 You can use <filename>OVERRIDES</filename> to conditionally select
691 a specific version of a variable and to conditionally
692 append or prepend the value of a variable.
693 <note>
694 Overrides can only use lower-case characters.
695 Additionally, underscores are not permitted in override names
696 as they are used to separate overrides from each other and
697 from the variable name.
698 </note>
699 <itemizedlist>
700 <listitem><para><emphasis>Selecting a Variable:</emphasis>
701 The <filename>OVERRIDES</filename> variable is
702 a colon-character-separated list that contains items
703 for which you want to satisfy conditions.
704 Thus, if you have a variable that is conditional on “armâ€, and “armâ€
705 is in <filename>OVERRIDES</filename>, then the “armâ€-specific
706 version of the variable is used rather than the non-conditional
707 version.
708 Here is an example:
709 <literallayout class='monospaced'>
710 OVERRIDES = "architecture:os:machine"
711 TEST = "default"
712 TEST_os = "osspecific"
713 TEST_nooverride = "othercondvalue"
714 </literallayout>
715 In this example, the <filename>OVERRIDES</filename>
716 variable lists three overrides:
717 "architecture", "os", and "machine".
718 The variable <filename>TEST</filename> by itself has a default
719 value of "default".
720 You select the os-specific version of the <filename>TEST</filename>
721 variable by appending the "os" override to the variable
722 (i.e.<filename>TEST_os</filename>).
723 </para>
724
725 <para>
726 To better understand this, consider a practical example
727 that assumes an OpenEmbedded metadata-based Linux
728 kernel recipe file.
729 The following lines from the recipe file first set
730 the kernel branch variable <filename>KBRANCH</filename>
731 to a default value, then conditionally override that
732 value based on the architecture of the build:
733 <literallayout class='monospaced'>
734 KBRANCH = "standard/base"
735 KBRANCH_qemuarm = "standard/arm-versatile-926ejs"
736 KBRANCH_qemumips = "standard/mti-malta32"
737 KBRANCH_qemuppc = "standard/qemuppc"
738 KBRANCH_qemux86 = "standard/common-pc/base"
739 KBRANCH_qemux86-64 = "standard/common-pc-64/base"
740 KBRANCH_qemumips64 = "standard/mti-malta64"
741 </literallayout>
742 </para></listitem>
743 <listitem><para><emphasis>Appending and Prepending:</emphasis>
744 BitBake also supports append and prepend operations to
745 variable values based on whether a specific item is
746 listed in <filename>OVERRIDES</filename>.
747 Here is an example:
748 <literallayout class='monospaced'>
749 DEPENDS = "glibc ncurses"
750 OVERRIDES = "machine:local"
751 DEPENDS_append_machine = " libmad"
752 </literallayout>
753 In this example, <filename>DEPENDS</filename> becomes
754 "glibc ncurses libmad".
755 </para>
756
757 <para>
758 Again, using an OpenEmbedded metadata-based
759 kernel recipe file as an example, the
760 following lines will conditionally append to the
761 <filename>KERNEL_FEATURES</filename> variable based
762 on the architecture:
763 <literallayout class='monospaced'>
764 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
765 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
766 KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
767 </literallayout>
768 </para></listitem>
769 <listitem><para><emphasis>Setting a Variable for a Single Task:</emphasis>
770 BitBake supports setting a variable just for the
771 duration of a single task.
772 Here is an example:
773 <literallayout class='monospaced'>
774 FOO_task-configure = "val 1"
775 FOO_task-compile = "val 2"
776 </literallayout>
777 In the previous example, <filename>FOO</filename>
778 has the value "val 1" while the
779 <filename>do_configure</filename> task is executed,
780 and the value "val 2" while the
781 <filename>do_compile</filename> task is executed.
782 </para>
783
784 <para>Internally, this is implemented by prepending
785 the task (e.g. "task-compile:") to the value of
786 <link linkend='var-bb-OVERRIDES'><filename>OVERRIDES</filename></link>
787 for the local datastore of the <filename>do_compile</filename>
788 task.</para>
789
790 <para>You can also use this syntax with other combinations
791 (e.g. "<filename>_prepend</filename>") as shown in the
792 following example:
793 <literallayout class='monospaced'>
794 EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} "
795 </literallayout>
796 </para></listitem>
797 </itemizedlist>
798 </para>
799 </section>
800
801 <section id='key-expansion'>
802 <title>Key Expansion</title>
803
804 <para>
805 Key expansion happens when the BitBake datastore is finalized.
806 To better understand this, consider the following example:
807 <literallayout class='monospaced'>
808 A${B} = "X"
809 B = "2"
810 A2 = "Y"
811 </literallayout>
812 In this case, after all the parsing is complete,
813 BitBake expands <filename>${B}</filename> into "2".
814 This expansion causes <filename>A2</filename>, which was
815 set to "Y" before the expansion, to become "X".
816 </para>
817 </section>
818
819 <section id='variable-interaction-worked-examples'>
820 <title>Examples</title>
821
822 <para>
823 Despite the previous explanations that show the different forms of
824 variable definitions, it can be hard to work
825 out exactly what happens when variable operators, conditional
826 overrides, and unconditional overrides are combined.
827 This section presents some common scenarios along
828 with explanations for variable interactions that
829 typically confuse users.
830 </para>
831
832 <para>
833 There is often confusion concerning the order in which
834 overrides and various "append" operators take effect.
835 Recall that an append or prepend operation using "_append"
836 and "_prepend" does not result in an immediate assignment
837 as would "+=", ".=", "=+", or "=.".
838 Consider the following example:
839 <literallayout class='monospaced'>
840 OVERRIDES = "foo"
841 A = "Z"
842 A_foo_append = "X"
843 </literallayout>
844 For this case, <filename>A</filename> is
845 unconditionally set to "Z" and "X" is
846 unconditionally and immediately appended to the variable
847 <filename>A_foo</filename>.
848 Because overrides have not been applied yet,
849 <filename>A_foo</filename> is set to "X" due to the append
850 and <filename>A</filename> simply equals "Z".
851 </para>
852
853 <para>
854 Applying overrides, however, changes things.
855 Since "foo" is listed in <filename>OVERRIDES</filename>,
856 the conditional variable <filename>A</filename> is replaced
857 with the "foo" version, which is equal to "X".
858 So effectively, <filename>A_foo</filename> replaces <filename>A</filename>.
859 </para>
860
861 <para>
862 This next example changes the order of the override and
863 the append:
864 <literallayout class='monospaced'>
865 OVERRIDES = "foo"
866 A = "Z"
867 A_append_foo = "X"
868 </literallayout>
869 For this case, before overrides are handled,
870 <filename>A</filename> is set to "Z" and <filename>A_append_foo</filename>
871 is set to "X".
872 Once the override for "foo" is applied, however,
873 <filename>A</filename> gets appended with "X".
874 Consequently, <filename>A</filename> becomes "ZX".
875 Notice that spaces are not appended.
876 </para>
877
878 <para>
879 This next example has the order of the appends and overrides reversed
880 back as in the first example:
881 <literallayout class='monospaced'>
882 OVERRIDES = "foo"
883 A = "Y"
884 A_foo_append = "Z"
885 A_foo_append = "X"
886 </literallayout>
887 For this case, before any overrides are resolved,
888 <filename>A</filename> is set to "Y" using an immediate assignment.
889 After this immediate assignment, <filename>A_foo</filename> is set
890 to "Z", and then further appended with
891 "X" leaving the variable set to "ZX".
892 Finally, applying the override for "foo" results in the conditional
893 variable <filename>A</filename> becoming "ZX" (i.e.
894 <filename>A</filename> is replaced with <filename>A_foo</filename>).
895 </para>
896
897 <para>
898 This final example mixes in some varying operators:
899 <literallayout class='monospaced'>
900 A = "1"
901 A_append = "2"
902 A_append = "3"
903 A += "4"
904 A .= "5"
905 </literallayout>
906 For this case, the type of append operators are affecting the
907 order of assignments as BitBake passes through the code
908 multiple times.
909 Initially, <filename>A</filename> is set to "1 45" because
910 of the three statements that use immediate operators.
911 After these assignments are made, BitBake applies the
912 "_append" operations.
913 Those operations result in <filename>A</filename> becoming "1 4523".
914 </para>
915 </section>
916 </section>
917
918 <section id='sharing-functionality'>
919 <title>Sharing Functionality</title>
920
921 <para>
922 BitBake allows for metadata sharing through include files
923 (<filename>.inc</filename>) and class files
924 (<filename>.bbclass</filename>).
925 For example, suppose you have a piece of common functionality
926 such as a task definition that you want to share between
927 more than one recipe.
928 In this case, creating a <filename>.bbclass</filename>
929 file that contains the common functionality and then using
930 the <filename>inherit</filename> directive in your recipes to
931 inherit the class would be a common way to share the task.
932 </para>
933
934 <para>
935 This section presents the mechanisms BitBake provides to
936 allow you to share functionality between recipes.
937 Specifically, the mechanisms include <filename>include</filename>,
938 <filename>inherit</filename>, <filename>INHERIT</filename>, and
939 <filename>require</filename> directives.
940 </para>
941
942 <section id='locating-include-and-class-files'>
943 <title>Locating Include and Class Files</title>
944
945 <para>
946 BitBake uses the
947 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>
948 variable to locate needed include and class files.
949 Additionally, BitBake searches the current directory for
950 <filename>include</filename> and <filename>require</filename>
951 directives.
952 <note>
953 The <filename>BBPATH</filename> variable is analogous to
954 the environment variable <filename>PATH</filename>.
955 </note>
956 </para>
957
958 <para>
959 In order for include and class files to be found by BitBake,
960 they need to be located in a "classes" subdirectory that can
961 be found in <filename>BBPATH</filename>.
962 </para>
963 </section>
964
965 <section id='inherit-directive'>
966 <title><filename>inherit</filename> Directive</title>
967
968 <para>
969 When writing a recipe or class file, you can use the
970 <filename>inherit</filename> directive to inherit the
971 functionality of a class (<filename>.bbclass</filename>).
972 BitBake only supports this directive when used within recipe
973 and class files (i.e. <filename>.bb</filename> and
974 <filename>.bbclass</filename>).
975 </para>
976
977 <para>
978 The <filename>inherit</filename> directive is a rudimentary
979 means of specifying functionality contained in class files
980 that your recipes require.
981 For example, you can easily abstract out the tasks involved in
982 building a package that uses Autoconf and Automake and put
983 those tasks into a class file and then have your recipe
984 inherit that class file.
985 </para>
986
987 <para>
988 As an example, your recipes could use the following directive
989 to inherit an <filename>autotools.bbclass</filename> file.
990 The class file would contain common functionality for using
991 Autotools that could be shared across recipes:
992 <literallayout class='monospaced'>
993 inherit autotools
994 </literallayout>
995 In this case, BitBake would search for the directory
996 <filename>classes/autotools.bbclass</filename>
997 in <filename>BBPATH</filename>.
998 <note>
999 You can override any values and functions of the
1000 inherited class within your recipe by doing so
1001 after the "inherit" statement.
1002 </note>
1003 If you want to use the directive to inherit
1004 multiple classes, separate them with spaces.
1005 The following example shows how to inherit both the
1006 <filename>buildhistory</filename> and <filename>rm_work</filename>
1007 classes:
1008 <literallayout class='monospaced'>
1009 inherit buildhistory rm_work
1010 </literallayout>
1011 </para>
1012
1013 <para>
1014 An advantage with the inherit directive as compared to both
1015 the
1016 <link linkend='include-directive'>include</link> and
1017 <link linkend='require-inclusion'>require</link> directives
1018 is that you can inherit class files conditionally.
1019 You can accomplish this by using a variable expression
1020 after the <filename>inherit</filename> statement.
1021 Here is an example:
1022 <literallayout class='monospaced'>
1023 inherit ${VARNAME}
1024 </literallayout>
1025 If <filename>VARNAME</filename> is going to be set, it needs
1026 to be set before the <filename>inherit</filename> statement
1027 is parsed.
1028 One way to achieve a conditional inherit in this case is to use
1029 overrides:
1030 <literallayout class='monospaced'>
1031 VARIABLE = ""
1032 VARIABLE_someoverride = "myclass"
1033 </literallayout>
1034 </para>
1035
1036 <para>
1037 Another method is by using anonymous Python.
1038 Here is an example:
1039 <literallayout class='monospaced'>
1040 python () {
1041 if condition == value:
1042 d.setVar('VARIABLE', 'myclass')
1043 else:
1044 d.setVar('VARIABLE', '')
1045 }
1046 </literallayout>
1047 </para>
1048
1049 <para>
1050 Alternatively, you could use an in-line Python expression
1051 in the following form:
1052 <literallayout class='monospaced'>
1053 inherit ${@'classname' if condition else ''}
1054 inherit ${@functionname(params)}
1055 </literallayout>
1056 In all cases, if the expression evaluates to an empty
1057 string, the statement does not trigger a syntax error
1058 because it becomes a no-op.
1059 </para>
1060 </section>
1061
1062 <section id='include-directive'>
1063 <title><filename>include</filename> Directive</title>
1064
1065 <para>
1066 BitBake understands the <filename>include</filename>
1067 directive.
1068 This directive causes BitBake to parse whatever file you specify,
1069 and to insert that file at that location.
1070 The directive is much like its equivalent in Make except
1071 that if the path specified on the include line is a relative
1072 path, BitBake locates the first file it can find
1073 within <filename>BBPATH</filename>.
1074 </para>
1075
1076 <para>
1077 The include directive is a more generic method of including
1078 functionality as compared to the
1079 <link linkend='inherit-directive'>inherit</link> directive,
1080 which is restricted to class (i.e. <filename>.bbclass</filename>)
1081 files.
1082 The include directive is applicable for any other kind of
1083 shared or encapsulated functionality or configuration that
1084 does not suit a <filename>.bbclass</filename> file.
1085 </para>
1086
1087 <para>
1088 As an example, suppose you needed a recipe to include some
1089 self-test definitions:
1090 <literallayout class='monospaced'>
1091 include test_defs.inc
1092 </literallayout>
1093 <note>
1094 The <filename>include</filename> directive does not
1095 produce an error when the file cannot be found.
1096 Consequently, it is recommended that if the file you
1097 are including is expected to exist, you should use
1098 <link linkend='require-inclusion'><filename>require</filename></link>
1099 instead of <filename>include</filename>.
1100 Doing so makes sure that an error is produced if the
1101 file cannot be found.
1102 </note>
1103 </para>
1104 </section>
1105
1106 <section id='require-inclusion'>
1107 <title><filename>require</filename> Directive</title>
1108
1109 <para>
1110 BitBake understands the <filename>require</filename>
1111 directive.
1112 This directive behaves just like the
1113 <filename>include</filename> directive with the exception that
1114 BitBake raises a parsing error if the file to be included cannot
1115 be found.
1116 Thus, any file you require is inserted into the file that is
1117 being parsed at the location of the directive.
1118 </para>
1119
1120 <para>
1121 The require directive, like the include directive previously
1122 described, is a more generic method of including
1123 functionality as compared to the
1124 <link linkend='inherit-directive'>inherit</link> directive,
1125 which is restricted to class (i.e. <filename>.bbclass</filename>)
1126 files.
1127 The require directive is applicable for any other kind of
1128 shared or encapsulated functionality or configuration that
1129 does not suit a <filename>.bbclass</filename> file.
1130 </para>
1131
1132 <para>
1133 Similar to how BitBake handles
1134 <link linkend='include-directive'><filename>include</filename></link>,
1135 if the path specified
1136 on the require line is a relative path, BitBake locates
1137 the first file it can find within <filename>BBPATH</filename>.
1138 </para>
1139
1140 <para>
1141 As an example, suppose you have two versions of a recipe
1142 (e.g. <filename>foo_1.2.2.bb</filename> and
1143 <filename>foo_2.0.0.bb</filename>) where
1144 each version contains some identical functionality that could be
1145 shared.
1146 You could create an include file named <filename>foo.inc</filename>
1147 that contains the common definitions needed to build "foo".
1148 You need to be sure <filename>foo.inc</filename> is located in the
1149 same directory as your two recipe files as well.
1150 Once these conditions are set up, you can share the functionality
1151 using a <filename>require</filename> directive from within each
1152 recipe:
1153 <literallayout class='monospaced'>
1154 require foo.inc
1155 </literallayout>
1156 </para>
1157 </section>
1158
1159 <section id='inherit-configuration-directive'>
1160 <title><filename>INHERIT</filename> Configuration Directive</title>
1161
1162 <para>
1163 When creating a configuration file (<filename>.conf</filename>),
1164 you can use the
1165 <link linkend='var-bb-INHERIT'><filename>INHERIT</filename></link>
1166 configuration directive to inherit a class.
1167 BitBake only supports this directive when used within
1168 a configuration file.
1169 </para>
1170
1171 <para>
1172 As an example, suppose you needed to inherit a class
1173 file called <filename>abc.bbclass</filename> from a
1174 configuration file as follows:
1175 <literallayout class='monospaced'>
1176 INHERIT += "abc"
1177 </literallayout>
1178 This configuration directive causes the named
1179 class to be inherited at the point of the directive
1180 during parsing.
1181 As with the <filename>inherit</filename> directive, the
1182 <filename>.bbclass</filename> file must be located in a
1183 "classes" subdirectory in one of the directories specified
1184 in <filename>BBPATH</filename>.
1185 <note>
1186 Because <filename>.conf</filename> files are parsed
1187 first during BitBake's execution, using
1188 <filename>INHERIT</filename> to inherit a class effectively
1189 inherits the class globally (i.e. for all recipes).
1190 </note>
1191 If you want to use the directive to inherit
1192 multiple classes, you can provide them on the same line in the
1193 <filename>local.conf</filename> file.
1194 Use spaces to separate the classes.
1195 The following example shows how to inherit both the
1196 <filename>autotools</filename> and <filename>pkgconfig</filename>
1197 classes:
1198 <literallayout class='monospaced'>
1199 INHERIT += "autotools pkgconfig"
1200 </literallayout>
1201 </para>
1202 </section>
1203 </section>
1204
1205 <section id='functions'>
1206 <title>Functions</title>
1207
1208 <para>
1209 As with most languages, functions are the building blocks that
1210 are used to build up operations into tasks.
1211 BitBake supports these types of functions:
1212 <itemizedlist>
1213 <listitem><para><emphasis>Shell Functions:</emphasis>
1214 Functions written in shell script and executed either
1215 directly as functions, tasks, or both.
1216 They can also be called by other shell functions.
1217 </para></listitem>
1218 <listitem><para><emphasis>BitBake-Style Python Functions:</emphasis>
1219 Functions written in Python and executed by BitBake or other
1220 Python functions using <filename>bb.build.exec_func()</filename>.
1221 </para></listitem>
1222 <listitem><para><emphasis>Python Functions:</emphasis>
1223 Functions written in Python and executed by Python.
1224 </para></listitem>
1225 <listitem><para><emphasis>Anonymous Python Functions:</emphasis>
1226 Python functions executed automatically during
1227 parsing.
1228 </para></listitem>
1229 </itemizedlist>
1230 Regardless of the type of function, you can only
1231 define them in class (<filename>.bbclass</filename>)
1232 and recipe (<filename>.bb</filename> or <filename>.inc</filename>)
1233 files.
1234 </para>
1235
1236 <section id='shell-functions'>
1237 <title>Shell Functions</title>
1238
1239 <para>
1240 Functions written in shell script and executed either
1241 directly as functions, tasks, or both.
1242 They can also be called by other shell functions.
1243 Here is an example shell function definition:
1244 <literallayout class='monospaced'>
1245 some_function () {
1246 echo "Hello World"
1247 }
1248 </literallayout>
1249 When you create these types of functions in your recipe
1250 or class files, you need to follow the shell programming
1251 rules.
1252 The scripts are executed by <filename>/bin/sh</filename>,
1253 which may not be a bash shell but might be something
1254 such as <filename>dash</filename>.
1255 You should not use Bash-specific script (bashisms).
1256 </para>
1257
1258 <para>
1259 Overrides and override-style operators like
1260 <filename>_append</filename> and
1261 <filename>_prepend</filename> can also be applied to
1262 shell functions.
1263 Most commonly, this application would be used in a
1264 <filename>.bbappend</filename> file to modify functions in
1265 the main recipe.
1266 It can also be used to modify functions inherited from
1267 classes.
1268 </para>
1269
1270 <para>
1271 As an example, consider the following:
1272 <literallayout class='monospaced'>
1273 do_foo() {
1274 bbplain first
1275 fn
1276 }
1277
1278 fn_prepend() {
1279 bbplain second
1280 }
1281
1282 fn() {
1283 bbplain third
1284 }
1285
1286 do_foo_append() {
1287 bbplain fourth
1288 }
1289 </literallayout>
1290 Running <filename>do_foo</filename>
1291 prints the following:
1292 <literallayout class='monospaced'>
1293 recipename do_foo: first
1294 recipename do_foo: second
1295 recipename do_foo: third
1296 recipename do_foo: fourth
1297 </literallayout>
1298 <note>
1299 Overrides and override-style operators can
1300 be applied to any shell function, not just
1301 <link linkend='tasks'>tasks</link>.
1302 </note>
1303 You can use the <filename>bitbake -e</filename>&nbsp;<replaceable>recipename</replaceable>
1304 command to view the final assembled function
1305 after all overrides have been applied.
1306 </para>
1307 </section>
1308
1309 <section id='bitbake-style-python-functions'>
1310 <title>BitBake-Style Python Functions</title>
1311
1312 <para>
1313 These functions are written in Python and executed by
1314 BitBake or other Python functions using
1315 <filename>bb.build.exec_func()</filename>.
1316 </para>
1317
1318 <para>
1319 An example BitBake function is:
1320 <literallayout class='monospaced'>
1321 python some_python_function () {
1322 d.setVar("TEXT", "Hello World")
1323 print d.getVar("TEXT")
1324 }
1325 </literallayout>
1326 Because the Python "bb" and "os" modules are already
1327 imported, you do not need to import these modules.
1328 Also in these types of functions, the datastore ("d")
1329 is a global variable and is always automatically
1330 available.
1331 <note>
1332 Variable expressions (e.g. <filename>${X}</filename>)
1333 are no longer expanded within Python functions.
1334 This behavior is intentional in order to allow you
1335 to freely set variable values to expandable expressions
1336 without having them expanded prematurely.
1337 If you do wish to expand a variable within a Python
1338 function, use <filename>d.getVar("X")</filename>.
1339 Or, for more complicated expressions, use
1340 <filename>d.expand()</filename>.
1341 </note>
1342 </para>
1343
1344 <para>
1345 Similar to shell functions, you can also apply overrides
1346 and override-style operators to BitBake-style Python
1347 functions.
1348 </para>
1349
1350 <para>
1351 As an example, consider the following:
1352 <literallayout class='monospaced'>
1353 python do_foo_prepend() {
1354 bb.plain("first")
1355 }
1356
1357 python do_foo() {
1358 bb.plain("second")
1359 }
1360
1361 python do_foo_append() {
1362 bb.plain("third")
1363 }
1364 </literallayout>
1365 Running <filename>do_foo</filename> prints
1366 the following:
1367 <literallayout class='monospaced'>
1368 recipename do_foo: first
1369 recipename do_foo: second
1370 recipename do_foo: third
1371 </literallayout>
1372 You can use the <filename>bitbake -e</filename>&nbsp;<replaceable>recipename</replaceable>
1373 command to view the final assembled function
1374 after all overrides have been applied.
1375 </para>
1376 </section>
1377
1378 <section id='python-functions'>
1379 <title>Python Functions</title>
1380
1381 <para>
1382 These functions are written in Python and are executed by
1383 other Python code.
1384 Examples of Python functions are utility functions
1385 that you intend to call from in-line Python or
1386 from within other Python functions.
1387 Here is an example:
1388 <literallayout class='monospaced'>
1389 def get_depends(d):
1390 if d.getVar('SOMECONDITION'):
1391 return "dependencywithcond"
1392 else:
1393 return "dependency"
1394 SOMECONDITION = "1"
1395 DEPENDS = "${@get_depends(d)}"
1396 </literallayout>
1397 This would result in <filename>DEPENDS</filename>
1398 containing <filename>dependencywithcond</filename>.
1399 </para>
1400
1401 <para>
1402 Here are some things to know about Python functions:
1403 <itemizedlist>
1404 <listitem><para>Python functions can take parameters.
1405 </para></listitem>
1406 <listitem><para>The BitBake datastore is not
1407 automatically available.
1408 Consequently, you must pass it in as a
1409 parameter to the function.
1410 </para></listitem>
1411 <listitem><para>The "bb" and "os" Python modules are
1412 automatically available.
1413 You do not need to import them.
1414 </para></listitem>
1415 </itemizedlist>
1416 </para>
1417 </section>
1418
1419 <section id='bitbake-style-python-functions-versus-python-functions'>
1420 <title>BitBake-Style Python Functions Versus Python Functions</title>
1421
1422 <para>
1423 Following are some important differences between
1424 BitBake-style Python functions and regular Python
1425 functions defined with "def":
1426 <itemizedlist>
1427 <listitem><para>
1428 Only BitBake-style Python functions can be
1429 <link linkend='tasks'>tasks</link>.
1430 </para></listitem>
1431 <listitem><para>
1432 Overrides and override-style operators can only
1433 be applied to BitBake-style Python functions.
1434 </para></listitem>
1435 <listitem><para>
1436 Only regular Python functions can take arguments
1437 and return values.
1438 </para></listitem>
1439 <listitem><para>
1440 <link linkend='variable-flags'>Variable flags</link>
1441 such as <filename>[dirs]</filename>,
1442 <filename>[cleandirs]</filename>, and
1443 <filename>[lockfiles]</filename> can be used
1444 on BitBake-style Python functions, but not on
1445 regular Python functions.
1446 </para></listitem>
1447 <listitem><para>
1448 BitBake-style Python functions generate a separate
1449 <filename>${</filename><link linkend='var-bb-T'><filename>T</filename></link><filename>}/run.</filename><replaceable>function-name</replaceable><filename>.</filename><replaceable>pid</replaceable>
1450 script that is executed to run the function, and also
1451 generate a log file in
1452 <filename>${T}/log.</filename><replaceable>function-name</replaceable><filename>.</filename><replaceable>pid</replaceable>
1453 if they are executed as tasks.</para>
1454
1455 <para>
1456 Regular Python functions execute "inline" and do not
1457 generate any files in <filename>${T}</filename>.
1458 </para></listitem>
1459 <listitem><para>
1460 Regular Python functions are called with the usual
1461 Python syntax.
1462 BitBake-style Python functions are usually tasks and
1463 are called directly by BitBake, but can also be called
1464 manually from Python code by using the
1465 <filename>bb.build.exec_func()</filename> function.
1466 Here is an example:
1467 <literallayout class='monospaced'>
1468 bb.build.exec_func("my_bitbake_style_function", d)
1469 </literallayout>
1470 <note>
1471 <filename>bb.build.exec_func()</filename> can also
1472 be used to run shell functions from Python code.
1473 If you want to run a shell function before a Python
1474 function within the same task, then you can use a
1475 parent helper Python function that starts by running
1476 the shell function with
1477 <filename>bb.build.exec_func()</filename> and then
1478 runs the Python code.
1479 </note></para>
1480
1481 <para>To detect errors from functions executed with
1482 <filename>bb.build.exec_func()</filename>, you
1483 can catch the <filename>bb.build.FuncFailed</filename>
1484 exception.
1485 <note>
1486 Functions in metadata (recipes and classes) should
1487 not themselves raise
1488 <filename>bb.build.FuncFailed</filename>.
1489 Rather, <filename>bb.build.FuncFailed</filename>
1490 should be viewed as a general indicator that the
1491 called function failed by raising an exception.
1492 For example, an exception raised by
1493 <filename>bb.fatal()</filename> will be caught inside
1494 <filename>bb.build.exec_func()</filename>, and a
1495 <filename>bb.build.FuncFailed</filename> will be raised
1496 in response.
1497 </note>
1498 </para></listitem>
1499 </itemizedlist>
1500 </para>
1501
1502 <para>
1503 Due to their simplicity, you should prefer regular Python functions
1504 over BitBake-style Python functions unless you need a feature specific
1505 to BitBake-style Python functions.
1506 Regular Python functions in metadata are a more recent invention than
1507 BitBake-style Python functions, and older code tends to use
1508 <filename>bb.build.exec_func()</filename> more often.
1509 </para>
1510 </section>
1511
1512 <section id='anonymous-python-functions'>
1513 <title>Anonymous Python Functions</title>
1514
1515 <para>
1516 Sometimes it is useful to set variables or perform
1517 other operations programmatically during parsing.
1518 To do this, you can define special Python functions,
1519 called anonymous Python functions, that run at the
1520 end of parsing.
1521 For example, the following conditionally sets a variable
1522 based on the value of another variable:
1523 <literallayout class='monospaced'>
1524 python () {
1525 if d.getVar('SOMEVAR') == 'value':
1526 d.setVar('ANOTHERVAR', 'value2')
1527 }
1528 </literallayout>
1529 An equivalent way to mark a function as an anonymous
1530 function is to give it the name "__anonymous", rather
1531 than no name.
1532 </para>
1533
1534 <para>
1535 Anonymous Python functions always run at the end
1536 of parsing, regardless of where they are defined.
1537 If a recipe contains many anonymous functions, they
1538 run in the same order as they are defined within the
1539 recipe.
1540 As an example, consider the following snippet:
1541 <literallayout class='monospaced'>
1542 python () {
1543 d.setVar('FOO', 'foo 2')
1544 }
1545
1546 FOO = "foo 1"
1547
1548 python () {
1549 d.appendVar('BAR', ' bar 2')
1550 }
1551
1552 BAR = "bar 1"
1553 </literallayout>
1554 The previous example is conceptually equivalent to the
1555 following snippet:
1556 <literallayout class='monospaced'>
1557 FOO = "foo 1"
1558 BAR = "bar 1"
1559 FOO = "foo 2"
1560 BAR += "bar 2"
1561 </literallayout>
1562 <filename>FOO</filename> ends up with the value "foo 2",
1563 and <filename>BAR</filename> with the value "bar 1 bar 2".
1564 Just as in the second snippet, the values set for the
1565 variables within the anonymous functions become available
1566 to tasks, which always run after parsing.
1567 </para>
1568
1569 <para>
1570 Overrides and override-style operators such as
1571 "<filename>_append</filename>" are applied before
1572 anonymous functions run.
1573 In the following example, <filename>FOO</filename> ends
1574 up with the value "foo from anonymous":
1575 <literallayout class='monospaced'>
1576 FOO = "foo"
1577 FOO_append = " from outside"
1578
1579 python () {
1580 d.setVar("FOO", "foo from anonymous")
1581 }
1582 </literallayout>
1583 For methods you can use with anonymous Python functions,
1584 see the
1585 "<link linkend='functions-you-can-call-from-within-python'>Functions You Can Call From Within Python</link>"
1586 section.
1587 For a different method to run Python code during parsing,
1588 see the
1589 "<link linkend='inline-python-variable-expansion'>Inline Python Variable Expansion</link>"
1590 section.
1591 </para>
1592 </section>
1593
1594 <section id='flexible-inheritance-for-class-functions'>
1595 <title>Flexible Inheritance for Class Functions</title>
1596
1597 <para>
1598 Through coding techniques and the use of
1599 <filename>EXPORT_FUNCTIONS</filename>, BitBake supports
1600 exporting a function from a class such that the
1601 class function appears as the default implementation
1602 of the function, but can still be called if a recipe
1603 inheriting the class needs to define its own version of
1604 the function.
1605 </para>
1606
1607 <para>
1608 To understand the benefits of this feature, consider
1609 the basic scenario where a class defines a task function
1610 and your recipe inherits the class.
1611 In this basic scenario, your recipe inherits the task
1612 function as defined in the class.
1613 If desired, your recipe can add to the start and end of the
1614 function by using the "_prepend" or "_append" operations
1615 respectively, or it can redefine the function completely.
1616 However, if it redefines the function, there is
1617 no means for it to call the class version of the function.
1618 <filename>EXPORT_FUNCTIONS</filename> provides a mechanism
1619 that enables the recipe's version of the function to call
1620 the original version of the function.
1621 </para>
1622
1623 <para>
1624 To make use of this technique, you need the following
1625 things in place:
1626 <itemizedlist>
1627 <listitem><para>
1628 The class needs to define the function as follows:
1629 <literallayout class='monospaced'>
1630 <replaceable>classname</replaceable><filename>_</filename><replaceable>functionname</replaceable>
1631 </literallayout>
1632 For example, if you have a class file
1633 <filename>bar.bbclass</filename> and a function named
1634 <filename>do_foo</filename>, the class must define the function
1635 as follows:
1636 <literallayout class='monospaced'>
1637 bar_do_foo
1638 </literallayout>
1639 </para></listitem>
1640 <listitem><para>
1641 The class needs to contain the <filename>EXPORT_FUNCTIONS</filename>
1642 statement as follows:
1643 <literallayout class='monospaced'>
1644 EXPORT_FUNCTIONS <replaceable>functionname</replaceable>
1645 </literallayout>
1646 For example, continuing with the same example, the
1647 statement in the <filename>bar.bbclass</filename> would be
1648 as follows:
1649 <literallayout class='monospaced'>
1650 EXPORT_FUNCTIONS do_foo
1651 </literallayout>
1652 </para></listitem>
1653 <listitem><para>
1654 You need to call the function appropriately from within your
1655 recipe.
1656 Continuing with the same example, if your recipe
1657 needs to call the class version of the function,
1658 it should call <filename>bar_do_foo</filename>.
1659 Assuming <filename>do_foo</filename> was a shell function
1660 and <filename>EXPORT_FUNCTIONS</filename> was used as above,
1661 the recipe's function could conditionally call the
1662 class version of the function as follows:
1663 <literallayout class='monospaced'>
1664 do_foo() {
1665 if [ somecondition ] ; then
1666 bar_do_foo
1667 else
1668 # Do something else
1669 fi
1670 }
1671 </literallayout>
1672 To call your modified version of the function as defined
1673 in your recipe, call it as <filename>do_foo</filename>.
1674 </para></listitem>
1675 </itemizedlist>
1676 With these conditions met, your single recipe
1677 can freely choose between the original function
1678 as defined in the class file and the modified function in your recipe.
1679 If you do not set up these conditions, you are limited to using one function
1680 or the other.
1681 </para>
1682 </section>
1683 </section>
1684
1685 <section id='tasks'>
1686 <title>Tasks</title>
1687
1688 <para>
1689 Tasks are BitBake execution units that make up the
1690 steps that BitBake can run for a given recipe.
1691 Tasks are only supported in recipes and classes
1692 (i.e. in <filename>.bb</filename> files and files
1693 included or inherited from <filename>.bb</filename>
1694 files).
1695 By convention, tasks have names that start with "do_".
1696 </para>
1697
1698 <section id='promoting-a-function-to-a-task'>
1699 <title>Promoting a Function to a Task</title>
1700
1701 <para>
1702 Tasks are either
1703 <link linkend='shell-functions'>shell functions</link> or
1704 <link linkend='bitbake-style-python-functions'>BitBake-style Python functions</link>
1705 that have been promoted to tasks by using the
1706 <filename>addtask</filename> command.
1707 The <filename>addtask</filename> command can also
1708 optionally describe dependencies between the
1709 task and other tasks.
1710 Here is an example that shows how to define a task
1711 and declare some dependencies:
1712 <literallayout class='monospaced'>
1713 python do_printdate () {
1714 import time
1715 print time.strftime('%Y%m%d', time.gmtime())
1716 }
1717 addtask printdate after do_fetch before do_build
1718 </literallayout>
1719 The first argument to <filename>addtask</filename>
1720 is the name of the function to promote to
1721 a task.
1722 If the name does not start with "do_", "do_" is
1723 implicitly added, which enforces the convention that
1724 all task names start with "do_".
1725 </para>
1726
1727 <para>
1728 In the previous example, the
1729 <filename>do_printdate</filename> task becomes a
1730 dependency of the <filename>do_build</filename>
1731 task, which is the default task (i.e. the task run by
1732 the <filename>bitbake</filename> command unless
1733 another task is specified explicitly).
1734 Additionally, the <filename>do_printdate</filename>
1735 task becomes dependent upon the
1736 <filename>do_fetch</filename> task.
1737 Running the <filename>do_build</filename> task
1738 results in the <filename>do_printdate</filename>
1739 task running first.
1740 <note>
1741 If you try out the previous example, you might see that
1742 the <filename>do_printdate</filename> task is only run
1743 the first time you build the recipe with
1744 the <filename>bitbake</filename> command.
1745 This is because BitBake considers the task "up-to-date"
1746 after that initial run.
1747 If you want to force the task to always be rerun for
1748 experimentation purposes, you can make BitBake always
1749 consider the task "out-of-date" by using the
1750 <filename>[</filename><link linkend='variable-flags'><filename>nostamp</filename></link><filename>]</filename>
1751 variable flag, as follows:
1752 <literallayout class='monospaced'>
1753 do_printdate[nostamp] = "1"
1754 </literallayout>
1755 You can also explicitly run the task and provide the
1756 <filename>-f</filename> option as follows:
1757 <literallayout class='monospaced'>
1758 $ bitbake <replaceable>recipe</replaceable> -c printdate -f
1759 </literallayout>
1760 When manually selecting a task to run with the
1761 <filename>bitbake</filename>&nbsp;<replaceable>recipe</replaceable>&nbsp;<filename>-c</filename>&nbsp;<replaceable>task</replaceable>
1762 command, you can omit the "do_" prefix as part of the
1763 task name.
1764 </note>
1765 </para>
1766
1767 <para>
1768 You might wonder about the practical effects of using
1769 <filename>addtask</filename> without specifying any
1770 dependencies as is done in the following example:
1771 <literallayout class='monospaced'>
1772 addtask printdate
1773 </literallayout>
1774 In this example, assuming dependencies have not been
1775 added through some other means, the only way to run
1776 the task is by explicitly selecting it with
1777 <filename>bitbake</filename>&nbsp;<replaceable>recipe</replaceable>&nbsp;<filename>-c printdate</filename>.
1778 You can use the
1779 <filename>do_listtasks</filename> task to list all tasks
1780 defined in a recipe as shown in the following example:
1781 <literallayout class='monospaced'>
1782 $ bitbake <replaceable>recipe</replaceable> -c listtasks
1783 </literallayout>
1784 For more information on task dependencies, see the
1785 "<link linkend='dependencies'>Dependencies</link>"
1786 section.
1787 </para>
1788
1789 <para>
1790 See the
1791 "<link linkend='variable-flags'>Variable Flags</link>"
1792 section for information on variable flags you can use with
1793 tasks.
1794 </para>
1795 </section>
1796
1797 <section id='deleting-a-task'>
1798 <title>Deleting a Task</title>
1799
1800 <para>
1801 As well as being able to add tasks, you can delete them.
1802 Simply use the <filename>deltask</filename> command to
1803 delete a task.
1804 For example, to delete the example task used in the previous
1805 sections, you would use:
1806 <literallayout class='monospaced'>
1807 deltask printdate
1808 </literallayout>
1809 If you delete a task using the <filename>deltask</filename>
1810 command and the task has dependencies, the dependencies are
1811 not reconnected.
1812 For example, suppose you have three tasks named
1813 <filename>do_a</filename>, <filename>do_b</filename>, and
1814 <filename>do_c</filename>.
1815 Furthermore, <filename>do_c</filename> is dependent on
1816 <filename>do_b</filename>, which in turn is dependent on
1817 <filename>do_a</filename>.
1818 Given this scenario, if you use <filename>deltask</filename>
1819 to delete <filename>do_b</filename>, the implicit dependency
1820 relationship between <filename>do_c</filename> and
1821 <filename>do_a</filename> through <filename>do_b</filename>
1822 no longer exists, and <filename>do_c</filename> dependencies
1823 are not updated to include <filename>do_a</filename>.
1824 Thus, <filename>do_c</filename> is free to run before
1825 <filename>do_a</filename>.
1826 </para>
1827
1828 <para>
1829 If you want dependencies such as these to remain intact, use
1830 the <filename>[noexec]</filename> varflag to disable the task
1831 instead of using the <filename>deltask</filename> command to
1832 delete it:
1833 <literallayout class='monospaced'>
1834 do_b[noexec] = "1"
1835 </literallayout>
1836 </para>
1837 </section>
1838
1839 <section id='passing-information-into-the-build-task-environment'>
1840 <title>Passing Information Into the Build Task Environment</title>
1841
1842 <para>
1843 When running a task, BitBake tightly controls the shell execution
1844 environment of the build tasks to make
1845 sure unwanted contamination from the build machine cannot
1846 influence the build.
1847 <note>
1848 By default, BitBake cleans the environment to include only those
1849 things exported or listed in its whitelist to ensure that the build
1850 environment is reproducible and consistent.
1851 You can prevent this "cleaning" by setting the
1852 <link linkend='var-bb-BB_PRESERVE_ENV'><filename>BB_PRESERVE_ENV</filename></link>
1853 variable.
1854 </note>
1855 Consequently, if you do want something to get passed into the
1856 build task environment, you must take these two steps:
1857 <orderedlist>
1858 <listitem><para>
1859 Tell BitBake to load what you want from the environment
1860 into the datastore.
1861 You can do so through the
1862 <link linkend='var-bb-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link>
1863 and
1864 <link linkend='var-bb-BB_ENV_EXTRAWHITE'><filename>BB_ENV_EXTRAWHITE</filename></link>
1865 variables.
1866 For example, assume you want to prevent the build system from
1867 accessing your <filename>$HOME/.ccache</filename>
1868 directory.
1869 The following command "whitelists" the environment variable
1870 <filename>CCACHE_DIR</filename> causing BitBake to allow that
1871 variable into the datastore:
1872 <literallayout class='monospaced'>
1873 export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"
1874 </literallayout></para></listitem>
1875 <listitem><para>
1876 Tell BitBake to export what you have loaded into the
1877 datastore to the task environment of every running task.
1878 Loading something from the environment into the datastore
1879 (previous step) only makes it available in the datastore.
1880 To export it to the task environment of every running task,
1881 use a command similar to the following in your local configuration
1882 file <filename>local.conf</filename> or your
1883 distribution configuration file:
1884 <literallayout class='monospaced'>
1885 export CCACHE_DIR
1886 </literallayout>
1887 <note>
1888 A side effect of the previous steps is that BitBake
1889 records the variable as a dependency of the build process
1890 in things like the setscene checksums.
1891 If doing so results in unnecessary rebuilds of tasks, you can
1892 whitelist the variable so that the setscene code
1893 ignores the dependency when it creates checksums.
1894 </note></para></listitem>
1895 </orderedlist>
1896 </para>
1897
1898 <para>
1899 Sometimes, it is useful to be able to obtain information
1900 from the original execution environment.
1901 BitBake saves a copy of the original environment into
1902 a special variable named
1903 <link linkend='var-bb-BB_ORIGENV'><filename>BB_ORIGENV</filename></link>.
1904 </para>
1905
1906 <para>
1907 The <filename>BB_ORIGENV</filename> variable returns a datastore
1908 object that can be queried using the standard datastore operators
1909 such as <filename>getVar(, False)</filename>.
1910 The datastore object is useful, for example, to find the original
1911 <filename>DISPLAY</filename> variable.
1912 Here is an example:
1913 <literallayout class='monospaced'>
1914 origenv = d.getVar("BB_ORIGENV", False)
1915 bar = origenv.getVar("BAR", False)
1916 </literallayout>
1917 The previous example returns <filename>BAR</filename> from the original
1918 execution environment.
1919 </para>
1920 </section>
1921 </section>
1922
1923 <section id='variable-flags'>
1924 <title>Variable Flags</title>
1925
1926 <para>
1927 Variable flags (varflags) help control a task's functionality
1928 and dependencies.
1929 BitBake reads and writes varflags to the datastore using the following
1930 command forms:
1931 <literallayout class='monospaced'>
1932 <replaceable>variable</replaceable> = d.getVarFlags("<replaceable>variable</replaceable>")
1933 self.d.setVarFlags("FOO", {"func": True})
1934 </literallayout>
1935 </para>
1936
1937 <para>
1938 When working with varflags, the same syntax, with the exception of
1939 overrides, applies.
1940 In other words, you can set, append, and prepend varflags just like
1941 variables.
1942 See the
1943 "<link linkend='variable-flag-syntax'>Variable Flag Syntax</link>"
1944 section for details.
1945 </para>
1946
1947 <para>
1948 BitBake has a defined set of varflags available for recipes and
1949 classes.
1950 Tasks support a number of these flags which control various
1951 functionality of the task:
1952 <itemizedlist>
1953 <listitem><para><emphasis><filename>[cleandirs]</filename>:</emphasis>
1954 Empty directories that should be created before the
1955 task runs.
1956 Directories that already exist are removed and recreated
1957 to empty them.
1958 </para></listitem>
1959 <listitem><para><emphasis><filename>[depends]</filename>:</emphasis>
1960 Controls inter-task dependencies.
1961 See the
1962 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
1963 variable and the
1964 "<link linkend='inter-task-dependencies'>Inter-Task Dependencies</link>"
1965 section for more information.
1966 </para></listitem>
1967 <listitem><para><emphasis><filename>[deptask]</filename>:</emphasis>
1968 Controls task build-time dependencies.
1969 See the
1970 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
1971 variable and the
1972 "<link linkend='build-dependencies'>Build Dependencies</link>"
1973 section for more information.
1974 </para></listitem>
1975 <listitem><para><emphasis><filename>[dirs]</filename>:</emphasis>
1976 Directories that should be created before the task runs.
1977 Directories that already exist are left as is.
1978 The last directory listed is used as the
1979 current working directory for the task.
1980 </para></listitem>
1981 <listitem><para><emphasis><filename>[lockfiles]</filename>:</emphasis>
1982 Specifies one or more lockfiles to lock while the task
1983 executes.
1984 Only one task may hold a lockfile, and any task that
1985 attempts to lock an already locked file will block until
1986 the lock is released.
1987 You can use this variable flag to accomplish mutual
1988 exclusion.
1989 </para></listitem>
1990 <listitem><para><emphasis><filename>[noexec]</filename>:</emphasis>
1991 When set to "1", marks the task as being empty, with
1992 no execution required.
1993 You can use the <filename>[noexec]</filename> flag to set up
1994 tasks as dependency placeholders, or to disable tasks defined
1995 elsewhere that are not needed in a particular recipe.
1996 </para></listitem>
1997 <listitem><para><emphasis><filename>[nostamp]</filename>:</emphasis>
1998 When set to "1", tells BitBake to not generate a stamp
1999 file for a task, which implies the task should always
2000 be executed.
2001 <note><title>Caution</title>
2002 Any task that depends (possibly indirectly) on a
2003 <filename>[nostamp]</filename> task will always be
2004 executed as well.
2005 This can cause unnecessary rebuilding if you are
2006 not careful.
2007 </note>
2008 </para></listitem>
2009 <listitem><para><emphasis><filename>[number_threads]</filename>:</emphasis>
2010 Limits tasks to a specific number of simultaneous threads
2011 during execution.
2012 This varflag is useful when your build host has a large number
2013 of cores but certain tasks need to be rate-limited due to various
2014 kinds of resource constraints (e.g. to avoid network throttling).
2015 <filename>number_threads</filename> works similarly to the
2016 <link linkend='var-bb-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>
2017 variable but is task-specific.</para>
2018
2019 <para>Set the value globally.
2020 For example, the following makes sure the
2021 <filename>do_fetch</filename> task uses no more than two
2022 simultaneous execution threads:
2023 <literallayout class='monospaced'>
2024 do_fetch[number_threads] = "2"
2025 </literallayout>
2026 <note><title>Warnings</title>
2027 <itemizedlist>
2028 <listitem><para>
2029 Setting the varflag in individual recipes rather
2030 than globally can result in unpredictable behavior.
2031 </para></listitem>
2032 <listitem><para>
2033 Setting the varflag to a value greater than the
2034 value used in the <filename>BB_NUMBER_THREADS</filename>
2035 variable causes <filename>number_threads</filename>
2036 to have no effect.
2037 </para></listitem>
2038 </itemizedlist>
2039 </note>
2040 </para></listitem>
2041 <listitem><para><emphasis><filename>[postfuncs]</filename>:</emphasis>
2042 List of functions to call after the completion of the task.
2043 </para></listitem>
2044 <listitem><para><emphasis><filename>[prefuncs]</filename>:</emphasis>
2045 List of functions to call before the task executes.
2046 </para></listitem>
2047 <listitem><para><emphasis><filename>[rdepends]</filename>:</emphasis>
2048 Controls inter-task runtime dependencies.
2049 See the
2050 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>
2051 variable, the
2052 <link linkend='var-bb-RRECOMMENDS'><filename>RRECOMMENDS</filename></link>
2053 variable, and the
2054 "<link linkend='inter-task-dependencies'>Inter-Task Dependencies</link>"
2055 section for more information.
2056 </para></listitem>
2057 <listitem><para><emphasis><filename>[rdeptask]</filename>:</emphasis>
2058 Controls task runtime dependencies.
2059 See the
2060 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>
2061 variable, the
2062 <link linkend='var-bb-RRECOMMENDS'><filename>RRECOMMENDS</filename></link>
2063 variable, and the
2064 "<link linkend='runtime-dependencies'>Runtime Dependencies</link>"
2065 section for more information.
2066 </para></listitem>
2067 <listitem><para><emphasis><filename>[recideptask]</filename>:</emphasis>
2068 When set in conjunction with
2069 <filename>recrdeptask</filename>, specifies a task that
2070 should be inspected for additional dependencies.
2071 </para></listitem>
2072 <listitem><para><emphasis><filename>[recrdeptask]</filename>:</emphasis>
2073 Controls task recursive runtime dependencies.
2074 See the
2075 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>
2076 variable, the
2077 <link linkend='var-bb-RRECOMMENDS'><filename>RRECOMMENDS</filename></link>
2078 variable, and the
2079 "<link linkend='recursive-dependencies'>Recursive Dependencies</link>"
2080 section for more information.
2081 </para></listitem>
2082 <listitem><para><emphasis><filename>[stamp-extra-info]</filename>:</emphasis>
2083 Extra stamp information to append to the task's stamp.
2084 As an example, OpenEmbedded uses this flag to allow
2085 machine-specific tasks.
2086 </para></listitem>
2087 <listitem><para><emphasis><filename>[umask]</filename>:</emphasis>
2088 The umask to run the task under.
2089 </para></listitem>
2090 </itemizedlist>
2091 </para>
2092
2093 <para>
2094 Several varflags are useful for controlling how signatures are
2095 calculated for variables.
2096 For more information on this process, see the
2097 "<link linkend='checksums'>Checksums (Signatures)</link>"
2098 section.
2099 <itemizedlist>
2100 <listitem><para><emphasis><filename>[vardeps]</filename>:</emphasis>
2101 Specifies a space-separated list of additional
2102 variables to add to a variable's dependencies
2103 for the purposes of calculating its signature.
2104 Adding variables to this list is useful, for example, when
2105 a function refers to a variable in a manner that
2106 does not allow BitBake to automatically determine
2107 that the variable is referred to.
2108 </para></listitem>
2109 <listitem><para><emphasis><filename>[vardepsexclude]</filename>:</emphasis>
2110 Specifies a space-separated list of variables
2111 that should be excluded from a variable's dependencies
2112 for the purposes of calculating its signature.
2113 </para></listitem>
2114 <listitem><para><emphasis><filename>[vardepvalue]</filename>:</emphasis>
2115 If set, instructs BitBake to ignore the actual
2116 value of the variable and instead use the specified
2117 value when calculating the variable's signature.
2118 </para></listitem>
2119 <listitem><para><emphasis><filename>[vardepvalueexclude]</filename>:</emphasis>
2120 Specifies a pipe-separated list of strings to exclude
2121 from the variable's value when calculating the
2122 variable's signature.
2123 </para></listitem>
2124 </itemizedlist>
2125 </para>
2126 </section>
2127
2128 <section id='events'>
2129 <title>Events</title>
2130
2131 <para>
2132 BitBake allows installation of event handlers within recipe
2133 and class files.
2134 Events are triggered at certain points during operation, such
2135 as the beginning of operation against a given recipe
2136 (i.e. <filename>*.bb</filename>), the start of a given task,
2137 a task failure, a task success, and so forth.
2138 The intent is to make it easy to do things like email
2139 notification on build failures.
2140 </para>
2141
2142 <para>
2143 Following is an example event handler that prints the name
2144 of the event and the content of the
2145 <filename>FILE</filename> variable:
2146 <literallayout class='monospaced'>
2147 addhandler myclass_eventhandler
2148 python myclass_eventhandler() {
2149 from bb.event import getName
2150 print("The name of the Event is %s" % getName(e))
2151 print("The file we run for is %s" % d.getVar('FILE'))
2152 }
2153 myclass_eventhandler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted"
2154 </literallayout>
2155 In the previous example, an eventmask has been set so that
2156 the handler only sees the "BuildStarted" and "BuildCompleted"
2157 events.
2158 This event handler gets called every time an event matching
2159 the eventmask is triggered.
2160 A global variable "e" is defined, which represents the current
2161 event.
2162 With the <filename>getName(e)</filename> method, you can get
2163 the name of the triggered event.
2164 The global datastore is available as "d".
2165 In legacy code, you might see "e.data" used to get the datastore.
2166 However, realize that "e.data" is deprecated and you should use
2167 "d" going forward.
2168 </para>
2169
2170 <para>
2171 The context of the datastore is appropriate to the event
2172 in question.
2173 For example, "BuildStarted" and "BuildCompleted" events run
2174 before any tasks are executed so would be in the global
2175 configuration datastore namespace.
2176 No recipe-specific metadata exists in that namespace.
2177 The "BuildStarted" and "BuildCompleted" events also run in
2178 the main cooker/server process rather than any worker context.
2179 Thus, any changes made to the datastore would be seen by other
2180 cooker/server events within the current build but not seen
2181 outside of that build or in any worker context.
2182 Task events run in the actual tasks in question consequently
2183 have recipe-specific and task-specific contents.
2184 These events run in the worker context and are discarded at
2185 the end of task execution.
2186 </para>
2187
2188 <para>
2189 During a standard build, the following common events might
2190 occur.
2191 The following events are the most common kinds of events that
2192 most metadata might have an interest in viewing:
2193 <itemizedlist>
2194 <listitem><para>
2195 <filename>bb.event.ConfigParsed()</filename>:
2196 Fired when the base configuration; which consists of
2197 <filename>bitbake.conf</filename>,
2198 <filename>base.bbclass</filename> and any global
2199 <filename>INHERIT</filename> statements; has been parsed.
2200 You can see multiple such events when each of the
2201 workers parse the base configuration or if the server
2202 changes configuration and reparses.
2203 Any given datastore only has one such event executed
2204 against it, however.
2205 If
2206 <link linkende='var-bb-BB_INVALIDCONF'><filename>BB_INVALIDCONF</filename></link>
2207 is set in the datastore by the event handler, the
2208 configuration is reparsed and a new event triggered,
2209 allowing the metadata to update configuration.
2210 </para></listitem>
2211 <listitem><para>
2212 <filename>bb.event.HeartbeatEvent()</filename>:
2213 Fires at regular time intervals of one second.
2214 You can configure the interval time using the
2215 <filename>BB_HEARTBEAT_EVENT</filename> variable.
2216 The event's "time" attribute is the
2217 <filename>time.time()</filename> value when the
2218 event is triggered.
2219 This event is useful for activities such as
2220 system state monitoring.
2221 </para></listitem>
2222 <listitem><para>
2223 <filename>bb.event.ParseStarted()</filename>:
2224 Fired when BitBake is about to start parsing recipes.
2225 This event's "total" attribute represents the number of
2226 recipes BitBake plans to parse.
2227 </para></listitem>
2228 <listitem><para>
2229 <filename>bb.event.ParseProgress()</filename>:
2230 Fired as parsing progresses.
2231 This event's "current" attribute is the number of
2232 recipes parsed as well as the "total" attribute.
2233 </para></listitem>
2234 <listitem><para>
2235 <filename>bb.event.ParseCompleted()</filename>:
2236 Fired when parsing is complete.
2237 This event's "cached", "parsed", "skipped", "virtuals",
2238 "masked", and "errors" attributes provide statistics
2239 for the parsing results.
2240 </para></listitem>
2241 <listitem><para>
2242 <filename>bb.event.BuildStarted()</filename>:
2243 Fired when a new build starts.
2244 BitBake fires multiple "BuildStarted" events (one per configuration)
2245 when multiple configuration (multiconfig) is enabled.
2246 </para></listitem>
2247 <listitem><para>
2248 <filename>bb.build.TaskStarted()</filename>:
2249 Fired when a task starts.
2250 This event's "taskfile" attribute points to the recipe
2251 from which the task originates.
2252 The "taskname" attribute, which is the task's name,
2253 includes the <filename>do_</filename> prefix, and the
2254 "logfile" attribute point to where the task's output is
2255 stored.
2256 Finally, the "time" attribute is the task's execution start
2257 time.
2258 </para></listitem>
2259 <listitem><para>
2260 <filename>bb.build.TaskInvalid()</filename>:
2261 Fired if BitBake tries to execute a task that does not exist.
2262 </para></listitem>
2263 <listitem><para>
2264 <filename>bb.build.TaskFailedSilent()</filename>:
2265 Fired for setscene tasks that fail and should not be
2266 presented to the user verbosely.
2267 </para></listitem>
2268 <listitem><para>
2269 <filename>bb.build.TaskFailed()</filename>:
2270 Fired for normal tasks that fail.
2271 </para></listitem>
2272 <listitem><para>
2273 <filename>bb.build.TaskSucceeded()</filename>:
2274 Fired when a task successfully completes.
2275 </para></listitem>
2276 <listitem><para>
2277 <filename>bb.event.BuildCompleted()</filename>:
2278 Fired when a build finishes.
2279 </para></listitem>
2280 <listitem><para>
2281 <filename>bb.cooker.CookerExit()</filename>:
2282 Fired when the BitBake server/cooker shuts down.
2283 This event is usually only seen by the UIs as a
2284 sign they should also shutdown.
2285 </para></listitem>
2286 </itemizedlist>
2287 </para>
2288
2289 <para>
2290 This next list of example events occur based on specific
2291 requests to the server.
2292 These events are often used to communicate larger pieces of
2293 information from the BitBake server to other parts of
2294 BitBake such as user interfaces:
2295 <itemizedlist>
2296 <listitem><para>
2297 <filename>bb.event.TreeDataPreparationStarted()</filename>
2298 </para></listitem>
2299 <listitem><para>
2300 <filename>bb.event.TreeDataPreparationProgress()</filename>
2301 </para></listitem>
2302 <listitem><para>
2303 <filename>bb.event.TreeDataPreparationCompleted()</filename>
2304 </para></listitem>
2305 <listitem><para>
2306 <filename>bb.event.DepTreeGenerated()</filename>
2307 </para></listitem>
2308 <listitem><para>
2309 <filename>bb.event.CoreBaseFilesFound()</filename>
2310 </para></listitem>
2311 <listitem><para>
2312 <filename>bb.event.ConfigFilePathFound()</filename>
2313 </para></listitem>
2314 <listitem><para>
2315 <filename>bb.event.FilesMatchingFound()</filename>
2316 </para></listitem>
2317 <listitem><para>
2318 <filename>bb.event.ConfigFilesFound()</filename>
2319 </para></listitem>
2320 <listitem><para>
2321 <filename>bb.event.TargetsTreeGenerated()</filename>
2322 </para></listitem>
2323 </itemizedlist>
2324 </para>
2325 </section>
2326
2327 <section id='variants-class-extension-mechanism'>
2328 <title>Variants - Class Extension Mechanism</title>
2329
2330 <para>
2331 BitBake supports two features that facilitate creating
2332 from a single recipe file multiple incarnations of that
2333 recipe file where all incarnations are buildable.
2334 These features are enabled through the
2335 <link linkend='var-bb-BBCLASSEXTEND'><filename>BBCLASSEXTEND</filename></link>
2336 and
2337 <link linkend='var-bb-BBVERSIONS'><filename>BBVERSIONS</filename></link>
2338 variables.
2339 <note>
2340 The mechanism for this class extension is extremely
2341 specific to the implementation.
2342 Usually, the recipe's
2343 <link linkend='var-bb-PROVIDES'><filename>PROVIDES</filename></link>,
2344 <link linkend='var-bb-PN'><filename>PN</filename></link>, and
2345 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
2346 variables would need to be modified by the extension class.
2347 For specific examples, see the OE-Core
2348 <filename>native</filename>, <filename>nativesdk</filename>,
2349 and <filename>multilib</filename> classes.
2350 </note>
2351 <itemizedlist>
2352 <listitem><para><emphasis><filename>BBCLASSEXTEND</filename>:</emphasis>
2353 This variable is a space separated list of classes used to "extend" the
2354 recipe for each variant.
2355 Here is an example that results in a second incarnation of the current
2356 recipe being available.
2357 This second incarnation will have the "native" class inherited.
2358 <literallayout class='monospaced'>
2359 BBCLASSEXTEND = "native"
2360 </literallayout></para></listitem>
2361 <listitem><para><emphasis><filename>BBVERSIONS</filename>:</emphasis>
2362 This variable allows a single recipe to build multiple versions of a
2363 project from a single recipe file.
2364 You can also specify conditional metadata
2365 (using the
2366 <link linkend='var-bb-OVERRIDES'><filename>OVERRIDES</filename></link>
2367 mechanism) for a single version, or an optionally named range of versions.
2368 Here is an example:
2369 <literallayout class='monospaced'>
2370 BBVERSIONS = "1.0 2.0 git"
2371 SRC_URI_git = "git://someurl/somepath.git"
2372
2373 BBVERSIONS = "1.0.[0-6]:1.0.0+ \ 1.0.[7-9]:1.0.7+"
2374 SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"
2375 </literallayout>
2376 The name of the range defaults to the original version of the
2377 recipe.
2378 For example, in OpenEmbedded, the recipe file
2379 <filename>foo_1.0.0+.bb</filename> creates a default name range
2380 of <filename>1.0.0+</filename>.
2381 This is useful because the range name is not only placed
2382 into overrides, but it is also made available for the metadata to use
2383 in the variable that defines the base recipe versions for use in
2384 <filename>file://</filename> search paths
2385 (<link linkend='var-bb-FILESPATH'><filename>FILESPATH</filename></link>).
2386 </para></listitem>
2387 </itemizedlist>
2388 </para>
2389 </section>
2390
2391 <section id='dependencies'>
2392 <title>Dependencies</title>
2393
2394 <para>
2395 To allow for efficient parallel processing, BitBake handles
2396 dependencies at the task level.
2397 Dependencies can exist both between tasks within a single recipe
2398 and between tasks in different recipes.
2399 Following are examples of each:
2400 <itemizedlist>
2401 <listitem><para>For tasks within a single recipe, a
2402 recipe's <filename>do_configure</filename>
2403 task might need to complete before its
2404 <filename>do_compile</filename> task can run.
2405 </para></listitem>
2406 <listitem><para>For tasks in different recipes, one
2407 recipe's <filename>do_configure</filename>
2408 task might require another recipe's
2409 <filename>do_populate_sysroot</filename>
2410 task to finish first such that the libraries and headers
2411 provided by the other recipe are available.
2412 </para></listitem>
2413 </itemizedlist>
2414 </para>
2415
2416 <para>
2417 This section describes several ways to declare dependencies.
2418 Remember, even though dependencies are declared in different ways, they
2419 are all simply dependencies between tasks.
2420 </para>
2421
2422 <section id='dependencies-internal-to-the-bb-file'>
2423 <title>Dependencies Internal to the <filename>.bb</filename> File</title>
2424
2425 <para>
2426 BitBake uses the <filename>addtask</filename> directive
2427 to manage dependencies that are internal to a given recipe
2428 file.
2429 You can use the <filename>addtask</filename> directive to
2430 indicate when a task is dependent on other tasks or when
2431 other tasks depend on that recipe.
2432 Here is an example:
2433 <literallayout class='monospaced'>
2434 addtask printdate after do_fetch before do_build
2435 </literallayout>
2436 In this example, the <filename>do_printdate</filename>
2437 task depends on the completion of the
2438 <filename>do_fetch</filename> task, and the
2439 <filename>do_build</filename> task depends on the
2440 completion of the <filename>do_printdate</filename>
2441 task.
2442 <note><para>
2443 For a task to run, it must be a direct or indirect
2444 dependency of some other task that is scheduled to
2445 run.</para>
2446
2447 <para>For illustration, here are some examples:
2448 <itemizedlist>
2449 <listitem><para>
2450 The directive
2451 <filename>addtask mytask before do_configure</filename>
2452 causes <filename>do_mytask</filename> to run before
2453 <filename>do_configure</filename> runs.
2454 Be aware that <filename>do_mytask</filename> still only
2455 runs if its <link linkend='checksums'>input checksum</link>
2456 has changed since the last time it was run.
2457 Changes to the input checksum of
2458 <filename>do_mytask</filename> also indirectly cause
2459 <filename>do_configure</filename> to run.
2460 </para></listitem>
2461 <listitem><para>
2462 The directive
2463 <filename>addtask mytask after do_configure</filename>
2464 by itself never causes <filename>do_mytask</filename>
2465 to run.
2466 <filename>do_mytask</filename> can still be run manually
2467 as follows:
2468 <literallayout class='monospaced'>
2469 $ bitbake <replaceable>recipe</replaceable> -c mytask
2470 </literallayout>
2471 Declaring <filename>do_mytask</filename> as a dependency
2472 of some other task that is scheduled to run also causes
2473 it to run.
2474 Regardless, the task runs after
2475 <filename>do_configure</filename>.
2476 </para></listitem>
2477 </itemizedlist></para>
2478 </note>
2479 </para>
2480 </section>
2481
2482 <section id='build-dependencies'>
2483 <title>Build Dependencies</title>
2484
2485 <para>
2486 BitBake uses the
2487 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
2488 variable to manage build time dependencies.
2489 The <filename>[deptask]</filename> varflag for tasks
2490 signifies the task of each
2491 item listed in <filename>DEPENDS</filename> that must
2492 complete before that task can be executed.
2493 Here is an example:
2494 <literallayout class='monospaced'>
2495 do_configure[deptask] = "do_populate_sysroot"
2496 </literallayout>
2497 In this example, the <filename>do_populate_sysroot</filename>
2498 task of each item in <filename>DEPENDS</filename> must complete before
2499 <filename>do_configure</filename> can execute.
2500 </para>
2501 </section>
2502
2503 <section id='runtime-dependencies'>
2504 <title>Runtime Dependencies</title>
2505
2506 <para>
2507 BitBake uses the
2508 <link linkend='var-bb-PACKAGES'><filename>PACKAGES</filename></link>,
2509 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>, and
2510 <link linkend='var-bb-RRECOMMENDS'><filename>RRECOMMENDS</filename></link>
2511 variables to manage runtime dependencies.
2512 </para>
2513
2514 <para>
2515 The <filename>PACKAGES</filename> variable lists runtime
2516 packages.
2517 Each of those packages can have <filename>RDEPENDS</filename> and
2518 <filename>RRECOMMENDS</filename> runtime dependencies.
2519 The <filename>[rdeptask]</filename> flag for tasks is used to
2520 signify the task of each
2521 item runtime dependency which must have completed before that
2522 task can be executed.
2523 <literallayout class='monospaced'>
2524 do_package_qa[rdeptask] = "do_packagedata"
2525 </literallayout>
2526 In the previous example, the <filename>do_packagedata</filename>
2527 task of each item in <filename>RDEPENDS</filename> must have
2528 completed before <filename>do_package_qa</filename> can execute.
2529 Although <filename>RDEPENDS</filename> contains entries from the
2530 runtime dependency namespace, BitBake knows how to map them back
2531 to the build-time dependency namespace, in which the tasks are defined.
2532 </para>
2533 </section>
2534
2535 <section id='recursive-dependencies'>
2536 <title>Recursive Dependencies</title>
2537
2538 <para>
2539 BitBake uses the <filename>[recrdeptask]</filename> flag to manage
2540 recursive task dependencies.
2541 BitBake looks through the build-time and runtime
2542 dependencies of the current recipe, looks through
2543 the task's inter-task
2544 dependencies, and then adds dependencies for the
2545 listed task.
2546 Once BitBake has accomplished this, it recursively works through
2547 the dependencies of those tasks.
2548 Iterative passes continue until all dependencies are discovered
2549 and added.
2550 </para>
2551
2552 <para>
2553 The <filename>[recrdeptask]</filename> flag is most commonly
2554 used in high-level
2555 recipes that need to wait for some task to finish "globally".
2556 For example, <filename>image.bbclass</filename> has the following:
2557 <literallayout class='monospaced'>
2558 do_rootfs[recrdeptask] += "do_packagedata"
2559 </literallayout>
2560 This statement says that the <filename>do_packagedata</filename>
2561 task of the current recipe and all recipes reachable
2562 (by way of dependencies) from the
2563 image recipe must run before the <filename>do_rootfs</filename>
2564 task can run.
2565 </para>
2566
2567 <para>
2568 BitBake allows a task to recursively depend on itself by
2569 referencing itself in the task list:
2570 <literallayout class='monospaced'>
2571 do_a[recrdeptask] = "do_a do_b"
2572 </literallayout>
2573 In the same way as before, this means that the <filename>do_a</filename>
2574 and <filename>do_b</filename> tasks of the current recipe and all
2575 recipes reachable (by way of dependencies) from the recipe
2576 must run before the <filename>do_a</filename> task can run. In this
2577 case BitBake will ignore the current recipe's <filename>do_a</filename>
2578 task circular dependency on itself.
2579 </para>
2580 </section>
2581
2582 <section id='inter-task-dependencies'>
2583 <title>Inter-Task Dependencies</title>
2584
2585 <para>
2586 BitBake uses the <filename>[depends]</filename>
2587 flag in a more generic form
2588 to manage inter-task dependencies.
2589 This more generic form allows for inter-dependency
2590 checks for specific tasks rather than checks for
2591 the data in <filename>DEPENDS</filename>.
2592 Here is an example:
2593 <literallayout class='monospaced'>
2594 do_patch[depends] = "quilt-native:do_populate_sysroot"
2595 </literallayout>
2596 In this example, the <filename>do_populate_sysroot</filename>
2597 task of the target <filename>quilt-native</filename>
2598 must have completed before the
2599 <filename>do_patch</filename> task can execute.
2600 </para>
2601
2602 <para>
2603 The <filename>[rdepends]</filename> flag works in a similar
2604 way but takes targets
2605 in the runtime namespace instead of the build-time dependency
2606 namespace.
2607 </para>
2608 </section>
2609 </section>
2610
2611 <section id='functions-you-can-call-from-within-python'>
2612 <title>Functions You Can Call From Within Python</title>
2613
2614 <para>
2615 BitBake provides many functions you can call from
2616 within Python functions.
2617 This section lists the most commonly used functions,
2618 and mentions where to find others.
2619 </para>
2620
2621 <section id='functions-for-accessing-datastore-variables'>
2622 <title>Functions for Accessing Datastore Variables</title>
2623
2624 <para>
2625 It is often necessary to access variables in the
2626 BitBake datastore using Python functions.
2627 The BitBake datastore has an API that allows you this
2628 access.
2629 Here is a list of available operations:
2630 </para>
2631
2632 <para>
2633 <informaltable frame='none'>
2634 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
2635 <colspec colname='c1' colwidth='1*'/>
2636 <colspec colname='c2' colwidth='1*'/>
2637 <thead>
2638 <row>
2639 <entry align="left"><emphasis>Operation</emphasis></entry>
2640 <entry align="left"><emphasis>Description</emphasis></entry>
2641 </row>
2642 </thead>
2643 <tbody>
2644 <row>
2645 <entry align="left"><filename>d.getVar("X", expand)</filename></entry>
2646 <entry align="left">Returns the value of variable "X".
2647 Using "expand=True" expands the value.
2648 Returns "None" if the variable "X" does not exist.</entry>
2649 </row>
2650 <row>
2651 <entry align="left"><filename>d.setVar("X", "value")</filename></entry>
2652 <entry align="left">Sets the variable "X" to "value".</entry>
2653 </row>
2654 <row>
2655 <entry align="left"><filename>d.appendVar("X", "value")</filename></entry>
2656 <entry align="left">Adds "value" to the end of the variable "X".
2657 Acts like <filename>d.setVar("X", "value")</filename>
2658 if the variable "X" does not exist.</entry>
2659 </row>
2660 <row>
2661 <entry align="left"><filename>d.prependVar("X", "value")</filename></entry>
2662 <entry align="left">Adds "value" to the start of the variable "X".
2663 Acts like <filename>d.setVar("X", "value")</filename>
2664 if the variable "X" does not exist.</entry>
2665 </row>
2666 <row>
2667 <entry align="left"><filename>d.delVar("X")</filename></entry>
2668 <entry align="left">Deletes the variable "X" from the datastore.
2669 Does nothing if the variable "X" does not exist.</entry>
2670 </row>
2671 <row>
2672 <entry align="left"><filename>d.renameVar("X", "Y")</filename></entry>
2673 <entry align="left">Renames the variable "X" to "Y".
2674 Does nothing if the variable "X" does not exist.</entry>
2675 </row>
2676 <row>
2677 <entry align="left"><filename>d.getVarFlag("X", flag, expand)</filename></entry>
2678 <entry align="left">Returns the value of variable "X".
2679 Using "expand=True" expands the value.
2680 Returns "None" if either the variable "X" or the named flag
2681 does not exist.</entry>
2682 </row>
2683 <row>
2684 <entry align="left"><filename>d.setVarFlag("X", flag, "value")</filename></entry>
2685 <entry align="left">Sets the named flag for variable "X" to "value".</entry>
2686 </row>
2687 <row>
2688 <entry align="left"><filename>d.appendVarFlag("X", flag, "value")</filename></entry>
2689 <entry align="left">Appends "value" to the named flag on the
2690 variable "X".
2691 Acts like <filename>d.setVarFlag("X", flag, "value")</filename>
2692 if the named flag does not exist.</entry>
2693 </row>
2694 <row>
2695 <entry align="left"><filename>d.prependVarFlag("X", flag, "value")</filename></entry>
2696 <entry align="left">Prepends "value" to the named flag on
2697 the variable "X".
2698 Acts like <filename>d.setVarFlag("X", flag, "value")</filename>
2699 if the named flag does not exist.</entry>
2700 </row>
2701 <row>
2702 <entry align="left"><filename>d.delVarFlag("X", flag)</filename></entry>
2703 <entry align="left">Deletes the named flag on the variable
2704 "X" from the datastore.</entry>
2705 </row>
2706 <row>
2707 <entry align="left"><filename>d.setVarFlags("X", flagsdict)</filename></entry>
2708 <entry align="left">Sets the flags specified in
2709 the <filename>flagsdict()</filename> parameter.
2710 <filename>setVarFlags</filename> does not clear previous flags.
2711 Think of this operation as <filename>addVarFlags</filename>.</entry>
2712 </row>
2713 <row>
2714 <entry align="left"><filename>d.getVarFlags("X")</filename></entry>
2715 <entry align="left">Returns a <filename>flagsdict</filename>
2716 of the flags for the variable "X".
2717 Returns "None" if the variable "X" does not exist.</entry>
2718 </row>
2719 <row>
2720 <entry align="left"><filename>d.delVarFlags("X")</filename></entry>
2721 <entry align="left">Deletes all the flags for the variable "X".
2722 Does nothing if the variable "X" does not exist.</entry>
2723 </row>
2724 <row>
2725 <entry align="left"><filename>d.expand(expression)</filename></entry>
2726 <entry align="left">Expands variable references in the specified
2727 string expression.
2728 References to variables that do not exist are left as is.
2729 For example, <filename>d.expand("foo ${X}")</filename>
2730 expands to the literal string "foo ${X}" if the
2731 variable "X" does not exist.</entry>
2732 </row>
2733 </tbody>
2734 </tgroup>
2735 </informaltable>
2736 </para>
2737 </section>
2738
2739 <section id='other-functions'>
2740 <title>Other Functions</title>
2741
2742 <para>
2743 You can find many other functions that can be called
2744 from Python by looking at the source code of the
2745 <filename>bb</filename> module, which is in
2746 <filename>bitbake/lib/bb</filename>.
2747 For example,
2748 <filename>bitbake/lib/bb/utils.py</filename> includes
2749 the commonly used functions
2750 <filename>bb.utils.contains()</filename> and
2751 <filename>bb.utils.mkdirhier()</filename>, which come
2752 with docstrings.
2753 </para>
2754 </section>
2755 </section>
2756
2757 <section id='task-checksums-and-setscene'>
2758 <title>Task Checksums and Setscene</title>
2759
2760 <para>
2761 BitBake uses checksums (or signatures) along with the setscene
2762 to determine if a task needs to be run.
2763 This section describes the process.
2764 To help understand how BitBake does this, the section assumes an
2765 OpenEmbedded metadata-based example.
2766 </para>
2767
2768 <para>
2769 These checksums are stored in
2770 <link linkend='var-bb-STAMP'><filename>STAMP</filename></link>.
2771 You can examine the checksums using the following BitBake command:
2772 <literallayout class='monospaced'>
2773 $ bitbake-dumpsigs
2774 </literallayout>
2775 This command returns the signature data in a readable format
2776 that allows you to examine the inputs used when the
2777 OpenEmbedded build system generates signatures.
2778 For example, using <filename>bitbake-dumpsigs</filename>
2779 allows you to examine the <filename>do_compile</filename>
2780 task's “sigdata†for a C application (e.g.
2781 <filename>bash</filename>).
2782 Running the command also reveals that the “CC†variable is part of
2783 the inputs that are hashed.
2784 Any changes to this variable would invalidate the stamp and
2785 cause the <filename>do_compile</filename> task to run.
2786 </para>
2787
2788 <para>
2789 The following list describes related variables:
2790 <itemizedlist>
2791 <listitem><para>
2792 <link linkend='var-bb-BB_HASHCHECK_FUNCTION'><filename>BB_HASHCHECK_FUNCTION</filename></link>:
2793 Specifies the name of the function to call during
2794 the "setscene" part of the task's execution in order
2795 to validate the list of task hashes.
2796 </para></listitem>
2797 <listitem><para>
2798 <link linkend='var-bb-BB_SETSCENE_DEPVALID'><filename>BB_SETSCENE_DEPVALID</filename></link>:
2799 Specifies a function BitBake calls that determines
2800 whether BitBake requires a setscene dependency to
2801 be met.
2802 </para></listitem>
2803 <listitem><para>
2804 <link linkend='var-bb-BB_SETSCENE_VERIFY_FUNCTION2'><filename>BB_SETSCENE_VERIFY_FUNCTION2</filename></link>:
2805 Specifies a function to call that verifies the list of
2806 planned task execution before the main task execution
2807 happens.
2808 </para></listitem>
2809 <listitem><para>
2810 <link linkend='var-bb-BB_STAMP_POLICY'><filename>BB_STAMP_POLICY</filename></link>:
2811 Defines the mode for comparing timestamps of stamp files.
2812 </para></listitem>
2813 <listitem><para>
2814 <link linkend='var-bb-BB_STAMP_WHITELIST'><filename>BB_STAMP_WHITELIST</filename></link>:
2815 Lists stamp files that are looked at when the stamp policy
2816 is "whitelist".
2817 </para></listitem>
2818 <listitem><para>
2819 <link linkend='var-bb-BB_TASKHASH'><filename>BB_TASKHASH</filename></link>:
2820 Within an executing task, this variable holds the hash
2821 of the task as returned by the currently enabled
2822 signature generator.
2823 </para></listitem>
2824 <listitem><para>
2825 <link linkend='var-bb-STAMP'><filename>STAMP</filename></link>:
2826 The base path to create stamp files.
2827 </para></listitem>
2828 <listitem><para>
2829 <link linkend='var-bb-STAMPCLEAN'><filename>STAMPCLEAN</filename></link>:
2830 Again, the base path to create stamp files but can use wildcards
2831 for matching a range of files for clean operations.
2832 </para></listitem>
2833 </itemizedlist>
2834 </para>
2835 </section>
2836
2837 <section id='wildcard-support-in-variables'>
2838 <title>Wildcard Support in Variables</title>
2839
2840 <para>
2841 Support for wildcard use in variables varies depending on the
2842 context in which it is used.
2843 For example, some variables and file names allow limited use of
2844 wildcards through the "<filename>%</filename>" and
2845 "<filename>*</filename>" characters.
2846 Other variables or names support Python's
2847 <ulink url='https://docs.python.org/3/library/glob.html'><filename>glob</filename></ulink>
2848 syntax,
2849 <ulink url='https://docs.python.org/3/library/fnmatch.html#module-fnmatch'><filename>fnmatch</filename></ulink>
2850 syntax, or
2851 <ulink url='https://docs.python.org/3/library/re.html#re'><filename>Regular Expression (re)</filename></ulink>
2852 syntax.
2853 </para>
2854
2855 <para>
2856 For variables that have wildcard suport, the
2857 documentation describes which form of wildcard, its
2858 use, and its limitations.
2859 </para>
2860 </section>
2861
2862</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
new file mode 100644
index 0000000000..74a3eb8095
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -0,0 +1,1372 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3==================
4Variables Glossary
5==================
6
7|
8
9This chapter lists common variables used by BitBake and gives an
10overview of their function and contents.
11
12.. note::
13
14 Following are some points regarding the variables listed in this
15 glossary:
16
17 - The variables listed in this glossary are specific to BitBake.
18 Consequently, the descriptions are limited to that context.
19
20 - Also, variables exist in other systems that use BitBake (e.g. The
21 Yocto Project and OpenEmbedded) that have names identical to those
22 found in this glossary. For such cases, the variables in those
23 systems extend the functionality of the variable as it is
24 described here in this glossary.
25
26 - Finally, there are variables mentioned in this glossary that do
27 not appear in the BitBake glossary. These other variables are
28 variables used in systems that use BitBake.
29
30.. glossary::
31
32 :term:`ASSUME_PROVIDED`
33 Lists recipe names (:term:`PN` values) BitBake does not
34 attempt to build. Instead, BitBake assumes these recipes have already
35 been built.
36
37 In OpenEmbedded-Core, ``ASSUME_PROVIDED`` mostly specifies native
38 tools that should not be built. An example is ``git-native``, which
39 when specified allows for the Git binary from the host to be used
40 rather than building ``git-native``.
41
42 :term:`B`
43 The directory in which BitBake executes functions during a recipe's
44 build process.
45
46 :term:`BB_ALLOWED_NETWORKS`
47 Specifies a space-delimited list of hosts that the fetcher is allowed
48 to use to obtain the required source code. Following are
49 considerations surrounding this variable:
50
51 - This host list is only used if
52 :term:`BB_NO_NETWORK` is either not set or
53 set to "0".
54
55 - Limited support for the "``*``" wildcard character for matching
56 against the beginning of host names exists. For example, the
57 following setting matches ``git.gnu.org``, ``ftp.gnu.org``, and
58 ``foo.git.gnu.org``. ::
59
60 BB_ALLOWED_NETWORKS = "\*.gnu.org"
61
62 .. important::
63
64 The use of the "``*``" character only works at the beginning of
65 a host name and it must be isolated from the remainder of the
66 host name. You cannot use the wildcard character in any other
67 location of the name or combined with the front part of the
68 name.
69
70 For example, ``*.foo.bar`` is supported, while ``*aa.foo.bar``
71 is not.
72
73 - Mirrors not in the host list are skipped and logged in debug.
74
75 - Attempts to access networks not in the host list cause a failure.
76
77 Using ``BB_ALLOWED_NETWORKS`` in conjunction with
78 :term:`PREMIRRORS` is very useful. Adding the
79 host you want to use to ``PREMIRRORS`` results in the source code
80 being fetched from an allowed location and avoids raising an error
81 when a host that is not allowed is in a
82 :term:`SRC_URI` statement. This is because the
83 fetcher does not attempt to use the host listed in ``SRC_URI`` after
84 a successful fetch from the ``PREMIRRORS`` occurs.
85
86 :term:`BB_CONSOLELOG`
87 Specifies the path to a log file into which BitBake's user interface
88 writes output during the build.
89
90 :term:`BB_CURRENTTASK`
91 Contains the name of the currently running task. The name does not
92 include the ``do_`` prefix.
93
94 :term:`BB_DANGLINGAPPENDS_WARNONLY`
95 Defines how BitBake handles situations where an append file
96 (``.bbappend``) has no corresponding recipe file (``.bb``). This
97 condition often occurs when layers get out of sync (e.g. ``oe-core``
98 bumps a recipe version and the old recipe no longer exists and the
99 other layer has not been updated to the new version of the recipe
100 yet).
101
102 The default fatal behavior is safest because it is the sane reaction
103 given something is out of sync. It is important to realize when your
104 changes are no longer being applied.
105
106 :term:`BB_DEFAULT_TASK`
107 The default task to use when none is specified (e.g. with the ``-c``
108 command line option). The task name specified should not include the
109 ``do_`` prefix.
110
111 :term:`BB_DISKMON_DIRS`
112 Monitors disk space and available inodes during the build and allows
113 you to control the build based on these parameters.
114
115 Disk space monitoring is disabled by default. When setting this
116 variable, use the following form: ::
117
118 BB_DISKMON_DIRS = "<action>,<dir>,<threshold> [...]"
119
120 where:
121
122 <action> is:
123 ABORT: Immediately abort the build when
124 a threshold is broken.
125 STOPTASKS: Stop the build after the currently
126 executing tasks have finished when
127 a threshold is broken.
128 WARN: Issue a warning but continue the
129 build when a threshold is broken.
130 Subsequent warnings are issued as
131 defined by the
132 BB_DISKMON_WARNINTERVAL variable,
133 which must be defined.
134
135 <dir> is:
136 Any directory you choose. You can specify one or
137 more directories to monitor by separating the
138 groupings with a space. If two directories are
139 on the same device, only the first directory
140 is monitored.
141
142 <threshold> is:
143 Either the minimum available disk space,
144 the minimum number of free inodes, or
145 both. You must specify at least one. To
146 omit one or the other, simply omit the value.
147 Specify the threshold using G, M, K for Gbytes,
148 Mbytes, and Kbytes, respectively. If you do
149 not specify G, M, or K, Kbytes is assumed by
150 default. Do not use GB, MB, or KB.
151
152 Here are some examples: ::
153
154 BB_DISKMON_DIRS = "ABORT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K"
155 BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G"
156 BB_DISKMON_DIRS = "ABORT,${TMPDIR},,100K"
157
158 The first example works only if you also set the
159 :term:`BB_DISKMON_WARNINTERVAL`
160 variable. This example causes the build system to immediately abort
161 when either the disk space in ``${TMPDIR}`` drops below 1 Gbyte or
162 the available free inodes drops below 100 Kbytes. Because two
163 directories are provided with the variable, the build system also
164 issues a warning when the disk space in the ``${SSTATE_DIR}``
165 directory drops below 1 Gbyte or the number of free inodes drops
166 below 100 Kbytes. Subsequent warnings are issued during intervals as
167 defined by the ``BB_DISKMON_WARNINTERVAL`` variable.
168
169 The second example stops the build after all currently executing
170 tasks complete when the minimum disk space in the ``${TMPDIR}``
171 directory drops below 1 Gbyte. No disk monitoring occurs for the free
172 inodes in this case.
173
174 The final example immediately aborts the build when the number of
175 free inodes in the ``${TMPDIR}`` directory drops below 100 Kbytes. No
176 disk space monitoring for the directory itself occurs in this case.
177
178 :term:`BB_DISKMON_WARNINTERVAL`
179 Defines the disk space and free inode warning intervals.
180
181 If you are going to use the ``BB_DISKMON_WARNINTERVAL`` variable, you
182 must also use the :term:`BB_DISKMON_DIRS`
183 variable and define its action as "WARN". During the build,
184 subsequent warnings are issued each time disk space or number of free
185 inodes further reduces by the respective interval.
186
187 If you do not provide a ``BB_DISKMON_WARNINTERVAL`` variable and you
188 do use ``BB_DISKMON_DIRS`` with the "WARN" action, the disk
189 monitoring interval defaults to the following:
190 BB_DISKMON_WARNINTERVAL = "50M,5K"
191
192 When specifying the variable in your configuration file, use the
193 following form: ::
194
195 BB_DISKMON_WARNINTERVAL = "<disk_space_interval>,<disk_inode_interval>"
196
197 where:
198
199 <disk_space_interval> is:
200 An interval of memory expressed in either
201 G, M, or K for Gbytes, Mbytes, or Kbytes,
202 respectively. You cannot use GB, MB, or KB.
203
204 <disk_inode_interval> is:
205 An interval of free inodes expressed in either
206 G, M, or K for Gbytes, Mbytes, or Kbytes,
207 respectively. You cannot use GB, MB, or KB.
208
209 Here is an example: ::
210
211 BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K"
212 BB_DISKMON_WARNINTERVAL = "50M,5K"
213
214 These variables cause BitBake to
215 issue subsequent warnings each time the available disk space further
216 reduces by 50 Mbytes or the number of free inodes further reduces by
217 5 Kbytes in the ``${SSTATE_DIR}`` directory. Subsequent warnings
218 based on the interval occur each time a respective interval is
219 reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes).
220
221 :term:`BB_ENV_WHITELIST`
222 Specifies the internal whitelist of variables to allow through from
223 the external environment into BitBake's datastore. If the value of
224 this variable is not specified (which is the default), the following
225 list is used: :term:`BBPATH`, :term:`BB_PRESERVE_ENV`,
226 :term:`BB_ENV_WHITELIST`, and :term:`BB_ENV_EXTRAWHITE`.
227
228 .. note::
229
230 You must set this variable in the external environment in order
231 for it to work.
232
233 :term:`BB_ENV_EXTRAWHITE`
234 Specifies an additional set of variables to allow through (whitelist)
235 from the external environment into BitBake's datastore. This list of
236 variables are on top of the internal list set in
237 :term:`BB_ENV_WHITELIST`.
238
239 .. note::
240
241 You must set this variable in the external environment in order
242 for it to work.
243
244 :term:`BB_FETCH_PREMIRRORONLY`
245 When set to "1", causes BitBake's fetcher module to only search
246 :term:`PREMIRRORS` for files. BitBake will not
247 search the main :term:`SRC_URI` or
248 :term:`MIRRORS`.
249
250 :term:`BB_FILENAME`
251 Contains the filename of the recipe that owns the currently running
252 task. For example, if the ``do_fetch`` task that resides in the
253 ``my-recipe.bb`` is executing, the ``BB_FILENAME`` variable contains
254 "/foo/path/my-recipe.bb".
255
256 :term:`BBFILES_DYNAMIC`
257 Activates content depending on presence of identified layers. You
258 identify the layers by the collections that the layers define.
259
260 Use the ``BBFILES_DYNAMIC`` variable to avoid ``.bbappend`` files whose
261 corresponding ``.bb`` file is in a layer that attempts to modify other
262 layers through ``.bbappend`` but does not want to introduce a hard
263 dependency on those other layers.
264
265 Additionally you can prefix the rule with "!" to add ``.bbappend`` and
266 ``.bb`` files in case a layer is not present. Use this avoid hard
267 dependency on those other layers.
268
269 Use the following form for ``BBFILES_DYNAMIC``: ::
270
271 collection_name:filename_pattern
272
273 The following example identifies two collection names and two filename
274 patterns: ::
275
276 BBFILES_DYNAMIC += "\
277 clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \
278 core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \
279 "
280
281 When the collection name is prefixed with "!" it will add the file pattern in case
282 the layer is absent: ::
283
284 BBFILES_DYNAMIC += "\
285 !clang-layer:${LAYERDIR}/backfill/meta-clang/*/*/*.bb \
286 "
287
288 This next example shows an error message that occurs because invalid
289 entries are found, which cause parsing to abort: ::
290
291 ERROR: BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not:
292 /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend
293 /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend
294
295 :term:`BB_GENERATE_MIRROR_TARBALLS`
296 Causes tarballs of the Git repositories, including the Git metadata,
297 to be placed in the :term:`DL_DIR` directory. Anyone
298 wishing to create a source mirror would want to enable this variable.
299
300 For performance reasons, creating and placing tarballs of the Git
301 repositories is not the default action by BitBake. ::
302
303 BB_GENERATE_MIRROR_TARBALLS = "1"
304
305 :term:`BB_HASHCONFIG_WHITELIST`
306 Lists variables that are excluded from base configuration checksum,
307 which is used to determine if the cache can be reused.
308
309 One of the ways BitBake determines whether to re-parse the main
310 metadata is through checksums of the variables in the datastore of
311 the base configuration data. There are variables that you typically
312 want to exclude when checking whether or not to re-parse and thus
313 rebuild the cache. As an example, you would usually exclude ``TIME``
314 and ``DATE`` because these variables are always changing. If you did
315 not exclude them, BitBake would never reuse the cache.
316
317 :term:`BB_HASHBASE_WHITELIST`
318 Lists variables that are excluded from checksum and dependency data.
319 Variables that are excluded can therefore change without affecting
320 the checksum mechanism. A common example would be the variable for
321 the path of the build. BitBake's output should not (and usually does
322 not) depend on the directory in which it was built.
323
324 :term:`BB_HASHCHECK_FUNCTION`
325 Specifies the name of the function to call during the "setscene" part
326 of the task's execution in order to validate the list of task hashes.
327 The function returns the list of setscene tasks that should be
328 executed.
329
330 At this point in the execution of the code, the objective is to
331 quickly verify if a given setscene function is likely to work or not.
332 It's easier to check the list of setscene functions in one pass than
333 to call many individual tasks. The returned list need not be
334 completely accurate. A given setscene task can still later fail.
335 However, the more accurate the data returned, the more efficient the
336 build will be.
337
338 :term:`BB_INVALIDCONF`
339 Used in combination with the ``ConfigParsed`` event to trigger
340 re-parsing the base metadata (i.e. all the recipes). The
341 ``ConfigParsed`` event can set the variable to trigger the re-parse.
342 You must be careful to avoid recursive loops with this functionality.
343
344 :term:`BB_LOGCONFIG`
345 Specifies the name of a config file that contains the user logging
346 configuration. See
347 :ref:`bitbake-user-manual/bitbake-user-manual-execution:logging`
348 for additional information
349
350 :term:`BB_LOGFMT`
351 Specifies the name of the log files saved into
352 ``${``\ :term:`T`\ ``}``. By default, the ``BB_LOGFMT``
353 variable is undefined and the log file names get created using the
354 following form: ::
355
356 log.{task}.{pid}
357
358 If you want to force log files to take a specific name, you can set this
359 variable in a configuration file.
360
361 :term:`BB_NICE_LEVEL`
362 Allows BitBake to run at a specific priority (i.e. nice level).
363 System permissions usually mean that BitBake can reduce its priority
364 but not raise it again. See :term:`BB_TASK_NICE_LEVEL` for
365 additional information.
366
367 :term:`BB_NO_NETWORK`
368 Disables network access in the BitBake fetcher modules. With this
369 access disabled, any command that attempts to access the network
370 becomes an error.
371
372 Disabling network access is useful for testing source mirrors,
373 running builds when not connected to the Internet, and when operating
374 in certain kinds of firewall environments.
375
376 :term:`BB_NUMBER_THREADS`
377 The maximum number of tasks BitBake should run in parallel at any one
378 time. If your host development system supports multiple cores, a good
379 rule of thumb is to set this variable to twice the number of cores.
380
381 :term:`BB_NUMBER_PARSE_THREADS`
382 Sets the number of threads BitBake uses when parsing. By default, the
383 number of threads is equal to the number of cores on the system.
384
385 :term:`BB_ORIGENV`
386 Contains a copy of the original external environment in which BitBake
387 was run. The copy is taken before any whitelisted variable values are
388 filtered into BitBake's datastore.
389
390 .. note::
391
392 The contents of this variable is a datastore object that can be
393 queried using the normal datastore operations.
394
395 :term:`BB_PRESERVE_ENV`
396 Disables whitelisting and instead allows all variables through from
397 the external environment into BitBake's datastore.
398
399 .. note::
400
401 You must set this variable in the external environment in order
402 for it to work.
403
404 :term:`BB_RUNFMT`
405 Specifies the name of the executable script files (i.e. run files)
406 saved into ``${``\ :term:`T`\ ``}``. By default, the
407 ``BB_RUNFMT`` variable is undefined and the run file names get
408 created using the following form: ::
409
410 run.{task}.{pid}
411
412 If you want to force run files to take a specific name, you can set this
413 variable in a configuration file.
414
415 :term:`BB_RUNTASK`
416 Contains the name of the currently executing task. The value includes
417 the "do\_" prefix. For example, if the currently executing task is
418 ``do_config``, the value is "do_config".
419
420 :term:`BB_SCHEDULER`
421 Selects the name of the scheduler to use for the scheduling of
422 BitBake tasks. Three options exist:
423
424 - *basic* - The basic framework from which everything derives. Using
425 this option causes tasks to be ordered numerically as they are
426 parsed.
427
428 - *speed* - Executes tasks first that have more tasks depending on
429 them. The "speed" option is the default.
430
431 - *completion* - Causes the scheduler to try to complete a given
432 recipe once its build has started.
433
434 :term:`BB_SCHEDULERS`
435 Defines custom schedulers to import. Custom schedulers need to be
436 derived from the ``RunQueueScheduler`` class.
437
438 For information how to select a scheduler, see the
439 :term:`BB_SCHEDULER` variable.
440
441 :term:`BB_SETSCENE_DEPVALID`
442 Specifies a function BitBake calls that determines whether BitBake
443 requires a setscene dependency to be met.
444
445 When running a setscene task, BitBake needs to know which
446 dependencies of that setscene task also need to be run. Whether
447 dependencies also need to be run is highly dependent on the metadata.
448 The function specified by this variable returns a "True" or "False"
449 depending on whether the dependency needs to be met.
450
451 :term:`BB_SETSCENE_VERIFY_FUNCTION2`
452 Specifies a function to call that verifies the list of planned task
453 execution before the main task execution happens. The function is
454 called once BitBake has a list of setscene tasks that have run and
455 either succeeded or failed.
456
457 The function allows for a task list check to see if they make sense.
458 Even if BitBake was planning to skip a task, the returned value of
459 the function can force BitBake to run the task, which is necessary
460 under certain metadata defined circumstances.
461
462 :term:`BB_SIGNATURE_EXCLUDE_FLAGS`
463 Lists variable flags (varflags) that can be safely excluded from
464 checksum and dependency data for keys in the datastore. When
465 generating checksum or dependency data for keys in the datastore, the
466 flags set against that key are normally included in the checksum.
467
468 For more information on varflags, see the
469 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`"
470 section.
471
472 :term:`BB_SIGNATURE_HANDLER`
473 Defines the name of the signature handler BitBake uses. The signature
474 handler defines the way stamp files are created and handled, if and
475 how the signature is incorporated into the stamps, and how the
476 signature itself is generated.
477
478 A new signature handler can be added by injecting a class derived
479 from the ``SignatureGenerator`` class into the global namespace.
480
481 :term:`BB_SRCREV_POLICY`
482 Defines the behavior of the fetcher when it interacts with source
483 control systems and dynamic source revisions. The
484 ``BB_SRCREV_POLICY`` variable is useful when working without a
485 network.
486
487 The variable can be set using one of two policies:
488
489 - *cache* - Retains the value the system obtained previously rather
490 than querying the source control system each time.
491
492 - *clear* - Queries the source controls system every time. With this
493 policy, there is no cache. The "clear" policy is the default.
494
495 :term:`BB_STAMP_POLICY`
496 Defines the mode used for how timestamps of stamp files are compared.
497 You can set the variable to one of the following modes:
498
499 - *perfile* - Timestamp comparisons are only made between timestamps
500 of a specific recipe. This is the default mode.
501
502 - *full* - Timestamp comparisons are made for all dependencies.
503
504 - *whitelist* - Identical to "full" mode except timestamp
505 comparisons are made for recipes listed in the
506 :term:`BB_STAMP_WHITELIST` variable.
507
508 .. note::
509
510 Stamp policies are largely obsolete with the introduction of
511 setscene tasks.
512
513 :term:`BB_STAMP_WHITELIST`
514 Lists files whose stamp file timestamps are compared when the stamp
515 policy mode is set to "whitelist". For information on stamp policies,
516 see the :term:`BB_STAMP_POLICY` variable.
517
518 :term:`BB_STRICT_CHECKSUM`
519 Sets a more strict checksum mechanism for non-local URLs. Setting
520 this variable to a value causes BitBake to report an error if it
521 encounters a non-local URL that does not have at least one checksum
522 specified.
523
524 :term:`BB_TASK_IONICE_LEVEL`
525 Allows adjustment of a task's Input/Output priority. During
526 Autobuilder testing, random failures can occur for tasks due to I/O
527 starvation. These failures occur during various QEMU runtime
528 timeouts. You can use the ``BB_TASK_IONICE_LEVEL`` variable to adjust
529 the I/O priority of these tasks.
530
531 .. note::
532
533 This variable works similarly to the :term:`BB_TASK_NICE_LEVEL`
534 variable except with a task's I/O priorities.
535
536 Set the variable as follows: ::
537
538 BB_TASK_IONICE_LEVEL = "class.prio"
539
540 For *class*, the default value is "2", which is a best effort. You can use
541 "1" for realtime and "3" for idle. If you want to use realtime, you
542 must have superuser privileges.
543
544 For *prio*, you can use any value from "0", which is the highest
545 priority, to "7", which is the lowest. The default value is "4". You
546 do not need any special privileges to use this range of priority
547 values.
548
549 .. note::
550
551 In order for your I/O priority settings to take effect, you need the
552 Completely Fair Queuing (CFQ) Scheduler selected for the backing block
553 device. To select the scheduler, use the following command form where
554 device is the device (e.g. sda, sdb, and so forth): ::
555
556 $ sudo sh -c "echo cfq > /sys/block/device/queu/scheduler"
557
558 :term:`BB_TASK_NICE_LEVEL`
559 Allows specific tasks to change their priority (i.e. nice level).
560
561 You can use this variable in combination with task overrides to raise
562 or lower priorities of specific tasks. For example, on the `Yocto
563 Project <http://www.yoctoproject.org>`__ autobuilder, QEMU emulation
564 in images is given a higher priority as compared to build tasks to
565 ensure that images do not suffer timeouts on loaded systems.
566
567 :term:`BB_TASKHASH`
568 Within an executing task, this variable holds the hash of the task as
569 returned by the currently enabled signature generator.
570
571 :term:`BB_VERBOSE_LOGS`
572 Controls how verbose BitBake is during builds. If set, shell scripts
573 echo commands and shell script output appears on standard out
574 (stdout).
575
576 :term:`BB_WORKERCONTEXT`
577 Specifies if the current context is executing a task. BitBake sets
578 this variable to "1" when a task is being executed. The value is not
579 set when the task is in server context during parsing or event
580 handling.
581
582 :term:`BBCLASSEXTEND`
583 Allows you to extend a recipe so that it builds variants of the
584 software. Some examples of these variants for recipes from the
585 OpenEmbedded-Core metadata are "natives" such as ``quilt-native``,
586 which is a copy of Quilt built to run on the build system; "crosses"
587 such as ``gcc-cross``, which is a compiler built to run on the build
588 machine but produces binaries that run on the target ``MACHINE``;
589 "nativesdk", which targets the SDK machine instead of ``MACHINE``;
590 and "mulitlibs" in the form "``multilib:``\ multilib_name".
591
592 To build a different variant of the recipe with a minimal amount of
593 code, it usually is as simple as adding the variable to your recipe.
594 Here are two examples. The "native" variants are from the
595 OpenEmbedded-Core metadata: ::
596
597 BBCLASSEXTEND =+ "native nativesdk"
598 BBCLASSEXTEND =+ "multilib:multilib_name"
599
600 .. note::
601
602 Internally, the ``BBCLASSEXTEND`` mechanism generates recipe
603 variants by rewriting variable values and applying overrides such
604 as ``_class-native``. For example, to generate a native version of
605 a recipe, a :term:`DEPENDS` on "foo" is
606 rewritten to a ``DEPENDS`` on "foo-native".
607
608 Even when using ``BBCLASSEXTEND``, the recipe is only parsed once.
609 Parsing once adds some limitations. For example, it is not
610 possible to include a different file depending on the variant,
611 since ``include`` statements are processed when the recipe is
612 parsed.
613
614 :term:`BBDEBUG`
615 Sets the BitBake debug output level to a specific value as
616 incremented by the ``-D`` command line option.
617
618 .. note::
619
620 You must set this variable in the external environment in order
621 for it to work.
622
623 :term:`BBFILE_COLLECTIONS`
624 Lists the names of configured layers. These names are used to find
625 the other ``BBFILE_*`` variables. Typically, each layer appends its
626 name to this variable in its ``conf/layer.conf`` file.
627
628 :term:`BBFILE_PATTERN`
629 Variable that expands to match files from
630 :term:`BBFILES` in a particular layer. This
631 variable is used in the ``conf/layer.conf`` file and must be suffixed
632 with the name of the specific layer (e.g.
633 ``BBFILE_PATTERN_emenlow``).
634
635 :term:`BBFILE_PRIORITY`
636 Assigns the priority for recipe files in each layer.
637
638 This variable is useful in situations where the same recipe appears
639 in more than one layer. Setting this variable allows you to
640 prioritize a layer against other layers that contain the same recipe
641 - effectively letting you control the precedence for the multiple
642 layers. The precedence established through this variable stands
643 regardless of a recipe's version (:term:`PV` variable).
644 For example, a layer that has a recipe with a higher ``PV`` value but
645 for which the ``BBFILE_PRIORITY`` is set to have a lower precedence
646 still has a lower precedence.
647
648 A larger value for the ``BBFILE_PRIORITY`` variable results in a
649 higher precedence. For example, the value 6 has a higher precedence
650 than the value 5. If not specified, the ``BBFILE_PRIORITY`` variable
651 is set based on layer dependencies (see the ``LAYERDEPENDS`` variable
652 for more information. The default priority, if unspecified for a
653 layer with no dependencies, is the lowest defined priority + 1 (or 1
654 if no priorities are defined).
655
656 .. tip::
657
658 You can use the command bitbake-layers show-layers to list all
659 configured layers along with their priorities.
660
661 :term:`BBFILES`
662 A space-separated list of recipe files BitBake uses to build
663 software.
664
665 When specifying recipe files, you can pattern match using Python's
666 `glob <https://docs.python.org/3/library/glob.html>`_ syntax.
667 For details on the syntax, see the documentation by following the
668 previous link.
669
670 :term:`BBINCLUDED`
671 Contains a space-separated list of all of all files that BitBake's
672 parser included during parsing of the current file.
673
674 :term:`BBINCLUDELOGS`
675 If set to a value, enables printing the task log when reporting a
676 failed task.
677
678 :term:`BBINCLUDELOGS_LINES`
679 If :term:`BBINCLUDELOGS` is set, specifies
680 the maximum number of lines from the task log file to print when
681 reporting a failed task. If you do not set ``BBINCLUDELOGS_LINES``,
682 the entire log is printed.
683
684 :term:`BBLAYERS`
685 Lists the layers to enable during the build. This variable is defined
686 in the ``bblayers.conf`` configuration file in the build directory.
687 Here is an example: ::
688
689 BBLAYERS = " \
690 /home/scottrif/poky/meta \
691 /home/scottrif/poky/meta-yocto \
692 /home/scottrif/poky/meta-yocto-bsp \
693 /home/scottrif/poky/meta-mykernel \
694 "
695
696 This example enables four layers, one of which is a custom, user-defined
697 layer named ``meta-mykernel``.
698
699 :term:`BBLAYERS_FETCH_DIR`
700 Sets the base location where layers are stored. This setting is used
701 in conjunction with ``bitbake-layers layerindex-fetch`` and tells
702 ``bitbake-layers`` where to place the fetched layers.
703
704 :term:`BBMASK`
705 Prevents BitBake from processing recipes and recipe append files.
706
707 You can use the ``BBMASK`` variable to "hide" these ``.bb`` and
708 ``.bbappend`` files. BitBake ignores any recipe or recipe append
709 files that match any of the expressions. It is as if BitBake does not
710 see them at all. Consequently, matching files are not parsed or
711 otherwise used by BitBake.
712
713 The values you provide are passed to Python's regular expression
714 compiler. Consequently, the syntax follows Python's Regular
715 Expression (re) syntax. The expressions are compared against the full
716 paths to the files. For complete syntax information, see Python's
717 documentation at http://docs.python.org/3/library/re.html.
718
719 The following example uses a complete regular expression to tell
720 BitBake to ignore all recipe and recipe append files in the
721 ``meta-ti/recipes-misc/`` directory: ::
722
723 BBMASK = "meta-ti/recipes-misc/"
724
725 If you want to mask out multiple directories or recipes, you can
726 specify multiple regular expression fragments. This next example
727 masks out multiple directories and individual recipes: ::
728
729 BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/"
730 BBMASK += "/meta-oe/recipes-support/"
731 BBMASK += "/meta-foo/.*/openldap"
732 BBMASK += "opencv.*\.bbappend"
733 BBMASK += "lzma"
734
735 .. note::
736
737 When specifying a directory name, use the trailing slash character
738 to ensure you match just that directory name.
739
740 :term:`BBMULTICONFIG`
741 Enables BitBake to perform multiple configuration builds and lists
742 each separate configuration (multiconfig). You can use this variable
743 to cause BitBake to build multiple targets where each target has a
744 separate configuration. Define ``BBMULTICONFIG`` in your
745 ``conf/local.conf`` configuration file.
746
747 As an example, the following line specifies three multiconfigs, each
748 having a separate configuration file: ::
749
750 BBMULTIFONFIG = "configA configB configC"
751
752 Each configuration file you use must reside in the
753 build directory within a directory named ``conf/multiconfig`` (e.g.
754 build_directory\ ``/conf/multiconfig/configA.conf``).
755
756 For information on how to use ``BBMULTICONFIG`` in an environment
757 that supports building targets with multiple configurations, see the
758 ":ref:`bitbake-user-manual/bitbake-user-manual-intro:executing a multiple configuration build`"
759 section.
760
761 :term:`BBPATH`
762 Used by BitBake to locate class (``.bbclass``) and configuration
763 (``.conf``) files. This variable is analogous to the ``PATH``
764 variable.
765
766 If you run BitBake from a directory outside of the build directory,
767 you must be sure to set ``BBPATH`` to point to the build directory.
768 Set the variable as you would any environment variable and then run
769 BitBake: ::
770
771 $ BBPATH="build_directory"
772 $ export BBPATH
773 $ bitbake target
774
775 :term:`BBSERVER`
776 Points to the server that runs memory-resident BitBake. The variable
777 is only used when you employ memory-resident BitBake.
778
779 :term:`BBTARGETS`
780 Allows you to use a configuration file to add to the list of
781 command-line target recipes you want to build.
782
783 :term:`BBVERSIONS`
784 Allows a single recipe to build multiple versions of a project from a
785 single recipe file. You also able to specify conditional metadata
786 using the :term:`OVERRIDES` mechanism for a
787 single version or for an optionally named range of versions.
788
789 For more information on ``BBVERSIONS``, see the
790 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variants - class extension mechanism`"
791 section.
792
793 :term:`BITBAKE_UI`
794 Used to specify the UI module to use when running BitBake. Using this
795 variable is equivalent to using the ``-u`` command-line option.
796
797 .. note::
798
799 You must set this variable in the external environment in order
800 for it to work.
801
802 :term:`BUILDNAME`
803 A name assigned to the build. The name defaults to a datetime stamp
804 of when the build was started but can be defined by the metadata.
805
806 :term:`BZRDIR`
807 The directory in which files checked out of a Bazaar system are
808 stored.
809
810 :term:`CACHE`
811 Specifies the directory BitBake uses to store a cache of the metadata
812 so it does not need to be parsed every time BitBake is started.
813
814 :term:`CVSDIR`
815 The directory in which files checked out under the CVS system are
816 stored.
817
818 :term:`DEFAULT_PREFERENCE`
819 Specifies a weak bias for recipe selection priority.
820
821 The most common usage of this is variable is to set it to "-1" within
822 a recipe for a development version of a piece of software. Using the
823 variable in this way causes the stable version of the recipe to build
824 by default in the absence of ``PREFERRED_VERSION`` being used to
825 build the development version.
826
827 .. note::
828
829 The bias provided by DEFAULT_PREFERENCE is weak and is overridden by
830 :term:`BBFILE_PRIORITY` if that variable is different between two
831 layers that contain different versions of the same recipe.
832
833 :term:`DEPENDS`
834 Lists a recipe's build-time dependencies (i.e. other recipe files).
835
836 Consider this simple example for two recipes named "a" and "b" that
837 produce similarly named packages. In this example, the ``DEPENDS``
838 statement appears in the "a" recipe: ::
839
840 DEPENDS = "b"
841
842 Here, the dependency is such that the ``do_configure`` task for recipe "a"
843 depends on the ``do_populate_sysroot`` task of recipe "b". This means
844 anything that recipe "b" puts into sysroot is available when recipe "a" is
845 configuring itself.
846
847 For information on runtime dependencies, see the :term:`RDEPENDS`
848 variable.
849
850 :term:`DESCRIPTION`
851 A long description for the recipe.
852
853 :term:`DL_DIR`
854 The central download directory used by the build process to store
855 downloads. By default, ``DL_DIR`` gets files suitable for mirroring for
856 everything except Git repositories. If you want tarballs of Git
857 repositories, use the :term:`BB_GENERATE_MIRROR_TARBALLS` variable.
858
859 :term:`EXCLUDE_FROM_WORLD`
860 Directs BitBake to exclude a recipe from world builds (i.e.
861 ``bitbake world``). During world builds, BitBake locates, parses and
862 builds all recipes found in every layer exposed in the
863 ``bblayers.conf`` configuration file.
864
865 To exclude a recipe from a world build using this variable, set the
866 variable to "1" in the recipe.
867
868 .. note::
869
870 Recipes added to ``EXCLUDE_FROM_WORLD`` may still be built during a world
871 build in order to satisfy dependencies of other recipes. Adding a
872 recipe to ``EXCLUDE_FROM_WORLD`` only ensures that the recipe is not
873 explicitly added to the list of build targets in a world build.
874
875 :term:`FAKEROOT`
876 Contains the command to use when running a shell script in a fakeroot
877 environment. The ``FAKEROOT`` variable is obsolete and has been
878 replaced by the other ``FAKEROOT*`` variables. See these entries in
879 the glossary for more information.
880
881 :term:`FAKEROOTBASEENV`
882 Lists environment variables to set when executing the command defined
883 by :term:`FAKEROOTCMD` that starts the
884 bitbake-worker process in the fakeroot environment.
885
886 :term:`FAKEROOTCMD`
887 Contains the command that starts the bitbake-worker process in the
888 fakeroot environment.
889
890 :term:`FAKEROOTDIRS`
891 Lists directories to create before running a task in the fakeroot
892 environment.
893
894 :term:`FAKEROOTENV`
895 Lists environment variables to set when running a task in the
896 fakeroot environment. For additional information on environment
897 variables and the fakeroot environment, see the
898 :term:`FAKEROOTBASEENV` variable.
899
900 :term:`FAKEROOTNOENV`
901 Lists environment variables to set when running a task that is not in
902 the fakeroot environment. For additional information on environment
903 variables and the fakeroot environment, see the
904 :term:`FAKEROOTENV` variable.
905
906 :term:`FETCHCMD`
907 Defines the command the BitBake fetcher module executes when running
908 fetch operations. You need to use an override suffix when you use the
909 variable (e.g. ``FETCHCMD_git`` or ``FETCHCMD_svn``).
910
911 :term:`FILE`
912 Points at the current file. BitBake sets this variable during the
913 parsing process to identify the file being parsed. BitBake also sets
914 this variable when a recipe is being executed to identify the recipe
915 file.
916
917 :term:`FILESPATH`
918 Specifies directories BitBake uses when searching for patches and
919 files. The "local" fetcher module uses these directories when
920 handling ``file://`` URLs. The variable behaves like a shell ``PATH``
921 environment variable. The value is a colon-separated list of
922 directories that are searched left-to-right in order.
923
924 :term:`GITDIR`
925 The directory in which a local copy of a Git repository is stored
926 when it is cloned.
927
928 :term:`HGDIR`
929 The directory in which files checked out of a Mercurial system are
930 stored.
931
932 :term:`HOMEPAGE`
933 Website where more information about the software the recipe is
934 building can be found.
935
936 :term:`INHERIT`
937 Causes the named class or classes to be inherited globally. Anonymous
938 functions in the class or classes are not executed for the base
939 configuration and in each individual recipe. The OpenEmbedded build
940 system ignores changes to ``INHERIT`` in individual recipes.
941
942 For more information on ``INHERIT``, see the
943 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` configuration directive`"
944 section.
945
946 :term:`LAYERDEPENDS`
947 Lists the layers, separated by spaces, upon which this recipe
948 depends. Optionally, you can specify a specific layer version for a
949 dependency by adding it to the end of the layer name with a colon,
950 (e.g. "anotherlayer:3" to be compared against
951 :term:`LAYERVERSION`\ ``_anotherlayer`` in
952 this case). BitBake produces an error if any dependency is missing or
953 the version numbers do not match exactly (if specified).
954
955 You use this variable in the ``conf/layer.conf`` file. You must also
956 use the specific layer name as a suffix to the variable (e.g.
957 ``LAYERDEPENDS_mylayer``).
958
959 :term:`LAYERDIR`
960 When used inside the ``layer.conf`` configuration file, this variable
961 provides the path of the current layer. This variable is not
962 available outside of ``layer.conf`` and references are expanded
963 immediately when parsing of the file completes.
964
965 :term:`LAYERDIR_RE`
966 When used inside the ``layer.conf`` configuration file, this variable
967 provides the path of the current layer, escaped for use in a regular
968 expression (:term:`BBFILE_PATTERN`). This
969 variable is not available outside of ``layer.conf`` and references
970 are expanded immediately when parsing of the file completes.
971
972 :term:`LAYERVERSION`
973 Optionally specifies the version of a layer as a single number. You
974 can use this variable within
975 :term:`LAYERDEPENDS` for another layer in
976 order to depend on a specific version of the layer.
977
978 You use this variable in the ``conf/layer.conf`` file. You must also
979 use the specific layer name as a suffix to the variable (e.g.
980 ``LAYERDEPENDS_mylayer``).
981
982 :term:`LICENSE`
983 The list of source licenses for the recipe.
984
985 :term:`MIRRORS`
986 Specifies additional paths from which BitBake gets source code. When
987 the build system searches for source code, it first tries the local
988 download directory. If that location fails, the build system tries
989 locations defined by :term:`PREMIRRORS`, the
990 upstream source, and then locations specified by ``MIRRORS`` in that
991 order.
992
993 :term:`MULTI_PROVIDER_WHITELIST`
994 Allows you to suppress BitBake warnings caused when building two
995 separate recipes that provide the same output.
996
997 BitBake normally issues a warning when building two different recipes
998 where each provides the same output. This scenario is usually
999 something the user does not want. However, cases do exist where it
1000 makes sense, particularly in the ``virtual/*`` namespace. You can use
1001 this variable to suppress BitBake's warnings.
1002
1003 To use the variable, list provider names (e.g. recipe names,
1004 ``virtual/kernel``, and so forth).
1005
1006 :term:`OVERRIDES`
1007 BitBake uses ``OVERRIDES`` to control what variables are overridden
1008 after BitBake parses recipes and configuration files.
1009
1010 Following is a simple example that uses an overrides list based on
1011 machine architectures: OVERRIDES = "arm:x86:mips:powerpc" You can
1012 find information on how to use ``OVERRIDES`` in the
1013 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax
1014 (overrides)`" section.
1015
1016 :term:`P4DIR`
1017 The directory in which a local copy of a Perforce depot is stored
1018 when it is fetched.
1019
1020 :term:`PACKAGES`
1021 The list of packages the recipe creates.
1022
1023 :term:`PACKAGES_DYNAMIC`
1024 A promise that your recipe satisfies runtime dependencies for
1025 optional modules that are found in other recipes.
1026 ``PACKAGES_DYNAMIC`` does not actually satisfy the dependencies, it
1027 only states that they should be satisfied. For example, if a hard,
1028 runtime dependency (:term:`RDEPENDS`) of another
1029 package is satisfied during the build through the
1030 ``PACKAGES_DYNAMIC`` variable, but a package with the module name is
1031 never actually produced, then the other package will be broken.
1032
1033 :term:`PE`
1034 The epoch of the recipe. By default, this variable is unset. The
1035 variable is used to make upgrades possible when the versioning scheme
1036 changes in some backwards incompatible way.
1037
1038 :term:`PERSISTENT_DIR`
1039 Specifies the directory BitBake uses to store data that should be
1040 preserved between builds. In particular, the data stored is the data
1041 that uses BitBake's persistent data API and the data used by the PR
1042 Server and PR Service.
1043
1044 :term:`PF`
1045 Specifies the recipe or package name and includes all version and
1046 revision numbers (i.e. ``eglibc-2.13-r20+svnr15508/`` and
1047 ``bash-4.2-r1/``).
1048
1049 :term:`PN`
1050 The recipe name.
1051
1052 :term:`PR`
1053 The revision of the recipe.
1054
1055 :term:`PREFERRED_PROVIDER`
1056 Determines which recipe should be given preference when multiple
1057 recipes provide the same item. You should always suffix the variable
1058 with the name of the provided item, and you should set it to the
1059 :term:`PN` of the recipe to which you want to give
1060 precedence. Some examples: ::
1061
1062 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1063 PREFERRED_PROVIDER_virtual/xserver = "xserver-xf86"
1064 PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
1065
1066 :term:`PREFERRED_PROVIDERS`
1067 Determines which recipe should be given preference for cases where
1068 multiple recipes provide the same item. Functionally,
1069 ``PREFERRED_PROVIDERS`` is identical to
1070 :term:`PREFERRED_PROVIDER`. However, the ``PREFERRED_PROVIDERS`` variable
1071 lets you define preferences for multiple situations using the following
1072 form: ::
1073
1074 PREFERRED_PROVIDERS = "xxx:yyy aaa:bbb ..."
1075
1076 This form is a convenient replacement for the following: ::
1077
1078 PREFERRED_PROVIDER_xxx = "yyy"
1079 PREFERRED_PROVIDER_aaa = "bbb"
1080
1081 :term:`PREFERRED_VERSION`
1082 If there are multiple versions of recipes available, this variable
1083 determines which recipe should be given preference. You must always
1084 suffix the variable with the :term:`PN` you want to
1085 select, and you should set :term:`PV` accordingly for
1086 precedence.
1087
1088 The ``PREFERRED_VERSION`` variable supports limited wildcard use
1089 through the "``%``" character. You can use the character to match any
1090 number of characters, which can be useful when specifying versions
1091 that contain long revision numbers that potentially change. Here are
1092 two examples: ::
1093
1094 PREFERRED_VERSION_python = "2.7.3"
1095 PREFERRED_VERSION_linux-yocto = "4.12%"
1096
1097 .. important::
1098
1099 The use of the " % " character is limited in that it only works at the
1100 end of the string. You cannot use the wildcard character in any other
1101 location of the string.
1102
1103 :term:`PREMIRRORS`
1104 Specifies additional paths from which BitBake gets source code. When
1105 the build system searches for source code, it first tries the local
1106 download directory. If that location fails, the build system tries
1107 locations defined by ``PREMIRRORS``, the upstream source, and then
1108 locations specified by :term:`MIRRORS` in that order.
1109
1110 Typically, you would add a specific server for the build system to
1111 attempt before any others by adding something like the following to
1112 your configuration: ::
1113
1114 PREMIRRORS_prepend = "\
1115 git://.*/.* http://www.yoctoproject.org/sources/ \n \
1116 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
1117 http://.*/.* http://www.yoctoproject.org/sources/ \n \
1118 https://.*/.* http://www.yoctoproject.org/sources/ \n"
1119
1120 These changes cause the build system to intercept Git, FTP, HTTP, and
1121 HTTPS requests and direct them to the ``http://`` sources mirror. You can
1122 use ``file://`` URLs to point to local directories or network shares as
1123 well.
1124
1125 :term:`PROVIDES`
1126 A list of aliases by which a particular recipe can be known. By
1127 default, a recipe's own ``PN`` is implicitly already in its
1128 ``PROVIDES`` list. If a recipe uses ``PROVIDES``, the additional
1129 aliases are synonyms for the recipe and can be useful satisfying
1130 dependencies of other recipes during the build as specified by
1131 ``DEPENDS``.
1132
1133 Consider the following example ``PROVIDES`` statement from a recipe
1134 file ``libav_0.8.11.bb``: ::
1135
1136 PROVIDES += "libpostproc"
1137
1138 The ``PROVIDES`` statement results in the "libav" recipe also being known
1139 as "libpostproc".
1140
1141 In addition to providing recipes under alternate names, the
1142 ``PROVIDES`` mechanism is also used to implement virtual targets. A
1143 virtual target is a name that corresponds to some particular
1144 functionality (e.g. a Linux kernel). Recipes that provide the
1145 functionality in question list the virtual target in ``PROVIDES``.
1146 Recipes that depend on the functionality in question can include the
1147 virtual target in :term:`DEPENDS` to leave the
1148 choice of provider open.
1149
1150 Conventionally, virtual targets have names on the form
1151 "virtual/function" (e.g. "virtual/kernel"). The slash is simply part
1152 of the name and has no syntactical significance.
1153
1154 :term:`PRSERV_HOST`
1155 The network based :term:`PR` service host and port.
1156
1157 Following is an example of how the ``PRSERV_HOST`` variable is set: ::
1158
1159 PRSERV_HOST = "localhost:0"
1160
1161 You must set the variable if you want to automatically start a local PR
1162 service. You can set ``PRSERV_HOST`` to other values to use a remote PR
1163 service.
1164
1165 :term:`PV`
1166 The version of the recipe.
1167
1168 :term:`RDEPENDS`
1169 Lists a package's runtime dependencies (i.e. other packages) that
1170 must be installed in order for the built package to run correctly. If
1171 a package in this list cannot be found during the build, you will get
1172 a build error.
1173
1174 Because the ``RDEPENDS`` variable applies to packages being built,
1175 you should always use the variable in a form with an attached package
1176 name. For example, suppose you are building a development package
1177 that depends on the ``perl`` package. In this case, you would use the
1178 following ``RDEPENDS`` statement: ::
1179
1180 RDEPENDS_${PN}-dev += "perl"
1181
1182 In the example, the development package depends on the ``perl`` package.
1183 Thus, the ``RDEPENDS`` variable has the ``${PN}-dev`` package name as part
1184 of the variable.
1185
1186 BitBake supports specifying versioned dependencies. Although the
1187 syntax varies depending on the packaging format, BitBake hides these
1188 differences from you. Here is the general syntax to specify versions
1189 with the ``RDEPENDS`` variable: ::
1190
1191 RDEPENDS_${PN} = "package (operator version)"
1192
1193 For ``operator``, you can specify the following: ::
1194
1195 =
1196 <
1197 >
1198 <=
1199 >=
1200
1201 For example, the following sets up a dependency on version 1.2 or
1202 greater of the package ``foo``: ::
1203
1204 RDEPENDS_${PN} = "foo (>= 1.2)"
1205
1206 For information on build-time dependencies, see the :term:`DEPENDS`
1207 variable.
1208
1209 :term:`REPODIR`
1210 The directory in which a local copy of a ``google-repo`` directory is
1211 stored when it is synced.
1212
1213 :term:`RPROVIDES`
1214 A list of package name aliases that a package also provides. These
1215 aliases are useful for satisfying runtime dependencies of other
1216 packages both during the build and on the target (as specified by
1217 ``RDEPENDS``).
1218
1219 As with all package-controlling variables, you must always use the
1220 variable in conjunction with a package name override. Here is an
1221 example: ::
1222
1223 RPROVIDES_${PN} = "widget-abi-2"
1224
1225 :term:`RRECOMMENDS`
1226 A list of packages that extends the usability of a package being
1227 built. The package being built does not depend on this list of
1228 packages in order to successfully build, but needs them for the
1229 extended usability. To specify runtime dependencies for packages, see
1230 the ``RDEPENDS`` variable.
1231
1232 BitBake supports specifying versioned recommends. Although the syntax
1233 varies depending on the packaging format, BitBake hides these
1234 differences from you. Here is the general syntax to specify versions
1235 with the ``RRECOMMENDS`` variable: ::
1236
1237 RRECOMMENDS_${PN} = "package (operator version)"
1238
1239 For ``operator``, you can specify the following: ::
1240
1241 =
1242 <
1243 >
1244 <=
1245 >=
1246
1247 For example, the following sets up a recommend on version
1248 1.2 or greater of the package ``foo``: ::
1249
1250 RRECOMMENDS_${PN} = "foo (>= 1.2)"
1251
1252 :term:`SECTION`
1253 The section in which packages should be categorized.
1254
1255 :term:`SRC_URI`
1256 The list of source files - local or remote. This variable tells
1257 BitBake which bits to pull for the build and how to pull them. For
1258 example, if the recipe or append file needs to fetch a single tarball
1259 from the Internet, the recipe or append file uses a ``SRC_URI`` entry
1260 that specifies that tarball. On the other hand, if the recipe or
1261 append file needs to fetch a tarball and include a custom file, the
1262 recipe or append file needs an ``SRC_URI`` variable that specifies
1263 all those sources.
1264
1265 The following list explains the available URI protocols:
1266
1267 - ``file://`` : Fetches files, which are usually files shipped
1268 with the metadata, from the local machine. The path is relative to
1269 the :term:`FILESPATH` variable.
1270
1271 - ``bzr://`` : Fetches files from a Bazaar revision control
1272 repository.
1273
1274 - ``git://`` : Fetches files from a Git revision control
1275 repository.
1276
1277 - ``osc://`` : Fetches files from an OSC (OpenSUSE Build service)
1278 revision control repository.
1279
1280 - ``repo://`` : Fetches files from a repo (Git) repository.
1281
1282 - ``http://`` : Fetches files from the Internet using HTTP.
1283
1284 - ``https://`` : Fetches files from the Internet using HTTPS.
1285
1286 - ``ftp://`` : Fetches files from the Internet using FTP.
1287
1288 - ``cvs://`` : Fetches files from a CVS revision control
1289 repository.
1290
1291 - ``hg://`` : Fetches files from a Mercurial (``hg``) revision
1292 control repository.
1293
1294 - ``p4://`` : Fetches files from a Perforce (``p4``) revision
1295 control repository.
1296
1297 - ``ssh://`` : Fetches files from a secure shell.
1298
1299 - ``svn://`` : Fetches files from a Subversion (``svn``) revision
1300 control repository.
1301
1302 Here are some additional options worth mentioning:
1303
1304 - ``unpack`` : Controls whether or not to unpack the file if it is
1305 an archive. The default action is to unpack the file.
1306
1307 - ``subdir`` : Places the file (or extracts its contents) into the
1308 specified subdirectory. This option is useful for unusual tarballs
1309 or other archives that do not have their files already in a
1310 subdirectory within the archive.
1311
1312 - ``name`` : Specifies a name to be used for association with
1313 ``SRC_URI`` checksums when you have more than one file specified
1314 in ``SRC_URI``.
1315
1316 - ``downloadfilename`` : Specifies the filename used when storing
1317 the downloaded file.
1318
1319 :term:`SRCDATE`
1320 The date of the source code used to build the package. This variable
1321 applies only if the source was fetched from a Source Code Manager
1322 (SCM).
1323
1324 :term:`SRCREV`
1325 The revision of the source code used to build the package. This
1326 variable applies only when using Subversion, Git, Mercurial and
1327 Bazaar. If you want to build a fixed revision and you want to avoid
1328 performing a query on the remote repository every time BitBake parses
1329 your recipe, you should specify a ``SRCREV`` that is a full revision
1330 identifier and not just a tag.
1331
1332 :term:`SRCREV_FORMAT`
1333 Helps construct valid :term:`SRCREV` values when
1334 multiple source controlled URLs are used in
1335 :term:`SRC_URI`.
1336
1337 The system needs help constructing these values under these
1338 circumstances. Each component in the ``SRC_URI`` is assigned a name
1339 and these are referenced in the ``SRCREV_FORMAT`` variable. Consider
1340 an example with URLs named "machine" and "meta". In this case,
1341 ``SRCREV_FORMAT`` could look like "machine_meta" and those names
1342 would have the SCM versions substituted into each position. Only one
1343 ``AUTOINC`` placeholder is added and if needed. And, this placeholder
1344 is placed at the start of the returned string.
1345
1346 :term:`STAMP`
1347 Specifies the base path used to create recipe stamp files. The path
1348 to an actual stamp file is constructed by evaluating this string and
1349 then appending additional information.
1350
1351 :term:`STAMPCLEAN`
1352 Specifies the base path used to create recipe stamp files. Unlike the
1353 :term:`STAMP` variable, ``STAMPCLEAN`` can contain
1354 wildcards to match the range of files a clean operation should
1355 remove. BitBake uses a clean operation to remove any other stamps it
1356 should be removing when creating a new stamp.
1357
1358 :term:`SUMMARY`
1359 A short summary for the recipe, which is 72 characters or less.
1360
1361 :term:`SVNDIR`
1362 The directory in which files checked out of a Subversion system are
1363 stored.
1364
1365 :term:`T`
1366 Points to a directory were BitBake places temporary files, which
1367 consist mostly of task logs and scripts, when building a particular
1368 recipe.
1369
1370 :term:`TOPDIR`
1371 Points to the build directory. BitBake automatically sets this
1372 variable.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
deleted file mode 100644
index 4c29b2464f..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
+++ /dev/null
@@ -1,2537 +0,0 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<!-- Dummy chapter -->
6<chapter id='ref-bb-variables-glos'>
7
8<title>Variables Glossary</title>
9
10<para>
11 This chapter lists common variables used by BitBake and gives an overview
12 of their function and contents.
13</para>
14
15<note>
16 Following are some points regarding the variables listed in this glossary:
17 <itemizedlist>
18 <listitem><para>The variables listed in this glossary
19 are specific to BitBake.
20 Consequently, the descriptions are limited to that context.
21 </para></listitem>
22 <listitem><para>Also, variables exist in other systems that use BitBake
23 (e.g. The Yocto Project and OpenEmbedded) that have names identical
24 to those found in this glossary.
25 For such cases, the variables in those systems extend the
26 functionality of the variable as it is described here in
27 this glossary.
28 </para></listitem>
29 <listitem><para>Finally, there are variables mentioned in this
30 glossary that do not appear in the BitBake glossary.
31 These other variables are variables used in systems that use
32 BitBake.
33 </para></listitem>
34 </itemizedlist>
35</note>
36
37<glossary id='ref-bb-variables-glossary'>
38
39 <para>
40 <link linkend='var-bb-ASSUME_PROVIDED'>A</link>
41 <link linkend='var-bb-B'>B</link>
42 <link linkend='var-bb-CACHE'>C</link>
43 <link linkend='var-bb-DEFAULT_PREFERENCE'>D</link>
44 <link linkend='var-bb-EXCLUDE_FROM_WORLD'>E</link>
45 <link linkend='var-bb-FAKEROOT'>F</link>
46 <link linkend='var-bb-GITDIR'>G</link>
47 <link linkend='var-bb-HGDIR'>H</link>
48 <link linkend='var-bb-INHERIT'>I</link>
49<!-- <link linkend='var-glossary-j'>J</link> -->
50<!-- <link linkend='var-KARCH'>K</link> -->
51 <link linkend='var-bb-LAYERDEPENDS'>L</link>
52 <link linkend='var-bb-MIRRORS'>M</link>
53<!-- <link linkend='var-glossary-n'>N</link> -->
54 <link linkend='var-bb-OVERRIDES'>O</link>
55 <link linkend='var-bb-P4DIR'>P</link>
56<!-- <link linkend='var-QMAKE_PROFILES'>Q</link> -->
57 <link linkend='var-bb-RDEPENDS'>R</link>
58 <link linkend='var-bb-SECTION'>S</link>
59 <link linkend='var-bb-T'>T</link>
60<!-- <link linkend='var-UBOOT_CONFIG'>U</link> -->
61<!-- <link linkend='var-glossary-v'>V</link> -->
62<!-- <link linkend='var-WARN_QA'>W</link> -->
63<!-- <link linkend='var-glossary-x'>X</link> -->
64<!-- <link linkend='var-glossary-y'>Y</link> -->
65<!-- <link linkend='var-glossary-z'>Z</link>-->
66 </para>
67
68 <glossdiv id='var-bb-glossary-a'><title>A</title>
69
70 <glossentry id='var-bb-ASSUME_PROVIDED'><glossterm>ASSUME_PROVIDED</glossterm>
71 <glossdef>
72 <para>
73 Lists recipe names
74 (<link linkend='var-bb-PN'><filename>PN</filename></link>
75 values) BitBake does not attempt to build.
76 Instead, BitBake assumes these recipes have already been
77 built.
78 </para>
79
80 <para>
81 In OpenEmbedded-Core, <filename>ASSUME_PROVIDED</filename>
82 mostly specifies native tools that should not be built.
83 An example is <filename>git-native</filename>, which
84 when specified allows for the Git binary from the host to
85 be used rather than building
86 <filename>git-native</filename>.
87 </para>
88 </glossdef>
89 </glossentry>
90
91 </glossdiv>
92
93
94 <glossdiv id='var-bb-glossary-b'><title>B</title>
95
96 <glossentry id='var-bb-B'><glossterm>B</glossterm>
97 <glossdef>
98 <para>
99 The directory in which BitBake executes functions
100 during a recipe's build process.
101 </para>
102 </glossdef>
103 </glossentry>
104
105 <glossentry id='var-bb-BB_ALLOWED_NETWORKS'><glossterm>BB_ALLOWED_NETWORKS</glossterm>
106 <glossdef>
107 <para>
108 Specifies a space-delimited list of hosts that the fetcher
109 is allowed to use to obtain the required source code.
110 Following are considerations surrounding this variable:
111 <itemizedlist>
112 <listitem><para>
113 This host list is only used if
114 <link linkend='var-bb-BB_NO_NETWORK'><filename>BB_NO_NETWORK</filename></link>
115 is either not set or set to "0".
116 </para></listitem>
117 <listitem><para>
118 Limited support for the "<filename>*</filename>"
119 wildcard character for matching against the
120 beginning of host names exists.
121 For example, the following setting matches
122 <filename>git.gnu.org</filename>,
123 <filename>ftp.gnu.org</filename>, and
124 <filename>foo.git.gnu.org</filename>.
125 <literallayout class='monospaced'>
126 BB_ALLOWED_NETWORKS = "*.gnu.org"
127 </literallayout>
128 <note><title>Important</title>
129 <para>The use of the "<filename>*</filename>"
130 character only works at the beginning of
131 a host name and it must be isolated from
132 the remainder of the host name.
133 You cannot use the wildcard character in any
134 other location of the name or combined with
135 the front part of the name.</para>
136
137 <para>For example,
138 <filename>*.foo.bar</filename> is supported,
139 while <filename>*aa.foo.bar</filename> is not.
140 </para>
141 </note>
142 </para></listitem>
143 <listitem><para>
144 Mirrors not in the host list are skipped and
145 logged in debug.
146 </para></listitem>
147 <listitem><para>
148 Attempts to access networks not in the host list
149 cause a failure.
150 </para></listitem>
151 </itemizedlist>
152 Using <filename>BB_ALLOWED_NETWORKS</filename> in
153 conjunction with
154 <link linkend='var-bb-PREMIRRORS'><filename>PREMIRRORS</filename></link>
155 is very useful.
156 Adding the host you want to use to
157 <filename>PREMIRRORS</filename> results in the source code
158 being fetched from an allowed location and avoids raising
159 an error when a host that is not allowed is in a
160 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>
161 statement.
162 This is because the fetcher does not attempt to use the
163 host listed in <filename>SRC_URI</filename> after a
164 successful fetch from the
165 <filename>PREMIRRORS</filename> occurs.
166 </para>
167 </glossdef>
168 </glossentry>
169
170 <glossentry id='var-bb-BB_CONSOLELOG'><glossterm>BB_CONSOLELOG</glossterm>
171 <glossdef>
172 <para>
173 Specifies the path to a log file into which BitBake's user
174 interface writes output during the build.
175 </para>
176 </glossdef>
177 </glossentry>
178
179 <glossentry id='var-bb-BB_CURRENTTASK'><glossterm>BB_CURRENTTASK</glossterm>
180 <glossdef>
181 <para>
182 Contains the name of the currently running task.
183 The name does not include the
184 <filename>do_</filename> prefix.
185 </para>
186 </glossdef>
187 </glossentry>
188
189 <glossentry id='var-bb-BB_DANGLINGAPPENDS_WARNONLY'><glossterm>BB_DANGLINGAPPENDS_WARNONLY</glossterm>
190 <glossdef>
191 <para>
192 Defines how BitBake handles situations where an append
193 file (<filename>.bbappend</filename>) has no
194 corresponding recipe file (<filename>.bb</filename>).
195 This condition often occurs when layers get out of sync
196 (e.g. <filename>oe-core</filename> bumps a
197 recipe version and the old recipe no longer exists and the
198 other layer has not been updated to the new version
199 of the recipe yet).
200 </para>
201
202 <para>
203 The default fatal behavior is safest because it is
204 the sane reaction given something is out of sync.
205 It is important to realize when your changes are no longer
206 being applied.
207 </para>
208 </glossdef>
209 </glossentry>
210
211 <glossentry id='var-bb-BB_DEFAULT_TASK'><glossterm>BB_DEFAULT_TASK</glossterm>
212 <glossdef>
213 <para>
214 The default task to use when none is specified (e.g.
215 with the <filename>-c</filename> command line option).
216 The task name specified should not include the
217 <filename>do_</filename> prefix.
218 </para>
219 </glossdef>
220 </glossentry>
221
222 <glossentry id='var-bb-BB_DISKMON_DIRS'><glossterm>BB_DISKMON_DIRS</glossterm>
223 <glossdef>
224 <para>
225 Monitors disk space and available inodes during the build
226 and allows you to control the build based on these
227 parameters.
228 </para>
229
230 <para>
231 Disk space monitoring is disabled by default.
232 When setting this variable, use the following form:
233 <literallayout class='monospaced'>
234 BB_DISKMON_DIRS = "&lt;action&gt;,&lt;dir&gt;,&lt;threshold&gt; [...]"
235
236 where:
237
238 &lt;action&gt; is:
239 ABORT: Immediately abort the build when
240 a threshold is broken.
241 STOPTASKS: Stop the build after the currently
242 executing tasks have finished when
243 a threshold is broken.
244 WARN: Issue a warning but continue the
245 build when a threshold is broken.
246 Subsequent warnings are issued as
247 defined by the
248 <link linkend='var-bb-BB_DISKMON_WARNINTERVAL'>BB_DISKMON_WARNINTERVAL</link> variable,
249 which must be defined.
250
251 &lt;dir&gt; is:
252 Any directory you choose. You can specify one or
253 more directories to monitor by separating the
254 groupings with a space. If two directories are
255 on the same device, only the first directory
256 is monitored.
257
258 &lt;threshold&gt; is:
259 Either the minimum available disk space,
260 the minimum number of free inodes, or
261 both. You must specify at least one. To
262 omit one or the other, simply omit the value.
263 Specify the threshold using G, M, K for Gbytes,
264 Mbytes, and Kbytes, respectively. If you do
265 not specify G, M, or K, Kbytes is assumed by
266 default. Do not use GB, MB, or KB.
267 </literallayout>
268 </para>
269
270 <para>
271 Here are some examples:
272 <literallayout class='monospaced'>
273 BB_DISKMON_DIRS = "ABORT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K"
274 BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G"
275 BB_DISKMON_DIRS = "ABORT,${TMPDIR},,100K"
276 </literallayout>
277 The first example works only if you also set
278 the <link linkend='var-bb-BB_DISKMON_WARNINTERVAL'><filename>BB_DISKMON_WARNINTERVAL</filename></link> variable.
279 This example causes the build system to immediately
280 abort when either the disk space in <filename>${TMPDIR}</filename> drops
281 below 1 Gbyte or the available free inodes drops below
282 100 Kbytes.
283 Because two directories are provided with the variable, the
284 build system also issues a
285 warning when the disk space in the
286 <filename>${SSTATE_DIR}</filename> directory drops
287 below 1 Gbyte or the number of free inodes drops
288 below 100 Kbytes.
289 Subsequent warnings are issued during intervals as
290 defined by the <filename>BB_DISKMON_WARNINTERVAL</filename>
291 variable.
292 </para>
293
294 <para>
295 The second example stops the build after all currently
296 executing tasks complete when the minimum disk space
297 in the <filename>${TMPDIR}</filename>
298 directory drops below 1 Gbyte.
299 No disk monitoring occurs for the free inodes in this case.
300 </para>
301
302 <para>
303 The final example immediately aborts the build when the
304 number of free inodes in the <filename>${TMPDIR}</filename> directory
305 drops below 100 Kbytes.
306 No disk space monitoring for the directory itself occurs
307 in this case.
308 </para>
309 </glossdef>
310 </glossentry>
311
312 <glossentry id='var-bb-BB_DISKMON_WARNINTERVAL'><glossterm>BB_DISKMON_WARNINTERVAL</glossterm>
313 <glossdef>
314 <para>
315 Defines the disk space and free inode warning intervals.
316 </para>
317
318 <para>
319 If you are going to use the
320 <filename>BB_DISKMON_WARNINTERVAL</filename> variable, you must
321 also use the
322 <link linkend='var-bb-BB_DISKMON_DIRS'><filename>BB_DISKMON_DIRS</filename></link> variable
323 and define its action as "WARN".
324 During the build, subsequent warnings are issued each time
325 disk space or number of free inodes further reduces by
326 the respective interval.
327 </para>
328
329 <para>
330 If you do not provide a <filename>BB_DISKMON_WARNINTERVAL</filename>
331 variable and you do use <filename>BB_DISKMON_DIRS</filename> with
332 the "WARN" action, the disk monitoring interval defaults to
333 the following:
334 <literallayout class='monospaced'>
335 BB_DISKMON_WARNINTERVAL = "50M,5K"
336 </literallayout>
337 </para>
338
339 <para>
340 When specifying the variable in your configuration file,
341 use the following form:
342 <literallayout class='monospaced'>
343 BB_DISKMON_WARNINTERVAL = "&lt;disk_space_interval&gt;,&lt;disk_inode_interval&gt;"
344
345 where:
346
347 &lt;disk_space_interval&gt; is:
348 An interval of memory expressed in either
349 G, M, or K for Gbytes, Mbytes, or Kbytes,
350 respectively. You cannot use GB, MB, or KB.
351
352 &lt;disk_inode_interval&gt; is:
353 An interval of free inodes expressed in either
354 G, M, or K for Gbytes, Mbytes, or Kbytes,
355 respectively. You cannot use GB, MB, or KB.
356 </literallayout>
357 </para>
358
359 <para>
360 Here is an example:
361 <literallayout class='monospaced'>
362 BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K"
363 BB_DISKMON_WARNINTERVAL = "50M,5K"
364 </literallayout>
365 These variables cause BitBake to
366 issue subsequent warnings each time the available
367 disk space further reduces by 50 Mbytes or the number
368 of free inodes further reduces by 5 Kbytes in the
369 <filename>${SSTATE_DIR}</filename> directory.
370 Subsequent warnings based on the interval occur each time
371 a respective interval is reached beyond the initial warning
372 (i.e. 1 Gbytes and 100 Kbytes).
373 </para>
374 </glossdef>
375 </glossentry>
376
377 <glossentry id='var-bb-BB_ENV_WHITELIST'><glossterm>BB_ENV_WHITELIST</glossterm>
378 <glossdef>
379 <para>
380 Specifies the internal whitelist of variables to allow
381 through from the external environment into BitBake's
382 datastore.
383 If the value of this variable is not specified
384 (which is the default), the following list is used:
385 <link linkend='var-bb-BBPATH'><filename>BBPATH</filename></link>,
386 <link linkend='var-bb-BB_PRESERVE_ENV'><filename>BB_PRESERVE_ENV</filename></link>,
387 <link linkend='var-bb-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link>,
388 and
389 <link linkend='var-bb-BB_ENV_EXTRAWHITE'><filename>BB_ENV_EXTRAWHITE</filename></link>.
390 <note>
391 You must set this variable in the external environment
392 in order for it to work.
393 </note>
394 </para>
395 </glossdef>
396 </glossentry>
397
398 <glossentry id='var-bb-BB_ENV_EXTRAWHITE'><glossterm>BB_ENV_EXTRAWHITE</glossterm>
399 <glossdef>
400 <para>
401 Specifies an additional set of variables to allow through
402 (whitelist) from the external environment into BitBake's
403 datastore.
404 This list of variables are on top of the internal list
405 set in
406 <link linkend='var-bb-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link>.
407 <note>
408 You must set this variable in the external
409 environment in order for it to work.
410 </note>
411 </para>
412 </glossdef>
413 </glossentry>
414
415 <glossentry id='var-bb-BB_FETCH_PREMIRRORONLY'><glossterm>BB_FETCH_PREMIRRORONLY</glossterm>
416 <glossdef>
417 <para>
418 When set to "1", causes BitBake's fetcher module to only
419 search
420 <link linkend='var-bb-PREMIRRORS'><filename>PREMIRRORS</filename></link>
421 for files.
422 BitBake will not search the main
423 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>
424 or
425 <link linkend='var-bb-MIRRORS'><filename>MIRRORS</filename></link>.
426 </para>
427 </glossdef>
428 </glossentry>
429
430 <glossentry id='var-bb-BB_FILENAME'><glossterm>BB_FILENAME</glossterm>
431 <glossdef>
432 <para>
433 Contains the filename of the recipe that owns the currently
434 running task.
435 For example, if the <filename>do_fetch</filename> task that
436 resides in the <filename>my-recipe.bb</filename> is
437 executing, the <filename>BB_FILENAME</filename> variable
438 contains "/foo/path/my-recipe.bb".
439 </para>
440 </glossdef>
441 </glossentry>
442
443 <glossentry id='var-bb-BB_GENERATE_MIRROR_TARBALLS'><glossterm>BB_GENERATE_MIRROR_TARBALLS</glossterm>
444 <glossdef>
445 <para>
446 Causes tarballs of the Git repositories, including the
447 Git metadata, to be placed in the
448 <link linkend='var-bb-DL_DIR'><filename>DL_DIR</filename></link>
449 directory.
450 Anyone wishing to create a source mirror would want to
451 enable this variable.
452 </para>
453
454 <para>
455 For performance reasons, creating and placing tarballs of
456 the Git repositories is not the default action by BitBake.
457 <literallayout class='monospaced'>
458 BB_GENERATE_MIRROR_TARBALLS = "1"
459 </literallayout>
460 </para>
461 </glossdef>
462 </glossentry>
463
464 <glossentry id='var-bb-BB_HASHCONFIG_WHITELIST'><glossterm>BB_HASHCONFIG_WHITELIST</glossterm>
465 <glossdef>
466 <para>
467 Lists variables that are excluded from base configuration
468 checksum, which is used to determine if the cache can
469 be reused.
470 </para>
471
472 <para>
473 One of the ways BitBake determines whether to re-parse the
474 main metadata is through checksums of the variables in the
475 datastore of the base configuration data.
476 There are variables that you typically want to exclude when
477 checking whether or not to re-parse and thus rebuild the
478 cache.
479 As an example, you would usually exclude
480 <filename>TIME</filename> and <filename>DATE</filename>
481 because these variables are always changing.
482 If you did not exclude them, BitBake would never reuse the
483 cache.
484 </para>
485 </glossdef>
486 </glossentry>
487
488 <glossentry id='var-bb-BB_HASHBASE_WHITELIST'><glossterm>BB_HASHBASE_WHITELIST</glossterm>
489 <glossdef>
490 <para>
491 Lists variables that are excluded from checksum and
492 dependency data.
493 Variables that are excluded can therefore change without
494 affecting the checksum mechanism.
495 A common example would be the variable for the path of
496 the build.
497 BitBake's output should not (and usually does not) depend
498 on the directory in which it was built.
499 </para>
500 </glossdef>
501 </glossentry>
502
503 <glossentry id='var-bb-BB_HASHCHECK_FUNCTION'><glossterm>BB_HASHCHECK_FUNCTION</glossterm>
504 <glossdef>
505 <para>
506 Specifies the name of the function to call during the
507 "setscene" part of the task's execution in order to
508 validate the list of task hashes.
509 The function returns the list of setscene tasks that should
510 be executed.
511 </para>
512
513 <para>
514 At this point in the execution of the code, the objective
515 is to quickly verify if a given setscene function is likely
516 to work or not.
517 It's easier to check the list of setscene functions in
518 one pass than to call many individual tasks.
519 The returned list need not be completely accurate.
520 A given setscene task can still later fail.
521 However, the more accurate the data returned, the more
522 efficient the build will be.
523 </para>
524 </glossdef>
525 </glossentry>
526
527 <glossentry id='var-bb-BB_INVALIDCONF'><glossterm>BB_INVALIDCONF</glossterm>
528 <glossdef>
529 <para>
530 Used in combination with the
531 <filename>ConfigParsed</filename> event to trigger
532 re-parsing the base metadata (i.e. all the
533 recipes).
534 The <filename>ConfigParsed</filename> event can set the
535 variable to trigger the re-parse.
536 You must be careful to avoid recursive loops with this
537 functionality.
538 </para>
539 </glossdef>
540 </glossentry>
541
542 <glossentry id='var-bb-BB_LOGCONFIG'><glossterm>BB_LOGCONFIG</glossterm>
543 <glossdef>
544 <para>
545 Specifies the name of a config file that contains the user
546 logging configuration. See
547 <link linkend="logging">Logging</link> for additional
548 information
549 </para>
550 </glossdef>
551 </glossentry>
552
553 <glossentry id='var-bb-BB_LOGFMT'><glossterm>BB_LOGFMT</glossterm>
554 <glossdef>
555 <para>
556 Specifies the name of the log files saved into
557 <filename>${</filename><link linkend='var-bb-T'><filename>T</filename></link><filename>}</filename>.
558 By default, the <filename>BB_LOGFMT</filename> variable
559 is undefined and the log file names get created using the
560 following form:
561 <literallayout class='monospaced'>
562 log.{task}.{pid}
563 </literallayout>
564 If you want to force log files to take a specific name,
565 you can set this variable in a configuration file.
566 </para>
567 </glossdef>
568 </glossentry>
569
570 <glossentry id='var-bb-BB_NICE_LEVEL'><glossterm>BB_NICE_LEVEL</glossterm>
571 <glossdef>
572 <para>
573 Allows BitBake to run at a specific priority
574 (i.e. nice level).
575 System permissions usually mean that BitBake can reduce its
576 priority but not raise it again.
577 See
578 <link linkend='var-bb-BB_TASK_NICE_LEVEL'><filename>BB_TASK_NICE_LEVEL</filename></link>
579 for additional information.
580 </para>
581 </glossdef>
582 </glossentry>
583
584 <glossentry id='var-bb-BB_NO_NETWORK'><glossterm>BB_NO_NETWORK</glossterm>
585 <glossdef>
586 <para>
587 Disables network access in the BitBake fetcher modules.
588 With this access disabled, any command that attempts to
589 access the network becomes an error.
590 </para>
591
592 <para>
593 Disabling network access is useful for testing source
594 mirrors, running builds when not connected to the Internet,
595 and when operating in certain kinds of firewall
596 environments.
597 </para>
598 </glossdef>
599 </glossentry>
600
601 <glossentry id='var-bb-BB_NUMBER_THREADS'><glossterm>BB_NUMBER_THREADS</glossterm>
602 <glossdef>
603 <para>
604 The maximum number of tasks BitBake should run in parallel
605 at any one time.
606 If your host development system supports multiple cores,
607 a good rule of thumb is to set this variable to twice the
608 number of cores.
609 </para>
610 </glossdef>
611 </glossentry>
612
613 <glossentry id='var-bb-BB_NUMBER_PARSE_THREADS'><glossterm>BB_NUMBER_PARSE_THREADS</glossterm>
614 <glossdef>
615 <para>
616 Sets the number of threads BitBake uses when parsing.
617 By default, the number of threads is equal to the number
618 of cores on the system.
619 </para>
620 </glossdef>
621 </glossentry>
622
623 <glossentry id='var-bb-BB_ORIGENV'><glossterm>BB_ORIGENV</glossterm>
624 <glossdef>
625 <para>
626 Contains a copy of the original external environment in
627 which BitBake was run.
628 The copy is taken before any whitelisted variable values
629 are filtered into BitBake's datastore.
630 <note>
631 The contents of this variable is a datastore object
632 that can be queried using the normal datastore
633 operations.
634 </note>
635 </para>
636 </glossdef>
637 </glossentry>
638
639 <glossentry id='var-bb-BB_PRESERVE_ENV'><glossterm>BB_PRESERVE_ENV</glossterm>
640 <glossdef>
641 <para>
642 Disables whitelisting and instead allows all variables
643 through from the external environment into BitBake's
644 datastore.
645 <note>
646 You must set this variable in the external
647 environment in order for it to work.
648 </note>
649 </para>
650 </glossdef>
651 </glossentry>
652
653 <glossentry id='var-bb-BB_RUNFMT'><glossterm>BB_RUNFMT</glossterm>
654 <glossdef>
655 <para>
656 Specifies the name of the executable script files
657 (i.e. run files) saved into
658 <filename>${</filename><link linkend='var-bb-T'><filename>T</filename></link><filename>}</filename>.
659 By default, the <filename>BB_RUNFMT</filename> variable
660 is undefined and the run file names get created using the
661 following form:
662 <literallayout class='monospaced'>
663 run.{task}.{pid}
664 </literallayout>
665 If you want to force run files to take a specific name,
666 you can set this variable in a configuration file.
667 </para>
668 </glossdef>
669 </glossentry>
670
671 <glossentry id='var-bb-BB_RUNTASK'><glossterm>BB_RUNTASK</glossterm>
672 <glossdef>
673 <para>
674 Contains the name of the currently executing task.
675 The value includes the "do_" prefix.
676 For example, if the currently executing task is
677 <filename>do_config</filename>, the value is
678 "do_config".
679 </para>
680 </glossdef>
681 </glossentry>
682
683 <glossentry id='var-bb-BB_SCHEDULER'><glossterm>BB_SCHEDULER</glossterm>
684 <glossdef>
685 <para>
686 Selects the name of the scheduler to use for the
687 scheduling of BitBake tasks.
688 Three options exist:
689 <itemizedlist>
690 <listitem><para><emphasis>basic</emphasis> -
691 The basic framework from which everything derives.
692 Using this option causes tasks to be ordered
693 numerically as they are parsed.
694 </para></listitem>
695 <listitem><para><emphasis>speed</emphasis> -
696 Executes tasks first that have more tasks
697 depending on them.
698 The "speed" option is the default.
699 </para></listitem>
700 <listitem><para><emphasis>completion</emphasis> -
701 Causes the scheduler to try to complete a given
702 recipe once its build has started.
703 </para></listitem>
704 </itemizedlist>
705 </para>
706 </glossdef>
707 </glossentry>
708
709 <glossentry id='var-bb-BB_SCHEDULERS'><glossterm>BB_SCHEDULERS</glossterm>
710 <glossdef>
711 <para>
712 Defines custom schedulers to import.
713 Custom schedulers need to be derived from the
714 <filename>RunQueueScheduler</filename> class.
715 </para>
716
717 <para>
718 For information how to select a scheduler, see the
719 <link linkend='var-bb-BB_SCHEDULER'><filename>BB_SCHEDULER</filename></link>
720 variable.
721 </para>
722 </glossdef>
723 </glossentry>
724
725 <glossentry id='var-bb-BB_SETSCENE_DEPVALID'><glossterm>BB_SETSCENE_DEPVALID</glossterm>
726 <glossdef>
727 <para>
728 Specifies a function BitBake calls that determines
729 whether BitBake requires a setscene dependency to be met.
730 </para>
731
732 <para>
733 When running a setscene task, BitBake needs to
734 know which dependencies of that setscene task also need
735 to be run.
736 Whether dependencies also need to be run is highly
737 dependent on the metadata.
738 The function specified by this variable returns a
739 "True" or "False" depending on whether the dependency needs
740 to be met.
741 </para>
742 </glossdef>
743 </glossentry>
744
745 <glossentry id='var-bb-BB_SETSCENE_VERIFY_FUNCTION2'><glossterm>BB_SETSCENE_VERIFY_FUNCTION2</glossterm>
746 <glossdef>
747 <para>
748 Specifies a function to call that verifies the list of
749 planned task execution before the main task execution
750 happens.
751 The function is called once BitBake has a list of setscene
752 tasks that have run and either succeeded or failed.
753 </para>
754
755 <para>
756 The function allows for a task list check to see if they
757 make sense.
758 Even if BitBake was planning to skip a task, the
759 returned value of the function can force BitBake to run
760 the task, which is necessary under certain metadata
761 defined circumstances.
762 </para>
763 </glossdef>
764 </glossentry>
765
766 <glossentry id='var-bb-BB_SIGNATURE_EXCLUDE_FLAGS'><glossterm>BB_SIGNATURE_EXCLUDE_FLAGS</glossterm>
767 <glossdef>
768 <para>
769 Lists variable flags (varflags)
770 that can be safely excluded from checksum
771 and dependency data for keys in the datastore.
772 When generating checksum or dependency data for keys in the
773 datastore, the flags set against that key are normally
774 included in the checksum.
775 </para>
776
777 <para>
778 For more information on varflags, see the
779 "<link linkend='variable-flags'>Variable Flags</link>"
780 section.
781 </para>
782 </glossdef>
783 </glossentry>
784
785 <glossentry id='var-bb-BB_SIGNATURE_HANDLER'><glossterm>BB_SIGNATURE_HANDLER</glossterm>
786 <glossdef>
787 <para>
788 Defines the name of the signature handler BitBake uses.
789 The signature handler defines the way stamp files are
790 created and handled, if and how the signature is
791 incorporated into the stamps, and how the signature
792 itself is generated.
793 </para>
794
795 <para>
796 A new signature handler can be added by injecting a class
797 derived from the
798 <filename>SignatureGenerator</filename> class into the
799 global namespace.
800 </para>
801 </glossdef>
802 </glossentry>
803
804 <glossentry id='var-bb-BB_SRCREV_POLICY'><glossterm>BB_SRCREV_POLICY</glossterm>
805 <glossdef>
806 <para>
807 Defines the behavior of the fetcher when it interacts with
808 source control systems and dynamic source revisions.
809 The <filename>BB_SRCREV_POLICY</filename> variable is
810 useful when working without a network.
811 </para>
812
813 <para>
814 The variable can be set using one of two policies:
815 <itemizedlist>
816 <listitem><para><emphasis>cache</emphasis> -
817 Retains the value the system obtained previously
818 rather than querying the source control system
819 each time.
820 </para></listitem>
821 <listitem><para><emphasis>clear</emphasis> -
822 Queries the source controls system every time.
823 With this policy, there is no cache.
824 The "clear" policy is the default.
825 </para></listitem>
826 </itemizedlist>
827 </para>
828 </glossdef>
829 </glossentry>
830
831 <glossentry id='var-bb-BB_STAMP_POLICY'><glossterm>BB_STAMP_POLICY</glossterm>
832 <glossdef>
833 <para>
834 Defines the mode used for how timestamps of stamp files
835 are compared.
836 You can set the variable to one of the following modes:
837 <itemizedlist>
838 <listitem><para><emphasis>perfile</emphasis> -
839 Timestamp comparisons are only made
840 between timestamps of a specific recipe.
841 This is the default mode.
842 </para></listitem>
843 <listitem><para><emphasis>full</emphasis> -
844 Timestamp comparisons are made for all
845 dependencies.
846 </para></listitem>
847 <listitem><para><emphasis>whitelist</emphasis> -
848 Identical to "full" mode except timestamp
849 comparisons are made for recipes listed in the
850 <link linkend='var-bb-BB_STAMP_WHITELIST'><filename>BB_STAMP_WHITELIST</filename></link>
851 variable.
852 </para></listitem>
853 </itemizedlist>
854 <note>
855 Stamp policies are largely obsolete with the
856 introduction of setscene tasks.
857 </note>
858 </para>
859 </glossdef>
860 </glossentry>
861
862 <glossentry id='var-bb-BB_STAMP_WHITELIST'><glossterm>BB_STAMP_WHITELIST</glossterm>
863 <glossdef>
864 <para>
865 Lists files whose stamp file timestamps are compared when
866 the stamp policy mode is set to "whitelist".
867 For information on stamp policies, see the
868 <link linkend='var-bb-BB_STAMP_POLICY'><filename>BB_STAMP_POLICY</filename></link>
869 variable.
870 </para>
871 </glossdef>
872 </glossentry>
873
874 <glossentry id='var-bb-BB_STRICT_CHECKSUM'><glossterm>BB_STRICT_CHECKSUM</glossterm>
875 <glossdef>
876 <para>
877 Sets a more strict checksum mechanism for non-local URLs.
878 Setting this variable to a value causes BitBake
879 to report an error if it encounters a non-local URL
880 that does not have at least one checksum specified.
881 </para>
882 </glossdef>
883 </glossentry>
884
885 <glossentry id='var-bb-BB_TASK_IONICE_LEVEL'><glossterm>BB_TASK_IONICE_LEVEL</glossterm>
886 <glossdef>
887 <para>
888 Allows adjustment of a task's Input/Output priority.
889 During Autobuilder testing, random failures can occur
890 for tasks due to I/O starvation.
891 These failures occur during various QEMU runtime timeouts.
892 You can use the <filename>BB_TASK_IONICE_LEVEL</filename>
893 variable to adjust the I/O priority of these tasks.
894 <note>
895 This variable works similarly to the
896 <link linkend='var-bb-BB_TASK_NICE_LEVEL'><filename>BB_TASK_NICE_LEVEL</filename></link>
897 variable except with a task's I/O priorities.
898 </note>
899 </para>
900
901 <para>
902 Set the variable as follows:
903 <literallayout class='monospaced'>
904 BB_TASK_IONICE_LEVEL = "<replaceable>class</replaceable>.<replaceable>prio</replaceable>"
905 </literallayout>
906 For <replaceable>class</replaceable>, the default value is
907 "2", which is a best effort.
908 You can use "1" for realtime and "3" for idle.
909 If you want to use realtime, you must have superuser
910 privileges.
911 </para>
912
913 <para>
914 For <replaceable>prio</replaceable>, you can use any
915 value from "0", which is the highest priority, to "7",
916 which is the lowest.
917 The default value is "4".
918 You do not need any special privileges to use this range
919 of priority values.
920 <note>
921 In order for your I/O priority settings to take effect,
922 you need the Completely Fair Queuing (CFQ) Scheduler
923 selected for the backing block device.
924 To select the scheduler, use the following command form
925 where <replaceable>device</replaceable> is the device
926 (e.g. sda, sdb, and so forth):
927 <literallayout class='monospaced'>
928 $ sudo sh -c “echo cfq > /sys/block/<replaceable>device</replaceable>/queu/scheduler
929 </literallayout>
930 </note>
931 </para>
932 </glossdef>
933 </glossentry>
934
935 <glossentry id='var-bb-BB_TASK_NICE_LEVEL'><glossterm>BB_TASK_NICE_LEVEL</glossterm>
936 <glossdef>
937 <para>
938 Allows specific tasks to change their priority
939 (i.e. nice level).
940 </para>
941
942 <para>
943 You can use this variable in combination with task
944 overrides to raise or lower priorities of specific tasks.
945 For example, on the
946 <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink>
947 autobuilder, QEMU emulation in images is given a higher
948 priority as compared to build tasks to ensure that images
949 do not suffer timeouts on loaded systems.
950 </para>
951 </glossdef>
952 </glossentry>
953
954 <glossentry id='var-bb-BB_TASKHASH'><glossterm>BB_TASKHASH</glossterm>
955 <glossdef>
956 <para>
957 Within an executing task, this variable holds the hash
958 of the task as returned by the currently enabled
959 signature generator.
960 </para>
961 </glossdef>
962 </glossentry>
963
964 <glossentry id='var-bb-BB_VERBOSE_LOGS'><glossterm>BB_VERBOSE_LOGS</glossterm>
965 <glossdef>
966 <para>
967 Controls how verbose BitBake is during builds.
968 If set, shell scripts echo commands and shell script output
969 appears on standard out (stdout).
970 </para>
971 </glossdef>
972 </glossentry>
973
974 <glossentry id='var-bb-BB_WORKERCONTEXT'><glossterm>BB_WORKERCONTEXT</glossterm>
975 <glossdef>
976 <para>
977 Specifies if the current context is executing a task.
978 BitBake sets this variable to "1" when a task is
979 being executed.
980 The value is not set when the task is in server context
981 during parsing or event handling.
982 </para>
983 </glossdef>
984 </glossentry>
985
986
987 <glossentry id='var-bb-BBCLASSEXTEND'><glossterm>BBCLASSEXTEND</glossterm>
988 <glossdef>
989 <para>
990 Allows you to extend a recipe so that it builds variants
991 of the software.
992 Some examples of these variants for recipes from the
993 OpenEmbedded-Core metadata are "natives" such as
994 <filename>quilt-native</filename>, which is a copy of
995 Quilt built to run on the build system; "crosses" such
996 as <filename>gcc-cross</filename>, which is a compiler
997 built to run on the build machine but produces binaries
998 that run on the target <filename>MACHINE</filename>;
999 "nativesdk", which targets the SDK machine instead of
1000 <filename>MACHINE</filename>; and "mulitlibs" in the form
1001 "<filename>multilib:</filename><replaceable>multilib_name</replaceable>".
1002 </para>
1003
1004 <para>
1005 To build a different variant of the recipe with a minimal
1006 amount of code, it usually is as simple as adding the
1007 variable to your recipe.
1008 Here are two examples.
1009 The "native" variants are from the OpenEmbedded-Core
1010 metadata:
1011 <literallayout class='monospaced'>
1012 BBCLASSEXTEND =+ "native nativesdk"
1013 BBCLASSEXTEND =+ "multilib:<replaceable>multilib_name</replaceable>"
1014 </literallayout>
1015 <note>
1016 <para>
1017 Internally, the <filename>BBCLASSEXTEND</filename>
1018 mechanism generates recipe variants by rewriting
1019 variable values and applying overrides such as
1020 <filename>_class-native</filename>.
1021 For example, to generate a native version of a recipe,
1022 a
1023 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
1024 on "foo" is rewritten to a <filename>DEPENDS</filename>
1025 on "foo-native".
1026 </para>
1027
1028 <para>
1029 Even when using <filename>BBCLASSEXTEND</filename>, the
1030 recipe is only parsed once.
1031 Parsing once adds some limitations.
1032 For example, it is not possible to
1033 include a different file depending on the variant,
1034 since <filename>include</filename> statements are
1035 processed when the recipe is parsed.
1036 </para>
1037 </note>
1038 </para>
1039 </glossdef>
1040 </glossentry>
1041
1042 <glossentry id='var-bb-BBDEBUG'><glossterm>BBDEBUG</glossterm>
1043 <glossdef>
1044 <para>
1045 Sets the BitBake debug output level to a specific value
1046 as incremented by the <filename>-D</filename> command line
1047 option.
1048 <note>
1049 You must set this variable in the external environment
1050 in order for it to work.
1051 </note>
1052 </para>
1053 </glossdef>
1054 </glossentry>
1055
1056 <glossentry id='var-bb-BBFILE_COLLECTIONS'><glossterm>BBFILE_COLLECTIONS</glossterm>
1057 <glossdef>
1058 <para>Lists the names of configured layers.
1059 These names are used to find the other <filename>BBFILE_*</filename>
1060 variables.
1061 Typically, each layer appends its name to this variable in its
1062 <filename>conf/layer.conf</filename> file.
1063 </para>
1064 </glossdef>
1065 </glossentry>
1066
1067 <glossentry id='var-bb-BBFILE_PATTERN'><glossterm>BBFILE_PATTERN</glossterm>
1068 <glossdef>
1069 <para>Variable that expands to match files from
1070 <link linkend='var-bb-BBFILES'><filename>BBFILES</filename></link>
1071 in a particular layer.
1072 This variable is used in the <filename>conf/layer.conf</filename> file and must
1073 be suffixed with the name of the specific layer (e.g.
1074 <filename>BBFILE_PATTERN_emenlow</filename>).</para>
1075 </glossdef>
1076 </glossentry>
1077
1078 <glossentry id='var-bb-BBFILE_PRIORITY'><glossterm>BBFILE_PRIORITY</glossterm>
1079 <glossdef>
1080 <para>Assigns the priority for recipe files in each layer.</para>
1081 <para>This variable is useful in situations where the same recipe appears in
1082 more than one layer.
1083 Setting this variable allows you to prioritize a
1084 layer against other layers that contain the same recipe - effectively
1085 letting you control the precedence for the multiple layers.
1086 The precedence established through this variable stands regardless of a
1087 recipe's version
1088 (<link linkend='var-bb-PV'><filename>PV</filename></link> variable).
1089 For example, a layer that has a recipe with a higher <filename>PV</filename> value but for
1090 which the <filename>BBFILE_PRIORITY</filename> is set to have a lower precedence still has a
1091 lower precedence.</para>
1092 <para>A larger value for the <filename>BBFILE_PRIORITY</filename> variable results in a higher
1093 precedence.
1094 For example, the value 6 has a higher precedence than the value 5.
1095 If not specified, the <filename>BBFILE_PRIORITY</filename> variable is set based on layer
1096 dependencies (see the
1097 <filename><link linkend='var-bb-LAYERDEPENDS'>LAYERDEPENDS</link></filename> variable for
1098 more information.
1099 The default priority, if unspecified
1100 for a layer with no dependencies, is the lowest defined priority + 1
1101 (or 1 if no priorities are defined).</para>
1102 <tip>
1103 You can use the command <filename>bitbake-layers show-layers</filename> to list
1104 all configured layers along with their priorities.
1105 </tip>
1106 </glossdef>
1107 </glossentry>
1108
1109 <glossentry id='var-bb-BBFILES'><glossterm>BBFILES</glossterm>
1110 <glossdef>
1111 <para>
1112 A space-separated list of recipe files BitBake uses to
1113 build software.
1114 </para>
1115
1116 <para>
1117 When specifying recipe files, you can pattern match using
1118 Python's
1119 <ulink url='https://docs.python.org/3/library/glob.html'><filename>glob</filename></ulink>
1120 syntax.
1121 For details on the syntax, see the documentation by
1122 following the previous link.
1123 </para>
1124 </glossdef>
1125 </glossentry>
1126
1127 <glossentry id='var-BBFILES_DYNAMIC'><glossterm>BBFILES_DYNAMIC</glossterm>
1128 <info>
1129 BBFILES_DYNAMIC[doc] = "Activates content depending on presence of identified layers."
1130 </info>
1131 <glossdef>
1132 <para role="glossdeffirst">
1133 Activates content depending on presence of identified layers.
1134 You identify the layers by the collections that the layers
1135 define.
1136 </para>
1137
1138 <para>
1139 Use the <filename>BBFILES_DYNAMIC</filename> variable to
1140 avoid <filename>.bbappend</filename> files whose
1141 corresponding <filename>.bb</filename> file is in a layer
1142 that attempts to modify other layers through
1143 <filename>.bbappend</filename> but does not want to
1144 introduce a hard dependency on those other layers.
1145 </para>
1146
1147 <para>
1148 Additionally you can prefix the rule with "!" to add
1149 <filename>.bbappend</filename> and <filename>.bb</filename> files
1150 in case a layer is not present.
1151 Use this avoid hard dependency on those other layers.
1152 </para>
1153
1154 <para>
1155 Use the following form for
1156 <filename>BBFILES_DYNAMIC</filename>:
1157 <literallayout class='monospaced'>
1158 <replaceable>collection_name</replaceable>:<replaceable>filename_pattern</replaceable>
1159 </literallayout>
1160 The following example identifies two collection names and
1161 two filename patterns:
1162 <literallayout class='monospaced'>
1163 BBFILES_DYNAMIC += "\
1164 clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \
1165 core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \
1166 "
1167 </literallayout>
1168 When the collection name is prefixed with "!" it will add the file pattern in case
1169 the layer is absent:
1170 <literallayout class='monospaced'>
1171 BBFILES_DYNAMIC += "\
1172 !clang-layer:${LAYERDIR}/backfill/meta-clang/*/*/*.bb \
1173 "
1174 </literallayout>
1175
1176 This next example shows an error message that occurs
1177 because invalid entries are found, which cause parsing to
1178 abort:
1179 <literallayout class='monospaced'>
1180 ERROR: BBFILES_DYNAMIC entries must be of the form {!}&lt;collection name&gt;:&lt;filename pattern&gt;, not:
1181 /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend
1182 /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend
1183 </literallayout>
1184 </para>
1185 </glossdef>
1186 </glossentry>
1187
1188 <glossentry id='var-bb-BBINCLUDED'><glossterm>BBINCLUDED</glossterm>
1189 <glossdef>
1190 <para>
1191 Contains a space-separated list of all of all files that
1192 BitBake's parser included during parsing of the current
1193 file.
1194 </para>
1195 </glossdef>
1196 </glossentry>
1197
1198 <glossentry id='var-bb-BBINCLUDELOGS'><glossterm>BBINCLUDELOGS</glossterm>
1199 <glossdef>
1200 <para>
1201 If set to a value, enables printing the task log when
1202 reporting a failed task.
1203 </para>
1204 </glossdef>
1205 </glossentry>
1206
1207 <glossentry id='var-bb-BBINCLUDELOGS_LINES'><glossterm>BBINCLUDELOGS_LINES</glossterm>
1208 <glossdef>
1209 <para>
1210 If
1211 <link linkend='var-bb-BBINCLUDELOGS'><filename>BBINCLUDELOGS</filename></link>
1212 is set, specifies the maximum number of lines from the
1213 task log file to print when reporting a failed task.
1214 If you do not set <filename>BBINCLUDELOGS_LINES</filename>,
1215 the entire log is printed.
1216 </para>
1217 </glossdef>
1218 </glossentry>
1219
1220 <glossentry id='var-bb-BBLAYERS'><glossterm>BBLAYERS</glossterm>
1221 <glossdef>
1222 <para>Lists the layers to enable during the build.
1223 This variable is defined in the <filename>bblayers.conf</filename> configuration
1224 file in the build directory.
1225 Here is an example:
1226 <literallayout class='monospaced'>
1227 BBLAYERS = " \
1228 /home/scottrif/poky/meta \
1229 /home/scottrif/poky/meta-yocto \
1230 /home/scottrif/poky/meta-yocto-bsp \
1231 /home/scottrif/poky/meta-mykernel \
1232 "
1233
1234 </literallayout>
1235 This example enables four layers, one of which is a custom, user-defined layer
1236 named <filename>meta-mykernel</filename>.
1237 </para>
1238 </glossdef>
1239 </glossentry>
1240
1241 <glossentry id='var-bb-BBLAYERS_FETCH_DIR'><glossterm>BBLAYERS_FETCH_DIR</glossterm>
1242 <glossdef>
1243 <para>
1244 Sets the base location where layers are stored.
1245 This setting is used in conjunction with
1246 <filename>bitbake-layers layerindex-fetch</filename> and
1247 tells <filename>bitbake-layers</filename> where to place
1248 the fetched layers.
1249 </para>
1250 </glossdef>
1251 </glossentry>
1252
1253 <glossentry id='var-bb-BBMASK'><glossterm>BBMASK</glossterm>
1254 <glossdef>
1255 <para>
1256 Prevents BitBake from processing recipes and recipe
1257 append files.
1258 </para>
1259
1260 <para>
1261 You can use the <filename>BBMASK</filename> variable
1262 to "hide" these <filename>.bb</filename> and
1263 <filename>.bbappend</filename> files.
1264 BitBake ignores any recipe or recipe append files that
1265 match any of the expressions.
1266 It is as if BitBake does not see them at all.
1267 Consequently, matching files are not parsed or otherwise
1268 used by BitBake.
1269 </para>
1270
1271 <para>
1272 The values you provide are passed to Python's regular
1273 expression compiler.
1274 Consequently, the syntax follows Python's Regular
1275 Expression (re) syntax.
1276 The expressions are compared against the full paths to
1277 the files.
1278 For complete syntax information, see Python's
1279 documentation at
1280 <ulink url='http://docs.python.org/3/library/re.html#re'></ulink>.
1281 </para>
1282
1283 <para>
1284 The following example uses a complete regular expression
1285 to tell BitBake to ignore all recipe and recipe append
1286 files in the <filename>meta-ti/recipes-misc/</filename>
1287 directory:
1288 <literallayout class='monospaced'>
1289 BBMASK = "meta-ti/recipes-misc/"
1290 </literallayout>
1291 If you want to mask out multiple directories or recipes,
1292 you can specify multiple regular expression fragments.
1293 This next example masks out multiple directories and
1294 individual recipes:
1295 <literallayout class='monospaced'>
1296 BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/"
1297 BBMASK += "/meta-oe/recipes-support/"
1298 BBMASK += "/meta-foo/.*/openldap"
1299 BBMASK += "opencv.*\.bbappend"
1300 BBMASK += "lzma"
1301 </literallayout>
1302 <note>
1303 When specifying a directory name, use the trailing
1304 slash character to ensure you match just that directory
1305 name.
1306 </note>
1307 </para>
1308 </glossdef>
1309 </glossentry>
1310
1311 <glossentry id='var-bb-BBMULTICONFIG'><glossterm>BBMULTICONFIG</glossterm>
1312 <info>
1313 BBMULTICONFIG[doc] = "Enables BitBake to perform multiple configuration builds and lists each separate configuration (multiconfig)."
1314 </info>
1315 <glossdef>
1316 <para role="glossdeffirst">
1317<!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> -->
1318 Enables BitBake to perform multiple configuration builds
1319 and lists each separate configuration (multiconfig).
1320 You can use this variable to cause BitBake to build
1321 multiple targets where each target has a separate
1322 configuration.
1323 Define <filename>BBMULTICONFIG</filename> in your
1324 <filename>conf/local.conf</filename> configuration file.
1325 </para>
1326
1327 <para>
1328 As an example, the following line specifies three
1329 multiconfigs, each having a separate configuration file:
1330 <literallayout class='monospaced'>
1331 BBMULTIFONFIG = "configA configB configC"
1332 </literallayout>
1333 Each configuration file you use must reside in the
1334 build directory within a directory named
1335 <filename>conf/multiconfig</filename> (e.g.
1336 <replaceable>build_directory</replaceable><filename>/conf/multiconfig/configA.conf</filename>).
1337 </para>
1338
1339 <para>
1340 For information on how to use
1341 <filename>BBMULTICONFIG</filename> in an environment that
1342 supports building targets with multiple configurations,
1343 see the
1344 "<link linkend='executing-a-multiple-configuration-build'>Executing a Multiple Configuration Build</link>"
1345 section.
1346 </para>
1347 </glossdef>
1348 </glossentry>
1349
1350 <glossentry id='var-bb-BBPATH'><glossterm>BBPATH</glossterm>
1351 <glossdef>
1352 <para>
1353 Used by BitBake to locate class
1354 (<filename>.bbclass</filename>) and configuration
1355 (<filename>.conf</filename>) files.
1356 This variable is analogous to the
1357 <filename>PATH</filename> variable.
1358 </para>
1359
1360 <para>
1361 If you run BitBake from a directory outside of the
1362 build directory,
1363 you must be sure to set
1364 <filename>BBPATH</filename> to point to the
1365 build directory.
1366 Set the variable as you would any environment variable
1367 and then run BitBake:
1368 <literallayout class='monospaced'>
1369 $ BBPATH="<replaceable>build_directory</replaceable>"
1370 $ export BBPATH
1371 $ bitbake <replaceable>target</replaceable>
1372 </literallayout>
1373 </para>
1374 </glossdef>
1375 </glossentry>
1376
1377 <glossentry id='var-bb-BBSERVER'><glossterm>BBSERVER</glossterm>
1378 <glossdef>
1379 <para>
1380 Points to the server that runs memory-resident BitBake.
1381 The variable is only used when you employ memory-resident
1382 BitBake.
1383 </para>
1384 </glossdef>
1385 </glossentry>
1386
1387 <glossentry id='var-bb-BBTARGETS'><glossterm>BBTARGETS</glossterm>
1388 <glossdef>
1389 <para>
1390 Allows you to use a configuration file to add to the list
1391 of command-line target recipes you want to build.
1392 </para>
1393 </glossdef>
1394 </glossentry>
1395
1396 <glossentry id='var-bb-BBVERSIONS'><glossterm>BBVERSIONS</glossterm>
1397 <glossdef>
1398 <para>
1399 Allows a single recipe to build multiple versions of a
1400 project from a single recipe file.
1401 You also able to specify conditional metadata
1402 using the
1403 <link linkend='var-bb-OVERRIDES'><filename>OVERRIDES</filename></link>
1404 mechanism for a single version or for an optionally named
1405 range of versions.
1406 </para>
1407
1408 <para>
1409 For more information on <filename>BBVERSIONS</filename>,
1410 see the
1411 "<link linkend='variants-class-extension-mechanism'>Variants - Class Extension Mechanism</link>"
1412 section.
1413 </para>
1414 </glossdef>
1415 </glossentry>
1416
1417 <glossentry id='var-bb-BITBAKE_UI'><glossterm>BITBAKE_UI</glossterm>
1418 <glossdef>
1419 <para>
1420 Used to specify the UI module to use when running BitBake.
1421 Using this variable is equivalent to using the
1422 <filename>-u</filename> command-line option.
1423 <note>
1424 You must set this variable in the external environment
1425 in order for it to work.
1426 </note>
1427 </para>
1428 </glossdef>
1429 </glossentry>
1430
1431 <glossentry id='var-bb-BUILDNAME'><glossterm>BUILDNAME</glossterm>
1432 <glossdef>
1433 <para>
1434 A name assigned to the build.
1435 The name defaults to a datetime stamp of when the build was
1436 started but can be defined by the metadata.
1437 </para>
1438 </glossdef>
1439 </glossentry>
1440
1441 <glossentry id='var-bb-BZRDIR'><glossterm>BZRDIR</glossterm>
1442 <glossdef>
1443 <para>
1444 The directory in which files checked out of a Bazaar
1445 system are stored.
1446 </para>
1447 </glossdef>
1448 </glossentry>
1449
1450 </glossdiv>
1451
1452 <glossdiv id='var-bb-glossary-c'><title>C</title>
1453
1454 <glossentry id='var-bb-CACHE'><glossterm>CACHE</glossterm>
1455 <glossdef>
1456 <para>
1457 Specifies the directory BitBake uses to store a cache
1458 of the metadata so it does not need to be parsed every
1459 time BitBake is started.
1460 </para>
1461 </glossdef>
1462 </glossentry>
1463
1464 <glossentry id='var-bb-CVSDIR'><glossterm>CVSDIR</glossterm>
1465 <glossdef>
1466 <para>
1467 The directory in which files checked out under the
1468 CVS system are stored.
1469 </para>
1470 </glossdef>
1471 </glossentry>
1472
1473 </glossdiv>
1474
1475 <glossdiv id='var-bb-glossary-d'><title>D</title>
1476
1477 <glossentry id='var-bb-DEFAULT_PREFERENCE'><glossterm>DEFAULT_PREFERENCE</glossterm>
1478 <glossdef>
1479 <para>
1480 Specifies a weak bias for recipe selection priority.
1481 </para>
1482 <para>
1483 The most common usage of this is variable is to set
1484 it to "-1" within a recipe for a development version of a
1485 piece of software.
1486 Using the variable in this way causes the stable version
1487 of the recipe to build by default in the absence of
1488 <filename><link linkend='var-bb-PREFERRED_VERSION'>PREFERRED_VERSION</link></filename>
1489 being used to build the development version.
1490 </para>
1491 <note>
1492 The bias provided by <filename>DEFAULT_PREFERENCE</filename>
1493 is weak and is overridden by
1494 <filename><link linkend='var-bb-BBFILE_PRIORITY'>BBFILE_PRIORITY</link></filename>
1495 if that variable is different between two layers
1496 that contain different versions of the same recipe.
1497 </note>
1498 </glossdef>
1499 </glossentry>
1500
1501 <glossentry id='var-bb-DEPENDS'><glossterm>DEPENDS</glossterm>
1502 <glossdef>
1503 <para>
1504 Lists a recipe's build-time dependencies
1505 (i.e. other recipe files).
1506 </para>
1507
1508 <para>
1509 Consider this simple example for two recipes named "a" and
1510 "b" that produce similarly named packages.
1511 In this example, the <filename>DEPENDS</filename>
1512 statement appears in the "a" recipe:
1513 <literallayout class='monospaced'>
1514 DEPENDS = "b"
1515 </literallayout>
1516 Here, the dependency is such that the
1517 <filename>do_configure</filename> task for recipe "a"
1518 depends on the <filename>do_populate_sysroot</filename>
1519 task of recipe "b".
1520 This means anything that recipe "b" puts into sysroot
1521 is available when recipe "a" is configuring itself.
1522 </para>
1523
1524 <para>
1525 For information on runtime dependencies, see the
1526 <link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>
1527 variable.
1528 </para>
1529 </glossdef>
1530 </glossentry>
1531
1532 <glossentry id='var-bb-DESCRIPTION'><glossterm>DESCRIPTION</glossterm>
1533 <glossdef>
1534 <para>
1535 A long description for the recipe.
1536 </para>
1537 </glossdef>
1538 </glossentry>
1539
1540 <glossentry id='var-bb-DL_DIR'><glossterm>DL_DIR</glossterm>
1541 <glossdef>
1542 <para>
1543 The central download directory used by the build process to
1544 store downloads.
1545 By default, <filename>DL_DIR</filename> gets files
1546 suitable for mirroring for everything except Git
1547 repositories.
1548 If you want tarballs of Git repositories, use the
1549 <link linkend='var-bb-BB_GENERATE_MIRROR_TARBALLS'><filename>BB_GENERATE_MIRROR_TARBALLS</filename></link>
1550 variable.
1551 </para>
1552 </glossdef>
1553
1554 </glossentry>
1555 </glossdiv>
1556
1557 <glossdiv id='var-bb-glossary-e'><title>E</title>
1558
1559 <glossentry id='var-bb-EXCLUDE_FROM_WORLD'><glossterm>EXCLUDE_FROM_WORLD</glossterm>
1560 <glossdef>
1561 <para>
1562 Directs BitBake to exclude a recipe from world builds (i.e.
1563 <filename>bitbake world</filename>).
1564 During world builds, BitBake locates, parses and builds all
1565 recipes found in every layer exposed in the
1566 <filename>bblayers.conf</filename> configuration file.
1567 </para>
1568
1569 <para>
1570 To exclude a recipe from a world build using this variable,
1571 set the variable to "1" in the recipe.
1572 </para>
1573
1574 <note>
1575 Recipes added to <filename>EXCLUDE_FROM_WORLD</filename>
1576 may still be built during a world build in order to satisfy
1577 dependencies of other recipes.
1578 Adding a recipe to <filename>EXCLUDE_FROM_WORLD</filename>
1579 only ensures that the recipe is not explicitly added
1580 to the list of build targets in a world build.
1581 </note>
1582 </glossdef>
1583 </glossentry>
1584
1585 </glossdiv>
1586
1587 <glossdiv id='var-bb-glossary-f'><title>F</title>
1588
1589 <glossentry id='var-bb-FAKEROOT'><glossterm>FAKEROOT</glossterm>
1590 <glossdef>
1591 <para>
1592 Contains the command to use when running a shell script
1593 in a fakeroot environment.
1594 The <filename>FAKEROOT</filename> variable is obsolete
1595 and has been replaced by the other
1596 <filename>FAKEROOT*</filename> variables.
1597 See these entries in the glossary for more information.
1598 </para>
1599 </glossdef>
1600 </glossentry>
1601
1602 <glossentry id='var-bb-FAKEROOTBASEENV'><glossterm>FAKEROOTBASEENV</glossterm>
1603 <glossdef>
1604 <para>
1605 Lists environment variables to set when executing
1606 the command defined by
1607 <link linkend='var-bb-FAKEROOTCMD'><filename>FAKEROOTCMD</filename></link>
1608 that starts the bitbake-worker process
1609 in the fakeroot environment.
1610 </para>
1611 </glossdef>
1612 </glossentry>
1613
1614 <glossentry id='var-bb-FAKEROOTCMD'><glossterm>FAKEROOTCMD</glossterm>
1615 <glossdef>
1616 <para>
1617 Contains the command that starts the bitbake-worker
1618 process in the fakeroot environment.
1619 </para>
1620 </glossdef>
1621 </glossentry>
1622
1623 <glossentry id='var-bb-FAKEROOTDIRS'><glossterm>FAKEROOTDIRS</glossterm>
1624 <glossdef>
1625 <para>
1626 Lists directories to create before running a task in
1627 the fakeroot environment.
1628 </para>
1629 </glossdef>
1630 </glossentry>
1631
1632 <glossentry id='var-bb-FAKEROOTENV'><glossterm>FAKEROOTENV</glossterm>
1633 <glossdef>
1634 <para>
1635 Lists environment variables to set when running a task
1636 in the fakeroot environment.
1637 For additional information on environment variables and
1638 the fakeroot environment, see the
1639 <link linkend='var-bb-FAKEROOTBASEENV'><filename>FAKEROOTBASEENV</filename></link>
1640 variable.
1641 </para>
1642 </glossdef>
1643 </glossentry>
1644
1645 <glossentry id='var-bb-FAKEROOTNOENV'><glossterm>FAKEROOTNOENV</glossterm>
1646 <glossdef>
1647 <para>
1648 Lists environment variables to set when running a task
1649 that is not in the fakeroot environment.
1650 For additional information on environment variables and
1651 the fakeroot environment, see the
1652 <link linkend='var-bb-FAKEROOTENV'><filename>FAKEROOTENV</filename></link>
1653 variable.
1654 </para>
1655 </glossdef>
1656 </glossentry>
1657
1658 <glossentry id='var-bb-FETCHCMD'><glossterm>FETCHCMD</glossterm>
1659 <glossdef>
1660 <para>
1661 Defines the command the BitBake fetcher module
1662 executes when running fetch operations.
1663 You need to use an override suffix when you use the
1664 variable (e.g. <filename>FETCHCMD_git</filename>
1665 or <filename>FETCHCMD_svn</filename>).
1666 </para>
1667 </glossdef>
1668 </glossentry>
1669
1670 <glossentry id='var-bb-FILE'><glossterm>FILE</glossterm>
1671 <glossdef>
1672 <para>
1673 Points at the current file.
1674 BitBake sets this variable during the parsing process
1675 to identify the file being parsed.
1676 BitBake also sets this variable when a recipe is being
1677 executed to identify the recipe file.
1678 </para>
1679 </glossdef>
1680 </glossentry>
1681
1682 <glossentry id='var-bb-FILESPATH'><glossterm>FILESPATH</glossterm>
1683 <glossdef>
1684 <para>
1685 Specifies directories BitBake uses when searching for
1686 patches and files.
1687 The "local" fetcher module uses these directories when
1688 handling <filename>file://</filename> URLs.
1689 The variable behaves like a shell <filename>PATH</filename>
1690 environment variable.
1691 The value is a colon-separated list of directories that
1692 are searched left-to-right in order.
1693 </para>
1694 </glossdef>
1695 </glossentry>
1696
1697 </glossdiv>
1698
1699
1700 <glossdiv id='var-bb-glossary-g'><title>G</title>
1701
1702 <glossentry id='var-bb-GITDIR'><glossterm>GITDIR</glossterm>
1703 <glossdef>
1704 <para>
1705 The directory in which a local copy of a Git repository
1706 is stored when it is cloned.
1707 </para>
1708 </glossdef>
1709 </glossentry>
1710
1711 </glossdiv>
1712
1713
1714 <glossdiv id='var-bb-glossary-h'><title>H</title>
1715
1716 <glossentry id='var-bb-HGDIR'><glossterm>HGDIR</glossterm>
1717 <glossdef>
1718 <para>
1719 The directory in which files checked out of a Mercurial
1720 system are stored.
1721 </para>
1722 </glossdef>
1723 </glossentry>
1724
1725 <glossentry id='var-bb-HOMEPAGE'><glossterm>HOMEPAGE</glossterm>
1726 <glossdef>
1727 <para>Website where more information about the software the recipe is building
1728 can be found.</para>
1729 </glossdef>
1730 </glossentry>
1731
1732 </glossdiv>
1733
1734 <glossdiv id='var-bb-glossary-i'><title>I</title>
1735
1736 <glossentry id='var-bb-INHERIT'><glossterm>INHERIT</glossterm>
1737 <glossdef>
1738 <para>
1739 Causes the named class or classes to be inherited globally.
1740 Anonymous functions in the class or classes
1741 are not executed for the
1742 base configuration and in each individual recipe.
1743 The OpenEmbedded build system ignores changes to
1744 <filename>INHERIT</filename> in individual recipes.
1745 </para>
1746
1747 <para>
1748 For more information on <filename>INHERIT</filename>, see
1749 the
1750 "<link linkend="inherit-configuration-directive"><filename>INHERIT</filename> Configuration Directive</link>"
1751 section.
1752 </para>
1753 </glossdef>
1754 </glossentry>
1755
1756 </glossdiv>
1757
1758<!--
1759 <glossdiv id='var-glossary-j'><title>J</title>
1760 </glossdiv>
1761
1762 <glossdiv id='var-glossary-k'><title>K</title>
1763 </glossdiv>
1764-->
1765
1766 <glossdiv id='var-bb-glossary-l'><title>L</title>
1767
1768 <glossentry id='var-bb-LAYERDEPENDS'><glossterm>LAYERDEPENDS</glossterm>
1769 <glossdef>
1770 <para>Lists the layers, separated by spaces, upon which this recipe depends.
1771 Optionally, you can specify a specific layer version for a dependency
1772 by adding it to the end of the layer name with a colon, (e.g. "anotherlayer:3"
1773 to be compared against
1774 <link linkend='var-bb-LAYERVERSION'><filename>LAYERVERSION</filename></link><filename>_anotherlayer</filename>
1775 in this case).
1776 BitBake produces an error if any dependency is missing or
1777 the version numbers do not match exactly (if specified).</para>
1778 <para>
1779 You use this variable in the <filename>conf/layer.conf</filename> file.
1780 You must also use the specific layer name as a suffix
1781 to the variable (e.g. <filename>LAYERDEPENDS_mylayer</filename>).</para>
1782 </glossdef>
1783 </glossentry>
1784
1785 <glossentry id='var-bb-LAYERDIR'><glossterm>LAYERDIR</glossterm>
1786 <glossdef>
1787 <para>When used inside the <filename>layer.conf</filename> configuration
1788 file, this variable provides the path of the current layer.
1789 This variable is not available outside of <filename>layer.conf</filename>
1790 and references are expanded immediately when parsing of the file completes.</para>
1791 </glossdef>
1792 </glossentry>
1793
1794 <glossentry id='var-bb-LAYERDIR_RE'><glossterm>LAYERDIR_RE</glossterm>
1795 <glossdef>
1796 <para>When used inside the <filename>layer.conf</filename> configuration
1797 file, this variable provides the path of the current layer,
1798 escaped for use in a regular expression
1799 (<link linkend='var-bb-BBFILE_PATTERN'><filename>BBFILE_PATTERN</filename></link>).
1800 This variable is not available outside of <filename>layer.conf</filename>
1801 and references are expanded immediately when parsing of the file completes.</para>
1802 </glossdef>
1803 </glossentry>
1804
1805 <glossentry id='var-bb-LAYERVERSION'><glossterm>LAYERVERSION</glossterm>
1806 <glossdef>
1807 <para>Optionally specifies the version of a layer as a single number.
1808 You can use this variable within
1809 <link linkend='var-bb-LAYERDEPENDS'><filename>LAYERDEPENDS</filename></link>
1810 for another layer in order to depend on a specific version
1811 of the layer.</para>
1812 <para>
1813 You use this variable in the <filename>conf/layer.conf</filename> file.
1814 You must also use the specific layer name as a suffix
1815 to the variable (e.g. <filename>LAYERDEPENDS_mylayer</filename>).</para>
1816 </glossdef>
1817 </glossentry>
1818
1819 <glossentry id='var-bb-LICENSE'><glossterm>LICENSE</glossterm>
1820 <glossdef>
1821 <para>
1822 The list of source licenses for the recipe.
1823 </para>
1824 </glossdef>
1825 </glossentry>
1826
1827 </glossdiv>
1828
1829 <glossdiv id='var-bb-glossary-m'><title>M</title>
1830
1831 <glossentry id='var-bb-MIRRORS'><glossterm>MIRRORS</glossterm>
1832 <glossdef>
1833 <para>
1834 Specifies additional paths from which BitBake gets source code.
1835 When the build system searches for source code, it first
1836 tries the local download directory.
1837 If that location fails, the build system tries locations
1838 defined by
1839 <link linkend='var-bb-PREMIRRORS'><filename>PREMIRRORS</filename></link>,
1840 the upstream source, and then locations specified by
1841 <filename>MIRRORS</filename> in that order.
1842 </para>
1843 </glossdef>
1844 </glossentry>
1845
1846 <glossentry id='var-bb-MULTI_PROVIDER_WHITELIST'><glossterm>MULTI_PROVIDER_WHITELIST</glossterm>
1847 <glossdef>
1848 <para>
1849 Allows you to suppress BitBake warnings caused when
1850 building two separate recipes that provide the same
1851 output.
1852 </para>
1853
1854 <para>
1855 BitBake normally issues a warning when building two
1856 different recipes where each provides the same output.
1857 This scenario is usually something the user does not
1858 want.
1859 However, cases do exist where it makes sense, particularly
1860 in the <filename>virtual/*</filename> namespace.
1861 You can use this variable to suppress BitBake's warnings.
1862 </para>
1863
1864 <para>
1865 To use the variable, list provider names (e.g.
1866 recipe names, <filename>virtual/kernel</filename>,
1867 and so forth).
1868 </para>
1869 </glossdef>
1870 </glossentry>
1871
1872 </glossdiv>
1873
1874<!--
1875 <glossdiv id='var-glossary-n'><title>N</title>
1876 </glossdiv>
1877-->
1878
1879 <glossdiv id='var-bb-glossary-o'><title>O</title>
1880
1881 <glossentry id='var-bb-OVERRIDES'><glossterm>OVERRIDES</glossterm>
1882 <glossdef>
1883 <para>
1884 BitBake uses <filename>OVERRIDES</filename> to control
1885 what variables are overridden after BitBake parses
1886 recipes and configuration files.
1887 </para>
1888
1889 <para>
1890 Following is a simple example that uses an overrides
1891 list based on machine architectures:
1892 <literallayout class='monospaced'>
1893 OVERRIDES = "arm:x86:mips:powerpc"
1894 </literallayout>
1895 You can find information on how to use
1896 <filename>OVERRIDES</filename> in the
1897 "<link linkend='conditional-syntax-overrides'>Conditional Syntax (Overrides)</link>"
1898 section.
1899 </para>
1900 </glossdef>
1901 </glossentry>
1902 </glossdiv>
1903
1904 <glossdiv id='var-bb-glossary-p'><title>P</title>
1905
1906 <glossentry id='var-bb-P4DIR'><glossterm>P4DIR</glossterm>
1907 <glossdef>
1908 <para>
1909 The directory in which a local copy of a Perforce depot
1910 is stored when it is fetched.
1911 </para>
1912 </glossdef>
1913 </glossentry>
1914
1915 <glossentry id='var-bb-PACKAGES'><glossterm>PACKAGES</glossterm>
1916 <glossdef>
1917 <para>The list of packages the recipe creates.
1918 </para>
1919 </glossdef>
1920 </glossentry>
1921
1922 <glossentry id='var-bb-PACKAGES_DYNAMIC'><glossterm>PACKAGES_DYNAMIC</glossterm>
1923 <glossdef>
1924 <para>
1925 A promise that your recipe satisfies runtime dependencies
1926 for optional modules that are found in other recipes.
1927 <filename>PACKAGES_DYNAMIC</filename>
1928 does not actually satisfy the dependencies, it only states that
1929 they should be satisfied.
1930 For example, if a hard, runtime dependency
1931 (<link linkend='var-bb-RDEPENDS'><filename>RDEPENDS</filename></link>)
1932 of another package is satisfied during the build
1933 through the <filename>PACKAGES_DYNAMIC</filename>
1934 variable, but a package with the module name is never actually
1935 produced, then the other package will be broken.
1936 </para>
1937 </glossdef>
1938 </glossentry>
1939
1940 <glossentry id='var-bb-PE'><glossterm>PE</glossterm>
1941 <glossdef>
1942 <para>
1943 The epoch of the recipe.
1944 By default, this variable is unset.
1945 The variable is used to make upgrades possible when the
1946 versioning scheme changes in some backwards incompatible
1947 way.
1948 </para>
1949 </glossdef>
1950 </glossentry>
1951
1952 <glossentry id='var-bb-PERSISTENT_DIR'><glossterm>PERSISTENT_DIR</glossterm>
1953 <glossdef>
1954 <para>
1955 Specifies the directory BitBake uses to store data that
1956 should be preserved between builds.
1957 In particular, the data stored is the data that uses
1958 BitBake's persistent data API and the data used by the
1959 PR Server and PR Service.
1960 </para>
1961 </glossdef>
1962 </glossentry>
1963
1964 <glossentry id='var-bb-PF'><glossterm>PF</glossterm>
1965 <glossdef>
1966 <para>
1967 Specifies the recipe or package name and includes all version and revision
1968 numbers (i.e. <filename>eglibc-2.13-r20+svnr15508/</filename> and
1969 <filename>bash-4.2-r1/</filename>).
1970 </para>
1971 </glossdef>
1972 </glossentry>
1973
1974 <glossentry id='var-bb-PN'><glossterm>PN</glossterm>
1975 <glossdef>
1976 <para>The recipe name.</para>
1977 </glossdef>
1978 </glossentry>
1979
1980 <glossentry id='var-bb-PR'><glossterm>PR</glossterm>
1981 <glossdef>
1982 <para>The revision of the recipe.
1983 </para>
1984 </glossdef>
1985 </glossentry>
1986
1987 <glossentry id='var-bb-PREFERRED_PROVIDER'><glossterm>PREFERRED_PROVIDER</glossterm>
1988 <glossdef>
1989 <para>
1990 Determines which recipe should be given preference when
1991 multiple recipes provide the same item.
1992 You should always suffix the variable with the name of the
1993 provided item, and you should set it to the
1994 <link linkend='var-bb-PN'><filename>PN</filename></link>
1995 of the recipe to which you want to give precedence.
1996 Some examples:
1997 <literallayout class='monospaced'>
1998 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1999 PREFERRED_PROVIDER_virtual/xserver = "xserver-xf86"
2000 PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
2001 </literallayout>
2002 </para>
2003 </glossdef>
2004 </glossentry>
2005
2006 <glossentry id='var-bb-PREFERRED_PROVIDERS'><glossterm>PREFERRED_PROVIDERS</glossterm>
2007 <glossdef>
2008 <para>
2009 Determines which recipe should be given preference for
2010 cases where multiple recipes provide the same item.
2011 Functionally,
2012 <filename>PREFERRED_PROVIDERS</filename> is identical to
2013 <link linkend='var-bb-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></link>.
2014 However, the <filename>PREFERRED_PROVIDERS</filename>
2015 variable lets you define preferences for multiple
2016 situations using the following form:
2017 <literallayout class='monospaced'>
2018 PREFERRED_PROVIDERS = "xxx:yyy aaa:bbb ..."
2019 </literallayout>
2020 This form is a convenient replacement for the following:
2021 <literallayout class='monospaced'>
2022 PREFERRED_PROVIDER_xxx = "yyy"
2023 PREFERRED_PROVIDER_aaa = "bbb"
2024 </literallayout>
2025 </para>
2026 </glossdef>
2027 </glossentry>
2028
2029 <glossentry id='var-bb-PREFERRED_VERSION'><glossterm>PREFERRED_VERSION</glossterm>
2030 <glossdef>
2031 <para>
2032 If there are multiple versions of recipes available, this
2033 variable determines which recipe should be given preference.
2034 You must always suffix the variable with the
2035 <link linkend='var-bb-PN'><filename>PN</filename></link>
2036 you want to select, and you should set
2037 <link linkend='var-bb-PV'><filename>PV</filename></link>
2038 accordingly for precedence.
2039 </para>
2040
2041 <para>
2042 The <filename>PREFERRED_VERSION</filename> variable
2043 supports limited wildcard use through the
2044 "<filename>%</filename>" character.
2045 You can use the character to match any number of
2046 characters, which can be useful when specifying versions
2047 that contain long revision numbers that potentially change.
2048 Here are two examples:
2049 <literallayout class='monospaced'>
2050 PREFERRED_VERSION_python = "2.7.3"
2051 PREFERRED_VERSION_linux-yocto = "4.12%"
2052 </literallayout>
2053 <note><title>Important</title>
2054 The use of the "<filename>%</filename>" character
2055 is limited in that it only works at the end of the
2056 string.
2057 You cannot use the wildcard character in any other
2058 location of the string.
2059 </note>
2060 </para>
2061 </glossdef>
2062 </glossentry>
2063
2064 <glossentry id='var-bb-PREMIRRORS'><glossterm>PREMIRRORS</glossterm>
2065 <glossdef>
2066 <para>
2067 Specifies additional paths from which BitBake gets source code.
2068 When the build system searches for source code, it first
2069 tries the local download directory.
2070 If that location fails, the build system tries locations
2071 defined by <filename>PREMIRRORS</filename>, the upstream
2072 source, and then locations specified by
2073 <link linkend='var-bb-MIRRORS'><filename>MIRRORS</filename></link>
2074 in that order.
2075 </para>
2076
2077 <para>
2078 Typically, you would add a specific server for the
2079 build system to attempt before any others by adding
2080 something like the following to your configuration:
2081 <literallayout class='monospaced'>
2082 PREMIRRORS_prepend = "\
2083 git://.*/.* http://www.yoctoproject.org/sources/ \n \
2084 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
2085 http://.*/.* http://www.yoctoproject.org/sources/ \n \
2086 https://.*/.* http://www.yoctoproject.org/sources/ \n"
2087 </literallayout>
2088 These changes cause the build system to intercept
2089 Git, FTP, HTTP, and HTTPS requests and direct them to
2090 the <filename>http://</filename> sources mirror.
2091 You can use <filename>file://</filename> URLs to point
2092 to local directories or network shares as well.
2093 </para>
2094 </glossdef>
2095 </glossentry>
2096
2097 <glossentry id='var-bb-PROVIDES'><glossterm>PROVIDES</glossterm>
2098 <glossdef>
2099 <para>
2100 A list of aliases by which a particular recipe can be
2101 known.
2102 By default, a recipe's own
2103 <filename><link linkend='var-bb-PN'>PN</link></filename>
2104 is implicitly already in its <filename>PROVIDES</filename>
2105 list.
2106 If a recipe uses <filename>PROVIDES</filename>, the
2107 additional aliases are synonyms for the recipe and can
2108 be useful satisfying dependencies of other recipes during
2109 the build as specified by
2110 <filename><link linkend='var-bb-DEPENDS'>DEPENDS</link></filename>.
2111 </para>
2112
2113 <para>
2114 Consider the following example
2115 <filename>PROVIDES</filename> statement from a recipe
2116 file <filename>libav_0.8.11.bb</filename>:
2117 <literallayout class='monospaced'>
2118 PROVIDES += "libpostproc"
2119 </literallayout>
2120 The <filename>PROVIDES</filename> statement results in
2121 the "libav" recipe also being known as "libpostproc".
2122 </para>
2123
2124 <para>
2125 In addition to providing recipes under alternate names,
2126 the <filename>PROVIDES</filename> mechanism is also used
2127 to implement virtual targets.
2128 A virtual target is a name that corresponds to some
2129 particular functionality (e.g. a Linux kernel).
2130 Recipes that provide the functionality in question list the
2131 virtual target in <filename>PROVIDES</filename>.
2132 Recipes that depend on the functionality in question can
2133 include the virtual target in
2134 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
2135 to leave the choice of provider open.
2136 </para>
2137
2138 <para>
2139 Conventionally, virtual targets have names on the form
2140 "virtual/function" (e.g. "virtual/kernel").
2141 The slash is simply part of the name and has no
2142 syntactical significance.
2143 </para>
2144 </glossdef>
2145 </glossentry>
2146
2147 <glossentry id='var-bb-PRSERV_HOST'><glossterm>PRSERV_HOST</glossterm>
2148 <glossdef>
2149 <para>
2150 The network based
2151 <link linkend='var-bb-PR'><filename>PR</filename></link>
2152 service host and port.
2153 </para>
2154
2155 <para>
2156 Following is an example of how the <filename>PRSERV_HOST</filename> variable is
2157 set:
2158 <literallayout class='monospaced'>
2159 PRSERV_HOST = "localhost:0"
2160 </literallayout>
2161 You must set the variable if you want to automatically
2162 start a local PR service.
2163 You can set <filename>PRSERV_HOST</filename> to other
2164 values to use a remote PR service.
2165 </para>
2166 </glossdef>
2167 </glossentry>
2168
2169 <glossentry id='var-bb-PV'><glossterm>PV</glossterm>
2170 <glossdef>
2171 <para>The version of the recipe.
2172 </para>
2173 </glossdef>
2174 </glossentry>
2175
2176 </glossdiv>
2177
2178<!--
2179 <glossdiv id='var-glossary-q'><title>Q</title>
2180 </glossdiv>
2181-->
2182
2183 <glossdiv id='var-bb-glossary-r'><title>R</title>
2184
2185 <glossentry id='var-bb-RDEPENDS'><glossterm>RDEPENDS</glossterm>
2186 <glossdef>
2187 <para>
2188 Lists a package's runtime dependencies (i.e. other packages)
2189 that must be installed in order for the built package to run
2190 correctly.
2191 If a package in this list cannot be found during the build,
2192 you will get a build error.
2193 </para>
2194
2195 <para>
2196 Because the <filename>RDEPENDS</filename> variable applies
2197 to packages being built, you should always use the variable
2198 in a form with an attached package name.
2199 For example, suppose you are building a development package
2200 that depends on the <filename>perl</filename> package.
2201 In this case, you would use the following
2202 <filename>RDEPENDS</filename> statement:
2203 <literallayout class='monospaced'>
2204 RDEPENDS_${PN}-dev += "perl"
2205 </literallayout>
2206 In the example, the development package depends on
2207 the <filename>perl</filename> package.
2208 Thus, the <filename>RDEPENDS</filename> variable has the
2209 <filename>${PN}-dev</filename> package name as part of the
2210 variable.
2211 </para>
2212
2213 <para>
2214 BitBake supports specifying versioned dependencies.
2215 Although the syntax varies depending on the packaging
2216 format, BitBake hides these differences from you.
2217 Here is the general syntax to specify versions with
2218 the <filename>RDEPENDS</filename> variable:
2219 <literallayout class='monospaced'>
2220 RDEPENDS_${PN} = "<replaceable>package</replaceable> (<replaceable>operator</replaceable> <replaceable>version</replaceable>)"
2221 </literallayout>
2222 For <filename>operator</filename>, you can specify the
2223 following:
2224 <literallayout class='monospaced'>
2225 =
2226 &lt;
2227 &gt;
2228 &lt;=
2229 &gt;=
2230 </literallayout>
2231 For example, the following sets up a dependency on version
2232 1.2 or greater of the package <filename>foo</filename>:
2233 <literallayout class='monospaced'>
2234 RDEPENDS_${PN} = "foo (>= 1.2)"
2235 </literallayout>
2236 </para>
2237
2238 <para>
2239 For information on build-time dependencies, see the
2240 <link linkend='var-bb-DEPENDS'><filename>DEPENDS</filename></link>
2241 variable.
2242 </para>
2243 </glossdef>
2244 </glossentry>
2245
2246 <glossentry id='var-bb-REPODIR'><glossterm>REPODIR</glossterm>
2247 <glossdef>
2248 <para>
2249 The directory in which a local copy of a
2250 <filename>google-repo</filename> directory is stored
2251 when it is synced.
2252 </para>
2253 </glossdef>
2254 </glossentry>
2255
2256 <glossentry id='var-bb-RPROVIDES'><glossterm>RPROVIDES</glossterm>
2257 <glossdef>
2258 <para>
2259 A list of package name aliases that a package also provides.
2260 These aliases are useful for satisfying runtime dependencies
2261 of other packages both during the build and on the target
2262 (as specified by
2263 <filename><link linkend='var-bb-RDEPENDS'>RDEPENDS</link></filename>).
2264 </para>
2265 <para>
2266 As with all package-controlling variables, you must always
2267 use the variable in conjunction with a package name override.
2268 Here is an example:
2269 <literallayout class='monospaced'>
2270 RPROVIDES_${PN} = "widget-abi-2"
2271 </literallayout>
2272 </para>
2273 </glossdef>
2274 </glossentry>
2275
2276 <glossentry id='var-bb-RRECOMMENDS'><glossterm>RRECOMMENDS</glossterm>
2277 <glossdef>
2278 <para>
2279 A list of packages that extends the usability of a package
2280 being built.
2281 The package being built does not depend on this list of
2282 packages in order to successfully build, but needs them for
2283 the extended usability.
2284 To specify runtime dependencies for packages, see the
2285 <filename><link linkend='var-bb-RDEPENDS'>RDEPENDS</link></filename>
2286 variable.
2287 </para>
2288
2289 <para>
2290 BitBake supports specifying versioned recommends.
2291 Although the syntax varies depending on the packaging
2292 format, BitBake hides these differences from you.
2293 Here is the general syntax to specify versions with
2294 the <filename>RRECOMMENDS</filename> variable:
2295 <literallayout class='monospaced'>
2296 RRECOMMENDS_${PN} = "<replaceable>package</replaceable> (<replaceable>operator</replaceable> <replaceable>version</replaceable>)"
2297 </literallayout>
2298 For <filename>operator</filename>, you can specify the
2299 following:
2300 <literallayout class='monospaced'>
2301 =
2302 &lt;
2303 &gt;
2304 &lt;=
2305 &gt;=
2306 </literallayout>
2307 For example, the following sets up a recommend on version
2308 1.2 or greater of the package <filename>foo</filename>:
2309 <literallayout class='monospaced'>
2310 RRECOMMENDS_${PN} = "foo (>= 1.2)"
2311 </literallayout>
2312 </para>
2313 </glossdef>
2314 </glossentry>
2315
2316 </glossdiv>
2317
2318 <glossdiv id='var-bb-glossary-s'><title>S</title>
2319
2320 <glossentry id='var-bb-SECTION'><glossterm>SECTION</glossterm>
2321 <glossdef>
2322 <para>The section in which packages should be categorized.</para>
2323 </glossdef>
2324 </glossentry>
2325
2326 <glossentry id='var-bb-SRC_URI'><glossterm>SRC_URI</glossterm>
2327 <glossdef>
2328 <para>
2329 The list of source files - local or remote.
2330 This variable tells BitBake which bits
2331 to pull for the build and how to pull them.
2332 For example, if the recipe or append file needs to
2333 fetch a single tarball from the Internet, the recipe or
2334 append file uses a <filename>SRC_URI</filename>
2335 entry that specifies that tarball.
2336 On the other hand, if the recipe or append file needs to
2337 fetch a tarball and include a custom file, the recipe or
2338 append file needs an <filename>SRC_URI</filename> variable
2339 that specifies all those sources.</para>
2340 <para>The following list explains the available URI protocols:
2341 <itemizedlist>
2342 <listitem><para><emphasis><filename>file://</filename> -</emphasis>
2343 Fetches files, which are usually files shipped with
2344 the metadata,
2345 from the local machine.
2346 The path is relative to the
2347 <link linkend='var-bb-FILESPATH'><filename>FILESPATH</filename></link>
2348 variable.</para></listitem>
2349 <listitem><para><emphasis><filename>bzr://</filename> -</emphasis> Fetches files from a
2350 Bazaar revision control repository.</para></listitem>
2351 <listitem><para><emphasis><filename>git://</filename> -</emphasis> Fetches files from a
2352 Git revision control repository.</para></listitem>
2353 <listitem><para><emphasis><filename>osc://</filename> -</emphasis> Fetches files from
2354 an OSC (OpenSUSE Build service) revision control repository.</para></listitem>
2355 <listitem><para><emphasis><filename>repo://</filename> -</emphasis> Fetches files from
2356 a repo (Git) repository.</para></listitem>
2357 <listitem><para><emphasis><filename>http://</filename> -</emphasis> Fetches files from
2358 the Internet using HTTP.</para></listitem>
2359 <listitem><para><emphasis><filename>https://</filename> -</emphasis> Fetches files
2360 from the Internet using HTTPS.</para></listitem>
2361 <listitem><para><emphasis><filename>ftp://</filename> -</emphasis> Fetches files
2362 from the Internet using FTP.</para></listitem>
2363 <listitem><para><emphasis><filename>cvs://</filename> -</emphasis> Fetches files from
2364 a CVS revision control repository.</para></listitem>
2365 <listitem><para><emphasis><filename>hg://</filename> -</emphasis> Fetches files from
2366 a Mercurial (<filename>hg</filename>) revision control repository.</para></listitem>
2367 <listitem><para><emphasis><filename>p4://</filename> -</emphasis> Fetches files from
2368 a Perforce (<filename>p4</filename>) revision control repository.</para></listitem>
2369 <listitem><para><emphasis><filename>ssh://</filename> -</emphasis> Fetches files from
2370 a secure shell.</para></listitem>
2371 <listitem><para><emphasis><filename>svn://</filename> -</emphasis> Fetches files from
2372 a Subversion (<filename>svn</filename>) revision control repository.</para></listitem>
2373 </itemizedlist>
2374 </para>
2375 <para>Here are some additional options worth mentioning:
2376 <itemizedlist>
2377 <listitem><para><emphasis><filename>unpack</filename> -</emphasis> Controls
2378 whether or not to unpack the file if it is an archive.
2379 The default action is to unpack the file.</para></listitem>
2380 <listitem><para><emphasis><filename>subdir</filename> -</emphasis> Places the file
2381 (or extracts its contents) into the specified
2382 subdirectory.
2383 This option is useful for unusual tarballs or other archives that
2384 do not have their files already in a subdirectory within the archive.
2385 </para></listitem>
2386 <listitem><para><emphasis><filename>name</filename> -</emphasis> Specifies a
2387 name to be used for association with <filename>SRC_URI</filename> checksums
2388 when you have more than one file specified in <filename>SRC_URI</filename>.
2389 </para></listitem>
2390 <listitem><para><emphasis><filename>downloadfilename</filename> -</emphasis> Specifies
2391 the filename used when storing the downloaded file.</para></listitem>
2392 </itemizedlist>
2393 </para>
2394 </glossdef>
2395 </glossentry>
2396
2397 <glossentry id='var-bb-SRCDATE'><glossterm>SRCDATE</glossterm>
2398 <glossdef>
2399 <para>
2400 The date of the source code used to build the package.
2401 This variable applies only if the source was fetched from a Source Code Manager (SCM).
2402 </para>
2403 </glossdef>
2404 </glossentry>
2405
2406 <glossentry id='var-bb-SRCREV'><glossterm>SRCREV</glossterm>
2407 <glossdef>
2408 <para>
2409 The revision of the source code used to build the package.
2410 This variable applies only when using Subversion, Git, Mercurial and Bazaar.
2411 If you want to build a fixed revision and you want
2412 to avoid performing a query on the remote repository every time
2413 BitBake parses your recipe, you should specify a <filename>SRCREV</filename> that is a
2414 full revision identifier and not just a tag.
2415 </para>
2416 </glossdef>
2417 </glossentry>
2418
2419 <glossentry id='var-bb-SRCREV_FORMAT'><glossterm>SRCREV_FORMAT</glossterm>
2420 <glossdef>
2421 <para>
2422 Helps construct valid
2423 <link linkend='var-bb-SRCREV'><filename>SRCREV</filename></link>
2424 values when multiple source controlled URLs are used in
2425 <link linkend='var-bb-SRC_URI'><filename>SRC_URI</filename></link>.
2426 </para>
2427
2428 <para>
2429 The system needs help constructing these values under these
2430 circumstances.
2431 Each component in the <filename>SRC_URI</filename>
2432 is assigned a name and these are referenced
2433 in the <filename>SRCREV_FORMAT</filename> variable.
2434 Consider an example with URLs named "machine" and "meta".
2435 In this case, <filename>SRCREV_FORMAT</filename> could look
2436 like "machine_meta" and those names would have the SCM
2437 versions substituted into each position.
2438 Only one <filename>AUTOINC</filename> placeholder is added
2439 and if needed.
2440 And, this placeholder is placed at the start of the
2441 returned string.
2442 </para>
2443 </glossdef>
2444 </glossentry>
2445
2446 <glossentry id='var-bb-STAMP'><glossterm>STAMP</glossterm>
2447 <glossdef>
2448 <para>
2449 Specifies the base path used to create recipe stamp files.
2450 The path to an actual stamp file is constructed by evaluating this
2451 string and then appending additional information.
2452 </para>
2453 </glossdef>
2454 </glossentry>
2455
2456 <glossentry id='var-bb-STAMPCLEAN'><glossterm>STAMPCLEAN</glossterm>
2457 <glossdef>
2458 <para>
2459 Specifies the base path used to create recipe stamp files.
2460 Unlike the
2461 <link linkend='var-bb-STAMP'><filename>STAMP</filename></link>
2462 variable, <filename>STAMPCLEAN</filename> can contain
2463 wildcards to match the range of files a clean operation
2464 should remove.
2465 BitBake uses a clean operation to remove any other stamps
2466 it should be removing when creating a new stamp.
2467 </para>
2468 </glossdef>
2469 </glossentry>
2470
2471 <glossentry id='var-bb-SUMMARY'><glossterm>SUMMARY</glossterm>
2472 <glossdef>
2473 <para>
2474 A short summary for the recipe, which is 72 characters or less.
2475 </para>
2476 </glossdef>
2477 </glossentry>
2478
2479 <glossentry id='var-bb-SVNDIR'><glossterm>SVNDIR</glossterm>
2480 <glossdef>
2481 <para>
2482 The directory in which files checked out of a Subversion
2483 system are stored.
2484 </para>
2485 </glossdef>
2486 </glossentry>
2487
2488 </glossdiv>
2489
2490 <glossdiv id='var-bb-glossary-t'><title>T</title>
2491
2492 <glossentry id='var-bb-T'><glossterm>T</glossterm>
2493 <glossdef>
2494 <para>Points to a directory were BitBake places
2495 temporary files, which consist mostly of task logs and
2496 scripts, when building a particular recipe.
2497 </para>
2498 </glossdef>
2499 </glossentry>
2500
2501 <glossentry id='var-bb-TOPDIR'><glossterm>TOPDIR</glossterm>
2502 <glossdef>
2503 <para>
2504 Points to the build directory.
2505 BitBake automatically sets this variable.
2506 </para>
2507 </glossdef>
2508 </glossentry>
2509
2510 </glossdiv>
2511
2512<!--
2513 <glossdiv id='var-glossary-u'><title>U</title>
2514 </glossdiv>
2515
2516 <glossdiv id='var-glossary-v'><title>V</title>
2517 </glossdiv>
2518
2519 <glossdiv id='var-glossary-w'><title>W</title>
2520 </glossdiv>
2521
2522 <glossdiv id='var-glossary-x'><title>X</title>
2523 </glossdiv>
2524
2525 <glossdiv id='var-glossary-y'><title>Y</title>
2526 </glossdiv>
2527
2528 <glossdiv id='var-glossary-z'><title>Z</title>
2529 </glossdiv>
2530-->
2531
2532
2533</glossary>
2534</chapter>
2535<!--
2536vim: expandtab tw=80 ts=4
2537-->
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-style.css b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-style.css
deleted file mode 100644
index 65da2a4e31..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-style.css
+++ /dev/null
@@ -1,984 +0,0 @@
1/*
2 Generic XHTML / DocBook XHTML CSS Stylesheet.
3
4 Browser wrangling and typographic design by
5 Oyvind Kolas / pippin@gimp.org
6
7 Customised for Poky by
8 Matthew Allum / mallum@o-hand.com
9
10 Thanks to:
11 Liam R. E. Quin
12 William Skaggs
13 Jakub Steiner
14
15 Structure
16 ---------
17
18 The stylesheet is divided into the following sections:
19
20 Positioning
21 Margins, paddings, width, font-size, clearing.
22 Decorations
23 Borders, style
24 Colors
25 Colors
26 Graphics
27 Graphical backgrounds
28 Nasty IE tweaks
29 Workarounds needed to make it work in internet explorer,
30 currently makes the stylesheet non validating, but up until
31 this point it is validating.
32 Mozilla extensions
33 Transparency for footer
34 Rounded corners on boxes
35
36*/
37
38
39 /*************** /
40 / Positioning /
41/ ***************/
42
43body {
44 font-family: Verdana, Sans, sans-serif;
45
46 min-width: 640px;
47 width: 80%;
48 margin: 0em auto;
49 padding: 2em 5em 5em 5em;
50 color: #333;
51}
52
53h1,h2,h3,h4,h5,h6,h7 {
54 font-family: Arial, Sans;
55 color: #00557D;
56 clear: both;
57}
58
59h1 {
60 font-size: 2em;
61 text-align: left;
62 padding: 0em 0em 0em 0em;
63 margin: 2em 0em 0em 0em;
64}
65
66h2.subtitle {
67 margin: 0.10em 0em 3.0em 0em;
68 padding: 0em 0em 0em 0em;
69 font-size: 1.8em;
70 padding-left: 20%;
71 font-weight: normal;
72 font-style: italic;
73}
74
75h2 {
76 margin: 2em 0em 0.66em 0em;
77 padding: 0.5em 0em 0em 0em;
78 font-size: 1.5em;
79 font-weight: bold;
80}
81
82h3.subtitle {
83 margin: 0em 0em 1em 0em;
84 padding: 0em 0em 0em 0em;
85 font-size: 142.14%;
86 text-align: right;
87}
88
89h3 {
90 margin: 1em 0em 0.5em 0em;
91 padding: 1em 0em 0em 0em;
92 font-size: 140%;
93 font-weight: bold;
94}
95
96h4 {
97 margin: 1em 0em 0.5em 0em;
98 padding: 1em 0em 0em 0em;
99 font-size: 120%;
100 font-weight: bold;
101}
102
103h5 {
104 margin: 1em 0em 0.5em 0em;
105 padding: 1em 0em 0em 0em;
106 font-size: 110%;
107 font-weight: bold;
108}
109
110h6 {
111 margin: 1em 0em 0em 0em;
112 padding: 1em 0em 0em 0em;
113 font-size: 110%;
114 font-weight: bold;
115}
116
117.authorgroup {
118 background-color: transparent;
119 background-repeat: no-repeat;
120 padding-top: 256px;
121 background-image: url("figures/bitbake-title.png");
122 background-position: left top;
123 margin-top: -256px;
124 padding-right: 50px;
125 margin-left: 0px;
126 text-align: right;
127 width: 740px;
128}
129
130h3.author {
131 margin: 0em 0me 0em 0em;
132 padding: 0em 0em 0em 0em;
133 font-weight: normal;
134 font-size: 100%;
135 color: #333;
136 clear: both;
137}
138
139.author tt.email {
140 font-size: 66%;
141}
142
143.titlepage hr {
144 width: 0em;
145 clear: both;
146}
147
148.revhistory {
149 padding-top: 2em;
150 clear: both;
151}
152
153.toc,
154.list-of-tables,
155.list-of-examples,
156.list-of-figures {
157 padding: 1.33em 0em 2.5em 0em;
158 color: #00557D;
159}
160
161.toc p,
162.list-of-tables p,
163.list-of-figures p,
164.list-of-examples p {
165 padding: 0em 0em 0em 0em;
166 padding: 0em 0em 0.3em;
167 margin: 1.5em 0em 0em 0em;
168}
169
170.toc p b,
171.list-of-tables p b,
172.list-of-figures p b,
173.list-of-examples p b{
174 font-size: 100.0%;
175 font-weight: bold;
176}
177
178.toc dl,
179.list-of-tables dl,
180.list-of-figures dl,
181.list-of-examples dl {
182 margin: 0em 0em 0.5em 0em;
183 padding: 0em 0em 0em 0em;
184}
185
186.toc dt {
187 margin: 0em 0em 0em 0em;
188 padding: 0em 0em 0em 0em;
189}
190
191.toc dd {
192 margin: 0em 0em 0em 2.6em;
193 padding: 0em 0em 0em 0em;
194}
195
196div.glossary dl,
197div.variablelist dl {
198}
199
200.glossary dl dt,
201.variablelist dl dt,
202.variablelist dl dt span.term {
203 font-weight: normal;
204 width: 20em;
205 text-align: right;
206}
207
208.variablelist dl dt {
209 margin-top: 0.5em;
210}
211
212.glossary dl dd,
213.variablelist dl dd {
214 margin-top: -1em;
215 margin-left: 25.5em;
216}
217
218.glossary dd p,
219.variablelist dd p {
220 margin-top: 0em;
221 margin-bottom: 1em;
222}
223
224
225div.calloutlist table td {
226 padding: 0em 0em 0em 0em;
227 margin: 0em 0em 0em 0em;
228}
229
230div.calloutlist table td p {
231 margin-top: 0em;
232 margin-bottom: 1em;
233}
234
235div p.copyright {
236 text-align: left;
237}
238
239div.legalnotice p.legalnotice-title {
240 margin-bottom: 0em;
241}
242
243p {
244 line-height: 1.5em;
245 margin-top: 0em;
246
247}
248
249dl {
250 padding-top: 0em;
251}
252
253hr {
254 border: solid 1px;
255}
256
257
258.mediaobject,
259.mediaobjectco {
260 text-align: center;
261}
262
263img {
264 border: none;
265}
266
267ul {
268 padding: 0em 0em 0em 1.5em;
269}
270
271ul li {
272 padding: 0em 0em 0em 0em;
273}
274
275ul li p {
276 text-align: left;
277}
278
279table {
280 width :100%;
281}
282
283th {
284 padding: 0.25em;
285 text-align: left;
286 font-weight: normal;
287 vertical-align: top;
288}
289
290td {
291 padding: 0.25em;
292 vertical-align: top;
293}
294
295p a[id] {
296 margin: 0px;
297 padding: 0px;
298 display: inline;
299 background-image: none;
300}
301
302a {
303 text-decoration: underline;
304 color: #444;
305}
306
307pre {
308 overflow: auto;
309}
310
311a:hover {
312 text-decoration: underline;
313 /*font-weight: bold;*/
314}
315
316/* This style defines how the permalink character
317 appears by itself and when hovered over with
318 the mouse. */
319
320[alt='Permalink'] { color: #eee; }
321[alt='Permalink']:hover { color: black; }
322
323
324div.informalfigure,
325div.informalexample,
326div.informaltable,
327div.figure,
328div.table,
329div.example {
330 margin: 1em 0em;
331 padding: 1em;
332 page-break-inside: avoid;
333}
334
335
336div.informalfigure p.title b,
337div.informalexample p.title b,
338div.informaltable p.title b,
339div.figure p.title b,
340div.example p.title b,
341div.table p.title b{
342 padding-top: 0em;
343 margin-top: 0em;
344 font-size: 100%;
345 font-weight: normal;
346}
347
348.mediaobject .caption,
349.mediaobject .caption p {
350 text-align: center;
351 font-size: 80%;
352 padding-top: 0.5em;
353 padding-bottom: 0.5em;
354}
355
356.epigraph {
357 padding-left: 55%;
358 margin-bottom: 1em;
359}
360
361.epigraph p {
362 text-align: left;
363}
364
365.epigraph .quote {
366 font-style: italic;
367}
368.epigraph .attribution {
369 font-style: normal;
370 text-align: right;
371}
372
373span.application {
374 font-style: italic;
375}
376
377.programlisting {
378 font-family: monospace;
379 font-size: 80%;
380 white-space: pre;
381 margin: 1.33em 0em;
382 padding: 1.33em;
383}
384
385.tip,
386.warning,
387.caution,
388.note {
389 margin-top: 1em;
390 margin-bottom: 1em;
391
392}
393
394/* force full width of table within div */
395.tip table,
396.warning table,
397.caution table,
398.note table {
399 border: none;
400 width: 100%;
401}
402
403
404.tip table th,
405.warning table th,
406.caution table th,
407.note table th {
408 padding: 0.8em 0.0em 0.0em 0.0em;
409 margin : 0em 0em 0em 0em;
410}
411
412.tip p,
413.warning p,
414.caution p,
415.note p {
416 margin-top: 0.5em;
417 margin-bottom: 0.5em;
418 padding-right: 1em;
419 text-align: left;
420}
421
422.acronym {
423 text-transform: uppercase;
424}
425
426b.keycap,
427.keycap {
428 padding: 0.09em 0.3em;
429 margin: 0em;
430}
431
432.itemizedlist li {
433 clear: none;
434}
435
436.filename {
437 font-size: medium;
438 font-family: Courier, monospace;
439}
440
441
442div.navheader, div.heading{
443 position: absolute;
444 left: 0em;
445 top: 0em;
446 width: 100%;
447 background-color: #cdf;
448 width: 100%;
449}
450
451div.navfooter, div.footing{
452 position: fixed;
453 left: 0em;
454 bottom: 0em;
455 background-color: #eee;
456 width: 100%;
457}
458
459
460div.navheader td,
461div.navfooter td {
462 font-size: 66%;
463}
464
465div.navheader table th {
466 /*font-family: Georgia, Times, serif;*/
467 /*font-size: x-large;*/
468 font-size: 80%;
469}
470
471div.navheader table {
472 border-left: 0em;
473 border-right: 0em;
474 border-top: 0em;
475 width: 100%;
476}
477
478div.navfooter table {
479 border-left: 0em;
480 border-right: 0em;
481 border-bottom: 0em;
482 width: 100%;
483}
484
485div.navheader table td a,
486div.navfooter table td a {
487 color: #777;
488 text-decoration: none;
489}
490
491/* normal text in the footer */
492div.navfooter table td {
493 color: black;
494}
495
496div.navheader table td a:visited,
497div.navfooter table td a:visited {
498 color: #444;
499}
500
501
502/* links in header and footer */
503div.navheader table td a:hover,
504div.navfooter table td a:hover {
505 text-decoration: underline;
506 background-color: transparent;
507 color: #33a;
508}
509
510div.navheader hr,
511div.navfooter hr {
512 display: none;
513}
514
515
516.qandaset tr.question td p {
517 margin: 0em 0em 1em 0em;
518 padding: 0em 0em 0em 0em;
519}
520
521.qandaset tr.answer td p {
522 margin: 0em 0em 1em 0em;
523 padding: 0em 0em 0em 0em;
524}
525.answer td {
526 padding-bottom: 1.5em;
527}
528
529.emphasis {
530 font-weight: bold;
531}
532
533
534 /************* /
535 / decorations /
536/ *************/
537
538.titlepage {
539}
540
541.part .title {
542}
543
544.subtitle {
545 border: none;
546}
547
548/*
549h1 {
550 border: none;
551}
552
553h2 {
554 border-top: solid 0.2em;
555 border-bottom: solid 0.06em;
556}
557
558h3 {
559 border-top: 0em;
560 border-bottom: solid 0.06em;
561}
562
563h4 {
564 border: 0em;
565 border-bottom: solid 0.06em;
566}
567
568h5 {
569 border: 0em;
570}
571*/
572
573.programlisting {
574 border: solid 1px;
575}
576
577div.figure,
578div.table,
579div.informalfigure,
580div.informaltable,
581div.informalexample,
582div.example {
583 border: 1px solid;
584}
585
586
587
588.tip,
589.warning,
590.caution,
591.note {
592 border: 1px solid;
593}
594
595.tip table th,
596.warning table th,
597.caution table th,
598.note table th {
599 border-bottom: 1px solid;
600}
601
602.question td {
603 border-top: 1px solid black;
604}
605
606.answer {
607}
608
609
610b.keycap,
611.keycap {
612 border: 1px solid;
613}
614
615
616div.navheader, div.heading{
617 border-bottom: 1px solid;
618}
619
620
621div.navfooter, div.footing{
622 border-top: 1px solid;
623}
624
625 /********* /
626 / colors /
627/ *********/
628
629body {
630 color: #333;
631 background: white;
632}
633
634a {
635 background: transparent;
636}
637
638a:hover {
639 background-color: #dedede;
640}
641
642
643h1,
644h2,
645h3,
646h4,
647h5,
648h6,
649h7,
650h8 {
651 background-color: transparent;
652}
653
654hr {
655 border-color: #aaa;
656}
657
658
659.tip, .warning, .caution, .note {
660 border-color: #fff;
661}
662
663
664.tip table th,
665.warning table th,
666.caution table th,
667.note table th {
668 border-bottom-color: #fff;
669}
670
671
672.warning {
673 background-color: #f0f0f2;
674}
675
676.caution {
677 background-color: #f0f0f2;
678}
679
680.tip {
681 background-color: #f0f0f2;
682}
683
684.note {
685 background-color: #f0f0f2;
686}
687
688.glossary dl dt,
689.variablelist dl dt,
690.variablelist dl dt span.term {
691 color: #044;
692}
693
694div.figure,
695div.table,
696div.example,
697div.informalfigure,
698div.informaltable,
699div.informalexample {
700 border-color: #aaa;
701}
702
703pre.programlisting {
704 color: black;
705 background-color: #fff;
706 border-color: #aaa;
707 border-width: 2px;
708}
709
710.guimenu,
711.guilabel,
712.guimenuitem {
713 background-color: #eee;
714}
715
716
717b.keycap,
718.keycap {
719 background-color: #eee;
720 border-color: #999;
721}
722
723
724div.navheader {
725 border-color: black;
726}
727
728
729div.navfooter {
730 border-color: black;
731}
732
733
734 /*********** /
735 / graphics /
736/ ***********/
737
738/*
739body {
740 background-image: url("images/body_bg.jpg");
741 background-attachment: fixed;
742}
743
744.navheader,
745.note,
746.tip {
747 background-image: url("images/note_bg.jpg");
748 background-attachment: fixed;
749}
750
751.warning,
752.caution {
753 background-image: url("images/warning_bg.jpg");
754 background-attachment: fixed;
755}
756
757.figure,
758.informalfigure,
759.example,
760.informalexample,
761.table,
762.informaltable {
763 background-image: url("images/figure_bg.jpg");
764 background-attachment: fixed;
765}
766
767*/
768h1,
769h2,
770h3,
771h4,
772h5,
773h6,
774h7{
775}
776
777/*
778Example of how to stick an image as part of the title.
779
780div.article .titlepage .title
781{
782 background-image: url("figures/white-on-black.png");
783 background-position: center;
784 background-repeat: repeat-x;
785}
786*/
787
788div.preface .titlepage .title,
789div.colophon .title,
790div.chapter .titlepage .title,
791div.article .titlepage .title
792{
793}
794
795div.section div.section .titlepage .title,
796div.sect2 .titlepage .title {
797 background: none;
798}
799
800
801h1.title {
802 background-color: transparent;
803 background-repeat: no-repeat;
804 height: 256px;
805 text-indent: -9000px;
806 overflow:hidden;
807}
808
809h2.subtitle {
810 background-color: transparent;
811 text-indent: -9000px;
812 overflow:hidden;
813 width: 0px;
814 display: none;
815}
816
817 /*************************************** /
818 / pippin.gimp.org specific alterations /
819/ ***************************************/
820
821/*
822div.heading, div.navheader {
823 color: #777;
824 font-size: 80%;
825 padding: 0;
826 margin: 0;
827 text-align: left;
828 position: absolute;
829 top: 0px;
830 left: 0px;
831 width: 100%;
832 height: 50px;
833 background: url('/gfx/heading_bg.png') transparent;
834 background-repeat: repeat-x;
835 background-attachment: fixed;
836 border: none;
837}
838
839div.heading a {
840 color: #444;
841}
842
843div.footing, div.navfooter {
844 border: none;
845 color: #ddd;
846 font-size: 80%;
847 text-align:right;
848
849 width: 100%;
850 padding-top: 10px;
851 position: absolute;
852 bottom: 0px;
853 left: 0px;
854
855 background: url('/gfx/footing_bg.png') transparent;
856}
857*/
858
859
860
861 /****************** /
862 / nasty ie tweaks /
863/ ******************/
864
865/*
866div.heading, div.navheader {
867 width:expression(document.body.clientWidth + "px");
868}
869
870div.footing, div.navfooter {
871 width:expression(document.body.clientWidth + "px");
872 margin-left:expression("-5em");
873}
874body {
875 padding:expression("4em 5em 0em 5em");
876}
877*/
878
879 /**************************************** /
880 / mozilla vendor specific css extensions /
881/ ****************************************/
882/*
883div.navfooter, div.footing{
884 -moz-opacity: 0.8em;
885}
886
887div.figure,
888div.table,
889div.informalfigure,
890div.informaltable,
891div.informalexample,
892div.example,
893.tip,
894.warning,
895.caution,
896.note {
897 -moz-border-radius: 0.5em;
898}
899
900b.keycap,
901.keycap {
902 -moz-border-radius: 0.3em;
903}
904*/
905
906table tr td table tr td {
907 display: none;
908}
909
910
911hr {
912 display: none;
913}
914
915table {
916 border: 0em;
917}
918
919 .photo {
920 float: right;
921 margin-left: 1.5em;
922 margin-bottom: 1.5em;
923 margin-top: 0em;
924 max-width: 17em;
925 border: 1px solid gray;
926 padding: 3px;
927 background: white;
928}
929 .seperator {
930 padding-top: 2em;
931 clear: both;
932 }
933
934 #validators {
935 margin-top: 5em;
936 text-align: right;
937 color: #777;
938 }
939 @media print {
940 body {
941 font-size: 8pt;
942 }
943 .noprint {
944 display: none;
945 }
946 }
947
948
949.tip,
950.note {
951 background: #f0f0f2;
952 color: #333;
953 padding: 20px;
954 margin: 20px;
955}
956
957.tip h3,
958.note h3 {
959 padding: 0em;
960 margin: 0em;
961 font-size: 2em;
962 font-weight: bold;
963 color: #333;
964}
965
966.tip a,
967.note a {
968 color: #333;
969 text-decoration: underline;
970}
971
972.footnote {
973 font-size: small;
974 color: #333;
975}
976
977/* Changes the announcement text */
978.tip h3,
979.warning h3,
980.caution h3,
981.note h3 {
982 font-size:large;
983 color: #00557D;
984}
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual.xml
deleted file mode 100644
index d793265c9a..0000000000
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual.xml
+++ /dev/null
@@ -1,88 +0,0 @@
1<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4<book id='bitbake-user-manual' lang='en'
5 xmlns:xi="http://www.w3.org/2003/XInclude"
6 xmlns="http://docbook.org/ns/docbook"
7 >
8 <bookinfo>
9
10 <mediaobject>
11 <imageobject>
12 <imagedata fileref='figures/bitbake-title.png'
13 format='SVG'
14 align='left' scalefit='1' width='100%'/>
15 </imageobject>
16 </mediaobject>
17
18 <title>
19 BitBake User Manual
20 </title>
21
22 <authorgroup>
23 <author>
24 <firstname>Richard Purdie, Chris Larson, and </firstname> <surname>Phil Blundell</surname>
25 <affiliation>
26 <orgname>BitBake Community</orgname>
27 </affiliation>
28 <email>bitbake-devel@lists.openembedded.org</email>
29 </author>
30 </authorgroup>
31
32<!--
33# Add in some revision history if we want it here.
34 <revhistory>
35 <revision>
36 <revnumber>x.x</revnumber>
37 <date>dd month year</date>
38 <revremark>Some relevent comment</revremark>
39 </revision>
40 <revision>
41 <revnumber>x.x</revnumber>
42 <date>dd month year</date>
43 <revremark>Some relevent comment</revremark>
44 </revision>
45 <revision>
46 <revnumber>x.x</revnumber>
47 <date>dd month year</date>
48 <revremark>Some relevent comment</revremark>
49 </revision>
50 <revision>
51 <revnumber>x.x</revnumber>
52 <date>dd month year</date>
53 <revremark>Some relevent comment</revremark>
54 </revision>
55 </revhistory>
56-->
57
58 <copyright>
59 <year>2004-2018</year>
60 <holder>Richard Purdie</holder>
61 <holder>Chris Larson</holder>
62 <holder>and Phil Blundell</holder>
63 </copyright>
64
65 <legalnotice>
66 <para>
67 This work is licensed under the Creative Commons Attribution License.
68 To view a copy of this license, visit
69 <ulink url="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</ulink>
70 or send a letter to Creative Commons, 444 Castro Street,
71 Suite 900, Mountain View, California 94041, USA.
72 </para>
73 </legalnotice>
74 </bookinfo>
75
76 <xi:include href="bitbake-user-manual-intro.xml"/>
77
78 <xi:include href="bitbake-user-manual-execution.xml"/>
79
80 <xi:include href="bitbake-user-manual-metadata.xml"/>
81
82 <xi:include href="bitbake-user-manual-fetching.xml"/>
83
84 <xi:include href="bitbake-user-manual-ref-variables.xml"/>
85
86 <xi:include href="bitbake-user-manual-hello.xml"/>
87
88</book>
diff --git a/bitbake/doc/bitbake-user-manual/html.css b/bitbake/doc/bitbake-user-manual/html.css
deleted file mode 100644
index 6eedfd3189..0000000000
--- a/bitbake/doc/bitbake-user-manual/html.css
+++ /dev/null
@@ -1,281 +0,0 @@
1/* Feuille de style DocBook du projet Traduc.org */
2/* DocBook CSS stylesheet of the Traduc.org project */
3
4/* (c) Jean-Philippe Guérard - 14 août 2004 */
5/* (c) Jean-Philippe Guérard - 14 August 2004 */
6
7/* Cette feuille de style est libre, vous pouvez la */
8/* redistribuer et la modifier selon les termes de la Licence */
9/* Art Libre. Vous trouverez un exemplaire de cette Licence sur */
10/* http://tigreraye.org/Petit-guide-du-traducteur.html#licence-art-libre */
11
12/* This work of art is free, you can redistribute it and/or */
13/* modify it according to terms of the Free Art license. You */
14/* will find a specimen of this license on the Copyleft */
15/* Attitude web site: http://artlibre.org as well as on other */
16/* sites. */
17/* Please note that the French version of this licence as shown */
18/* on http://tigreraye.org/Petit-guide-du-traducteur.html#licence-art-libre */
19/* is only official licence of this document. The English */
20/* is only provided to help you understand this licence. */
21
22/* La dernière version de cette feuille de style est toujours */
23/* disponible sur : http://tigreraye.org/style.css */
24/* Elle est également disponible sur : */
25/* http://www.traduc.org/docs/HOWTO/lecture/style.css */
26
27/* The latest version of this stylesheet is available from: */
28/* http://tigreraye.org/style.css */
29/* It is also available on: */
30/* http://www.traduc.org/docs/HOWTO/lecture/style.css */
31
32/* N'hésitez pas à envoyer vos commentaires et corrections à */
33/* Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org> */
34
35/* Please send feedback and bug reports to */
36/* Jean-Philippe Guérard <jean-philippe.guerard@tigreraye.org> */
37
38/* $Id: style.css,v 1.14 2004/09/10 20:12:09 fevrier Exp fevrier $ */
39
40/* Présentation générale du document */
41/* Overall document presentation */
42
43body {
44 /*
45 font-family: Apolline, "URW Palladio L", Garamond, jGaramond,
46 "Bitstream Cyberbit", "Palatino Linotype", serif;
47 */
48 margin: 7%;
49 background-color: white;
50}
51
52/* Taille du texte */
53/* Text size */
54
55* { font-size: 100%; }
56
57/* Gestion des textes mis en relief imbriqués */
58/* Embedded emphasis */
59
60em { font-style: italic; }
61em em { font-style: normal; }
62em em em { font-style: italic; }
63
64/* Titres */
65/* Titles */
66
67h1 { font-size: 200%; font-weight: 900; }
68h2 { font-size: 160%; font-weight: 900; }
69h3 { font-size: 130%; font-weight: bold; }
70h4 { font-size: 115%; font-weight: bold; }
71h5 { font-size: 108%; font-weight: bold; }
72h6 { font-weight: bold; }
73
74/* Nom de famille en petites majuscules (uniquement en français) */
75/* Last names in small caps (for French only) */
76
77*[class~="surname"]:lang(fr) { font-variant: small-caps; }
78
79/* Blocs de citation */
80/* Quotation blocs */
81
82div[class~="blockquote"] {
83 border: solid 2px #AAA;
84 padding: 5px;
85 margin: 5px;
86}
87
88div[class~="blockquote"] > table {
89 border: none;
90}
91
92/* Blocs litéraux : fond gris clair */
93/* Literal blocs: light gray background */
94
95*[class~="literallayout"] {
96 background: #f0f0f0;
97 padding: 5px;
98 margin: 5px;
99}
100
101/* Programmes et captures texte : fond bleu clair */
102/* Listing and text screen snapshots: light blue background */
103
104*[class~="programlisting"], *[class~="screen"] {
105 background: #f0f0ff;
106 padding: 5px;
107 margin: 5px;
108}
109
110/* Les textes à remplacer sont surlignés en vert pâle */
111/* Replaceable text in highlighted in pale green */
112
113*[class~="replaceable"] {
114 background-color: #98fb98;
115 font-style: normal; }
116
117/* Tables : fonds gris clair & bords simples */
118/* Tables: light gray background and solid borders */
119
120*[class~="table"] *[class~="title"] { width:100%; border: 0px; }
121
122table {
123 border: 1px solid #aaa;
124 border-collapse: collapse;
125 padding: 2px;
126 margin: 5px;
127}
128
129/* Listes simples en style table */
130/* Simples lists in table presentation */
131
132table[class~="simplelist"] {
133 background-color: #F0F0F0;
134 margin: 5px;
135 border: solid 1px #AAA;
136}
137
138table[class~="simplelist"] td {
139 border: solid 1px #AAA;
140}
141
142/* Les tables */
143/* Tables */
144
145*[class~="table"] table {
146 background-color: #F0F0F0;
147 border: solid 1px #AAA;
148}
149*[class~="informaltable"] table { background-color: #F0F0F0; }
150
151th,td {
152 vertical-align: baseline;
153 text-align: left;
154 padding: 0.1em 0.3em;
155 empty-cells: show;
156}
157
158/* Alignement des colonnes */
159/* Colunms alignment */
160
161td[align=center] , th[align=center] { text-align: center; }
162td[align=right] , th[align=right] { text-align: right; }
163td[align=left] , th[align=left] { text-align: left; }
164td[align=justify] , th[align=justify] { text-align: justify; }
165
166/* Pas de marge autour des images */
167/* No inside margins for images */
168
169img { border: 0; }
170
171/* Les liens ne sont pas soulignés */
172/* No underlines for links */
173
174:link , :visited , :active { text-decoration: none; }
175
176/* Prudence : cadre jaune et fond jaune clair */
177/* Caution: yellow border and light yellow background */
178
179*[class~="caution"] {
180 border: solid 2px yellow;
181 background-color: #ffffe0;
182 padding: 1em 6px 1em ;
183 margin: 5px;
184}
185
186*[class~="caution"] th {
187 vertical-align: middle
188}
189
190*[class~="caution"] table {
191 background-color: #ffffe0;
192 border: none;
193}
194
195/* Note importante : cadre jaune et fond jaune clair */
196/* Important: yellow border and light yellow background */
197
198*[class~="important"] {
199 border: solid 2px yellow;
200 background-color: #ffffe0;
201 padding: 1em 6px 1em;
202 margin: 5px;
203}
204
205*[class~="important"] th {
206 vertical-align: middle
207}
208
209*[class~="important"] table {
210 background-color: #ffffe0;
211 border: none;
212}
213
214/* Mise en évidence : texte légèrement plus grand */
215/* Highlights: slightly larger texts */
216
217*[class~="highlights"] {
218 font-size: 110%;
219}
220
221/* Note : cadre bleu et fond bleu clair */
222/* Notes: blue border and light blue background */
223
224*[class~="note"] {
225 border: solid 2px #7099C5;
226 background-color: #f0f0ff;
227 padding: 1em 6px 1em ;
228 margin: 5px;
229}
230
231*[class~="note"] th {
232 vertical-align: middle
233}
234
235*[class~="note"] table {
236 background-color: #f0f0ff;
237 border: none;
238}
239
240/* Astuce : cadre vert et fond vert clair */
241/* Tip: green border and light green background */
242
243*[class~="tip"] {
244 border: solid 2px #00ff00;
245 background-color: #f0ffff;
246 padding: 1em 6px 1em ;
247 margin: 5px;
248}
249
250*[class~="tip"] th {
251 vertical-align: middle;
252}
253
254*[class~="tip"] table {
255 background-color: #f0ffff;
256 border: none;
257}
258
259/* Avertissement : cadre rouge et fond rouge clair */
260/* Warning: red border and light red background */
261
262*[class~="warning"] {
263 border: solid 2px #ff0000;
264 background-color: #fff0f0;
265 padding: 1em 6px 1em ;
266 margin: 5px;
267}
268
269*[class~="warning"] th {
270 vertical-align: middle;
271}
272
273
274*[class~="warning"] table {
275 background-color: #fff0f0;
276 border: none;
277}
278
279/* Fin */
280/* The End */
281