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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
|
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<chapter id="user-manual-command">
<title>The BitBake Command</title>
<para>
BitBake is the underlying piece of the build system.
Two excellent examples are the Yocto Project and the OpenEmbedded
build systems.
Each provide an environment in which to develop embedded Linux
images, and each use BitBake as their underlying build engine.
</para>
<para>
BitBake facilitates executing tasks in a single <filename>.bb</filename>
file, or executing a given task on a set of multiple
<filename>.bb</filename> files, accounting for interdependencies
amongst them.
This chapter presents the BitBake syntax, provides some execution
examples, and shows you how to control BitBake with key metadata.
</para>
<section id='usage-and-syntax'>
<title>Usage and syntax</title>
<para>
Following is the usage and syntax for BitBake:
<literallayout class='monospaced'>
$ bitbake -h
Usage: bitbake [options] [recipename/target ...]
Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
will provide the layer, BBFILES and other configuration information.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-b BUILDFILE, --buildfile=BUILDFILE
Execute tasks from a specific .bb recipe directly.
WARNING: Does not handle any dependencies from other
recipes.
-k, --continue Continue as much as possible after an error. While the
target that failed and anything depending on it cannot
be built, as much as possible will be built before
stopping.
-a, --tryaltconfigs Continue with builds by trying to use alternative
providers where possible.
-f, --force Force the specified targets/task to run (invalidating
any existing stamp file).
-c CMD, --cmd=CMD Specify the task to execute. The exact options
available depend on the metadata. Some examples might
be 'compile' or 'populate_sysroot' or 'listtasks' may
give a list of the tasks available.
-C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP
Invalidate the stamp for the specified task such as
'compile' and then run the default task for the
specified target(s).
-r PREFILE, --read=PREFILE
Read the specified file before bitbake.conf.
-R POSTFILE, --postread=POSTFILE
Read the specified file after bitbake.conf.
-v, --verbose Output more log message data 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.
-S, --dump-signatures
Don't execute, just dump out the signature
construction information.
-p, --parse-only Quit after parsing the BB recipes.
-s, --show-versions Show current and preferred versions of all recipes.
-e, --environment Show the global or per-package environment complete
with information about where variables were
set/changed.
-g, --graphviz Save dependency tree information for the specified
targets in the dot syntax.
-I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED
Assume these dependencies don't exist and are already
provided (equivalent to ASSUME_PROVIDED). Useful to
make dependency graphs more appealing
-l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS
Show debug logging for the specified logging domains
-P, --profile Profile the command and save reports.
-u UI, --ui=UI The user interface to use (e.g. knotty, hob, depexp).
-t SERVERTYPE, --servertype=SERVERTYPE
Choose which server to use, process or xmlrpc.
--revisions-changed Set the exit code depending on whether upstream
floating revisions have changed or not.
--server-only Run bitbake without a UI, only starting a server
(cooker) process.
-B BIND, --bind=BIND The name/address for the bitbake server to bind to.
--no-setscene Do not run any setscene tasks. sstate will be ignored
and everything needed, built.
--remote-server=REMOTE_SERVER
Connect to the specified server.
-m, --kill-server Terminate the remote server.
--observe-only Connect to a server as an observing-only client.
--status-only Check the status of the remote bitbake server.
</literallayout>
</para>
</section>
<section id='bitbake-examples'>
<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'>
<title>Executing a Task Against a Single Recipe</title>
<para>
Executing tasks for a single recipe file is relatively simple.
You specify the file in question, and BitBake parses
it and executes the specified task.
If you do not specify a task, BitBake executes the default
task, which is "build”.
BitBake obeys inter-task dependencies when doing
so.
</para>
<para>
The following command runs the clean task on the
<filename>foo_1.0.bb</filename> recipe file:
<literallayout class='monospaced'>
$ bitbake -b foo.bb -c clean
</literallayout>
The following command runs the build task, which is
the default task, on the <filename>foo_1.0.bb</filename>
recipe file:
<literallayout class='monospaced'>
$ bitbake -b foo_1.0.bb
</literallayout>
</para>
</section>
<section id='executing-tasks-against-a-set-of-recipe-files'>
<title>Executing Tasks Against a Set of Recipe Files</title>
<para>
There are a number of additional complexities introduced
when one wants to manage multiple <filename>.bb</filename>
files.
Clearly there needs to be a way to tell BitBake what
files are available, and of those, which you
want to execute.
There also needs to be a way for each recipe
to express its dependencies, both for build-time and
runtime.
There must be a way for you to express recipe preferences
when multiple recipes provide the same functionality, or when
there are multiple versions of a recipe.
</para>
<para>
The <filename>bitbake</filename> command, when not using
"--buildfile" or "-b" only accepts a "PROVIDER".
You cannot provide anything else.
By default, a recipe file generally "PROVIDES" its
"packagename", "packagename-version", and
"packagename-version-revision" as shown in the following
example:
<literallayout class='monospaced'>
$ bitbake foo
$ bitbake foo-1.0
$ bitbake foo-1.0-r0
</literallayout>
This next example "PROVIDES" the package name and also uses
the "-c" option to tell BitBake to just excute the
<filename>do_clean</filename> task:
<literallayout class='monospaced'>
$ bitbake -c clean foo
</literallayout>
</para>
</section>
<section id='generating-dependency-graphs'>
<title>Generating Dependency Graphs</title>
<para>
BitBake is able to generate dependency graphs using
the dot syntax.
You can convert these graphs into images using the dot
application from
<ulink url='http://www.graphviz.org'>Graphviz</ulink>.
</para>
<para>
When you generate a dependency graph, BitBake writes two files
to the current working directory:
<filename>depends.dot</filename>, which contains dependency information
at the package level, and <filename>task-depends.dot</filename>,
which contains a breakdown of the dependencies at the task level.
</para>
<para>
To stop depending on common depends, use use the "-I" depend
option and BitBake omits them from the graph.
Leaving this information out can produce more readable graphs.
This way, you can remove from the graph
<filename>DEPENDS</filename> from inherited classes
such as <filename>base.bbclass</filename>.
</para>
<para>
Here are two exmples that create dependency graphs.
The second example omits common depends from the graph:
<literallayout class='monospaced'>
$ bitbake -g foo
$ bitbake -g -I virtual/whatever -I bloom foo
</literallayout>
</para>
</section>
</section>
<section id='controlling-bitbake'>
<title>Controlling BitBake</title>
<para>
Including variables in your recipe and class files help control
how BitBake operates.
</para>
<section id='execution-threads'>
<title>Execution Threads</title>
<para>
You can control how many thread BitBake supports by using the
<link linkend='var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>
variable.
You would set this in your <filename>local.conf</filename>
configuration file.
</para>
</section>
<section id='using-provides'>
<title>Using <filename>PROVIDES</filename></title>
<para>
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'>
package1.bb:
PROVIDES += "virtual/package"
package2.bb:
DEPENDS += "virtual/package"
package3.bb:
PROVIDES += "virtual/package"
</literallayout>
As you can see, we have two different
recipes 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 <filename>.conf</filename>
file, to select package1:
<literallayout class='monospaced'>
PREFERRED_PROVIDER_virtual/package = "package1"
</literallayout>
</para>
</section>
<section id='specifying-version-preference'>
<title>Specifying Version Preference</title>
<para>
When there are multiple “versions” of a given package,
BitBake defaults to selecting the most recent
version, unless otherwise specified.
If the <filename>.bb</filename> in question has a
<filename>DEFAULT_PREFERENCE</filename> set lower than
the other recipes (default is 0), then it will not be
selected.
This allows the person or persons maintaining
the repository of <filename>.bb</filename> files to specify
their preference for the default selected version.
In addition, the user can specify their preferred version.
</para>
<para>
If the first <filename>.bb</filename> is named
<filename>a_1.1.bb</filename>, then the
<filename>PN</filename> variable will be set to
“a”, and the <filename>PV</filename> 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
<filename>.conf</filename> file that BitBake parses, we
can change that.
<literallayout class='monospaced'>
PREFERRED_VERSION_a = "1.1"
</literallayout>
</para>
</section>
<section id='using-recipe-file-collections'>
<title>Using Recipe File Collections</title>
<para>
Recipe file collections exist to allow the user to
have multiple repositories of
<filename>.bb</filename> files 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.
Here is an example:
<literallayout class='monospaced'>
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"
</literallayout>
</para>
</section>
</section>
</chapter>
|