summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/user-manual/user-manual-execution.xml
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/doc/user-manual/user-manual-execution.xml')
-rw-r--r--bitbake/doc/user-manual/user-manual-execution.xml329
1 files changed, 264 insertions, 65 deletions
diff --git a/bitbake/doc/user-manual/user-manual-execution.xml b/bitbake/doc/user-manual/user-manual-execution.xml
index e9f19be6de..148ac3e38a 100644
--- a/bitbake/doc/user-manual/user-manual-execution.xml
+++ b/bitbake/doc/user-manual/user-manual-execution.xml
@@ -23,11 +23,19 @@
23 $ bitbake <target> 23 $ bitbake <target>
24 </literallayout> 24 </literallayout>
25 For information on the BitBake command and its options, 25 For information on the BitBake command and its options,
26 see the 26 see
27 "<link linkend='user-manual-command'>BitBake Command</link> 27 "<link linkend='user-manual-command'>The BitBake Command</link>"
28 chapter. 28 section.
29 </para> 29 </para>
30 30
31 <note>
32 Prior to executing BitBake, you should take advantage of parallel
33 thread execution by setting the
34 <link linkend='var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>
35 variable in your <filename>local.conf</filename>
36 configuration file.
37 </note>
38
31 <section id='parsing-the-base-configuration-metadata'> 39 <section id='parsing-the-base-configuration-metadata'>
32 <title>Parsing the Base Configuration Metadata</title> 40 <title>Parsing the Base Configuration Metadata</title>
33 41
@@ -103,10 +111,13 @@
103 <listitem><para><link linkend='var-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link></para></listitem> 111 <listitem><para><link linkend='var-BB_ENV_WHITELIST'><filename>BB_ENV_WHITELIST</filename></link></para></listitem>
104 <listitem><para><link linkend='var-BB_PRESERVE_ENV'><filename>BB_PRESERVE_ENV</filename></link></para></listitem> 112 <listitem><para><link linkend='var-BB_PRESERVE_ENV'><filename>BB_PRESERVE_ENV</filename></link></para></listitem>
105 <listitem><para><link linkend='var-BB_ENV_EXTRAWHITE'><filename>BB_ENV_EXTRAWHITE</filename></link></para></listitem> 113 <listitem><para><link linkend='var-BB_ENV_EXTRAWHITE'><filename>BB_ENV_EXTRAWHITE</filename></link></para></listitem>
106 <listitem><para><link linkend='var-BB_ORIGENV'><filename>BB_ORIGENV</filename></link></para></listitem> 114 <listitem><para>
107 <listitem><para><link linkend='var-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></link></para></listitem> 115 <link linkend='var-BITBAKE_UI'><filename>BITBAKE_UI</filename></link>
108 <listitem><para><link linkend='var-PREFERRED_PROVIDERS'><filename>PREFERRED_PROVIDERS</filename></link></para></listitem> 116 </para></listitem>
109 </itemizedlist> 117 </itemizedlist>
118 You can find information on how to pass environment variables into the BitBake
119 execution environment in the
120 "<link linkend='passing-information-into-the-build-task-environment'>Passing Information Into the Build Task Environment</link>" section.
110 </para> 121 </para>
111 122
112 <para> 123 <para>
@@ -146,12 +157,16 @@
146 <para> 157 <para>
147 Only variable definitions and include directives are allowed 158 Only variable definitions and include directives are allowed
148 in <filename>.conf</filename> files. 159 in <filename>.conf</filename> files.
149 The following variables include: 160 Some variables directly influence BitBake's behavior.
161 These variables might have been set from the environment
162 depending on the environment variables previously
163 mentioned or set in the configuration files.
164 See the
165 "<link linkend='ref-variables-glos'>Variables Glossary</link>"
166 for a full list of variables.
167 The following list shows common variables set:
150 <itemizedlist> 168 <itemizedlist>
151 <listitem><para> 169 <listitem><para>
152 <link linkend='var-BITBAKE_UI'><filename>BITBAKE_UI</filename></link>
153 </para></listitem>
154 <listitem><para>
155 <link linkend='var-BBDEBUG'><filename>BBDEBUG</filename></link> 170 <link linkend='var-BBDEBUG'><filename>BBDEBUG</filename></link>
156 </para></listitem> 171 </para></listitem>
157 <listitem><para> 172 <listitem><para>
@@ -196,6 +211,8 @@
196 <listitem><para> 211 <listitem><para>
197 <link linkend='var-BBMASK'><filename>BBMASK</filename></link> 212 <link linkend='var-BBMASK'><filename>BBMASK</filename></link>
198 </para></listitem> 213 </para></listitem>
214 <listitem><para><link linkend='var-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></link></para></listitem>
215 <listitem><para><link linkend='var-PREFERRED_PROVIDERS'><filename>PREFERRED_PROVIDERS</filename></link></para></listitem>
199 </itemizedlist> 216 </itemizedlist>
200 </para> 217 </para>
201 218
@@ -234,8 +251,7 @@
234 <title>Locating and Parsing Recipes</title> 251 <title>Locating and Parsing Recipes</title>
235 252
236 <para> 253 <para>
237 During the configuration phase, BitBake will have 254 During the configuration phase, BitBake will have set
238 set
239 <link linkend='var-BBFILES'><filename>BBFILES</filename></link>. 255 <link linkend='var-BBFILES'><filename>BBFILES</filename></link>.
240 BitBake now uses it to construct a list of recipes to parse, 256 BitBake now uses it to construct a list of recipes to parse,
241 along with any append files (<filename>.bbappend</filename>) 257 along with any append files (<filename>.bbappend</filename>)
@@ -244,7 +260,7 @@
244 available files and supports wildcards. 260 available files and supports wildcards.
245 An example would be: 261 An example would be:
246 <literallayout class='monospaced'> 262 <literallayout class='monospaced'>
247 BBFILES = "/path/to/bbfiles/*.bb" 263 BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend"
248 </literallayout> 264 </literallayout>
249 BitBake parses each recipe and append file located 265 BitBake parses each recipe and append file located
250 with <filename>BBFILES</filename> and stores the values of 266 with <filename>BBFILES</filename> and stores the values of
@@ -279,7 +295,8 @@
279 <para> 295 <para>
280 By the time parsing is complete for a recipe, BitBake 296 By the time parsing is complete for a recipe, BitBake
281 has a list of tasks that the recipe defines and a set of 297 has a list of tasks that the recipe defines and a set of
282 data consisting of keys and values. 298 data consisting of keys and values as well as
299 dependency information about the tasks.
283 </para> 300 </para>
284 301
285 <para> 302 <para>
@@ -287,16 +304,48 @@
287 It only needs a small subset of the information to make 304 It only needs a small subset of the information to make
288 decisions about the recipe. 305 decisions about the recipe.
289 Consequently, BitBake caches the values in which it is 306 Consequently, BitBake caches the values in which it is
290 interested. 307 interested and does not store the rest of the information.
291 </para> 308 Experience has shown it's faster to re-parse the metadata than to
292 309 try and write it out to the disk and reload then it.
293 <para> 310 </para>
294 Subsequent BitBake commands then parse the base 311
295 configuration and compute a checksum of that data. 312 <para>
296 If that checksum matches what is in the cache, the 313 Where possible, subsequent BitBake commands reuse this cache of
297 recipe and class files have not changed. 314 recipe information.
298 In this case, BitBake reloads the cached information 315 The validity of this cache is determined by first computing a
299 about the recipe instead of reparsing it from scratch. 316 checksum of the base configuration data (see
317 <link linkend='var-BB_HASHCONFIG_WHITELIST'><filename>BB_HASHCONFIG_WHITELIST</filename></link>)
318 and then checking if the checksum matches.
319 If that checksum matches what is in the cache and the recipe
320 and class files have not changed, Bitbake is able to use
321 the cache.
322 BitBake then reloads the cached information about the recipe
323 instead of reparsing it from scratch.
324 </para>
325
326 <para>
327 Recipe file collections exist to allow the user to
328 have multiple repositories of
329 <filename>.bb</filename> files that contain the same
330 exact package.
331 For example, one could easily use them to make one's
332 own local copy of an upstream repository, but with
333 custom modifications that one does not want upstream.
334 Here is an example:
335 <literallayout class='monospaced'>
336 BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
337 BBFILE_COLLECTIONS = "upstream local"
338 BBFILE_PATTERN_upstream = "^/stuff/openembedded/"
339 BBFILE_PATTERN_local = "^/stuff/openembedded.modified/"
340 BBFILE_PRIORITY_upstream = "5"
341 BBFILE_PRIORITY_local = "10"
342 </literallayout>
343 <note>
344 The layers mechanism is now the preferred method of collecting
345 code.
346 While the collections code remains, its main use is to set layer
347 priorities and to deal with overlap (conflicts) between layers.
348 </note>
300 </para> 349 </para>
301 </section> 350 </section>
302 351
@@ -304,38 +353,60 @@
304 <title>Preferences and Providers</title> 353 <title>Preferences and Providers</title>
305 354
306 <para> 355 <para>
307 Assuming BitBake has been instructed to execute a target and 356 Assuming BitBake has been instructed to execute a target
308 that all the recipe files have been parsed, BitBake starts to 357 and that all the recipe files have been parsed, BitBake
309 build the target and look for providers of that target. 358 starts to figure out how to build the target.
310 Once a provider is selected, BitBake resolves all the dependencies for 359 BitBake starts by looking through the
311 the target. 360 <link linkend='var-PROVIDES'><filename>PROVIDES</filename></link>
312 As an example, suppose the target is 361 set in recipe files.
313 <filename>core-image-sato</filename>. 362 The default <filename>PROVIDES</filename> for a recipe is its name
314 In this case, it would lead to 363 (<link linkend='var-PN'><filename>PN</filename></link>),
315 <filename>packagegroup-core-x11-sato</filename>, 364 however, a recipe can provide multiple things.
316 which in turn leads to recipes like <filename>matchbox-terminal</filename>,
317 <filename>pcmanfm</filename> and <filename>gthumb</filename>.
318 These recipes in turn depend on <filename>eglibc</filename> and the toolchain.
319 </para> 365 </para>
320 366
321 <para> 367 <para>
322 Sometimes a target might have multiple providers. 368 As an example of adding an extra provider, suppose a recipe named
323 A common example is "virtual/kernel", which is provided by each kernel package. 369 <filename>package1.bb</filename> contained the following:
324 Each machine often selects the best kernel provider by using a line similar to the 370 <literallayout class='monospaced'>
325 following in the machine configuration file: 371 PROVIDES += "virtual/package"
372 </literallayout>
373 The recipe now provides both "package1" and "virtual/package.
374 The "virtual/" namespace is often used to denote cases where
375 multiple providers are expected with the user choosing between
376 them.
377 Kernels and toolchain components are common cases of this in
378 OpenEmbedded.
326 </para> 379 </para>
327 380
328 <literallayout class='monospaced'>
329 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
330 </literallayout>
331
332 <para> 381 <para>
382 Sometimes a target might have multiple providers.
383 A common example is "virtual/kernel", which is provided by each
384 kernel recipe.
385 Each machine often selects the best kernel provider by using a
386 line similar to the following in the machine configuration file:
387 <literallayout class='monospaced'>
388 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
389 </literallayout>
333 The default 390 The default
334 <link linkend='var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></link> 391 <link linkend='var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></link>
335 is the provider with the same name as the target. 392 is the provider with the same name as the target.
336 </para> 393 </para>
337 394
338 <para> 395 <para>
396 Bitbake iterates through each target it needs to build and resolve
397 them using this process.
398 As an example, suppose the target is
399 <filename>core-image-sato</filename>.
400 In this case, it would lead to
401 <filename>packagegroup-core-x11-sato</filename>,
402 which in turn leads to recipes like
403 <filename>matchbox-terminal</filename>, <filename>pcmanfm</filename>
404 and <filename>gthumb</filename>.
405 These recipes in turn depend on <filename>eglibc</filename>
406 and the toolchain.
407 </para>
408
409 <para>
339 Understanding how providers are chosen is made complicated by the fact 410 Understanding how providers are chosen is made complicated by the fact
340 that multiple versions might exist. 411 that multiple versions might exist.
341 BitBake defaults to the highest version of a provider. 412 BitBake defaults to the highest version of a provider.
@@ -358,6 +429,41 @@
358 <para> 429 <para>
359 In summary, BitBake has created a list of providers, which is prioritized, for each target. 430 In summary, BitBake has created a list of providers, which is prioritized, for each target.
360 </para> 431 </para>
432
433 <para>
434 When there are multiple “versions” of a given package,
435 BitBake defaults to selecting the most recent
436 version, unless otherwise specified.
437 If the recipe in question has a
438 <link linkend='var-DEFAULT_PREFERENCE'><filename>DEFAULT_PREFERENCE</filename></link>
439 set lower than
440 the other recipes (default is 0), then it will not be
441 selected.
442 This allows the person or persons maintaining
443 the repository of recipe files to specify
444 their preference for the default selected version.
445 In addition, the user can specify their preferred version.
446 </para>
447
448 <para>
449 If the first recipe is named <filename>a_1.1.bb</filename>,
450 then the
451 <link linkend='var-PN'><filename>PN</filename></link> variable
452 will be set to “a”, and the
453 <link linkend='var-PV'><filename>PV</filename></link>
454 variable will be set to 1.1.
455 </para>
456
457 <para>
458 If we then have a recipe named <filename>a_1.2.bb</filename>, BitBake
459 will choose 1.2 by default.
460 However, if we define the following variable in a
461 <filename>.conf</filename> file that BitBake parses, we
462 can change that.
463 <literallayout class='monospaced'>
464 PREFERRED_VERSION_a = "1.1"
465 </literallayout>
466 </para>
361 </section> 467 </section>
362 468
363 <section id='bb-bitbake-dependencies'> 469 <section id='bb-bitbake-dependencies'>
@@ -422,7 +528,20 @@
422 compile timestamp for a given target, then the compile task would rerun. 528 compile timestamp for a given target, then the compile task would rerun.
423 Running the compile task again, however, has no effect on other providers 529 Running the compile task again, however, has no effect on other providers
424 that depend on that target. 530 that depend on that target.
425 This behavior could change or become configurable in future versions of BitBake. 531 </para>
532
533 <para>
534 The exact format of the stamps is partly configurable.
535 In modern versions of BitBake, a hash is appended to the
536 stamp so that if the configuration changes, the stamp becomes
537 invalid and the task is automatically rerun.
538 This hash, or signature used, is governed by the signature policy
539 that is configured (see the
540 "<link linkend='checksums'>Checksums (Signatures)</link>"
541 section for information).
542 It is also possible to append extra metadata to the stamp using
543 the "stamp-extra-info" task flag.
544 For example, OpenEmbedded uses this flag to make some tasks machine-specific.
426 </para> 545 </para>
427 546
428 <note> 547 <note>
@@ -462,7 +581,12 @@
462 </para> 581 </para>
463 582
464 <para> 583 <para>
465 Variables specific to scheduling functionality exist: 584 The order in which BitBake runs the tasks is controlled by its
585 task scheduler.
586 It is possible to configure the scheduler and define custom
587 implementations for specific use cases.
588 For more information, see these variables that control the
589 behavior:
466 <itemizedlist> 590 <itemizedlist>
467 <listitem><para> 591 <listitem><para>
468 <link linkend='var-BB_SCHEDULER'><filename>BB_SCHEDULER</filename></link> 592 <link linkend='var-BB_SCHEDULER'><filename>BB_SCHEDULER</filename></link>
@@ -471,22 +595,10 @@
471 <link linkend='var-BB_SCHEDULERS'><filename>BB_SCHEDULERS</filename></link> 595 <link linkend='var-BB_SCHEDULERS'><filename>BB_SCHEDULERS</filename></link>
472 </para></listitem> 596 </para></listitem>
473 </itemizedlist> 597 </itemizedlist>
474 </para> 598 It is possible to have functions run before and after a task's main
475 </section> 599 function.
476 600 This is done using the "prefuncs" and "postfuncs" flags of the task
477 <section id='setscene'> 601 that lists the functions to run.
478 <title>Setscene</title>
479
480 <para>
481 This section needs to get the concept of the setscene across.
482 The reader needs to know what it is and what it is used for during
483 the build process.
484 </para>
485
486 <para>
487 You can find more information on setscene metadata in the
488 "<link linkend='task-checksums-and-setscene'>Task Checksums and Setscene</link>"
489 section.
490 </para> 602 </para>
491 </section> 603 </section>
492 604
@@ -495,10 +607,10 @@
495 607
496 <para> 608 <para>
497 A checksum is a unique signature of a task's inputs. 609 A checksum is a unique signature of a task's inputs.
498 The setscene code uses a checksum to determine if a task needs 610 The signature of a task can be used to determine if a task
499 to be run. 611 needs to be run.
500 Because it is a change in a task's inputs that triggers running 612 Because it is a change in a task's inputs that triggers running
501 the task, the process needs to detect all the inputs to a given task. 613 the task, BitBake needs to detect all the inputs to a given task.
502 For shell tasks, this turns out to be fairly easy because 614 For shell tasks, this turns out to be fairly easy because
503 BitBake generates a "run" shell script for each task and 615 BitBake generates a "run" shell script for each task and
504 it is possible to create a checksum that gives you a good idea of when 616 it is possible to create a checksum that gives you a good idea of when
@@ -514,6 +626,10 @@
514 affect the output for target packages. 626 affect the output for target packages.
515 The simplistic approach for excluding the working directory is to set 627 The simplistic approach for excluding the working directory is to set
516 it to some fixed value and create the checksum for the "run" script. 628 it to some fixed value and create the checksum for the "run" script.
629 BitBake goes one step better and uses the
630 <link linkend='var-BB_HASHBASE_WHITELIST'><filename>BB_HASHBASE_WHITELIST</filename></link>
631 variable to define a list of variables that should never be included
632 when generating the signatures.
517 </para> 633 </para>
518 634
519 <para> 635 <para>
@@ -652,4 +768,87 @@
652 section. 768 section.
653 </para> 769 </para>
654 </section> 770 </section>
771
772 <section id='setscene'>
773 <title>Setscene</title>
774
775 <para>
776 The setscene process enables BitBake to handle "pre-built" artifacts.
777 The ability to handle and reuse these artifacts allows BitBake
778 the luxury of not having to build something from scratch every time.
779 Instead, BitBake can use, when possible, existing build artifacts.
780 </para>
781
782 <para>
783 BitBake needs to have reliable data indicating whether or not an
784 artifact is compatible.
785 Signatures, described in the previous section, provide an ideal
786 way of representing whether an artifact is compatible.
787 If a signature is the same, an object can be reused.
788 </para>
789
790 <para>
791 If an object can be reused, the problem then becomes how to
792 replace a given task or set of tasks with the pre-built artifact.
793 BitBake solves the problem with the "setscene" process.
794 </para>
795
796 <para>
797 When BitBake is asked to build a given target, before building anything,
798 it first asks whether cached information is available for any of the
799 targets it's building, or any of the intermediate targets.
800 If cached information is available, BitBake uses this information instead of
801 running the main tasks.
802 </para>
803
804 <para>
805 BitBake first calls the function defined by the
806 <link linkend='var-BB_HASHCHECK_FUNCTION'><filename>BB_HASHCHECK_FUNCTION</filename></link>
807 variable with a list of tasks and corresponding
808 hashes it wants to build.
809 This function is designed to be fast and returns a list
810 of the tasks for which it believes in can obtain artifacts.
811 </para>
812
813 <para>
814 Next, for each of the tasks that were returned as possibilities,
815 BitBake executes a setscene version of the task that the possible
816 artifact covers.
817 Setscene versions of a task have the string "_setscene" appended to the
818 task name.
819 So, for example, the task with the name <filename>xxx</filename> has
820 a setscene task named <filename>xxx_setscene</filename>.
821 The setscene version of the task executes and provides the necessary
822 artifacts returning either success or failure.
823 <note>
824 Artifacts might need to be fetched from the network.
825 </note>
826 </para>
827
828 <para>
829 As previously mentioned, an artifact can cover more than one task.
830 For example, it is pointless to obtain a compiler if you
831 already have the compiled binary.
832 To handle this, BitBake calls the
833 <link linkend='var-BB_SETSCENE_DEPVALID'><filename>BB_SETSCENE_DEPVALID</filename></link>
834 function for each successful setscene task to know whether or not it needs
835 to obtain the dependencies of that task.
836 </para>
837
838 <para>
839 Finally, after all the setscene tasks have executed, BitBake calls the
840 function listed in
841 <link linkend='var-BB_SETSCENE_VERIFY_FUNCTION'><filename>BB_SETSCENE_VERIFY_FUNCTION</filename></link>
842 with the list of tasks BitBake thinks has been "covered".
843 The metadata can then ensure that this list is correct and can
844 inform BitBake that it wants specific tasks to be run regardless
845 of the setscene result.
846 </para>
847
848 <para>
849 You can find more information on setscene metadata in the
850 "<link linkend='task-checksums-and-setscene'>Task Checksums and Setscene</link>"
851 section.
852 </para>
853 </section>
655</chapter> 854</chapter>