diff options
Diffstat (limited to 'bitbake/doc/bitbake-user-manual')
6 files changed, 594 insertions, 172 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst index d58fbb32ea..d407f59c0d 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst | |||
| @@ -64,11 +64,11 @@ data itself is of various types: | |||
| 64 | together. | 64 | together. |
| 65 | 65 | ||
| 66 | The ``layer.conf`` files are used to construct key variables such as | 66 | The ``layer.conf`` files are used to construct key variables such as |
| 67 | :term:`BBPATH` and :term:`BBFILES`. | 67 | :term:`BBPATH` and :term:`BBFILES`. :term:`BBPATH` is used to search for |
| 68 | :term:`BBPATH` is used to search for configuration and class files under the | 68 | configuration files under the ``conf`` directory and class files under the |
| 69 | ``conf`` and ``classes`` directories, respectively. :term:`BBFILES` is used | 69 | ``classes-global``, ``classes-recipe`` and ``classes`` directories. |
| 70 | to locate both recipe and recipe append files (``.bb`` and | 70 | :term:`BBFILES` is used to locate both recipe and recipe append files (``.bb`` |
| 71 | ``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the | 71 | and ``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the |
| 72 | user has set the :term:`BBPATH` and :term:`BBFILES` directly in the environment. | 72 | user has set the :term:`BBPATH` and :term:`BBFILES` directly in the environment. |
| 73 | 73 | ||
| 74 | Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable | 74 | Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable |
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst index fb4f0a23d7..f357765b77 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst | |||
| @@ -39,10 +39,10 @@ variable and then calls the ``download`` method to download the files. | |||
| 39 | 39 | ||
| 40 | The instantiation of the fetch class is usually followed by:: | 40 | The instantiation of the fetch class is usually followed by:: |
| 41 | 41 | ||
| 42 | rootdir = l.getVar('WORKDIR') | 42 | rootdir = l.getVar('UNPACKDIR') |
| 43 | fetcher.unpack(rootdir) | 43 | fetcher.unpack(rootdir) |
| 44 | 44 | ||
| 45 | This code unpacks the downloaded files to the specified by ``WORKDIR``. | 45 | This code unpacks the downloaded files to the specified by ``UNPACKDIR``. |
| 46 | 46 | ||
| 47 | .. note:: | 47 | .. note:: |
| 48 | 48 | ||
| @@ -51,7 +51,7 @@ This code unpacks the downloaded files to the specified by ``WORKDIR``. | |||
| 51 | examine the OpenEmbedded class file ``base.bbclass`` | 51 | examine the OpenEmbedded class file ``base.bbclass`` |
| 52 | . | 52 | . |
| 53 | 53 | ||
| 54 | The :term:`SRC_URI` and ``WORKDIR`` variables are not hardcoded into the | 54 | The :term:`SRC_URI` and ``UNPACKDIR`` variables are not hardcoded into the |
| 55 | fetcher, since those fetcher methods can be (and are) called with | 55 | fetcher, since those fetcher methods can be (and are) called with |
| 56 | different variable names. In OpenEmbedded for example, the shared state | 56 | different variable names. In OpenEmbedded for example, the shared state |
| 57 | (sstate) code uses the fetch module to fetch the sstate files. | 57 | (sstate) code uses the fetch module to fetch the sstate files. |
| @@ -436,13 +436,15 @@ This fetcher supports the following parameters: | |||
| 436 | "nobranch" is set to "1", this is a mandatory parameter. The number of | 436 | "nobranch" is set to "1", this is a mandatory parameter. The number of |
| 437 | branch parameters must match the number of name parameters. | 437 | branch parameters must match the number of name parameters. |
| 438 | 438 | ||
| 439 | - *"rev":* The revision to use for the checkout. The default is | 439 | - *"rev":* The revision to use for the checkout. If :term:`SRCREV` is also set, |
| 440 | "master". | 440 | this parameter must match its value. |
| 441 | 441 | ||
| 442 | - *"tag":* Specifies a tag to use for the checkout. To correctly | 442 | - *"tag":* Specifies a tag to use when fetching. To correctly resolve |
| 443 | resolve tags, BitBake must access the network. For that reason, tags | 443 | tags, BitBake must access the network. If a ``rev`` parameter or |
| 444 | are often not used. As far as Git is concerned, the "tag" parameter | 444 | :term:`SRCREV` is also specified, network access is not necessary to resolve |
| 445 | behaves effectively the same as the "rev" parameter. | 445 | the tag and instead, it is verified that they both resolve to the same commit |
| 446 | SHA at unpack time. The ``tag`` parameter is optional, but strongly | ||
| 447 | recommended if the checked out revision is a tag. | ||
| 446 | 448 | ||
| 447 | - *"subpath":* Limits the checkout to a specific subpath of the tree. | 449 | - *"subpath":* Limits the checkout to a specific subpath of the tree. |
| 448 | By default, the whole tree is checked out. | 450 | By default, the whole tree is checked out. |
| @@ -463,13 +465,6 @@ Here are some example URLs:: | |||
| 463 | 465 | ||
| 464 | .. note:: | 466 | .. note:: |
| 465 | 467 | ||
| 466 | When using ``git`` as the fetcher of the main source code of your software, | ||
| 467 | ``S`` should be set accordingly:: | ||
| 468 | |||
| 469 | S = "${WORKDIR}/git" | ||
| 470 | |||
| 471 | .. note:: | ||
| 472 | |||
| 473 | Specifying passwords directly in ``git://`` urls is not supported. | 468 | Specifying passwords directly in ``git://`` urls is not supported. |
| 474 | There are several reasons: :term:`SRC_URI` is often written out to logs and | 469 | There are several reasons: :term:`SRC_URI` is often written out to logs and |
| 475 | other places, and that could easily leak passwords; it is also all too | 470 | other places, and that could easily leak passwords; it is also all too |
| @@ -598,7 +593,7 @@ and port, username, and password, and fetches the Head Revision:: | |||
| 598 | SRC_URI = "p4://example-depot/main/source/..." | 593 | SRC_URI = "p4://example-depot/main/source/..." |
| 599 | SRCREV = "${AUTOREV}" | 594 | SRCREV = "${AUTOREV}" |
| 600 | PV = "p4-${SRCPV}" | 595 | PV = "p4-${SRCPV}" |
| 601 | S = "${WORKDIR}/p4" | 596 | S = "${UNPACKDIR}/p4" |
| 602 | 597 | ||
| 603 | Here is an example that specifies the server URL and port, username, and | 598 | Here is an example that specifies the server URL and port, username, and |
| 604 | password, and fetches a Revision based on a Label:: | 599 | password, and fetches a Revision based on a Label:: |
| @@ -607,15 +602,15 @@ password, and fetches a Revision based on a Label:: | |||
| 607 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." | 602 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." |
| 608 | SRCREV = "release-1.0" | 603 | SRCREV = "release-1.0" |
| 609 | PV = "p4-${SRCPV}" | 604 | PV = "p4-${SRCPV}" |
| 610 | S = "${WORKDIR}/p4" | 605 | S = "${UNPACKDIR}/p4" |
| 611 | 606 | ||
| 612 | .. note:: | 607 | .. note:: |
| 613 | 608 | ||
| 614 | You should always set S to "${WORKDIR}/p4" in your recipe. | 609 | You should always set S to "${UNPACKDIR}/p4" in your recipe. |
| 615 | 610 | ||
| 616 | By default, the fetcher strips the depot location from the local file paths. In | 611 | By default, the fetcher strips the depot location from the local file paths. In |
| 617 | the above example, the content of ``example-depot/main/source/`` will be placed | 612 | the above example, the content of ``example-depot/main/source/`` will be placed |
| 618 | in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot | 613 | in ``${UNPACKDIR}/p4``. For situations where preserving parts of the remote depot |
| 619 | paths locally is desirable, the fetcher supports two parameters: | 614 | paths locally is desirable, the fetcher supports two parameters: |
| 620 | 615 | ||
| 621 | - *"module":* | 616 | - *"module":* |
| @@ -686,9 +681,9 @@ Such functionality is set by the variable: | |||
| 686 | delegate access to resources, if this variable is set, the Az Fetcher will | 681 | delegate access to resources, if this variable is set, the Az Fetcher will |
| 687 | use it when fetching artifacts from the cloud. | 682 | use it when fetching artifacts from the cloud. |
| 688 | 683 | ||
| 689 | You can specify the AZ_SAS variable as shown below:: | 684 | You can specify the AZ_SAS variable prefixed with a ? as shown below:: |
| 690 | 685 | ||
| 691 | AZ_SAS = "se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>" | 686 | AZ_SAS = "?se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>" |
| 692 | 687 | ||
| 693 | Here is an example URL:: | 688 | Here is an example URL:: |
| 694 | 689 | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst index 35ffb88b02..9837b009ea 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst | |||
| @@ -206,6 +206,34 @@ installing (empty by default) and packaging (empty by default). These | |||
| 206 | tasks are often overridden or extended by other classes added during the | 206 | tasks are often overridden or extended by other classes added during the |
| 207 | project development process. | 207 | project development process. |
| 208 | 208 | ||
| 209 | Class Types | ||
| 210 | ~~~~~~~~~~~ | ||
| 211 | |||
| 212 | BitBake supports class files installed in three different directories: | ||
| 213 | |||
| 214 | - ``classes-global/``: these classes must be inherited globally through the | ||
| 215 | :term:`INHERIT` variable in a :ref:`configuration file | ||
| 216 | <bitbake-user-manual/bitbake-user-manual-intro:Configuration Files>`. These | ||
| 217 | classes are included for every recipe being built. For example, you would use | ||
| 218 | the global class named ``myclass`` like so:: | ||
| 219 | |||
| 220 | INHERIT += "myclass" | ||
| 221 | |||
| 222 | - ``classes-recipe/``: these classes must be inherited from a recipe using the | ||
| 223 | :ref:`inherit <ref-bitbake-user-manual-metadata-inherit>` directive. They do | ||
| 224 | not support being inherited globally. For example, you would use the recipe | ||
| 225 | class named ``myclass`` like so:: | ||
| 226 | |||
| 227 | inherit myclass | ||
| 228 | |||
| 229 | - ``classes/``: this final directory is meant for classes that can be used in | ||
| 230 | the two contexts explain above. In other words, they can be inherit either | ||
| 231 | globally or in a recipe. | ||
| 232 | |||
| 233 | For details on how BitBake locates class files, see the | ||
| 234 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Locating Class Files` | ||
| 235 | section of the Bitbake User Manual. | ||
| 236 | |||
| 209 | Layers | 237 | Layers |
| 210 | ------ | 238 | ------ |
| 211 | 239 | ||
| @@ -258,6 +286,8 @@ the append file would match the following recipe names:: | |||
| 258 | busybox_1.21.1.bb | 286 | busybox_1.21.1.bb |
| 259 | busybox_1.21.2.bb | 287 | busybox_1.21.2.bb |
| 260 | busybox_1.21.3.bb | 288 | busybox_1.21.3.bb |
| 289 | busybox_1.21.10.bb | ||
| 290 | busybox_1.21.11.bb | ||
| 261 | 291 | ||
| 262 | .. note:: | 292 | .. note:: |
| 263 | 293 | ||
| @@ -349,40 +379,84 @@ Usage and syntax | |||
| 349 | Following is the usage and syntax for BitBake:: | 379 | Following is the usage and syntax for BitBake:: |
| 350 | 380 | ||
| 351 | $ bitbake -h | 381 | $ bitbake -h |
| 352 | Usage: bitbake [options] [recipename/target recipe:do_task ...] | 382 | usage: bitbake [-s] [-e] [-g] [-u UI] [--version] [-h] [-f] [-c CMD] |
| 353 | 383 | [-C INVALIDATE_STAMP] [--runall RUNALL] [--runonly RUNONLY] | |
| 354 | Executes the specified task (default is 'build') for a given set of target recipes (.bb files). | 384 | [--no-setscene] [--skip-setscene] [--setscene-only] [-n] [-p] |
| 355 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which | 385 | [-k] [-P] [-S SIGNATURE_HANDLER] [--revisions-changed] |
| 356 | will provide the layer, BBFILES and other configuration information. | 386 | [-b BUILDFILE] [-D] [-l DEBUG_DOMAINS] [-v] [-q] |
| 387 | [-w WRITEEVENTLOG] [-B BIND] [-T SERVER_TIMEOUT] | ||
| 388 | [--remote-server REMOTE_SERVER] [-m] [--token XMLRPCTOKEN] | ||
| 389 | [--observe-only] [--status-only] [--server-only] [-r PREFILE] | ||
| 390 | [-R POSTFILE] [-I EXTRA_ASSUME_PROVIDED] | ||
| 391 | [recipename/target ...] | ||
| 392 | |||
| 393 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH | ||
| 394 | which will provide the layer, BBFILES and other configuration information. | ||
| 395 | |||
| 396 | General options: | ||
| 397 | recipename/target Execute the specified task (default is 'build') for | ||
| 398 | these target recipes (.bb files). | ||
| 399 | -s, --show-versions Show current and preferred versions of all recipes. | ||
| 400 | -e, --environment Show the global or per-recipe environment complete | ||
| 401 | with information about where variables were | ||
| 402 | set/changed. | ||
| 403 | -g, --graphviz Save dependency tree information for the specified | ||
| 404 | targets in the dot syntax. | ||
| 405 | -u UI, --ui UI The user interface to use (knotty, ncurses, taskexp, | ||
| 406 | taskexp_ncurses or teamcity - default knotty). | ||
| 407 | --version Show programs version and exit. | ||
| 408 | -h, --help Show this help message and exit. | ||
| 357 | 409 | ||
| 358 | Options: | 410 | Task control options: |
| 359 | --version show program's version number and exit | ||
| 360 | -h, --help show this help message and exit | ||
| 361 | -b BUILDFILE, --buildfile=BUILDFILE | ||
| 362 | Execute tasks from a specific .bb recipe directly. | ||
| 363 | WARNING: Does not handle any dependencies from other | ||
| 364 | recipes. | ||
| 365 | -k, --continue Continue as much as possible after an error. While the | ||
| 366 | target that failed and anything depending on it cannot | ||
| 367 | be built, as much as possible will be built before | ||
| 368 | stopping. | ||
| 369 | -f, --force Force the specified targets/task to run (invalidating | 411 | -f, --force Force the specified targets/task to run (invalidating |
| 370 | any existing stamp file). | 412 | any existing stamp file). |
| 371 | -c CMD, --cmd=CMD Specify the task to execute. The exact options | 413 | -c CMD, --cmd CMD Specify the task to execute. The exact options |
| 372 | available depend on the metadata. Some examples might | 414 | available depend on the metadata. Some examples might |
| 373 | be 'compile' or 'populate_sysroot' or 'listtasks' may | 415 | be 'compile' or 'populate_sysroot' or 'listtasks' may |
| 374 | give a list of the tasks available. | 416 | give a list of the tasks available. |
| 375 | -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP | 417 | -C INVALIDATE_STAMP, --clear-stamp INVALIDATE_STAMP |
| 376 | Invalidate the stamp for the specified task such as | 418 | Invalidate the stamp for the specified task such as |
| 377 | 'compile' and then run the default task for the | 419 | 'compile' and then run the default task for the |
| 378 | specified target(s). | 420 | specified target(s). |
| 379 | -r PREFILE, --read=PREFILE | 421 | --runall RUNALL Run the specified task for any recipe in the taskgraph |
| 380 | Read the specified file before bitbake.conf. | 422 | of the specified target (even if it wouldn't otherwise |
| 381 | -R POSTFILE, --postread=POSTFILE | 423 | have run). |
| 382 | Read the specified file after bitbake.conf. | 424 | --runonly RUNONLY Run only the specified task within the taskgraph of |
| 383 | -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also | 425 | the specified targets (and any task dependencies those |
| 384 | print bb.note(...) messages to stdout (in addition to | 426 | tasks may have). |
| 385 | writing them to ${T}/log.do_<task>). | 427 | --no-setscene Do not run any setscene tasks. sstate will be ignored |
| 428 | and everything needed, built. | ||
| 429 | --skip-setscene Skip setscene tasks if they would be executed. Tasks | ||
| 430 | previously restored from sstate will be kept, unlike | ||
| 431 | --no-setscene. | ||
| 432 | --setscene-only Only run setscene tasks, don't run any real tasks. | ||
| 433 | |||
| 434 | Execution control options: | ||
| 435 | -n, --dry-run Don't execute, just go through the motions. | ||
| 436 | -p, --parse-only Quit after parsing the BB recipes. | ||
| 437 | -k, --continue Continue as much as possible after an error. While the | ||
| 438 | target that failed and anything depending on it cannot | ||
| 439 | be built, as much as possible will be built before | ||
| 440 | stopping. | ||
| 441 | -P, --profile Profile the command and save reports. | ||
| 442 | -S SIGNATURE_HANDLER, --dump-signatures SIGNATURE_HANDLER | ||
| 443 | Dump out the signature construction information, with | ||
| 444 | no task execution. The SIGNATURE_HANDLER parameter is | ||
| 445 | passed to the handler. Two common values are none and | ||
| 446 | printdiff but the handler may define more/less. none | ||
| 447 | means only dump the signature, printdiff means | ||
| 448 | recursively compare the dumped signature with the most | ||
| 449 | recent one in a local build or sstate cache (can be | ||
| 450 | used to find out why tasks re-run when that is not | ||
| 451 | expected) | ||
| 452 | --revisions-changed Set the exit code depending on whether upstream | ||
| 453 | floating revisions have changed or not. | ||
| 454 | -b BUILDFILE, --buildfile BUILDFILE | ||
| 455 | Execute tasks from a specific .bb recipe directly. | ||
| 456 | WARNING: Does not handle any dependencies from other | ||
| 457 | recipes. | ||
| 458 | |||
| 459 | Logging/output control options: | ||
| 386 | -D, --debug Increase the debug level. You can specify this more | 460 | -D, --debug Increase the debug level. You can specify this more |
| 387 | than once. -D sets the debug level to 1, where only | 461 | than once. -D sets the debug level to 1, where only |
| 388 | bb.debug(1, ...) messages are printed to stdout; -DD | 462 | bb.debug(1, ...) messages are printed to stdout; -DD |
| @@ -392,65 +466,47 @@ Following is the usage and syntax for BitBake:: | |||
| 392 | -D only affects output to stdout. All debug messages | 466 | -D only affects output to stdout. All debug messages |
| 393 | are written to ${T}/log.do_taskname, regardless of the | 467 | are written to ${T}/log.do_taskname, regardless of the |
| 394 | debug level. | 468 | debug level. |
| 469 | -l DEBUG_DOMAINS, --log-domains DEBUG_DOMAINS | ||
| 470 | Show debug logging for the specified logging domains. | ||
| 471 | -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also | ||
| 472 | print bb.note(...) messages to stdout (in addition to | ||
| 473 | writing them to ${T}/log.do_<task>). | ||
| 395 | -q, --quiet Output less log message data to the terminal. You can | 474 | -q, --quiet Output less log message data to the terminal. You can |
| 396 | specify this more than once. | 475 | specify this more than once. |
| 397 | -n, --dry-run Don't execute, just go through the motions. | 476 | -w WRITEEVENTLOG, --write-log WRITEEVENTLOG |
| 398 | -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER | 477 | Writes the event log of the build to a bitbake event |
| 399 | Dump out the signature construction information, with | 478 | json file. Use '' (empty string) to assign the name |
| 400 | no task execution. The SIGNATURE_HANDLER parameter is | 479 | automatically. |
| 401 | passed to the handler. Two common values are none and | 480 | |
| 402 | printdiff but the handler may define more/less. none | 481 | Server options: |
| 403 | means only dump the signature, printdiff means compare | 482 | -B BIND, --bind BIND The name/address for the bitbake xmlrpc server to bind |
| 404 | the dumped signature with the cached one. | ||
| 405 | -p, --parse-only Quit after parsing the BB recipes. | ||
| 406 | -s, --show-versions Show current and preferred versions of all recipes. | ||
| 407 | -e, --environment Show the global or per-recipe environment complete | ||
| 408 | with information about where variables were | ||
| 409 | set/changed. | ||
| 410 | -g, --graphviz Save dependency tree information for the specified | ||
| 411 | targets in the dot syntax. | ||
| 412 | -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED | ||
| 413 | Assume these dependencies don't exist and are already | ||
| 414 | provided (equivalent to ASSUME_PROVIDED). Useful to | ||
| 415 | make dependency graphs more appealing | ||
| 416 | -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS | ||
| 417 | Show debug logging for the specified logging domains | ||
| 418 | -P, --profile Profile the command and save reports. | ||
| 419 | -u UI, --ui=UI The user interface to use (knotty, ncurses, taskexp or | ||
| 420 | teamcity - default knotty). | ||
| 421 | --token=XMLRPCTOKEN Specify the connection token to be used when | ||
| 422 | connecting to a remote server. | ||
| 423 | --revisions-changed Set the exit code depending on whether upstream | ||
| 424 | floating revisions have changed or not. | ||
| 425 | --server-only Run bitbake without a UI, only starting a server | ||
| 426 | (cooker) process. | ||
| 427 | -B BIND, --bind=BIND The name/address for the bitbake xmlrpc server to bind | ||
| 428 | to. | 483 | to. |
| 429 | -T SERVER_TIMEOUT, --idle-timeout=SERVER_TIMEOUT | 484 | -T SERVER_TIMEOUT, --idle-timeout SERVER_TIMEOUT |
| 430 | Set timeout to unload bitbake server due to | 485 | Set timeout to unload bitbake server due to |
| 431 | inactivity, set to -1 means no unload, default: | 486 | inactivity, set to -1 means no unload, default: |
| 432 | Environment variable BB_SERVER_TIMEOUT. | 487 | Environment variable BB_SERVER_TIMEOUT. |
| 433 | --no-setscene Do not run any setscene tasks. sstate will be ignored | 488 | --remote-server REMOTE_SERVER |
| 434 | and everything needed, built. | ||
| 435 | --skip-setscene Skip setscene tasks if they would be executed. Tasks | ||
| 436 | previously restored from sstate will be kept, unlike | ||
| 437 | --no-setscene | ||
| 438 | --setscene-only Only run setscene tasks, don't run any real tasks. | ||
| 439 | --remote-server=REMOTE_SERVER | ||
| 440 | Connect to the specified server. | 489 | Connect to the specified server. |
| 441 | -m, --kill-server Terminate any running bitbake server. | 490 | -m, --kill-server Terminate any running bitbake server. |
| 491 | --token XMLRPCTOKEN Specify the connection token to be used when | ||
| 492 | connecting to a remote server. | ||
| 442 | --observe-only Connect to a server as an observing-only client. | 493 | --observe-only Connect to a server as an observing-only client. |
| 443 | --status-only Check the status of the remote bitbake server. | 494 | --status-only Check the status of the remote bitbake server. |
| 444 | -w WRITEEVENTLOG, --write-log=WRITEEVENTLOG | 495 | --server-only Run bitbake without a UI, only starting a server |
| 445 | Writes the event log of the build to a bitbake event | 496 | (cooker) process. |
| 446 | json file. Use '' (empty string) to assign the name | 497 | |
| 447 | automatically. | 498 | Configuration options: |
| 448 | --runall=RUNALL Run the specified task for any recipe in the taskgraph | 499 | -r PREFILE, --read PREFILE |
| 449 | of the specified target (even if it wouldn't otherwise | 500 | Read the specified file before bitbake.conf. |
| 450 | have run). | 501 | -R POSTFILE, --postread POSTFILE |
| 451 | --runonly=RUNONLY Run only the specified task within the taskgraph of | 502 | Read the specified file after bitbake.conf. |
| 452 | the specified targets (and any task dependencies those | 503 | -I EXTRA_ASSUME_PROVIDED, --ignore-deps EXTRA_ASSUME_PROVIDED |
| 453 | tasks may have). | 504 | Assume these dependencies don't exist and are already |
| 505 | provided (equivalent to ASSUME_PROVIDED). Useful to | ||
| 506 | make dependency graphs more appealing. | ||
| 507 | |||
| 508 | .. | ||
| 509 | Bitbake help output generated with "stty columns 80; bin/bitbake -h" | ||
| 454 | 510 | ||
| 455 | .. _bitbake-examples: | 511 | .. _bitbake-examples: |
| 456 | 512 | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst new file mode 100644 index 0000000000..09e353945b --- /dev/null +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ================= | ||
| 4 | Library Functions | ||
| 5 | ================= | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | This chapter lists common library functions available under the ``lib/`` | ||
| 10 | directory in BitBake. | ||
| 11 | |||
| 12 | These functions can be used in recipes or configuration files with | ||
| 13 | :ref:`inline-Python <bitbake-user-manual/bitbake-user-manual-metadata:Inline | ||
| 14 | Python Variable Expansion>` or :ref:`Python | ||
| 15 | <bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python | ||
| 16 | Functions>` functions. | ||
| 17 | |||
| 18 | Logging utilities | ||
| 19 | ================= | ||
| 20 | |||
| 21 | Different logging utilities can be used from Python code in recipes or | ||
| 22 | configuration files. | ||
| 23 | |||
| 24 | The strings passed below can be formatted with ``str.format()``, for example:: | ||
| 25 | |||
| 26 | bb.warn("Houston, we have a %s", "bit of a problem") | ||
| 27 | |||
| 28 | Formatted string can also be used directly:: | ||
| 29 | |||
| 30 | bb.error("%s, we have a %s" % ("Houston", "big problem")) | ||
| 31 | |||
| 32 | Python f-strings may also be used:: | ||
| 33 | |||
| 34 | h = "Houston" | ||
| 35 | bb.fatal(f"{h}, we have a critical problem") | ||
| 36 | |||
| 37 | .. automodule:: bb | ||
| 38 | :members: | ||
| 39 | debug, | ||
| 40 | error, | ||
| 41 | erroronce, | ||
| 42 | fatal, | ||
| 43 | note, | ||
| 44 | plain, | ||
| 45 | verbnote, | ||
| 46 | warn, | ||
| 47 | warnonce, | ||
| 48 | |||
| 49 | ``bb.utils`` | ||
| 50 | ============ | ||
| 51 | |||
| 52 | .. automodule:: bb.utils | ||
| 53 | :members: | ||
| 54 | :exclude-members: | ||
| 55 | LogCatcher, | ||
| 56 | PrCtlError, | ||
| 57 | VersionStringException, | ||
| 58 | better_compile, | ||
| 59 | better_exec, | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index 58975f4c88..6a3488ed23 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | |||
| @@ -754,22 +754,11 @@ share the task. | |||
| 754 | This section presents the mechanisms BitBake provides to allow you to | 754 | This section presents the mechanisms BitBake provides to allow you to |
| 755 | share functionality between recipes. Specifically, the mechanisms | 755 | share functionality between recipes. Specifically, the mechanisms |
| 756 | include ``include``, ``inherit``, :term:`INHERIT`, and ``require`` | 756 | include ``include``, ``inherit``, :term:`INHERIT`, and ``require`` |
| 757 | directives. | 757 | directives. There is also a higher-level abstraction called |
| 758 | ``configuration fragments`` that is enabled with ``addfragments`` | ||
| 759 | directive. | ||
| 758 | 760 | ||
| 759 | Locating Include and Class Files | 761 | .. _ref-bitbake-user-manual-metadata-inherit: |
| 760 | -------------------------------- | ||
| 761 | |||
| 762 | BitBake uses the :term:`BBPATH` variable to locate | ||
| 763 | needed include and class files. Additionally, BitBake searches the | ||
| 764 | current directory for ``include`` and ``require`` directives. | ||
| 765 | |||
| 766 | .. note:: | ||
| 767 | |||
| 768 | The BBPATH variable is analogous to the environment variable PATH . | ||
| 769 | |||
| 770 | In order for include and class files to be found by BitBake, they need | ||
| 771 | to be located in a "classes" subdirectory that can be found in | ||
| 772 | :term:`BBPATH`. | ||
| 773 | 762 | ||
| 774 | ``inherit`` Directive | 763 | ``inherit`` Directive |
| 775 | --------------------- | 764 | --------------------- |
| @@ -809,19 +798,43 @@ An advantage with the inherit directive as compared to both the | |||
| 809 | :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` | 798 | :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` |
| 810 | directives is that you can inherit class files conditionally. You can | 799 | directives is that you can inherit class files conditionally. You can |
| 811 | accomplish this by using a variable expression after the ``inherit`` | 800 | accomplish this by using a variable expression after the ``inherit`` |
| 812 | statement. Here is an example:: | 801 | statement. |
| 802 | |||
| 803 | For inheriting classes conditionally, using the :ref:`inherit_defer | ||
| 804 | <ref-bitbake-user-manual-metadata-inherit-defer>` directive is advised as | ||
| 805 | :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` is | ||
| 806 | evaluated at the end of parsing. | ||
| 807 | |||
| 808 | .. _ref-bitbake-user-manual-metadata-inherit-defer: | ||
| 809 | |||
| 810 | ``inherit_defer`` Directive | ||
| 811 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 812 | |||
| 813 | The :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` | ||
| 814 | directive works like the :ref:`inherit | ||
| 815 | <ref-bitbake-user-manual-metadata-inherit>` directive, except that it is only | ||
| 816 | evaluated at the end of parsing. Its usage is recommended when a conditional | ||
| 817 | expression is used. | ||
| 813 | 818 | ||
| 814 | inherit ${VARNAME} | 819 | This allows conditional expressions to be evaluated "late", meaning changes to |
| 820 | the variable after the line is parsed will take effect. With the :ref:`inherit | ||
| 821 | <ref-bitbake-user-manual-metadata-inherit>` directive this is not the case. | ||
| 822 | |||
| 823 | Here is an example:: | ||
| 824 | |||
| 825 | inherit_defer ${VARNAME} | ||
| 815 | 826 | ||
| 816 | If ``VARNAME`` is | 827 | If ``VARNAME`` is |
| 817 | going to be set, it needs to be set before the ``inherit`` statement is | 828 | going to be set, it needs to be set before the ``inherit_defer`` statement is |
| 818 | parsed. One way to achieve a conditional inherit in this case is to use | 829 | parsed. One way to achieve a conditional inherit in this case is to use |
| 819 | overrides:: | 830 | overrides:: |
| 820 | 831 | ||
| 821 | VARIABLE = "" | 832 | VARIABLE = "" |
| 822 | VARIABLE:someoverride = "myclass" | 833 | VARIABLE:someoverride = "myclass" |
| 823 | 834 | ||
| 824 | Another method is by using anonymous Python. Here is an example:: | 835 | Another method is by using :ref:`anonymous Python |
| 836 | <bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`. | ||
| 837 | Here is an example:: | ||
| 825 | 838 | ||
| 826 | python () { | 839 | python () { |
| 827 | if condition == value: | 840 | if condition == value: |
| @@ -830,44 +843,90 @@ Another method is by using anonymous Python. Here is an example:: | |||
| 830 | d.setVar('VARIABLE', '') | 843 | d.setVar('VARIABLE', '') |
| 831 | } | 844 | } |
| 832 | 845 | ||
| 833 | Alternatively, you could use an in-line Python expression in the | 846 | Alternatively, you could use an inline Python expression in the |
| 834 | following form:: | 847 | following form:: |
| 835 | 848 | ||
| 836 | inherit ${@'classname' if condition else ''} | 849 | inherit_defer ${@'classname' if condition else ''} |
| 837 | inherit ${@functionname(params)} | 850 | |
| 851 | Or:: | ||
| 852 | |||
| 853 | inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)} | ||
| 838 | 854 | ||
| 839 | In all cases, if the expression evaluates to an | 855 | In all cases, if the expression evaluates to an |
| 840 | empty string, the statement does not trigger a syntax error because it | 856 | empty string, the statement does not trigger a syntax error because it |
| 841 | becomes a no-op. | 857 | becomes a no-op. |
| 842 | 858 | ||
| 859 | See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes | ||
| 860 | ``inherit`` calls to ``inherit_defer``. | ||
| 861 | |||
| 862 | .. _ref-include-directive: | ||
| 863 | |||
| 843 | ``include`` Directive | 864 | ``include`` Directive |
| 844 | --------------------- | 865 | --------------------- |
| 845 | 866 | ||
| 846 | BitBake understands the ``include`` directive. This directive causes | 867 | The ``include`` directive causes BitBake to parse a given file, |
| 847 | BitBake to parse whatever file you specify, and to insert that file at | 868 | and to include that file's contents at the location of the |
| 848 | that location. The directive is much like its equivalent in Make except | 869 | ``include`` statement. This directive is similar to its equivalent |
| 849 | that if the path specified on the include line is a relative path, | 870 | in Make, except that if the path specified on the BitBake ``include`` |
| 850 | BitBake locates the first file it can find within :term:`BBPATH`. | 871 | line is a relative path, BitBake will search for it on the path designated |
| 872 | by :term:`BBPATH` and will include *only the first matching file*. | ||
| 851 | 873 | ||
| 852 | The include directive is a more generic method of including | 874 | The ``include`` directive is a more generic method of including |
| 853 | functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` | 875 | functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` |
| 854 | directive, which is restricted to class (i.e. ``.bbclass``) files. The | 876 | directive, which is restricted to class (i.e. ``.bbclass``) files. The |
| 855 | include directive is applicable for any other kind of shared or | 877 | ``include`` directive is applicable for any other kind of shared or |
| 856 | encapsulated functionality or configuration that does not suit a | 878 | encapsulated functionality or configuration that does not suit a |
| 857 | ``.bbclass`` file. | 879 | ``.bbclass`` file. |
| 858 | 880 | ||
| 859 | As an example, suppose you needed a recipe to include some self-test | 881 | For example, if you needed a recipe to include some self-test definitions, |
| 860 | definitions:: | 882 | you might write:: |
| 861 | 883 | ||
| 862 | include test_defs.inc | 884 | include test_defs.inc |
| 863 | 885 | ||
| 886 | The ``include`` directive does not produce an error if the specified file | ||
| 887 | cannot be found. If the included file *must* exist, then you should use | ||
| 888 | use :ref:`require <require-inclusion>` instead, which will generate an error | ||
| 889 | if the file cannot be found. | ||
| 890 | |||
| 864 | .. note:: | 891 | .. note:: |
| 865 | 892 | ||
| 866 | The include directive does not produce an error when the file cannot be | 893 | Note well that the ``include`` directive will include the first matching |
| 867 | found. Consequently, it is recommended that if the file you are including is | 894 | file and nothing further (which is almost always the behaviour you want). |
| 868 | expected to exist, you should use :ref:`require <require-inclusion>` instead | 895 | If you need to include all matching files, you need to use the |
| 869 | of include . Doing so makes sure that an error is produced if the file cannot | 896 | ``include_all`` directive, explained below. |
| 870 | be found. | 897 | |
| 898 | .. _ref-include-all-directive: | ||
| 899 | |||
| 900 | ``include_all`` Directive | ||
| 901 | ------------------------- | ||
| 902 | |||
| 903 | The ``include_all`` directive works like the :ref:`include | ||
| 904 | <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` | ||
| 905 | directive but will include *all* of the files that match the specified path in | ||
| 906 | the enabled layers (layers part of :term:`BBLAYERS`). | ||
| 907 | |||
| 908 | .. note:: | ||
| 909 | |||
| 910 | This behaviour is rarely what you want in normal operation, and should | ||
| 911 | be reserved for only those situations when you explicitly want to parse | ||
| 912 | and include all matching files found across all layers, as the following | ||
| 913 | example shows. | ||
| 914 | |||
| 915 | As a realistic example of this directive, imagine that all of your active | ||
| 916 | layers contain a file ``conf/distro/include/maintainers.inc``, containing | ||
| 917 | maintainer information for the recipes in that layer, and you wanted to | ||
| 918 | collect all of the content from all of those files across all of those layers. | ||
| 919 | You could use the statement:: | ||
| 920 | |||
| 921 | include_all conf/distro/include/maintainers.inc | ||
| 922 | |||
| 923 | In this case, BitBake will iterate through all of the directories in | ||
| 924 | the colon-separated :term:`BBPATH` (from left to right) and collect the | ||
| 925 | contents of all matching files, so you end up with the maintainer | ||
| 926 | information of all of your active layers, not just the first one. | ||
| 927 | |||
| 928 | As the ``include_all`` directive uses the ``include`` directive in the | ||
| 929 | background, as with ``include``, no error is produced if no files are matched. | ||
| 871 | 930 | ||
| 872 | .. _require-inclusion: | 931 | .. _require-inclusion: |
| 873 | 932 | ||
| @@ -933,6 +992,162 @@ the ``autotools`` and ``pkgconfig`` classes:: | |||
| 933 | 992 | ||
| 934 | INHERIT += "autotools pkgconfig" | 993 | INHERIT += "autotools pkgconfig" |
| 935 | 994 | ||
| 995 | ``addfragments`` Directive | ||
| 996 | -------------------------- | ||
| 997 | |||
| 998 | This directive allows fine-tuning local configurations with configuration | ||
| 999 | snippets contained in layers in a structured, controlled way. Typically it would | ||
| 1000 | go into ``bitbake.conf``, for example:: | ||
| 1001 | |||
| 1002 | addfragments conf/fragments OE_FRAGMENTS OE_FRAGMENTS_METADATA_VARS OE_BUILTIN_FRAGMENTS | ||
| 1003 | |||
| 1004 | ``addfragments`` takes four parameters: | ||
| 1005 | |||
| 1006 | - path prefix for fragment files inside the layer file tree that bitbake | ||
| 1007 | uses to construct full paths to the fragment files | ||
| 1008 | |||
| 1009 | - name of variable that holds the list of enabled fragments in an | ||
| 1010 | active build | ||
| 1011 | |||
| 1012 | - name of variable that contains a list of variable names containing | ||
| 1013 | fragment-specific metadata (such as descriptions) | ||
| 1014 | |||
| 1015 | - name of variable that contains definitions for built-in fragments | ||
| 1016 | |||
| 1017 | This allows listing enabled configuration fragments in ``OE_FRAGMENTS`` | ||
| 1018 | variable like this:: | ||
| 1019 | |||
| 1020 | OE_FRAGMENTS = "core/domain/somefragment core/someotherfragment anotherlayer/anotherdomain/anotherfragment" | ||
| 1021 | |||
| 1022 | Fragment names listed in this variable must be prefixed by the layer name | ||
| 1023 | where a fragment file is located, defined by :term:`BBFILE_COLLECTIONS` in ``layer.conf``. | ||
| 1024 | |||
| 1025 | The implementation then expands this list into | ||
| 1026 | :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` | ||
| 1027 | directives with full paths to respective layers:: | ||
| 1028 | |||
| 1029 | require /path/to/core-layer/conf/fragments/domain/somefragment.conf | ||
| 1030 | require /path/to/core-layer/conf/fragments/someotherfragment.conf | ||
| 1031 | require /path/to/another-layer/conf/fragments/anotherdomain/anotherfragment.conf | ||
| 1032 | |||
| 1033 | The variable containing a list of fragment metadata variables could look like this:: | ||
| 1034 | |||
| 1035 | OE_FRAGMENTS_METADATA_VARS = "BB_CONF_FRAGMENT_SUMMARY BB_CONF_FRAGMENT_DESCRIPTION" | ||
| 1036 | |||
| 1037 | The implementation will add a flag containing the fragment name to each of those variables | ||
| 1038 | when parsing fragments, so that the variables are namespaced by fragment name, and do not override | ||
| 1039 | each other when several fragments are enabled. | ||
| 1040 | |||
| 1041 | The variable containing a built-in fragment definitions could look like this:: | ||
| 1042 | |||
| 1043 | OE_BUILTIN_FRAGMENTS = "someprefix:SOMEVARIABLE anotherprefix:ANOTHERVARIABLE" | ||
| 1044 | |||
| 1045 | and then if 'someprefix/somevalue' is added to the variable that holds the list | ||
| 1046 | of enabled fragments: | ||
| 1047 | |||
| 1048 | OE_FRAGMENTS = "... someprefix/somevalue" | ||
| 1049 | |||
| 1050 | bitbake will treat that as direct value assignment in its configuration:: | ||
| 1051 | |||
| 1052 | SOMEVARIABLE = "somevalue" | ||
| 1053 | |||
| 1054 | Locating Include Files | ||
| 1055 | ---------------------- | ||
| 1056 | |||
| 1057 | BitBake uses the :term:`BBPATH` variable to locate needed include files. | ||
| 1058 | Additionally, BitBake searches the current directory for :ref:`include | ||
| 1059 | <ref-include-directive>` and :ref:`require <require-inclusion>` directives. | ||
| 1060 | |||
| 1061 | .. note:: | ||
| 1062 | |||
| 1063 | The BBPATH variable is analogous to the environment variable PATH . | ||
| 1064 | |||
| 1065 | For these two directives, BitBake includes the first file it finds. | ||
| 1066 | |||
| 1067 | .. note:: | ||
| 1068 | |||
| 1069 | It is also possible to include *all* occurences of a file with the same name | ||
| 1070 | with the :ref:`include_all <ref-include-all-directive>` directive. | ||
| 1071 | |||
| 1072 | Let's consider the following statement called from a recipe file located in | ||
| 1073 | ``/layers/meta-custom2/recipes-example/example_0.1.bb``:: | ||
| 1074 | |||
| 1075 | require myfile.inc | ||
| 1076 | |||
| 1077 | Where ``myfile.inc`` is located in ``/layers/meta-custom2/recipes-example/``. | ||
| 1078 | |||
| 1079 | And let's assume that the value of :term:`BBPATH` is | ||
| 1080 | ``/layers/meta-custom1:/layers/meta-custom2``. Then BitBake will try to find | ||
| 1081 | ``myfile.inc`` in this order:: | ||
| 1082 | |||
| 1083 | /layers/meta-custom2/recipes-example/example/myfile.inc | ||
| 1084 | /layers/meta-custom1/myfile.inc | ||
| 1085 | /layers/meta-custom2/myfile.inc | ||
| 1086 | |||
| 1087 | In this case the first path of the list matches and BitBake includes this file | ||
| 1088 | in ``example_0.1.bb``. | ||
| 1089 | |||
| 1090 | Another common example would be:: | ||
| 1091 | |||
| 1092 | require recipes-other/other/otherfile.inc | ||
| 1093 | |||
| 1094 | Where ``otherfile.inc`` is located in | ||
| 1095 | ``/layers/meta-custom1/recipes-other/other/``. | ||
| 1096 | |||
| 1097 | In this case, the following paths would be searched:: | ||
| 1098 | |||
| 1099 | /layers/meta-custom2/recipes-example/example/recipes-other/other/otherfile.inc | ||
| 1100 | /layers/meta-custom1/recipes-other/other/otherfile.inc | ||
| 1101 | /layers/meta-custom2/recipes-other/other/otherfile.inc | ||
| 1102 | |||
| 1103 | This time, the second item of this list would be matched. | ||
| 1104 | |||
| 1105 | .. note:: | ||
| 1106 | |||
| 1107 | In the above examples, the exact same search order applies for the | ||
| 1108 | :ref:`include <ref-include-directive>` directive. | ||
| 1109 | |||
| 1110 | Locating Class Files | ||
| 1111 | -------------------- | ||
| 1112 | |||
| 1113 | Like include files, class files are located using the :term:`BBPATH` variable. | ||
| 1114 | The classes can be included in the ``classes-recipe``, ``classes-global`` and | ||
| 1115 | ``classes`` directories, as explained in the | ||
| 1116 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:Class types` section of the | ||
| 1117 | Bitbake User Manual. Like for the :ref:`include <ref-include-directive>` and | ||
| 1118 | :ref:`require <require-inclusion>` directives, BitBake stops and inherits the | ||
| 1119 | first class that it finds. | ||
| 1120 | |||
| 1121 | For classes inherited with the :ref:`inherit | ||
| 1122 | <ref-bitbake-user-manual-metadata-inherit>` directive, BitBake will try to | ||
| 1123 | locate the class under each ``classes-recipe`` directory for each path in | ||
| 1124 | :term:`BBPATH`, and then do the same for each ``classes`` directory for each | ||
| 1125 | path in :term:`BBPATH`. | ||
| 1126 | |||
| 1127 | For example, if the value :term:`BBPATH` is | ||
| 1128 | ``/layers/meta-custom1:/layers/meta-custom2`` then the ``hello`` class | ||
| 1129 | would be searched in this order:: | ||
| 1130 | |||
| 1131 | /layers/meta-custom1/classes-recipe/hello.bbclass | ||
| 1132 | /layers/meta-custom2/classes-recipe/hello.bbclass | ||
| 1133 | /layers/meta-custom1/classes/hello.bbclass | ||
| 1134 | /layers/meta-custom2/classes/hello.bbclass | ||
| 1135 | |||
| 1136 | .. note:: | ||
| 1137 | |||
| 1138 | Note that the order of the list above does not depend on where the class in | ||
| 1139 | inherited from. | ||
| 1140 | |||
| 1141 | Likewise, for classes inherited with the :term:`INHERIT` variable, the | ||
| 1142 | ``classes-global`` directory is searched first, and the ``classes`` directory is | ||
| 1143 | searched second. Taking the above example, this would result in the following | ||
| 1144 | list:: | ||
| 1145 | |||
| 1146 | /layers/meta-custom1/classes-global/hello.bbclass | ||
| 1147 | /layers/meta-custom2/classes-global/hello.bbclass | ||
| 1148 | /layers/meta-custom1/classes/hello.bbclass | ||
| 1149 | /layers/meta-custom2/classes/hello.bbclass | ||
| 1150 | |||
| 936 | Functions | 1151 | Functions |
| 937 | ========= | 1152 | ========= |
| 938 | 1153 | ||
| @@ -1303,8 +1518,8 @@ the task and other tasks. Here is an example that shows how to define a | |||
| 1303 | task and declare some dependencies:: | 1518 | task and declare some dependencies:: |
| 1304 | 1519 | ||
| 1305 | python do_printdate () { | 1520 | python do_printdate () { |
| 1306 | import time | 1521 | import datetime |
| 1307 | print time.strftime('%Y%m%d', time.gmtime()) | 1522 | bb.plain('Date: %s' % (datetime.date.today())) |
| 1308 | } | 1523 | } |
| 1309 | addtask printdate after do_fetch before do_build | 1524 | addtask printdate after do_fetch before do_build |
| 1310 | 1525 | ||
| @@ -1972,11 +2187,8 @@ access. Here is a list of available operations: | |||
| 1972 | Other Functions | 2187 | Other Functions |
| 1973 | --------------- | 2188 | --------------- |
| 1974 | 2189 | ||
| 1975 | You can find many other functions that can be called from Python by | 2190 | Other functions are documented in the |
| 1976 | looking at the source code of the ``bb`` module, which is in | 2191 | :doc:`/bitbake-user-manual/bitbake-user-manual-library-functions` document. |
| 1977 | ``bitbake/lib/bb``. For example, ``bitbake/lib/bb/utils.py`` includes | ||
| 1978 | the commonly used functions ``bb.utils.contains()`` and | ||
| 1979 | ``bb.utils.mkdirhier()``, which come with docstrings. | ||
| 1980 | 2192 | ||
| 1981 | Extending Python Library Code | 2193 | Extending Python Library Code |
| 1982 | ----------------------------- | 2194 | ----------------------------- |
| @@ -2016,12 +2228,12 @@ OpenEmbedded metadata-based example. | |||
| 2016 | These checksums are stored in :term:`STAMP`. You can | 2228 | These checksums are stored in :term:`STAMP`. You can |
| 2017 | examine the checksums using the following BitBake command:: | 2229 | examine the checksums using the following BitBake command:: |
| 2018 | 2230 | ||
| 2019 | $ bitbake-dumpsigs | 2231 | $ bitbake-dumpsig |
| 2020 | 2232 | ||
| 2021 | This command returns the signature data in a readable | 2233 | This command returns the signature data in a readable |
| 2022 | format that allows you to examine the inputs used when the OpenEmbedded | 2234 | format that allows you to examine the inputs used when the OpenEmbedded |
| 2023 | build system generates signatures. For example, using | 2235 | build system generates signatures. For example, using |
| 2024 | ``bitbake-dumpsigs`` allows you to examine the ``do_compile`` task's | 2236 | ``bitbake-dumpsig`` allows you to examine the ``do_compile`` task's |
| 2025 | "sigdata" for a C application (e.g. ``bash``). Running the command also | 2237 | "sigdata" for a C application (e.g. ``bash``). Running the command also |
| 2026 | reveals that the "CC" variable is part of the inputs that are hashed. | 2238 | reveals that the "CC" variable is part of the inputs that are hashed. |
| 2027 | Any changes to this variable would invalidate the stamp and cause the | 2239 | Any changes to this variable would invalidate the stamp and cause the |
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 index 899e584f91..810f886897 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | |||
| @@ -127,17 +127,10 @@ overview of their function and contents. | |||
| 127 | Contains the name of the currently running task. The name does not | 127 | Contains the name of the currently running task. The name does not |
| 128 | include the ``do_`` prefix. | 128 | include the ``do_`` prefix. |
| 129 | 129 | ||
| 130 | :term:`BB_DANGLINGAPPENDS_WARNONLY` | 130 | :term:`BB_CURRENT_MC` |
| 131 | Defines how BitBake handles situations where an append file | 131 | Contains the name of the current multiconfig a task is being run under. |
| 132 | (``.bbappend``) has no corresponding recipe file (``.bb``). This | 132 | The name is taken from the multiconfig configuration file (a file |
| 133 | condition often occurs when layers get out of sync (e.g. ``oe-core`` | 133 | ``mc1.conf`` would make this variable equal to ``mc1``). |
| 134 | bumps a recipe version and the old recipe no longer exists and the | ||
| 135 | other layer has not been updated to the new version of the recipe | ||
| 136 | yet). | ||
| 137 | |||
| 138 | The default fatal behavior is safest because it is the sane reaction | ||
| 139 | given something is out of sync. It is important to realize when your | ||
| 140 | changes are no longer being applied. | ||
| 141 | 134 | ||
| 142 | :term:`BB_DEFAULT_TASK` | 135 | :term:`BB_DEFAULT_TASK` |
| 143 | The default task to use when none is specified (e.g. with the ``-c`` | 136 | The default task to use when none is specified (e.g. with the ``-c`` |
| @@ -148,6 +141,25 @@ overview of their function and contents. | |||
| 148 | The default umask to apply to tasks if specified and no task specific | 141 | The default umask to apply to tasks if specified and no task specific |
| 149 | umask flag is set. | 142 | umask flag is set. |
| 150 | 143 | ||
| 144 | :term:`BB_DEFER_BBCLASSES` | ||
| 145 | The classes listed in this variable have their :ref:`inherit | ||
| 146 | <ref-bitbake-user-manual-metadata-inherit>` calls automatically promoted | ||
| 147 | to deferred inherits. See :ref:`inherit_defer | ||
| 148 | <ref-bitbake-user-manual-metadata-inherit-defer>` for more information on | ||
| 149 | deferred inherits. | ||
| 150 | |||
| 151 | This means that if :term:`BB_DEFER_BBCLASSES` is set as follows:: | ||
| 152 | |||
| 153 | BB_DEFER_BBCLASSES = "foo" | ||
| 154 | |||
| 155 | The following statement:: | ||
| 156 | |||
| 157 | inherit foo | ||
| 158 | |||
| 159 | Will automatically be equal to calling:: | ||
| 160 | |||
| 161 | inherit_defer foo | ||
| 162 | |||
| 151 | :term:`BB_DISKMON_DIRS` | 163 | :term:`BB_DISKMON_DIRS` |
| 152 | Monitors disk space and available inodes during the build and allows | 164 | Monitors disk space and available inodes during the build and allows |
| 153 | you to control the build based on these parameters. | 165 | you to control the build based on these parameters. |
| @@ -317,6 +329,11 @@ overview of their function and contents. | |||
| 317 | 329 | ||
| 318 | For example usage, see :term:`BB_GIT_SHALLOW`. | 330 | For example usage, see :term:`BB_GIT_SHALLOW`. |
| 319 | 331 | ||
| 332 | :term:`BB_GIT_DEFAULT_DESTSUFFIX` | ||
| 333 | The default destination directory where the :ref:`Git fetcher | ||
| 334 | <git-fetcher>` unpacks the source code. If this variable is not set, the | ||
| 335 | source code is unpacked in a directory named "git". | ||
| 336 | |||
| 320 | :term:`BB_GIT_SHALLOW` | 337 | :term:`BB_GIT_SHALLOW` |
| 321 | Setting this variable to "1" enables the support for fetching, using and | 338 | Setting this variable to "1" enables the support for fetching, using and |
| 322 | generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_. | 339 | generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_. |
| @@ -327,11 +344,26 @@ overview of their function and contents. | |||
| 327 | mirror tarball. If the shallow mirror tarball cannot be fetched, it will | 344 | mirror tarball. If the shallow mirror tarball cannot be fetched, it will |
| 328 | try to fetch the full mirror tarball and use that. | 345 | try to fetch the full mirror tarball and use that. |
| 329 | 346 | ||
| 330 | When a mirror tarball is not available, a full git clone will be performed | 347 | This setting causes an initial shallow clone instead of an initial full bare clone. |
| 331 | regardless of whether this variable is set or not. Support for shallow | 348 | The amount of data transferred during the initial clone will be significantly reduced. |
| 332 | clones is not currently implemented as git does not directly support | 349 | |
| 333 | shallow cloning a particular git commit hash (it only supports cloning | 350 | However, every time the source revision (referenced in :term:`SRCREV`) |
| 334 | from a tag or branch reference). | 351 | changes, regardless of whether the cache within the download directory |
| 352 | (defined by :term:`DL_DIR`) has been cleaned up or not, | ||
| 353 | the data transfer may be significantly higher because entirely | ||
| 354 | new shallow clones are required for each source revision change. | ||
| 355 | |||
| 356 | Over time, numerous shallow clones may cumulatively transfer | ||
| 357 | the same amount of data as an initial full bare clone. | ||
| 358 | This is especially the case with very large repositories. | ||
| 359 | |||
| 360 | Existing initial full bare clones, created without this setting, | ||
| 361 | will still be utilized. | ||
| 362 | |||
| 363 | If the Git error "Server does not allow request for unadvertised object" | ||
| 364 | occurs, an initial full bare clone is fetched automatically. | ||
| 365 | This may happen if the Git server does not allow the request | ||
| 366 | or if the Git client has issues with this functionality. | ||
| 335 | 367 | ||
| 336 | See also :term:`BB_GIT_SHALLOW_DEPTH` and | 368 | See also :term:`BB_GIT_SHALLOW_DEPTH` and |
| 337 | :term:`BB_GENERATE_SHALLOW_TARBALLS`. | 369 | :term:`BB_GENERATE_SHALLOW_TARBALLS`. |
| @@ -424,7 +456,7 @@ overview of their function and contents. | |||
| 424 | 456 | ||
| 425 | Example usage:: | 457 | Example usage:: |
| 426 | 458 | ||
| 427 | BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" | 459 | BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686" |
| 428 | 460 | ||
| 429 | :term:`BB_INVALIDCONF` | 461 | :term:`BB_INVALIDCONF` |
| 430 | Used in combination with the ``ConfigParsed`` event to trigger | 462 | Used in combination with the ``ConfigParsed`` event to trigger |
| @@ -525,11 +557,28 @@ overview of their function and contents. | |||
| 525 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 557 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
| 526 | the difference in "total" pressure from the previous second. The | 558 | the difference in "total" pressure from the previous second. The |
| 527 | minimum value is 1.0 (extremely slow builds) and the maximum is | 559 | minimum value is 1.0 (extremely slow builds) and the maximum is |
| 528 | 1000000 (a pressure value unlikely to ever be reached). | 560 | 1000000 (a pressure value unlikely to ever be reached). See |
| 561 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 562 | |||
| 563 | A default value to limit the CPU pressure to be set in ``conf/local.conf`` | ||
| 564 | could be:: | ||
| 529 | 565 | ||
| 530 | This threshold can be set in ``conf/local.conf`` as:: | 566 | BB_PRESSURE_MAX_CPU = "15000" |
| 531 | 567 | ||
| 532 | BB_PRESSURE_MAX_CPU = "500" | 568 | Multiple values should be tested on the build host to determine what suits |
| 569 | best, depending on the need for performance versus load average during | ||
| 570 | the build. | ||
| 571 | |||
| 572 | .. note:: | ||
| 573 | |||
| 574 | You may see numerous messages printed by BitBake in case the | ||
| 575 | :term:`BB_PRESSURE_MAX_CPU` is too low:: | ||
| 576 | |||
| 577 | Pressure status changed to CPU: True, IO: False, Mem: False (CPU: 1105.9/2.0, IO: 0.0/2.0, Mem: 0.0/2.0) - using 1/64 bitbake threads | ||
| 578 | |||
| 579 | This means that the :term:`BB_PRESSURE_MAX_CPU` should be increased to | ||
| 580 | a reasonable value for limiting the CPU pressure on the system. | ||
| 581 | Monitor the varying value after ``CPU:`` above to set a sensible value. | ||
| 533 | 582 | ||
| 534 | :term:`BB_PRESSURE_MAX_IO` | 583 | :term:`BB_PRESSURE_MAX_IO` |
| 535 | Specifies a maximum I/O pressure threshold, above which BitBake's | 584 | Specifies a maximum I/O pressure threshold, above which BitBake's |
| @@ -541,14 +590,34 @@ overview of their function and contents. | |||
| 541 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 590 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
| 542 | the difference in "total" pressure from the previous second. The | 591 | the difference in "total" pressure from the previous second. The |
| 543 | minimum value is 1.0 (extremely slow builds) and the maximum is | 592 | minimum value is 1.0 (extremely slow builds) and the maximum is |
| 544 | 1000000 (a pressure value unlikely to ever be reached). | 593 | 1000000 (a pressure value unlikely to ever be reached). See |
| 594 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 545 | 595 | ||
| 546 | At this point in time, experiments show that IO pressure tends to | 596 | At this point in time, experiments show that IO pressure tends to |
| 547 | be short-lived and regulating just the CPU with | 597 | be short-lived and regulating just the CPU with |
| 548 | :term:`BB_PRESSURE_MAX_CPU` can help to reduce it. | 598 | :term:`BB_PRESSURE_MAX_CPU` can help to reduce it. |
| 549 | 599 | ||
| 550 | :term:`BB_PRESSURE_MAX_MEMORY` | 600 | A default value to limit the IO pressure to be set in ``conf/local.conf`` |
| 601 | could be:: | ||
| 551 | 602 | ||
| 603 | BB_PRESSURE_MAX_IO = "15000" | ||
| 604 | |||
| 605 | Multiple values should be tested on the build host to determine what suits | ||
| 606 | best, depending on the need for performance versus I/O usage during the | ||
| 607 | build. | ||
| 608 | |||
| 609 | .. note:: | ||
| 610 | |||
| 611 | You may see numerous messages printed by BitBake in case the | ||
| 612 | :term:`BB_PRESSURE_MAX_IO` is too low:: | ||
| 613 | |||
| 614 | Pressure status changed to CPU: None, IO: True, Mem: False (CPU: 2236.0/None, IO: 153.6/2.0, Mem: 0.0/2.0) - using 19/64 bitbake threads | ||
| 615 | |||
| 616 | This means that the :term:`BB_PRESSURE_MAX_IO` should be increased to | ||
| 617 | a reasonable value for limiting the I/O pressure on the system. | ||
| 618 | Monitor the varying value after ``IO:`` above to set a sensible value. | ||
| 619 | |||
| 620 | :term:`BB_PRESSURE_MAX_MEMORY` | ||
| 552 | Specifies a maximum memory pressure threshold, above which BitBake's | 621 | Specifies a maximum memory pressure threshold, above which BitBake's |
| 553 | scheduler will not start new tasks (providing there is at least | 622 | scheduler will not start new tasks (providing there is at least |
| 554 | one active task). If no value is set, memory pressure is not | 623 | one active task). If no value is set, memory pressure is not |
| @@ -558,7 +627,8 @@ overview of their function and contents. | |||
| 558 | version 4.20 expose under ``/proc/pressure``. The threshold represents | 627 | version 4.20 expose under ``/proc/pressure``. The threshold represents |
| 559 | the difference in "total" pressure from the previous second. The | 628 | the difference in "total" pressure from the previous second. The |
| 560 | minimum value is 1.0 (extremely slow builds) and the maximum is | 629 | minimum value is 1.0 (extremely slow builds) and the maximum is |
| 561 | 1000000 (a pressure value unlikely to ever be reached). | 630 | 1000000 (a pressure value unlikely to ever be reached). See |
| 631 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 562 | 632 | ||
| 563 | Memory pressure is experienced when time is spent swapping, | 633 | Memory pressure is experienced when time is spent swapping, |
| 564 | refaulting pages from the page cache or performing direct reclaim. | 634 | refaulting pages from the page cache or performing direct reclaim. |
| @@ -566,6 +636,26 @@ overview of their function and contents. | |||
| 566 | might be useful as a last resort to prevent OOM errors if they are | 636 | might be useful as a last resort to prevent OOM errors if they are |
| 567 | occurring during builds. | 637 | occurring during builds. |
| 568 | 638 | ||
| 639 | A default value to limit the memory pressure to be set in | ||
| 640 | ``conf/local.conf`` could be:: | ||
| 641 | |||
| 642 | BB_PRESSURE_MAX_MEMORY = "15000" | ||
| 643 | |||
| 644 | Multiple values should be tested on the build host to determine what suits | ||
| 645 | best, depending on the need for performance versus memory consumption | ||
| 646 | during the build. | ||
| 647 | |||
| 648 | .. note:: | ||
| 649 | |||
| 650 | You may see numerous messages printed by BitBake in case the | ||
| 651 | :term:`BB_PRESSURE_MAX_MEMORY` is too low:: | ||
| 652 | |||
| 653 | Pressure status changed to CPU: None, IO: False, Mem: True (CPU: 29.5/None, IO: 0.0/2.0, Mem: 2553.3/2.0) - using 17/64 bitbake threads | ||
| 654 | |||
| 655 | This means that the :term:`BB_PRESSURE_MAX_MEMORY` should be increased to | ||
| 656 | a reasonable value for limiting the memory pressure on the system. | ||
| 657 | Monitor the varying value after ``Mem:`` above to set a sensible value. | ||
| 658 | |||
| 569 | :term:`BB_RUNFMT` | 659 | :term:`BB_RUNFMT` |
| 570 | Specifies the name of the executable script files (i.e. run files) | 660 | Specifies the name of the executable script files (i.e. run files) |
| 571 | saved into ``${``\ :term:`T`\ ``}``. By default, the | 661 | saved into ``${``\ :term:`T`\ ``}``. By default, the |
| @@ -680,11 +770,11 @@ overview of their function and contents. | |||
| 680 | .. note:: | 770 | .. note:: |
| 681 | 771 | ||
| 682 | In order for your I/O priority settings to take effect, you need the | 772 | In order for your I/O priority settings to take effect, you need the |
| 683 | Completely Fair Queuing (CFQ) Scheduler selected for the backing block | 773 | Budget Fair Queuing (BFQ) Scheduler selected for the backing block |
| 684 | device. To select the scheduler, use the following command form where | 774 | device. To select the scheduler, use the following command form where |
| 685 | device is the device (e.g. sda, sdb, and so forth):: | 775 | device is the device (e.g. sda, sdb, and so forth):: |
| 686 | 776 | ||
| 687 | $ sudo sh -c "echo cfq > /sys/block/device/queu/scheduler" | 777 | $ sudo sh -c "echo bfq > /sys/block/device/queue/scheduler" |
| 688 | 778 | ||
| 689 | :term:`BB_TASK_NICE_LEVEL` | 779 | :term:`BB_TASK_NICE_LEVEL` |
| 690 | Allows specific tasks to change their priority (i.e. nice level). | 780 | Allows specific tasks to change their priority (i.e. nice level). |
| @@ -699,6 +789,12 @@ overview of their function and contents. | |||
| 699 | Within an executing task, this variable holds the hash of the task as | 789 | Within an executing task, this variable holds the hash of the task as |
| 700 | returned by the currently enabled signature generator. | 790 | returned by the currently enabled signature generator. |
| 701 | 791 | ||
| 792 | :term:`BB_USE_HOME_NPMRC` | ||
| 793 | Controls whether or not BitBake uses the user's .npmrc file within their | ||
| 794 | home directory within the npm fetcher. This can be used for authentication | ||
| 795 | of private NPM registries, among other uses. This is turned off by default | ||
| 796 | and requires the user to explicitly set it to "1" to enable. | ||
| 797 | |||
| 702 | :term:`BB_VERBOSE_LOGS` | 798 | :term:`BB_VERBOSE_LOGS` |
| 703 | Controls how verbose BitBake is during builds. If set, shell scripts | 799 | Controls how verbose BitBake is during builds. If set, shell scripts |
| 704 | echo commands and shell script output appears on standard out | 800 | echo commands and shell script output appears on standard out |
| @@ -766,6 +862,10 @@ overview of their function and contents. | |||
| 766 | :term:`BBFILE_PRIORITY` | 862 | :term:`BBFILE_PRIORITY` |
| 767 | Assigns the priority for recipe files in each layer. | 863 | Assigns the priority for recipe files in each layer. |
| 768 | 864 | ||
| 865 | This variable is used in the ``conf/layer.conf`` file and must be | ||
| 866 | suffixed with a `_` followed by the name of the specific layer (e.g. | ||
| 867 | ``BBFILE_PRIORITY_emenlow``). Colon as separator is not supported. | ||
| 868 | |||
| 769 | This variable is useful in situations where the same recipe appears | 869 | This variable is useful in situations where the same recipe appears |
| 770 | in more than one layer. Setting this variable allows you to | 870 | in more than one layer. Setting this variable allows you to |
| 771 | prioritize a layer against other layers that contain the same recipe | 871 | prioritize a layer against other layers that contain the same recipe |
| @@ -780,7 +880,7 @@ overview of their function and contents. | |||
| 780 | higher precedence. For example, the value 6 has a higher precedence | 880 | higher precedence. For example, the value 6 has a higher precedence |
| 781 | than the value 5. If not specified, the :term:`BBFILE_PRIORITY` variable | 881 | than the value 5. If not specified, the :term:`BBFILE_PRIORITY` variable |
| 782 | is set based on layer dependencies (see the :term:`LAYERDEPENDS` variable | 882 | is set based on layer dependencies (see the :term:`LAYERDEPENDS` variable |
| 783 | for more information. The default priority, if unspecified for a | 883 | for more information). The default priority, if unspecified for a |
| 784 | layer with no dependencies, is the lowest defined priority + 1 (or 1 | 884 | layer with no dependencies, is the lowest defined priority + 1 (or 1 |
| 785 | if no priorities are defined). | 885 | if no priorities are defined). |
| 786 | 886 | ||
