Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
| 2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
| 3 | |
| 4 | <chapter id="bitbake-user-manual-intro"> |
| 5 | <title>Overview</title> |
| 6 | |
| 7 | <para> |
| 8 | Welcome to the BitBake User Manual. |
| 9 | This manual provides information on the BitBake tool. |
| 10 | The information attempts to be as independent as possible regarding |
| 11 | systems that use BitBake, such as OpenEmbedded and the |
| 12 | Yocto Project. |
| 13 | In some cases, scenarios or examples within the context of |
| 14 | a build system are used in the manual to help with understanding. |
| 15 | For these cases, the manual clearly states the context. |
| 16 | </para> |
| 17 | |
| 18 | <section id="intro"> |
| 19 | <title>Introduction</title> |
| 20 | |
| 21 | <para> |
| 22 | Fundamentally, BitBake is a generic task execution |
| 23 | engine that allows shell and Python tasks to be run |
| 24 | efficiently and in parallel while working within |
| 25 | complex inter-task dependency constraints. |
| 26 | One of BitBake's main users, OpenEmbedded, takes this core |
| 27 | and builds embedded Linux software stacks using |
| 28 | a task-oriented approach. |
| 29 | </para> |
| 30 | |
| 31 | <para> |
| 32 | Conceptually, BitBake is similar to GNU Make in |
| 33 | some regards but has significant differences: |
| 34 | <itemizedlist> |
| 35 | <listitem><para> |
| 36 | BitBake executes tasks according to provided |
| 37 | metadata that builds up the tasks. |
| 38 | Metadata is stored in recipe (<filename>.bb</filename>) |
| 39 | and related recipe "append" (<filename>.bbappend</filename>) |
| 40 | files, configuration (<filename>.conf</filename>) and |
| 41 | underlying include (<filename>.inc</filename>) files, and |
| 42 | in class (<filename>.bbclass</filename>) files. |
| 43 | The metadata provides |
| 44 | BitBake with instructions on what tasks to run and |
| 45 | the dependencies between those tasks. |
| 46 | </para></listitem> |
| 47 | <listitem><para> |
| 48 | BitBake includes a fetcher library for obtaining source |
| 49 | code from various places such as local files, source control |
| 50 | systems, or websites. |
| 51 | </para></listitem> |
| 52 | <listitem><para> |
| 53 | The instructions for each unit to be built (e.g. a piece |
| 54 | of software) are known as "recipe" files and |
| 55 | contain all the information about the unit |
| 56 | (dependencies, source file locations, checksums, description |
| 57 | and so on). |
| 58 | </para></listitem> |
| 59 | <listitem><para> |
| 60 | BitBake includes a client/server abstraction and can |
| 61 | be used from a command line or used as a service over |
| 62 | XML-RPC and has several different user interfaces. |
| 63 | </para></listitem> |
| 64 | </itemizedlist> |
| 65 | </para> |
| 66 | </section> |
| 67 | |
| 68 | <section id="history-and-goals"> |
| 69 | <title>History and Goals</title> |
| 70 | |
| 71 | <para> |
| 72 | BitBake was originally a part of the OpenEmbedded project. |
| 73 | It was inspired by the Portage package management system |
| 74 | used by the Gentoo Linux distribution. |
| 75 | On December 7, 2004, OpenEmbedded project team member |
| 76 | Chris Larson split the project into two distinct pieces: |
| 77 | <itemizedlist> |
| 78 | <listitem><para>BitBake, a generic task executor</para></listitem> |
| 79 | <listitem><para>OpenEmbedded, a metadata set utilized by |
| 80 | BitBake</para></listitem> |
| 81 | </itemizedlist> |
| 82 | Today, BitBake is the primary basis of the |
| 83 | <ulink url="http://www.openembedded.org/">OpenEmbedded</ulink> |
| 84 | project, which is being used to build and maintain Linux |
| 85 | distributions such as the |
| 86 | <ulink url='http://www.angstrom-distribution.org/'>Angstrom Distribution</ulink>, |
| 87 | and which is also being used as the build tool for Linux projects |
| 88 | such as the |
| 89 | <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink>. |
| 90 | </para> |
| 91 | |
| 92 | <para> |
| 93 | Prior to BitBake, no other build tool adequately met the needs of |
| 94 | an aspiring embedded Linux distribution. |
| 95 | All of the build systems used by traditional desktop Linux |
| 96 | distributions lacked important functionality, and none of the |
| 97 | ad hoc Buildroot-based systems, prevalent in the |
| 98 | embedded space, were scalable or maintainable. |
| 99 | </para> |
| 100 | |
| 101 | <para> |
| 102 | Some important original goals for BitBake were: |
| 103 | <itemizedlist> |
| 104 | <listitem><para> |
| 105 | Handle cross-compilation. |
| 106 | </para></listitem> |
| 107 | <listitem><para> |
| 108 | Handle inter-package dependencies (build time on |
| 109 | target architecture, build time on native |
| 110 | architecture, and runtime). |
| 111 | </para></listitem> |
| 112 | <listitem><para> |
| 113 | Support running any number of tasks within a given |
| 114 | package, including, but not limited to, fetching |
| 115 | upstream sources, unpacking them, patching them, |
| 116 | configuring them, and so forth. |
| 117 | </para></listitem> |
| 118 | <listitem><para> |
| 119 | Be Linux distribution agnostic for both build and |
| 120 | target systems. |
| 121 | </para></listitem> |
| 122 | <listitem><para> |
| 123 | Be architecture agnostic. |
| 124 | </para></listitem> |
| 125 | <listitem><para> |
| 126 | Support multiple build and target operating systems |
| 127 | (e.g. Cygwin, the BSDs, and so forth). |
| 128 | </para></listitem> |
| 129 | <listitem><para> |
| 130 | Be self contained, rather than tightly |
| 131 | integrated into the build machine's root |
| 132 | filesystem. |
| 133 | </para></listitem> |
| 134 | <listitem><para> |
| 135 | Handle conditional metadata on the target architecture, |
| 136 | operating system, distribution, and machine. |
| 137 | </para></listitem> |
| 138 | <listitem><para> |
| 139 | Be easy to use the tools to supply local metadata and packages |
| 140 | against which to operate. |
| 141 | </para></listitem> |
| 142 | <listitem><para> |
| 143 | Be easy to use BitBake to collaborate between multiple |
| 144 | projects for their builds. |
| 145 | </para></listitem> |
| 146 | <listitem><para> |
| 147 | Provide an inheritance mechanism to share |
| 148 | common metadata between many packages. |
| 149 | </para></listitem> |
| 150 | </itemizedlist> |
| 151 | Over time it became apparent that some further requirements |
| 152 | were necessary: |
| 153 | <itemizedlist> |
| 154 | <listitem><para> |
| 155 | Handle variants of a base recipe (e.g. native, sdk, |
| 156 | and multilib). |
| 157 | </para></listitem> |
| 158 | <listitem><para> |
| 159 | Split metadata into layers and allow layers |
| 160 | to enhance or override other layers. |
| 161 | </para></listitem> |
| 162 | <listitem><para> |
| 163 | Allow representation of a given set of input variables |
| 164 | to a task as a checksum. |
| 165 | Based on that checksum, allow acceleration of builds |
| 166 | with prebuilt components. |
| 167 | </para></listitem> |
| 168 | </itemizedlist> |
| 169 | BitBake satisfies all the original requirements and many more |
| 170 | with extensions being made to the basic functionality to |
| 171 | reflect the additional requirements. |
| 172 | Flexibility and power have always been the priorities. |
| 173 | BitBake is highly extensible and supports embedded Python code and |
| 174 | execution of any arbitrary tasks. |
| 175 | </para> |
| 176 | </section> |
| 177 | |
| 178 | <section id="Concepts"> |
| 179 | <title>Concepts</title> |
| 180 | |
| 181 | <para> |
| 182 | BitBake is a program written in the Python language. |
| 183 | At the highest level, BitBake interprets metadata, decides |
| 184 | what tasks are required to run, and executes those tasks. |
| 185 | Similar to GNU Make, BitBake controls how software is |
| 186 | built. |
| 187 | GNU Make achieves its control through "makefiles", while |
| 188 | BitBake uses "recipes". |
| 189 | </para> |
| 190 | |
| 191 | <para> |
| 192 | BitBake extends the capabilities of a simple |
| 193 | tool like GNU Make by allowing for the definition of much more |
| 194 | complex tasks, such as assembling entire embedded Linux |
| 195 | distributions. |
| 196 | </para> |
| 197 | |
| 198 | <para> |
| 199 | The remainder of this section introduces several concepts |
| 200 | that should be understood in order to better leverage |
| 201 | the power of BitBake. |
| 202 | </para> |
| 203 | |
| 204 | <section id='recipes'> |
| 205 | <title>Recipes</title> |
| 206 | |
| 207 | <para> |
| 208 | BitBake Recipes, which are denoted by the file extension |
| 209 | <filename>.bb</filename>, are the most basic metadata files. |
| 210 | These recipe files provide BitBake with the following: |
| 211 | <itemizedlist> |
| 212 | <listitem><para>Descriptive information about the |
| 213 | package (author, homepage, license, and so on)</para></listitem> |
| 214 | <listitem><para>The version of the recipe</para></listitem> |
| 215 | <listitem><para>Existing dependencies (both build |
| 216 | and runtime dependencies)</para></listitem> |
| 217 | <listitem><para>Where the source code resides and |
| 218 | how to fetch it</para></listitem> |
| 219 | <listitem><para>Whether the source code requires |
| 220 | any patches, where to find them, and how to apply |
| 221 | them</para></listitem> |
| 222 | <listitem><para>How to configure and compile the |
| 223 | source code</para></listitem> |
| 224 | <listitem><para>Where on the target machine to install the |
| 225 | package or packages created</para></listitem> |
| 226 | </itemizedlist> |
| 227 | </para> |
| 228 | |
| 229 | <para> |
| 230 | Within the context of BitBake, or any project utilizing BitBake |
| 231 | as its build system, files with the <filename>.bb</filename> |
| 232 | extension are referred to as recipes. |
| 233 | <note> |
| 234 | The term "package" is also commonly used to describe recipes. |
| 235 | However, since the same word is used to describe packaged |
| 236 | output from a project, it is best to maintain a single |
| 237 | descriptive term - "recipes". |
| 238 | Put another way, a single "recipe" file is quite capable |
| 239 | of generating a number of related but separately installable |
| 240 | "packages". |
| 241 | In fact, that ability is fairly common. |
| 242 | </note> |
| 243 | </para> |
| 244 | </section> |
| 245 | |
| 246 | <section id='configuration-files'> |
| 247 | <title>Configuration Files</title> |
| 248 | |
| 249 | <para> |
| 250 | Configuration files, which are denoted by the |
| 251 | <filename>.conf</filename> extension, define |
| 252 | various configuration variables that govern the project's build |
| 253 | process. |
| 254 | These files fall into several areas that define |
| 255 | machine configuration options, distribution configuration |
| 256 | options, compiler tuning options, general common |
| 257 | configuration options, and user configuration options. |
| 258 | The main configuration file is the sample |
| 259 | <filename>bitbake.conf</filename> file, which is |
| 260 | located within the BitBake source tree |
| 261 | <filename>conf</filename> directory. |
| 262 | </para> |
| 263 | </section> |
| 264 | |
| 265 | <section id='classes'> |
| 266 | <title>Classes</title> |
| 267 | |
| 268 | <para> |
| 269 | Class files, which are denoted by the |
| 270 | <filename>.bbclass</filename> extension, contain |
| 271 | information that is useful to share between metadata files. |
| 272 | The BitBake source tree currently comes with one class metadata file |
| 273 | called <filename>base.bbclass</filename>. |
| 274 | You can find this file in the |
| 275 | <filename>classes</filename> directory. |
| 276 | The <filename>base.bbclass</filename> class files is special since it |
| 277 | is always included automatically for all recipes |
| 278 | and classes. |
| 279 | This class contains definitions for standard basic tasks such |
| 280 | as fetching, unpacking, configuring (empty by default), |
| 281 | compiling (runs any Makefile present), installing (empty by |
| 282 | default) and packaging (empty by default). |
| 283 | These tasks are often overridden or extended by other classes |
| 284 | added during the project development process. |
| 285 | </para> |
| 286 | </section> |
| 287 | |
| 288 | <section id='layers'> |
| 289 | <title>Layers</title> |
| 290 | |
| 291 | <para> |
| 292 | Layers allow you to isolate different types of |
| 293 | customizations from each other. |
| 294 | While you might find it tempting to keep everything in one layer |
| 295 | when working on a single project, the more modular you organize |
| 296 | your metadata, the easier it is to cope with future changes. |
| 297 | </para> |
| 298 | |
| 299 | <para> |
| 300 | To illustrate how you can use layers to keep things modular, |
| 301 | consider customizations you might make to support a specific target machine. |
| 302 | These types of customizations typically reside in a special layer, |
| 303 | rather than a general layer, called a Board Support Package (BSP) |
| 304 | Layer. |
| 305 | Furthermore, the machine customizations should be isolated from |
| 306 | recipes and metadata that support a new GUI environment, for |
| 307 | example. |
| 308 | This situation gives you a couple of layers: one for the machine |
| 309 | configurations and one for the GUI environment. |
| 310 | It is important to understand, however, that the BSP layer can still |
| 311 | make machine-specific additions to recipes within |
| 312 | the GUI environment layer without polluting the GUI layer itself |
| 313 | with those machine-specific changes. |
| 314 | You can accomplish this through a recipe that is a BitBake append |
| 315 | (<filename>.bbappend</filename>) file. |
| 316 | </para> |
| 317 | </section> |
| 318 | |
| 319 | <section id='append-bbappend-files'> |
| 320 | <title>Append Files</title> |
| 321 | |
| 322 | <para> |
| 323 | Append files, which are files that have the |
| 324 | <filename>.bbappend</filename> file extension, extend or |
| 325 | override information in an existing recipe file. |
| 326 | </para> |
| 327 | |
| 328 | <para> |
| 329 | BitBake expects every append file to have a corresponding recipe file. |
| 330 | Furthermore, the append file and corresponding recipe file |
| 331 | must use the same root filename. |
| 332 | The filenames can differ only in the file type suffix used |
| 333 | (e.g. <filename>formfactor_0.0.bb</filename> and |
| 334 | <filename>formfactor_0.0.bbappend</filename>). |
| 335 | </para> |
| 336 | |
| 337 | <para> |
| 338 | Information in append files extends or |
| 339 | overrides the information in the underlying, |
| 340 | similarly-named recipe files. |
| 341 | </para> |
| 342 | |
| 343 | <para> |
| 344 | When you name an append file, you can use the |
| 345 | wildcard character (%) to allow for matching recipe names. |
| 346 | For example, suppose you have an append file named |
| 347 | as follows: |
| 348 | <literallayout class='monospaced'> |
| 349 | busybox_1.21.%.bbappend |
| 350 | </literallayout> |
| 351 | That append file would match any <filename>busybox_1.21.x.bb</filename> |
| 352 | version of the recipe. |
| 353 | So, the append file would match the following recipe names: |
| 354 | <literallayout class='monospaced'> |
| 355 | busybox_1.21.1.bb |
| 356 | busybox_1.21.2.bb |
| 357 | busybox_1.21.3.bb |
| 358 | </literallayout> |
| 359 | If the <filename>busybox</filename> recipe was updated to |
| 360 | <filename>busybox_1.3.0.bb</filename>, the append name would not |
| 361 | match. |
| 362 | However, if you named the append file |
| 363 | <filename>busybox_1.%.bbappend</filename>, then you would have a match. |
| 364 | </para> |
| 365 | |
| 366 | <para> |
| 367 | In the most general case, you could name the append file something as |
| 368 | simple as <filename>busybox_%.bbappend</filename> to be entirely |
| 369 | version independent. |
| 370 | </para> |
| 371 | </section> |
| 372 | </section> |
| 373 | |
| 374 | <section id='obtaining-bitbake'> |
| 375 | <title>Obtaining BitBake</title> |
| 376 | |
| 377 | <para> |
| 378 | You can obtain BitBake several different ways: |
| 379 | <itemizedlist> |
| 380 | <listitem><para><emphasis>Cloning BitBake:</emphasis> |
| 381 | Using Git to clone the BitBake source code repository |
| 382 | is the recommended method for obtaining BitBake. |
| 383 | Cloning the repository makes it easy to get bug fixes |
| 384 | and have access to stable branches and the master |
| 385 | branch. |
| 386 | Once you have cloned BitBake, you should use |
| 387 | the latest stable |
| 388 | branch for development since the master branch is for |
| 389 | BitBake development and might contain less stable changes. |
| 390 | </para> |
| 391 | <para>You usually need a version of BitBake |
| 392 | that matches the metadata you are using. |
| 393 | The metadata is generally backwards compatible but |
| 394 | not forward compatible.</para> |
| 395 | <para>Here is an example that clones the BitBake repository: |
| 396 | <literallayout class='monospaced'> |
| 397 | $ git clone git://git.openembedded.org/bitbake |
| 398 | </literallayout> |
| 399 | This command clones the BitBake Git repository into a |
| 400 | directory called <filename>bitbake</filename>. |
| 401 | Alternatively, you can |
| 402 | designate a directory after the |
| 403 | <filename>git clone</filename> command |
| 404 | if you want to call the new directory something |
| 405 | other than <filename>bitbake</filename>. |
| 406 | Here is an example that names the directory |
| 407 | <filename>bbdev</filename>: |
| 408 | <literallayout class='monospaced'> |
| 409 | $ git clone git://git.openembedded.org/bitbake bbdev |
| 410 | </literallayout></para></listitem> |
| 411 | <listitem><para><emphasis>Installation using your Distribution |
| 412 | Package Management System:</emphasis> |
| 413 | This method is not |
| 414 | recommended because the BitBake version that is |
| 415 | provided by your distribution, in most cases, |
| 416 | is several |
| 417 | releases behind a snapshot of the BitBake repository. |
| 418 | </para></listitem> |
| 419 | <listitem><para><emphasis>Taking a snapshot of BitBake:</emphasis> |
| 420 | Downloading a snapshot of BitBake from the |
| 421 | source code repository gives you access to a known |
| 422 | branch or release of BitBake. |
| 423 | <note> |
| 424 | Cloning the Git repository, as described earlier, |
| 425 | is the preferred method for getting BitBake. |
| 426 | Cloning the repository makes it easier to update as |
| 427 | patches are added to the stable branches. |
| 428 | </note></para> |
| 429 | <para>The following example downloads a snapshot of |
| 430 | BitBake version 1.17.0: |
| 431 | <literallayout class='monospaced'> |
| 432 | $ wget http://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz |
| 433 | $ tar zxpvf bitbake-1.17.0.tar.gz |
| 434 | </literallayout> |
| 435 | After extraction of the tarball using the tar utility, |
| 436 | you have a directory entitled |
| 437 | <filename>bitbake-1.17.0</filename>. |
| 438 | </para></listitem> |
| 439 | <listitem><para><emphasis>Using the BitBake that Comes With Your |
| 440 | Build Checkout:</emphasis> |
| 441 | A final possibility for getting a copy of BitBake is that it |
| 442 | already comes with your checkout of a larger Bitbake-based build |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 443 | system, such as Poky. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 444 | Rather than manually checking out individual layers and |
| 445 | gluing them together yourself, you can check |
| 446 | out an entire build system. |
| 447 | The checkout will already include a version of BitBake that |
| 448 | has been thoroughly tested for compatibility with the other |
| 449 | components. |
| 450 | For information on how to check out a particular BitBake-based |
| 451 | build system, consult that build system's supporting documentation. |
| 452 | </para></listitem> |
| 453 | </itemizedlist> |
| 454 | </para> |
| 455 | </section> |
| 456 | |
| 457 | <section id="bitbake-user-manual-command"> |
| 458 | <title>The BitBake Command</title> |
| 459 | |
| 460 | <para> |
| 461 | The <filename>bitbake</filename> command is the primary interface |
| 462 | to the BitBake tool. |
| 463 | This section presents the BitBake command syntax and provides |
| 464 | several execution examples. |
| 465 | </para> |
| 466 | |
| 467 | <section id='usage-and-syntax'> |
| 468 | <title>Usage and syntax</title> |
| 469 | |
| 470 | <para> |
| 471 | Following is the usage and syntax for BitBake: |
| 472 | <literallayout class='monospaced'> |
| 473 | $ bitbake -h |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 474 | Usage: bitbake [options] [recipename/target recipe:do_task ...] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 475 | |
| 476 | Executes the specified task (default is 'build') for a given set of target recipes (.bb files). |
| 477 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which |
| 478 | will provide the layer, BBFILES and other configuration information. |
| 479 | |
| 480 | Options: |
| 481 | --version show program's version number and exit |
| 482 | -h, --help show this help message and exit |
| 483 | -b BUILDFILE, --buildfile=BUILDFILE |
| 484 | Execute tasks from a specific .bb recipe directly. |
| 485 | WARNING: Does not handle any dependencies from other |
| 486 | recipes. |
| 487 | -k, --continue Continue as much as possible after an error. While the |
| 488 | target that failed and anything depending on it cannot |
| 489 | be built, as much as possible will be built before |
| 490 | stopping. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 491 | -f, --force Force the specified targets/task to run (invalidating |
| 492 | any existing stamp file). |
| 493 | -c CMD, --cmd=CMD Specify the task to execute. The exact options |
| 494 | available depend on the metadata. Some examples might |
| 495 | be 'compile' or 'populate_sysroot' or 'listtasks' may |
| 496 | give a list of the tasks available. |
| 497 | -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP |
| 498 | Invalidate the stamp for the specified task such as |
| 499 | 'compile' and then run the default task for the |
| 500 | specified target(s). |
| 501 | -r PREFILE, --read=PREFILE |
| 502 | Read the specified file before bitbake.conf. |
| 503 | -R POSTFILE, --postread=POSTFILE |
| 504 | Read the specified file after bitbake.conf. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 505 | -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also |
| 506 | print bb.note(...) messages to stdout (in addition to |
| 507 | writing them to ${T}/log.do_<task>). |
| 508 | -D, --debug Increase the debug level. You can specify this more |
| 509 | than once. -D sets the debug level to 1, where only |
| 510 | bb.debug(1, ...) messages are printed to stdout; -DD |
| 511 | sets the debug level to 2, where both bb.debug(1, ...) |
| 512 | and bb.debug(2, ...) messages are printed; etc. |
| 513 | Without -D, no debug messages are printed. Note that |
| 514 | -D only affects output to stdout. All debug messages |
| 515 | are written to ${T}/log.do_taskname, regardless of the |
| 516 | debug level. |
| 517 | -q, --quiet Output less log message data to the terminal. You can |
| 518 | specify this more than once. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 519 | -n, --dry-run Don't execute, just go through the motions. |
| 520 | -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER |
| 521 | Dump out the signature construction information, with |
| 522 | no task execution. The SIGNATURE_HANDLER parameter is |
| 523 | passed to the handler. Two common values are none and |
| 524 | printdiff but the handler may define more/less. none |
| 525 | means only dump the signature, printdiff means compare |
| 526 | the dumped signature with the cached one. |
| 527 | -p, --parse-only Quit after parsing the BB recipes. |
| 528 | -s, --show-versions Show current and preferred versions of all recipes. |
| 529 | -e, --environment Show the global or per-recipe environment complete |
| 530 | with information about where variables were |
| 531 | set/changed. |
| 532 | -g, --graphviz Save dependency tree information for the specified |
| 533 | targets in the dot syntax. |
| 534 | -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED |
| 535 | Assume these dependencies don't exist and are already |
| 536 | provided (equivalent to ASSUME_PROVIDED). Useful to |
| 537 | make dependency graphs more appealing |
| 538 | -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS |
| 539 | Show debug logging for the specified logging domains |
| 540 | -P, --profile Profile the command and save reports. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 541 | -u UI, --ui=UI The user interface to use (knotty, ncurses or taskexp |
| 542 | - default knotty). |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 543 | --token=XMLRPCTOKEN Specify the connection token to be used when |
| 544 | connecting to a remote server. |
| 545 | --revisions-changed Set the exit code depending on whether upstream |
| 546 | floating revisions have changed or not. |
| 547 | --server-only Run bitbake without a UI, only starting a server |
| 548 | (cooker) process. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 549 | -B BIND, --bind=BIND The name/address for the bitbake xmlrpc server to bind |
| 550 | to. |
| 551 | -T SERVER_TIMEOUT, --idle-timeout=SERVER_TIMEOUT |
| 552 | Set timeout to unload bitbake server due to |
| 553 | inactivity, set to -1 means no unload, default: |
| 554 | Environment variable BB_SERVER_TIMEOUT. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 555 | --no-setscene Do not run any setscene tasks. sstate will be ignored |
| 556 | and everything needed, built. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 557 | --setscene-only Only run setscene tasks, don't run any real tasks. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 558 | --remote-server=REMOTE_SERVER |
| 559 | Connect to the specified server. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 560 | -m, --kill-server Terminate any running bitbake server. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 561 | --observe-only Connect to a server as an observing-only client. |
| 562 | --status-only Check the status of the remote bitbake server. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 563 | -w WRITEEVENTLOG, --write-log=WRITEEVENTLOG |
| 564 | Writes the event log of the build to a bitbake event |
| 565 | json file. Use '' (empty string) to assign the name |
| 566 | automatically. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 567 | --runall=RUNALL Run the specified task for any recipe in the taskgraph |
| 568 | of the specified target (even if it wouldn't otherwise |
| 569 | have run). |
| 570 | --runonly=RUNONLY Run only the specified task within the taskgraph of |
| 571 | the specified targets (and any task dependencies those |
| 572 | tasks may have). |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 573 | </literallayout> |
| 574 | </para> |
| 575 | </section> |
| 576 | |
| 577 | <section id='bitbake-examples'> |
| 578 | <title>Examples</title> |
| 579 | |
| 580 | <para> |
| 581 | This section presents some examples showing how to use BitBake. |
| 582 | </para> |
| 583 | |
| 584 | <section id='example-executing-a-task-against-a-single-recipe'> |
| 585 | <title>Executing a Task Against a Single Recipe</title> |
| 586 | |
| 587 | <para> |
| 588 | Executing tasks for a single recipe file is relatively simple. |
| 589 | You specify the file in question, and BitBake parses |
| 590 | it and executes the specified task. |
| 591 | If you do not specify a task, BitBake executes the default |
| 592 | task, which is "build”. |
| 593 | BitBake obeys inter-task dependencies when doing |
| 594 | so. |
| 595 | </para> |
| 596 | |
| 597 | <para> |
| 598 | The following command runs the build task, which is |
| 599 | the default task, on the <filename>foo_1.0.bb</filename> |
| 600 | recipe file: |
| 601 | <literallayout class='monospaced'> |
| 602 | $ bitbake -b foo_1.0.bb |
| 603 | </literallayout> |
| 604 | The following command runs the clean task on the |
| 605 | <filename>foo.bb</filename> recipe file: |
| 606 | <literallayout class='monospaced'> |
| 607 | $ bitbake -b foo.bb -c clean |
| 608 | </literallayout> |
| 609 | <note> |
| 610 | The "-b" option explicitly does not handle recipe |
| 611 | dependencies. |
| 612 | Other than for debugging purposes, it is instead |
| 613 | recommended that you use the syntax presented in the |
| 614 | next section. |
| 615 | </note> |
| 616 | </para> |
| 617 | </section> |
| 618 | |
| 619 | <section id='executing-tasks-against-a-set-of-recipe-files'> |
| 620 | <title>Executing Tasks Against a Set of Recipe Files</title> |
| 621 | |
| 622 | <para> |
| 623 | There are a number of additional complexities introduced |
| 624 | when one wants to manage multiple <filename>.bb</filename> |
| 625 | files. |
| 626 | Clearly there needs to be a way to tell BitBake what |
| 627 | files are available and, of those, which you |
| 628 | want to execute. |
| 629 | There also needs to be a way for each recipe |
| 630 | to express its dependencies, both for build-time and |
| 631 | runtime. |
| 632 | There must be a way for you to express recipe preferences |
| 633 | when multiple recipes provide the same functionality, or when |
| 634 | there are multiple versions of a recipe. |
| 635 | </para> |
| 636 | |
| 637 | <para> |
| 638 | The <filename>bitbake</filename> command, when not using |
| 639 | "--buildfile" or "-b" only accepts a "PROVIDES". |
| 640 | You cannot provide anything else. |
| 641 | By default, a recipe file generally "PROVIDES" its |
| 642 | "packagename" as shown in the following example: |
| 643 | <literallayout class='monospaced'> |
| 644 | $ bitbake foo |
| 645 | </literallayout> |
| 646 | This next example "PROVIDES" the package name and also uses |
| 647 | the "-c" option to tell BitBake to just execute the |
| 648 | <filename>do_clean</filename> task: |
| 649 | <literallayout class='monospaced'> |
| 650 | $ bitbake -c clean foo |
| 651 | </literallayout> |
| 652 | </para> |
| 653 | </section> |
| 654 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 655 | <section id='executing-a-list-of-task-and-recipe-combinations'> |
| 656 | <title>Executing a List of Task and Recipe Combinations</title> |
| 657 | |
| 658 | <para> |
| 659 | The BitBake command line supports specifying different |
| 660 | tasks for individual targets when you specify multiple |
| 661 | targets. |
| 662 | For example, suppose you had two targets (or recipes) |
| 663 | <filename>myfirstrecipe</filename> and |
| 664 | <filename>mysecondrecipe</filename> and you needed |
| 665 | BitBake to run <filename>taskA</filename> for the first |
| 666 | recipe and <filename>taskB</filename> for the second |
| 667 | recipe: |
| 668 | <literallayout class='monospaced'> |
| 669 | $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB |
| 670 | </literallayout> |
| 671 | </para> |
| 672 | </section> |
| 673 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 674 | <section id='generating-dependency-graphs'> |
| 675 | <title>Generating Dependency Graphs</title> |
| 676 | |
| 677 | <para> |
| 678 | BitBake is able to generate dependency graphs using |
| 679 | the <filename>dot</filename> syntax. |
| 680 | You can convert these graphs into images using the |
| 681 | <filename>dot</filename> tool from |
| 682 | <ulink url='http://www.graphviz.org'>Graphviz</ulink>. |
| 683 | </para> |
| 684 | |
| 685 | <para> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 686 | When you generate a dependency graph, BitBake writes three files |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 687 | to the current working directory: |
| 688 | <itemizedlist> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 689 | <listitem><para> |
| 690 | <emphasis><filename>recipe-depends.dot</filename>:</emphasis> |
| 691 | Shows dependencies between recipes (i.e. a collapsed version of |
| 692 | <filename>task-depends.dot</filename>). |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 693 | </para></listitem> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 694 | <listitem><para> |
| 695 | <emphasis><filename>task-depends.dot</filename>:</emphasis> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 696 | Shows dependencies between tasks. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 697 | These dependencies match BitBake's internal task execution list. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 698 | </para></listitem> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 699 | <listitem><para> |
| 700 | <emphasis><filename>pn-buildlist</filename>:</emphasis> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 701 | Shows a simple list of targets that are to be built. |
| 702 | </para></listitem> |
| 703 | </itemizedlist> |
| 704 | </para> |
| 705 | |
| 706 | <para> |
| 707 | To stop depending on common depends, use the "-I" depend |
| 708 | option and BitBake omits them from the graph. |
| 709 | Leaving this information out can produce more readable graphs. |
| 710 | This way, you can remove from the graph |
| 711 | <filename>DEPENDS</filename> from inherited classes |
| 712 | such as <filename>base.bbclass</filename>. |
| 713 | </para> |
| 714 | |
| 715 | <para> |
| 716 | Here are two examples that create dependency graphs. |
| 717 | The second example omits depends common in OpenEmbedded from |
| 718 | the graph: |
| 719 | <literallayout class='monospaced'> |
| 720 | $ bitbake -g foo |
| 721 | |
| 722 | $ bitbake -g -I virtual/kernel -I eglibc foo |
| 723 | </literallayout> |
| 724 | </para> |
| 725 | </section> |
| 726 | </section> |
| 727 | </section> |
| 728 | </chapter> |