mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
bitbake: user-manual-bitbakecommand: Various edits/cleanups
(Bitbake rev: f079e0886b1b191d84621057f9752cc32bfabb44) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -2,16 +2,16 @@
|
|||||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||||
|
|
||||||
<chapter>
|
<chapter>
|
||||||
<title>The BitBake command</title>
|
<title>The BitBake Command</title>
|
||||||
|
|
||||||
<section id='bitbake-command-introduction'>
|
<section id='bitbake-command-introduction'>
|
||||||
<title>Introduction</title>
|
<title>Introduction</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
bitbake is the primary command in the system.
|
Bitbake is the primary command in the system.
|
||||||
It facilitates executing tasks in a single .bb
|
It facilitates executing tasks in a single <filename>.bb</filename>
|
||||||
file, or executing a given task on a set of multiple
|
file, or executing a given task on a set of multiple
|
||||||
.bb files, accounting for interdependencies
|
<filename>.bb</filename> files, accounting for interdependencies
|
||||||
amongst them.
|
amongst them.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
@@ -20,8 +20,9 @@
|
|||||||
<title>Usage and syntax</title>
|
<title>Usage and syntax</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
Following is the usage and syntax for BitBake:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
<prompt>$ </prompt>bitbake --help
|
$ bitbake -h
|
||||||
Usage: bitbake [options] [recipename/target ...]
|
Usage: bitbake [options] [recipename/target ...]
|
||||||
|
|
||||||
Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
|
Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
|
||||||
@@ -99,23 +100,30 @@ Options:
|
|||||||
<section id='bitbake-examples'>
|
<section id='bitbake-examples'>
|
||||||
<title>Examples</title>
|
<title>Examples</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This section presents some examples showing how to use BitBake.
|
||||||
|
</para>
|
||||||
|
|
||||||
<section id='example-executing-a-task-against-a-single-recipe'>
|
<section id='example-executing-a-task-against-a-single-recipe'>
|
||||||
<title>Executing a task against a single .bb</title>
|
<title>Executing a Task Against a Single Recipe</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Executing tasks for a single file is relatively simple.
|
Executing tasks for a single recipe file is relatively simple.
|
||||||
You specify the file in question, and BitBake parses
|
You specify the file in question, and BitBake parses
|
||||||
it and executes the specified task (or <quote>build</quote> by default).
|
it and executes the specified task (or “build” by default).
|
||||||
It obeys intertask dependencies when doing so.
|
BitBake obeys inter-task dependencies when doing
|
||||||
|
so.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<para><quote>clean</quote> task:</para>
|
The following command runs the clean task on the
|
||||||
|
<filename>foo_1.0.bb</filename> recipe file:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ bitbake -b foo.bb -c clean
|
$ bitbake -b foo.bb -c clean
|
||||||
</literallayout>
|
</literallayout>
|
||||||
|
The following command runs the build task, which is
|
||||||
<para><quote>build</quote> task:</para>
|
the default task, on the <filename>foo_1.0.bb</filename>
|
||||||
|
recipe file:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ bitbake -b foo_1.0.bb
|
$ bitbake -b foo_1.0.bb
|
||||||
</literallayout>
|
</literallayout>
|
||||||
@@ -123,20 +131,21 @@ Options:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='executing-tasks-against-a-set-of-recipe-files'>
|
<section id='executing-tasks-against-a-set-of-recipe-files'>
|
||||||
<title>Executing tasks against a set of .bb files</title>
|
<title>Executing Tasks Against a Set of Recipe Files</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
There are a number of additional complexities introduced
|
There are a number of additional complexities introduced
|
||||||
when one wants to manage multiple .bb
|
when one wants to manage multiple <filename>.bb</filename>
|
||||||
files.
|
files.
|
||||||
Clearly there needs to be a way to tell BitBake what
|
Clearly there needs to be a way to tell BitBake what
|
||||||
files are available, and of those, which we
|
files are available, and of those, which we
|
||||||
want to execute at this time
|
want to execute at this time.
|
||||||
There also needs to be a way for each .bb
|
There also needs to be a way for each <filename>.bb</filename>
|
||||||
to express its dependencies, both for build time and
|
to express its dependencies, both for build-time and
|
||||||
runtime.
|
runtime.
|
||||||
There must be a way for the user to express their preferences
|
There must be a way for the user to express their preferences
|
||||||
when multiple .bb's provide the same functionality, or when
|
when multiple recipes provide the same functionality, or when
|
||||||
there are multiple versions of a .bb.
|
there are multiple versions of a <filename>.bb</filename> file.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -144,10 +153,10 @@ Options:
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Note that the bitbake command, when not using
|
The <filename>bitbake</filename> command, when not using
|
||||||
--buildfile, accepts a <varname>PROVIDER</varname>, not a filename or
|
"--buildfile", accepts a PROVIDER, not a filename or
|
||||||
anything else.
|
anything else.
|
||||||
By default, a .bb generally PROVIDES its
|
By default, a <filename>.bb</filename> generally PROVIDES its
|
||||||
packagename, packagename-version, and packagename-version-revision.
|
packagename, packagename-version, and packagename-version-revision.
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ bitbake foo
|
$ bitbake foo
|
||||||
@@ -166,22 +175,23 @@ Options:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='generating-dependency-graphs'>
|
<section id='generating-dependency-graphs'>
|
||||||
<title>Generating dependency graphs</title>
|
<title>Generating Dependency Graphs</title>
|
||||||
<para>
|
|
||||||
BitBake is able to generate dependency graphs using
|
<para>
|
||||||
|
BitBake is able to generate dependency graphs using
|
||||||
the dot syntax.
|
the dot syntax.
|
||||||
These graphs can be converted to images using the <application>dot</application>
|
These graphs can be converted to images using the dot
|
||||||
application from
|
application from
|
||||||
<ulink url="http://www.graphviz.org">Graphviz</ulink>.
|
<ulink url='http://www.graphviz.org'>Graphviz</ulink>.
|
||||||
Two files will be written into the current working directory,
|
Two files will be written into the current working directory:
|
||||||
<emphasis>depends.dot</emphasis> containing dependency information
|
<filename>depends.dot</filename> containing dependency information
|
||||||
at the package level and <emphasis>task-depends.dot</emphasis>
|
at the package level and <filename>task-depends.dot</filename>
|
||||||
containing a breakdown of the dependencies at the task level.
|
containing a breakdown of the dependencies at the task level.
|
||||||
To stop depending on common depends, one can use the <prompt>-I depend</prompt>
|
To stop depending on common depends, one can use the "-I" depend
|
||||||
to omit these from the graph.
|
option to omit these from the graph.
|
||||||
This can lead to more readable graphs.
|
This can lead to more readable graphs.
|
||||||
This way, <varname>DEPENDS</varname> from inherited classes
|
This way, <filename>DEPENDS</filename> from inherited classes
|
||||||
such as base.bbclass can be removed from the
|
such as <filename>base.bbclass</filename> can be removed from the
|
||||||
graph.
|
graph.
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
$ bitbake -g foo
|
$ bitbake -g foo
|
||||||
@@ -193,14 +203,14 @@ Options:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='special-variables'>
|
<section id='special-variables'>
|
||||||
<title>Special variables</title>
|
<title>Special Variables</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Certain variables affect BitBake operation:
|
Certain variables affect BitBake operation:
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<section id='bb-number-threads'>
|
<section id='bb-number-threads'>
|
||||||
<title><varname>BB_NUMBER_THREADS</varname></title>
|
<title><filename>BB_NUMBER_THREADS</filename></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The number of threads BitBake should run at once (default: 1).
|
The number of threads BitBake should run at once (default: 1).
|
||||||
@@ -211,34 +221,35 @@ Options:
|
|||||||
<section id='bitbake-command-metadata'>
|
<section id='bitbake-command-metadata'>
|
||||||
<title>Metadata</title>
|
<title>Metadata</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
As you may have seen in the usage information, or in the
|
As you may have seen in the usage information, or in the
|
||||||
information about .bb files, the
|
information about <filename>.bb</filename> files, the
|
||||||
<varname>BBFILES</varname> variable is how the BitBake
|
<filename>BBFILES</filename> variable is how the BitBake
|
||||||
tool locates its files.
|
tool locates its files.
|
||||||
This variable is a space separated list of files
|
This variable is a space-separated list of files
|
||||||
that are available, and supports wildcards.
|
that are available, and supports wildcards.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<section id='setting-bbfiles'>
|
<section id='setting-bbfiles'>
|
||||||
<title>Setting BBFILES</title>
|
<title>Setting <filename>BBFILES</filename></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
BBFILES = "/path/to/bbfiles/*.bb"
|
BBFILES = "/path/to/bbfiles/*.bb"
|
||||||
</literallayout>
|
</literallayout>
|
||||||
With regard to dependencies, it expects the
|
With regard to dependencies, it expects the
|
||||||
.bb to define a
|
<filename>.bb</filename> to define a
|
||||||
<varname>DEPENDS</varname> variable, which contains a
|
<filename>DEPENDS</filename> variable, which contains a
|
||||||
space separated list of <quote>package names</quote>, which themselves
|
space separated list of “package names”, which themselves
|
||||||
are the <varname>PN</varname> variable. The
|
are the <filename>PN</filename> variable. The
|
||||||
<varname>PN</varname> variable is, in general,
|
<filename>PN</filename> variable is, in general,
|
||||||
set to a component of the .bb
|
set to a component of the <filename>.bb</filename>
|
||||||
filename by default.
|
filename by default.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='depending-on-another-recipe-file'>
|
<section id='depending-on-another-recipe-file'>
|
||||||
<title>Depending on another .bb</title>
|
<title>Depending on Another Recipe File</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
@@ -255,10 +266,13 @@ Options:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='using-provides'>
|
<section id='using-provides'>
|
||||||
<title>Using PROVIDES</title>
|
<title>Using <filename>PROVIDES</filename></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This example shows the usage of the <varname>PROVIDES</varname> variable, which allows a given .bb to specify what functionality it provides.
|
This example shows the usage of the
|
||||||
|
<filename>PROVIDES</filename> variable, which allows a
|
||||||
|
given <filename>.bb</filename> to specify what
|
||||||
|
functionality it provides.
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
package1.bb:
|
package1.bb:
|
||||||
|
|
||||||
@@ -273,7 +287,7 @@ This example shows the usage of the <varname>PROVIDES</varname> variable, which
|
|||||||
PROVIDES += "virtual/package"
|
PROVIDES += "virtual/package"
|
||||||
</literallayout>
|
</literallayout>
|
||||||
As you can see, we have two different
|
As you can see, we have two different
|
||||||
.bb's that provide the same functionality
|
recipes that provide the same functionality
|
||||||
(virtual/package).
|
(virtual/package).
|
||||||
Clearly, there needs to be a way for the person running
|
Clearly, there needs to be a way for the person running
|
||||||
BitBake to control which of those providers
|
BitBake to control which of those providers
|
||||||
@@ -282,7 +296,8 @@ This example shows the usage of the <varname>PROVIDES</varname> variable, which
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following would go into a .conf file, to select package1:
|
The following would go into a <filename>.conf</filename>
|
||||||
|
file, to select package1:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
PREFERRED_PROVIDER_virtual/package = "package1"
|
PREFERRED_PROVIDER_virtual/package = "package1"
|
||||||
</literallayout>
|
</literallayout>
|
||||||
@@ -290,27 +305,27 @@ The following would go into a .conf file, to select package1:
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='specifying-version-preference'>
|
<section id='specifying-version-preference'>
|
||||||
<title>Specifying version preference</title>
|
<title>Specifying Version Preference</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
When there are multiple <quote>versions</quote> of a given package,
|
When there are multiple “versions” of a given package,
|
||||||
BitBake defaults to selecting the most recent version,
|
BitBake defaults to selecting the most recent
|
||||||
unless otherwise specified.
|
version, unless otherwise specified.
|
||||||
If the .bb in question has a
|
If the <filename>.bb</filename> in question has a
|
||||||
<varname>DEFAULT_PREFERENCE</varname> set lower than
|
<filename>DEFAULT_PREFERENCE</filename> set lower than
|
||||||
the other .bb's (default is 0), then it will not be
|
the other recipes (default is 0), then it will not be
|
||||||
selected.
|
selected.
|
||||||
This allows the person or persons maintaining
|
This allows the person or persons maintaining
|
||||||
the repository of .bb files to specify
|
the repository of <filename>.bb</filename> files to specify
|
||||||
their preference for the default selected version.
|
their preference for the default selected version.
|
||||||
In addition, the user can specify their preferred version.
|
In addition, the user can specify their preferred version.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If the first .bb is named
|
If the first <filename>.bb</filename> is named
|
||||||
<filename>a_1.1.bb</filename>, then the
|
<filename>a_1.1.bb</filename>, then the
|
||||||
<varname>PN</varname> variable will be set to
|
<filename>PN</filename> variable will be set to
|
||||||
<quote>a</quote>, and the <varname>PV</varname> variable will be
|
“a”, and the <filename>PV</filename> variable will be
|
||||||
set to 1.1.
|
set to 1.1.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -318,27 +333,26 @@ The following would go into a .conf file, to select package1:
|
|||||||
If we then have an <filename>a_1.2.bb</filename>, BitBake
|
If we then have an <filename>a_1.2.bb</filename>, BitBake
|
||||||
will choose 1.2 by default.
|
will choose 1.2 by default.
|
||||||
However, if we define the following variable in a
|
However, if we define the following variable in a
|
||||||
.conf that BitBake parses, we
|
<filename>.conf</filename> file that BitBake parses, we
|
||||||
can change that.
|
can change that.
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
PREFERRED_VERSION_a = "1.1"
|
PREFERRED_VERSION_a = "1.1"
|
||||||
</literallayout>
|
</literallayout>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id='using-recipe-file-collections'>
|
<section id='using-recipe-file-collections'>
|
||||||
<title>Using <quote>bbfile collections</quote></title>
|
<title>Using Recipe File Collections</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
bbfile collections exist to allow the user to
|
Recipe file collections exist to allow the user to
|
||||||
have multiple repositories of
|
have multiple repositories of
|
||||||
bbfiles that contain the same
|
<filename>.bb</filename> files that contain the same
|
||||||
exact package.
|
exact package.
|
||||||
For example, one could easily use them to make one's
|
For example, one could easily use them to make one's
|
||||||
own local copy of an upstream repository, but with
|
own local copy of an upstream repository, but with
|
||||||
custom modifications that one does not want upstream.
|
custom modifications that one does not want upstream.
|
||||||
Usage:
|
Here is an example:
|
||||||
<literallayout class='monospaced'>
|
<literallayout class='monospaced'>
|
||||||
BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
|
BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
|
||||||
BBFILE_COLLECTIONS = "upstream local"
|
BBFILE_COLLECTIONS = "upstream local"
|
||||||
|
|||||||
Reference in New Issue
Block a user