1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
<chapter>
<title>The BitBake command</title>
<section>
<title>Introduction</title>
<para>bitbake is the primary command in the system. It
facilitates executing tasks in a single .bb file, or executing
a given task on a set of multiple .bb files, accounting for
interdependencies amongst them.</para>
</section>
<section>
<title>Usage and syntax</title>
<para>
<screen>
<prompt>$</prompt>bitbake --help usage: bitbake [options]
[package ...] Executes the specified task (default is
'build') for a given set of BitBake files. It expects that
BBFILES is defined, which is a space separated list of files
to be executed. BBFILES does support wildcards. Default
BBFILES are the .bb files in the current directory. options:
--version show program's version number and exit -h, --help
show this help message and exit -b BUILDFILE,
--buildfile=BUILDFILE execute the task against this .bb file,
rather than a package from BBFILES. -k, --continue continue
as much as possible after an error. While the target that
failed, and those that depend on it, cannot be remade, the
other dependencies of these targets can be processed all the
same. -f, --force force run of specified cmd, regardless of
stamp status -i, --interactive drop into the interactive mode
also called the BitBake shell. -c CMD, --cmd=CMD Specify task
to execute. Note that this only executes the specified task
for the providee and the packages it depends on, i.e.
'compile' does not implicitly call stage for the dependencies
(IOW: use only if you know what you are doing). Depending on
the base.bbclass a listtasks task is defined and will show
available tasks -r FILE, --read=FILE read the specified file
before bitbake.conf -v, --verbose output more chit-chat to
the terminal -D, --debug Increase the debug level. You can
specify this more than once. -n, --dry-run don't execute,
just go through the motions -p, --parse-only quit after
parsing the BB files (developers only) -s, --show-versions
show current and preferred versions of all packages -e,
--environment show the global or per-package environment
(this is what used to be bbread) -g, --graphviz emit the
dependency trees of the specified packages in the dot syntax
-I IGNORED_DOT_DEPS, --ignore-deps=IGNORED_DOT_DEPS Stop
processing at the given list of dependencies when generating
dependency graphs. This can help to make the graph more
appealing -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS Show
debug logging for the specified logging domains -P, --profile
profile the command and print a report</screen>
</para>
<para>
<example>
<title>Executing a task against a single .bb</title>
<para>Executing tasks for a single file is relatively
simple. You specify the file in question, and BitBake
parses it and executes the specified task (or
<quote>build</quote>by default). It obeys intertask
dependencies when doing so.</para>
<para>
<quote>clean</quote>task:</para>
<para>
<screen>
<prompt>$</prompt>bitbake -b blah_1.0.bb -c
clean</screen>
</para>
<para>
<quote>build</quote>task:</para>
<para>
<screen>
<prompt>$</prompt>bitbake -b blah_1.0.bb</screen>
</para>
</example>
</para>
<para>
<example>
<title>Executing tasks against a set of .bb files</title>
<para>There are a number of additional complexities
introduced when one wants to manage multiple .bb files.
Clearly there needs to be a way to tell BitBake what files
are available, and of those, which we want to execute at
this time. There also needs to be a way for each .bb to
express its dependencies, both for build time and runtime.
There must be a way for the user to express their
preferences when multiple .bb's provide the same
functionality, or when there are multiple versions of a
.bb.</para>
<para>The next section, Metadata, outlines how to specify
such things.</para>
<para>Note that the bitbake command, when not using
--buildfile, accepts a
<varname>PROVIDER</varname>, not a filename or anything
else. By default, a .bb generally PROVIDES its packagename,
packagename-version, and
packagename-version-revision.</para>
<screen>
<prompt>$</prompt>bitbake blah</screen>
<screen>
<prompt>$</prompt>bitbake blah-1.0</screen>
<screen>
<prompt>$</prompt>bitbake blah-1.0-r0</screen>
<screen>
<prompt>$</prompt>bitbake -c clean blah</screen>
<screen>
<prompt>$</prompt>bitbake virtual/whatever</screen>
<screen>
<prompt>$</prompt>bitbake -c clean
virtual/whatever</screen>
</example>
<example>
<title>Generating dependency graphs</title>
<para>BitBake is able to generate dependency graphs using
the dot syntax. These graphs can be converted to images
using the
<application>dot</application>application from
<ulink url="http://www.graphviz.org">Graphviz</ulink>. Two
files will be written into the current working directory,
<emphasis>depends.dot</emphasis>containing dependency
information at the package level and
<emphasis>task-depends.dot</emphasis>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 omit these from the graph.
This can lead to more readable graphs. This way,
<varname>DEPENDS</varname>from inherited classes such as
base.bbclass can be removed from the graph.</para>
<screen>
<prompt>$</prompt>bitbake -g blah</screen>
<screen>
<prompt>$</prompt>bitbake -g -I virtual/whatever -I bloom
blah</screen>
</example>
</para>
</section>
<section>
<title>Special variables</title>
<para>Certain variables affect BitBake operation:</para>
<section>
<title>
<varname>BB_NUMBER_THREADS</varname>
</title>
<para>The number of threads BitBake should run at once
(default: 1).</para>
</section>
</section>
<section>
<title>Metadata</title>
<para>As you may have seen in the usage information, or in the
information about .bb files, the
<varname>BBFILES</varname>variable is how the BitBake tool
locates its files. This variable is a space separated list of
files that are available, and supports wildcards.
<example>
<title>Setting BBFILES</title>
<programlisting>
<varname>BBFILES</varname>=
"/path/to/bbfiles/*.bb"</programlisting>
</example></para>
<para>With regard to dependencies, it expects the .bb to define
a
<varname>DEPENDS</varname>variable, which contains a space
separated list of
<quote>package names</quote>, which themselves are the
<varname>PN</varname>variable. The
<varname>PN</varname>variable is, in general, set to a
component of the .bb filename by default.</para>
<example>
<title>Depending on another .bb</title>
<para>a.bb:
<screen>PN = "package-a" DEPENDS +=
"package-b"</screen></para>
<para>b.bb:
<screen>PN = "package-b"</screen></para>
</example>
<example>
<title>Using PROVIDES</title>
<para>This example shows the usage of the
<varname>PROVIDES</varname>variable, which allows a given .bb
to specify what functionality it provides.</para>
<para>package1.bb:
<screen>PROVIDES += "virtual/package"</screen></para>
<para>package2.bb:
<screen>DEPENDS += "virtual/package"</screen></para>
<para>package3.bb:
<screen>PROVIDES += "virtual/package"</screen></para>
<para>As you can see, we have two different .bb's that
provide the same functionality (virtual/package). Clearly,
there needs to be a way for the person running BitBake to
control which of those providers gets used. There is, indeed,
such a way.</para>
<para>The following would go into a .conf file, to select
package1:
<screen>PREFERRED_PROVIDER_virtual/package =
"package1"</screen></para>
</example>
<example>
<title>Specifying version preference</title>
<para>When there are multiple
<quote>versions</quote>of a given package, BitBake defaults
to selecting the most recent version, unless otherwise
specified. If the .bb in question has a
<varname>DEFAULT_PREFERENCE</varname>set lower than the other
.bb's (default is 0), then it will not be selected. This
allows the person or persons maintaining the repository of
.bb files to specify their preference for the default
selected version. In addition, the user can specify their
preferred version.</para>
<para>If the first .bb is named
<filename>a_1.1.bb</filename>, then the
<varname>PN</varname>variable will be set to
<quote>a</quote>, and the
<varname>PV</varname>variable will be set to 1.1.</para>
<para>If we then have an
<filename>a_1.2.bb</filename>, BitBake will choose 1.2 by
default. However, if we define the following variable in a
.conf that BitBake parses, we can change that.
<screen>PREFERRED_VERSION_a = "1.1"</screen></para>
</example>
<example>
<title>Using
<quote>bbfile collections</quote></title>
<para>bbfile collections exist to allow the user to have
multiple repositories of bbfiles that contain the same exact
package. For example, one could easily use them to make one's
own local copy of an upstream repository, but with custom
modifications that one does not want upstream. Usage:</para>
<screen>BBFILES = "/stuff/openembedded/*/*.bb
/stuff/openembedded.modified/*/*.bb" BBFILE_COLLECTIONS =
"upstream local" BBFILE_PATTERN_upstream =
"^/stuff/openembedded/" BBFILE_PATTERN_local =
"^/stuff/openembedded.modified/" BBFILE_PRIORITY_upstream =
"5" BBFILE_PRIORITY_local = "10"</screen>
</example>
</section>
</chapter>
|