Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ******* |
| 4 | Classes |
| 5 | ******* |
| 6 | |
| 7 | Class files are used to abstract common functionality and share it |
| 8 | amongst multiple recipe (``.bb``) files. To use a class file, you simply |
| 9 | make sure the recipe inherits the class. In most cases, when a recipe |
| 10 | inherits a class it is enough to enable its features. There are cases, |
| 11 | however, where in the recipe you might need to set variables or override |
| 12 | some default behavior. |
| 13 | |
| 14 | Any :term:`Metadata` usually found in a recipe can also be |
| 15 | placed in a class file. Class files are identified by the extension |
| 16 | ``.bbclass`` and are usually placed in a ``classes/`` directory beneath |
| 17 | the ``meta*/`` directory found in the :term:`Source Directory`. |
| 18 | Class files can also be pointed to by |
| 19 | :term:`BUILDDIR` (e.g. ``build/``) in the same way as |
| 20 | ``.conf`` files in the ``conf`` directory. Class files are searched for |
| 21 | in :term:`BBPATH` using the same method by which ``.conf`` |
| 22 | files are searched. |
| 23 | |
| 24 | This chapter discusses only the most useful and important classes. Other |
| 25 | classes do exist within the ``meta/classes`` directory in the Source |
| 26 | Directory. You can reference the ``.bbclass`` files directly for more |
| 27 | information. |
| 28 | |
| 29 | .. _ref-classes-allarch: |
| 30 | |
| 31 | ``allarch.bbclass`` |
| 32 | =================== |
| 33 | |
| 34 | The ``allarch`` class is inherited by recipes that do not produce |
| 35 | architecture-specific output. The class disables functionality that is |
| 36 | normally needed for recipes that produce executable binaries (such as |
| 37 | building the cross-compiler and a C library as pre-requisites, and |
| 38 | splitting out of debug symbols during packaging). |
| 39 | |
| 40 | .. note:: |
| 41 | |
| 42 | Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that |
| 43 | produce packages that depend on tunings through use of the |
| 44 | :term:`RDEPENDS` and |
| 45 | :term:`TUNE_PKGARCH` variables, should never be |
| 46 | configured for all architectures using ``allarch``. This is the case |
| 47 | even if the recipes do not produce architecture-specific output. |
| 48 | |
| 49 | Configuring such recipes for all architectures causes the |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 50 | ``do_package_write_*`` tasks to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 51 | have different signatures for the machines with different tunings. |
| 52 | Additionally, unnecessary rebuilds occur every time an image for a |
| 53 | different ``MACHINE`` is built even when the recipe never changes. |
| 54 | |
| 55 | By default, all recipes inherit the :ref:`base <ref-classes-base>` and |
| 56 | :ref:`package <ref-classes-package>` classes, which enable |
| 57 | functionality needed for recipes that produce executable output. If your |
| 58 | recipe, for example, only produces packages that contain configuration |
| 59 | files, media files, or scripts (e.g. Python and Perl), then it should |
| 60 | inherit the ``allarch`` class. |
| 61 | |
| 62 | .. _ref-classes-archiver: |
| 63 | |
| 64 | ``archiver.bbclass`` |
| 65 | ==================== |
| 66 | |
| 67 | The ``archiver`` class supports releasing source code and other |
| 68 | materials with the binaries. |
| 69 | |
| 70 | For more details on the source archiver, see the |
| 71 | ":ref:`dev-manual/dev-manual-common-tasks:maintaining open source license compliance during your product's lifecycle`" |
| 72 | section in the Yocto Project Development Tasks Manual. You can also see |
| 73 | the :term:`ARCHIVER_MODE` variable for information |
| 74 | about the variable flags (varflags) that help control archive creation. |
| 75 | |
| 76 | .. _ref-classes-autotools: |
| 77 | |
| 78 | ``autotools*.bbclass`` |
| 79 | ====================== |
| 80 | |
| 81 | The ``autotools*`` classes support Autotooled packages. |
| 82 | |
| 83 | The ``autoconf``, ``automake``, and ``libtool`` packages bring |
| 84 | standardization. This class defines a set of tasks (e.g. ``configure``, |
| 85 | ``compile`` and so forth) that work for all Autotooled packages. It |
| 86 | should usually be enough to define a few standard variables and then |
| 87 | simply ``inherit autotools``. These classes can also work with software |
| 88 | that emulates Autotools. For more information, see the |
| 89 | ":ref:`new-recipe-autotooled-package`" section |
| 90 | in the Yocto Project Development Tasks Manual. |
| 91 | |
| 92 | By default, the ``autotools*`` classes use out-of-tree builds (i.e. |
| 93 | ``autotools.bbclass`` building with ``B != S``). |
| 94 | |
| 95 | If the software being built by a recipe does not support using |
| 96 | out-of-tree builds, you should have the recipe inherit the |
| 97 | ``autotools-brokensep`` class. The ``autotools-brokensep`` class behaves |
| 98 | the same as the ``autotools`` class but builds with :term:`B` |
| 99 | == :term:`S`. This method is useful when out-of-tree build |
| 100 | support is either not present or is broken. |
| 101 | |
| 102 | .. note:: |
| 103 | |
| 104 | It is recommended that out-of-tree support be fixed and used if at |
| 105 | all possible. |
| 106 | |
| 107 | It's useful to have some idea of how the tasks defined by the |
| 108 | ``autotools*`` classes work and what they do behind the scenes. |
| 109 | |
| 110 | - :ref:`ref-tasks-configure` - Regenerates the |
| 111 | configure script (using ``autoreconf``) and then launches it with a |
| 112 | standard set of arguments used during cross-compilation. You can pass |
| 113 | additional parameters to ``configure`` through the ``EXTRA_OECONF`` |
| 114 | or :term:`PACKAGECONFIG_CONFARGS` |
| 115 | variables. |
| 116 | |
| 117 | - :ref:`ref-tasks-compile` - Runs ``make`` with |
| 118 | arguments that specify the compiler and linker. You can pass |
| 119 | additional arguments through the ``EXTRA_OEMAKE`` variable. |
| 120 | |
| 121 | - :ref:`ref-tasks-install` - Runs ``make install`` and |
| 122 | passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``. |
| 123 | |
| 124 | .. _ref-classes-base: |
| 125 | |
| 126 | ``base.bbclass`` |
| 127 | ================ |
| 128 | |
| 129 | The ``base`` class is special in that every ``.bb`` file implicitly |
| 130 | inherits the class. This class contains definitions for standard basic |
| 131 | tasks such as fetching, unpacking, configuring (empty by default), |
| 132 | compiling (runs any ``Makefile`` present), installing (empty by default) |
| 133 | and packaging (empty by default). These classes are often overridden or |
| 134 | extended by other classes such as the |
| 135 | :ref:`autotools <ref-classes-autotools>` class or the |
| 136 | :ref:`package <ref-classes-package>` class. |
| 137 | |
| 138 | The class also contains some commonly used functions such as |
| 139 | ``oe_runmake``, which runs ``make`` with the arguments specified in |
| 140 | :term:`EXTRA_OEMAKE` variable as well as the |
| 141 | arguments passed directly to ``oe_runmake``. |
| 142 | |
| 143 | .. _ref-classes-bash-completion: |
| 144 | |
| 145 | ``bash-completion.bbclass`` |
| 146 | =========================== |
| 147 | |
| 148 | Sets up packaging and dependencies appropriate for recipes that build |
| 149 | software that includes bash-completion data. |
| 150 | |
| 151 | .. _ref-classes-bin-package: |
| 152 | |
| 153 | ``bin_package.bbclass`` |
| 154 | ======================= |
| 155 | |
| 156 | The ``bin_package`` class is a helper class for recipes that extract the |
| 157 | contents of a binary package (e.g. an RPM) and install those contents |
| 158 | rather than building the binary from source. The binary package is |
| 159 | extracted and new packages in the configured output package format are |
| 160 | created. Extraction and installation of proprietary binaries is a good |
| 161 | example use for this class. |
| 162 | |
| 163 | .. note:: |
| 164 | |
| 165 | For RPMs and other packages that do not contain a subdirectory, you |
| 166 | should specify an appropriate fetcher parameter to point to the |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 167 | subdirectory. For example, if BitBake is using the Git fetcher (``git://``), |
| 168 | the "subpath" parameter limits the checkout to a specific subpath |
| 169 | of the tree. Here is an example where ``${BP}`` is used so that the files |
| 170 | are extracted into the subdirectory expected by the default value of |
| 171 | ``S``: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 172 | :: |
| 173 | |
| 174 | SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}" |
| 175 | |
| 176 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 177 | See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for |
| 178 | more information on supported BitBake Fetchers. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 179 | |
| 180 | .. _ref-classes-binconfig: |
| 181 | |
| 182 | ``binconfig.bbclass`` |
| 183 | ===================== |
| 184 | |
| 185 | The ``binconfig`` class helps to correct paths in shell scripts. |
| 186 | |
| 187 | Before ``pkg-config`` had become widespread, libraries shipped shell |
| 188 | scripts to give information about the libraries and include paths needed |
| 189 | to build software (usually named ``LIBNAME-config``). This class assists |
| 190 | any recipe using such scripts. |
| 191 | |
| 192 | During staging, the OpenEmbedded build system installs such scripts into |
| 193 | the ``sysroots/`` directory. Inheriting this class results in all paths |
| 194 | in these scripts being changed to point into the ``sysroots/`` directory |
| 195 | so that all builds that use the script use the correct directories for |
| 196 | the cross compiling layout. See the |
| 197 | :term:`BINCONFIG_GLOB` variable for more |
| 198 | information. |
| 199 | |
| 200 | .. _ref-classes-binconfig-disabled: |
| 201 | |
| 202 | ``binconfig-disabled.bbclass`` |
| 203 | ============================== |
| 204 | |
| 205 | An alternative version of the :ref:`binconfig <ref-classes-binconfig>` |
| 206 | class, which disables binary configuration scripts by making them return |
| 207 | an error in favor of using ``pkg-config`` to query the information. The |
| 208 | scripts to be disabled should be specified using the |
| 209 | :term:`BINCONFIG` variable within the recipe inheriting |
| 210 | the class. |
| 211 | |
| 212 | .. _ref-classes-blacklist: |
| 213 | |
| 214 | ``blacklist.bbclass`` |
| 215 | ===================== |
| 216 | |
| 217 | The ``blacklist`` class prevents the OpenEmbedded build system from |
| 218 | building specific recipes (blacklists them). To use this class, inherit |
| 219 | the class globally and set :term:`PNBLACKLIST` for |
| 220 | each recipe you wish to blacklist. Specify the :term:`PN` |
| 221 | value as a variable flag (varflag) and provide a reason, which is |
| 222 | reported, if the package is requested to be built as the value. For |
| 223 | example, if you want to blacklist a recipe called "exoticware", you add |
| 224 | the following to your ``local.conf`` or distribution configuration: |
| 225 | :: |
| 226 | |
| 227 | INHERIT += "blacklist" |
| 228 | PNBLACKLIST[exoticware] = "Not supported by our organization." |
| 229 | |
| 230 | .. _ref-classes-buildhistory: |
| 231 | |
| 232 | ``buildhistory.bbclass`` |
| 233 | ======================== |
| 234 | |
| 235 | The ``buildhistory`` class records a history of build output metadata, |
| 236 | which can be used to detect possible regressions as well as used for |
| 237 | analysis of the build output. For more information on using Build |
| 238 | History, see the |
| 239 | ":ref:`dev-manual/dev-manual-common-tasks:maintaining build output quality`" |
| 240 | section in the Yocto Project Development Tasks Manual. |
| 241 | |
| 242 | .. _ref-classes-buildstats: |
| 243 | |
| 244 | ``buildstats.bbclass`` |
| 245 | ====================== |
| 246 | |
| 247 | The ``buildstats`` class records performance statistics about each task |
| 248 | executed during the build (e.g. elapsed time, CPU usage, and I/O usage). |
| 249 | |
| 250 | When you use this class, the output goes into the |
| 251 | :term:`BUILDSTATS_BASE` directory, which defaults |
| 252 | to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using |
| 253 | ``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading |
| 254 | chart of the entire build process and can be useful for highlighting |
| 255 | bottlenecks. |
| 256 | |
| 257 | Collecting build statistics is enabled by default through the |
| 258 | :term:`USER_CLASSES` variable from your |
| 259 | ``local.conf`` file. Consequently, you do not have to do anything to |
| 260 | enable the class. However, if you want to disable the class, simply |
| 261 | remove "buildstats" from the ``USER_CLASSES`` list. |
| 262 | |
| 263 | .. _ref-classes-buildstats-summary: |
| 264 | |
| 265 | ``buildstats-summary.bbclass`` |
| 266 | ============================== |
| 267 | |
| 268 | When inherited globally, prints statistics at the end of the build on |
| 269 | sstate re-use. In order to function, this class requires the |
| 270 | :ref:`buildstats <ref-classes-buildstats>` class be enabled. |
| 271 | |
| 272 | .. _ref-classes-ccache: |
| 273 | |
| 274 | ``ccache.bbclass`` |
| 275 | ================== |
| 276 | |
| 277 | The ``ccache`` class enables the C/C++ Compiler Cache for the build. |
| 278 | This class is used to give a minor performance boost during the build. |
| 279 | However, using the class can lead to unexpected side-effects. Thus, it |
| 280 | is recommended that you do not use this class. See |
| 281 | http://ccache.samba.org/ for information on the C/C++ Compiler |
| 282 | Cache. |
| 283 | |
| 284 | .. _ref-classes-chrpath: |
| 285 | |
| 286 | ``chrpath.bbclass`` |
| 287 | =================== |
| 288 | |
| 289 | The ``chrpath`` class is a wrapper around the "chrpath" utility, which |
| 290 | is used during the build process for ``nativesdk``, ``cross``, and |
| 291 | ``cross-canadian`` recipes to change ``RPATH`` records within binaries |
| 292 | in order to make them relocatable. |
| 293 | |
| 294 | .. _ref-classes-clutter: |
| 295 | |
| 296 | ``clutter.bbclass`` |
| 297 | =================== |
| 298 | |
| 299 | The ``clutter`` class consolidates the major and minor version naming |
| 300 | and other common items used by Clutter and related recipes. |
| 301 | |
| 302 | .. note:: |
| 303 | |
| 304 | Unlike some other classes related to specific libraries, recipes |
| 305 | building other software that uses Clutter do not need to inherit this |
| 306 | class unless they use the same recipe versioning scheme that the |
| 307 | Clutter and related recipes do. |
| 308 | |
| 309 | .. _ref-classes-cmake: |
| 310 | |
| 311 | ``cmake.bbclass`` |
| 312 | ================= |
| 313 | |
| 314 | The ``cmake`` class allows for recipes that need to build software using |
| 315 | the `CMake <https://cmake.org/overview/>`__ build system. You can use |
| 316 | the :term:`EXTRA_OECMAKE` variable to specify |
| 317 | additional configuration options to be passed using the ``cmake`` |
| 318 | command line. |
| 319 | |
| 320 | On the occasion that you would be installing custom CMake toolchain |
| 321 | files supplied by the application being built, you should install them |
| 322 | to the preferred CMake Module directory: ``${D}${datadir}/cmake/`` |
| 323 | Modules during |
| 324 | :ref:`ref-tasks-install`. |
| 325 | |
| 326 | .. _ref-classes-cml1: |
| 327 | |
| 328 | ``cml1.bbclass`` |
| 329 | ================ |
| 330 | |
| 331 | The ``cml1`` class provides basic support for the Linux kernel style |
| 332 | build configuration system. |
| 333 | |
| 334 | .. _ref-classes-compress_doc: |
| 335 | |
| 336 | ``compress_doc.bbclass`` |
| 337 | ======================== |
| 338 | |
| 339 | Enables compression for man pages and info pages. This class is intended |
| 340 | to be inherited globally. The default compression mechanism is gz (gzip) |
| 341 | but you can select an alternative mechanism by setting the |
| 342 | :term:`DOC_COMPRESS` variable. |
| 343 | |
| 344 | .. _ref-classes-copyleft_compliance: |
| 345 | |
| 346 | ``copyleft_compliance.bbclass`` |
| 347 | =============================== |
| 348 | |
| 349 | The ``copyleft_compliance`` class preserves source code for the purposes |
| 350 | of license compliance. This class is an alternative to the ``archiver`` |
| 351 | class and is still used by some users even though it has been deprecated |
| 352 | in favor of the :ref:`archiver <ref-classes-archiver>` class. |
| 353 | |
| 354 | .. _ref-classes-copyleft_filter: |
| 355 | |
| 356 | ``copyleft_filter.bbclass`` |
| 357 | =========================== |
| 358 | |
| 359 | A class used by the :ref:`archiver <ref-classes-archiver>` and |
| 360 | :ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes |
| 361 | for filtering licenses. The ``copyleft_filter`` class is an internal |
| 362 | class and is not intended to be used directly. |
| 363 | |
| 364 | .. _ref-classes-core-image: |
| 365 | |
| 366 | ``core-image.bbclass`` |
| 367 | ====================== |
| 368 | |
| 369 | The ``core-image`` class provides common definitions for the |
| 370 | ``core-image-*`` image recipes, such as support for additional |
| 371 | :term:`IMAGE_FEATURES`. |
| 372 | |
| 373 | .. _ref-classes-cpan: |
| 374 | |
| 375 | ``cpan*.bbclass`` |
| 376 | ================= |
| 377 | |
| 378 | The ``cpan*`` classes support Perl modules. |
| 379 | |
| 380 | Recipes for Perl modules are simple. These recipes usually only need to |
| 381 | point to the source's archive and then inherit the proper class file. |
| 382 | Building is split into two methods depending on which method the module |
| 383 | authors used. |
| 384 | |
| 385 | - Modules that use old ``Makefile.PL``-based build system require |
| 386 | ``cpan.bbclass`` in their recipes. |
| 387 | |
| 388 | - Modules that use ``Build.PL``-based build system require using |
| 389 | ``cpan_build.bbclass`` in their recipes. |
| 390 | |
| 391 | Both build methods inherit the ``cpan-base`` class for basic Perl |
| 392 | support. |
| 393 | |
| 394 | .. _ref-classes-cross: |
| 395 | |
| 396 | ``cross.bbclass`` |
| 397 | ================= |
| 398 | |
| 399 | The ``cross`` class provides support for the recipes that build the |
| 400 | cross-compilation tools. |
| 401 | |
| 402 | .. _ref-classes-cross-canadian: |
| 403 | |
| 404 | ``cross-canadian.bbclass`` |
| 405 | ========================== |
| 406 | |
| 407 | The ``cross-canadian`` class provides support for the recipes that build |
| 408 | the Canadian Cross-compilation tools for SDKs. See the |
| 409 | ":ref:`overview-manual/overview-manual-concepts:cross-development toolchain generation`" |
| 410 | section in the Yocto Project Overview and Concepts Manual for more |
| 411 | discussion on these cross-compilation tools. |
| 412 | |
| 413 | .. _ref-classes-crosssdk: |
| 414 | |
| 415 | ``crosssdk.bbclass`` |
| 416 | ==================== |
| 417 | |
| 418 | The ``crosssdk`` class provides support for the recipes that build the |
| 419 | cross-compilation tools used for building SDKs. See the |
| 420 | ":ref:`overview-manual/overview-manual-concepts:cross-development toolchain generation`" |
| 421 | section in the Yocto Project Overview and Concepts Manual for more |
| 422 | discussion on these cross-compilation tools. |
| 423 | |
| 424 | .. _ref-classes-debian: |
| 425 | |
| 426 | ``debian.bbclass`` |
| 427 | ================== |
| 428 | |
| 429 | The ``debian`` class renames output packages so that they follow the |
| 430 | Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and |
| 431 | ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library |
| 432 | name and version as part of the package name. |
| 433 | |
| 434 | If a recipe creates packages for multiple libraries (shared object files |
| 435 | of ``.so`` type), use the :term:`LEAD_SONAME` |
| 436 | variable in the recipe to specify the library on which to apply the |
| 437 | naming scheme. |
| 438 | |
| 439 | .. _ref-classes-deploy: |
| 440 | |
| 441 | ``deploy.bbclass`` |
| 442 | ================== |
| 443 | |
| 444 | The ``deploy`` class handles deploying files to the |
| 445 | :term:`DEPLOY_DIR_IMAGE` directory. The main |
| 446 | function of this class is to allow the deploy step to be accelerated by |
| 447 | shared state. Recipes that inherit this class should define their own |
| 448 | :ref:`ref-tasks-deploy` function to copy the files to be |
| 449 | deployed to :term:`DEPLOYDIR`, and use ``addtask`` to |
| 450 | add the task at the appropriate place, which is usually after |
| 451 | :ref:`ref-tasks-compile` or |
| 452 | :ref:`ref-tasks-install`. The class then takes care of |
| 453 | staging the files from ``DEPLOYDIR`` to ``DEPLOY_DIR_IMAGE``. |
| 454 | |
| 455 | .. _ref-classes-devshell: |
| 456 | |
| 457 | ``devshell.bbclass`` |
| 458 | ==================== |
| 459 | |
| 460 | The ``devshell`` class adds the ``do_devshell`` task. Distribution |
| 461 | policy dictates whether to include this class. See the ":ref:`platdev-appdev-devshell`" |
| 462 | section in the Yocto Project Development Tasks Manual for more |
| 463 | information about using ``devshell``. |
| 464 | |
| 465 | .. _ref-classes-devupstream: |
| 466 | |
| 467 | ``devupstream.bbclass`` |
| 468 | ======================= |
| 469 | |
| 470 | The ``devupstream`` class uses |
| 471 | :term:`BBCLASSEXTEND` to add a variant of the |
| 472 | recipe that fetches from an alternative URI (e.g. Git) instead of a |
| 473 | tarball. Following is an example: |
| 474 | :: |
| 475 | |
| 476 | BBCLASSEXTEND = "devupstream:target" |
| 477 | SRC_URI_class-devupstream = "git://git.example.com/example" |
| 478 | SRCREV_class-devupstream = "abcd1234" |
| 479 | |
| 480 | Adding the above statements to your recipe creates a variant that has |
| 481 | :term:`DEFAULT_PREFERENCE` set to "-1". |
| 482 | Consequently, you need to select the variant of the recipe to use it. |
| 483 | Any development-specific adjustments can be done by using the |
| 484 | ``class-devupstream`` override. Here is an example: |
| 485 | :: |
| 486 | |
| 487 | DEPENDS_append_class-devupstream = " gperf-native" |
| 488 | do_configure_prepend_class-devupstream() { |
| 489 | touch ${S}/README |
| 490 | } |
| 491 | |
| 492 | The class |
| 493 | currently only supports creating a development variant of the target |
| 494 | recipe, not ``native`` or ``nativesdk`` variants. |
| 495 | |
| 496 | The ``BBCLASSEXTEND`` syntax (i.e. ``devupstream:target``) provides |
| 497 | support for ``native`` and ``nativesdk`` variants. Consequently, this |
| 498 | functionality can be added in a future release. |
| 499 | |
| 500 | Support for other version control systems such as Subversion is limited |
| 501 | due to BitBake's automatic fetch dependencies (e.g. |
| 502 | ``subversion-native``). |
| 503 | |
| 504 | .. _ref-classes-distro_features_check: |
| 505 | |
| 506 | ``distro_features_check.bbclass`` |
| 507 | ================================= |
| 508 | |
| 509 | The ``distro_features_check`` class allows individual recipes to check |
| 510 | for required and conflicting |
| 511 | :term:`DISTRO_FEATURES`. |
| 512 | |
| 513 | This class provides support for the |
| 514 | :term:`REQUIRED_DISTRO_FEATURES` and |
| 515 | :term:`CONFLICT_DISTRO_FEATURES` |
| 516 | variables. If any conditions specified in the recipe using the above |
| 517 | variables are not met, the recipe will be skipped. |
| 518 | |
| 519 | .. _ref-classes-distutils: |
| 520 | |
| 521 | ``distutils*.bbclass`` |
| 522 | ====================== |
| 523 | |
| 524 | The ``distutils*`` classes support recipes for Python version 2.x |
| 525 | extensions, which are simple. These recipes usually only need to point |
| 526 | to the source's archive and then inherit the proper class. Building is |
| 527 | split into two methods depending on which method the module authors |
| 528 | used. |
| 529 | |
| 530 | - Extensions that use an Autotools-based build system require Autotools |
| 531 | and the classes based on ``distutils`` in their recipes. |
| 532 | |
| 533 | - Extensions that use build systems based on ``distutils`` require the |
| 534 | ``distutils`` class in their recipes. |
| 535 | |
| 536 | - Extensions that use build systems based on ``setuptools`` require the |
| 537 | :ref:`setuptools <ref-classes-setuptools>` class in their recipes. |
| 538 | |
| 539 | The ``distutils-common-base`` class is required by some of the |
| 540 | ``distutils*`` classes to provide common Python2 support. |
| 541 | |
| 542 | .. _ref-classes-distutils3: |
| 543 | |
| 544 | ``distutils3*.bbclass`` |
| 545 | ======================= |
| 546 | |
| 547 | The ``distutils3*`` classes support recipes for Python version 3.x |
| 548 | extensions, which are simple. These recipes usually only need to point |
| 549 | to the source's archive and then inherit the proper class. Building is |
| 550 | split into three methods depending on which method the module authors |
| 551 | used. |
| 552 | |
| 553 | - Extensions that use an Autotools-based build system require Autotools |
| 554 | and ``distutils``-based classes in their recipes. |
| 555 | |
| 556 | - Extensions that use ``distutils``-based build systems require the |
| 557 | ``distutils`` class in their recipes. |
| 558 | |
| 559 | - Extensions that use build systems based on ``setuptools3`` require |
| 560 | the :ref:`setuptools3 <ref-classes-setuptools>` class in their |
| 561 | recipes. |
| 562 | |
| 563 | The ``distutils3*`` classes either inherit their corresponding |
| 564 | ``distutils*`` class or replicate them using a Python3 version instead |
| 565 | (e.g. ``distutils3-base`` inherits ``distutils-common-base``, which is |
| 566 | the same as ``distutils-base`` but inherits ``python3native`` instead of |
| 567 | ``pythonnative``). |
| 568 | |
| 569 | .. _ref-classes-externalsrc: |
| 570 | |
| 571 | ``externalsrc.bbclass`` |
| 572 | ======================= |
| 573 | |
| 574 | The ``externalsrc`` class supports building software from source code |
| 575 | that is external to the OpenEmbedded build system. Building software |
| 576 | from an external source tree means that the build system's normal fetch, |
| 577 | unpack, and patch process is not used. |
| 578 | |
| 579 | By default, the OpenEmbedded build system uses the :term:`S` |
| 580 | and :term:`B` variables to locate unpacked recipe source code |
| 581 | and to build it, respectively. When your recipe inherits the |
| 582 | ``externalsrc`` class, you use the |
| 583 | :term:`EXTERNALSRC` and |
| 584 | :term:`EXTERNALSRC_BUILD` variables to |
| 585 | ultimately define ``S`` and ``B``. |
| 586 | |
| 587 | By default, this class expects the source code to support recipe builds |
| 588 | that use the :term:`B` variable to point to the directory in |
| 589 | which the OpenEmbedded build system places the generated objects built |
| 590 | from the recipes. By default, the ``B`` directory is set to the |
| 591 | following, which is separate from the source directory (``S``): |
| 592 | :: |
| 593 | |
| 594 | ${WORKDIR}/${BPN}/{PV}/ |
| 595 | |
| 596 | See these variables for more information: |
| 597 | :term:`WORKDIR`, :term:`BPN`, and |
| 598 | :term:`PV`, |
| 599 | |
| 600 | For more information on the ``externalsrc`` class, see the comments in |
| 601 | ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`. |
| 602 | For information on how to use the |
| 603 | ``externalsrc`` class, see the |
| 604 | ":ref:`dev-manual/dev-manual-common-tasks:building software from an external source`" |
| 605 | section in the Yocto Project Development Tasks Manual. |
| 606 | |
| 607 | .. _ref-classes-extrausers: |
| 608 | |
| 609 | ``extrausers.bbclass`` |
| 610 | ====================== |
| 611 | |
| 612 | The ``extrausers`` class allows additional user and group configuration |
| 613 | to be applied at the image level. Inheriting this class either globally |
| 614 | or from an image recipe allows additional user and group operations to |
| 615 | be performed using the |
| 616 | :term:`EXTRA_USERS_PARAMS` variable. |
| 617 | |
| 618 | .. note:: |
| 619 | |
| 620 | The user and group operations added using the |
| 621 | extrausers |
| 622 | class are not tied to a specific recipe outside of the recipe for the |
| 623 | image. Thus, the operations can be performed across the image as a |
| 624 | whole. Use the |
| 625 | useradd |
| 626 | class to add user and group configuration to a specific recipe. |
| 627 | |
| 628 | Here is an example that uses this class in an image recipe: |
| 629 | :: |
| 630 | |
| 631 | inherit extrausers |
| 632 | EXTRA_USERS_PARAMS = "\ |
| 633 | useradd -p '' tester; \ |
| 634 | groupadd developers; \ |
| 635 | userdel nobody; \ |
| 636 | groupdel -g video; \ |
| 637 | groupmod -g 1020 developers; \ |
| 638 | usermod -s /bin/sh tester; \ |
| 639 | " |
| 640 | |
| 641 | Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns |
| 642 | passwords: |
| 643 | :: |
| 644 | |
| 645 | inherit extrausers |
| 646 | EXTRA_USERS_PARAMS = "\ |
| 647 | useradd -P tester01 tester-jim; \ |
| 648 | useradd -P tester01 tester-sue; \ |
| 649 | " |
| 650 | |
| 651 | Finally, here is an example that sets the root password to "1876*18": |
| 652 | :: |
| 653 | |
| 654 | inherit extrausers |
| 655 | EXTRA_USERS_PARAMS = "\ |
| 656 | usermod -P 1876*18 root; \ |
| 657 | " |
| 658 | |
| 659 | .. _ref-classes-fontcache: |
| 660 | |
| 661 | ``fontcache.bbclass`` |
| 662 | ===================== |
| 663 | |
| 664 | The ``fontcache`` class generates the proper post-install and |
| 665 | post-remove (postinst and postrm) scriptlets for font packages. These |
| 666 | scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts |
| 667 | to the font information cache. Since the cache files are |
| 668 | architecture-specific, ``fc-cache`` runs using QEMU if the postinst |
| 669 | scriptlets need to be run on the build host during image creation. |
| 670 | |
| 671 | If the fonts being installed are in packages other than the main |
| 672 | package, set :term:`FONT_PACKAGES` to specify the |
| 673 | packages containing the fonts. |
| 674 | |
| 675 | .. _ref-classes-fs-uuid: |
| 676 | |
| 677 | ``fs-uuid.bbclass`` |
| 678 | =================== |
| 679 | |
| 680 | The ``fs-uuid`` class extracts UUID from |
| 681 | ``${``\ :term:`ROOTFS`\ ``}``, which must have been built |
| 682 | by the time that this function gets called. The ``fs-uuid`` class only |
| 683 | works on ``ext`` file systems and depends on ``tune2fs``. |
| 684 | |
| 685 | .. _ref-classes-gconf: |
| 686 | |
| 687 | ``gconf.bbclass`` |
| 688 | ================= |
| 689 | |
| 690 | The ``gconf`` class provides common functionality for recipes that need |
| 691 | to install GConf schemas. The schemas will be put into a separate |
| 692 | package (``${``\ :term:`PN`\ ``}-gconf``) that is created |
| 693 | automatically when this class is inherited. This package uses the |
| 694 | appropriate post-install and post-remove (postinst/postrm) scriptlets to |
| 695 | register and unregister the schemas in the target image. |
| 696 | |
| 697 | .. _ref-classes-gettext: |
| 698 | |
| 699 | ``gettext.bbclass`` |
| 700 | =================== |
| 701 | |
| 702 | The ``gettext`` class provides support for building software that uses |
| 703 | the GNU ``gettext`` internationalization and localization system. All |
| 704 | recipes building software that use ``gettext`` should inherit this |
| 705 | class. |
| 706 | |
| 707 | .. _ref-classes-gnomebase: |
| 708 | |
| 709 | ``gnomebase.bbclass`` |
| 710 | ===================== |
| 711 | |
| 712 | The ``gnomebase`` class is the base class for recipes that build |
| 713 | software from the GNOME stack. This class sets |
| 714 | :term:`SRC_URI` to download the source from the GNOME |
| 715 | mirrors as well as extending :term:`FILES` with the typical |
| 716 | GNOME installation paths. |
| 717 | |
| 718 | .. _ref-classes-gobject-introspection: |
| 719 | |
| 720 | ``gobject-introspection.bbclass`` |
| 721 | ================================= |
| 722 | |
| 723 | Provides support for recipes building software that supports GObject |
| 724 | introspection. This functionality is only enabled if the |
| 725 | "gobject-introspection-data" feature is in |
| 726 | :term:`DISTRO_FEATURES` as well as |
| 727 | "qemu-usermode" being in |
| 728 | :term:`MACHINE_FEATURES`. |
| 729 | |
| 730 | .. note:: |
| 731 | |
| 732 | This functionality is backfilled by default and, if not applicable, |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 733 | should be disabled through ``DISTRO_FEATURES_BACKFILL_CONSIDERED`` or |
| 734 | ``MACHINE_FEATURES_BACKFILL_CONSIDERED``, respectively. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 735 | |
| 736 | .. _ref-classes-grub-efi: |
| 737 | |
| 738 | ``grub-efi.bbclass`` |
| 739 | ==================== |
| 740 | |
| 741 | The ``grub-efi`` class provides ``grub-efi``-specific functions for |
| 742 | building bootable images. |
| 743 | |
| 744 | This class supports several variables: |
| 745 | |
| 746 | - :term:`INITRD`: Indicates list of filesystem images to |
| 747 | concatenate and use as an initial RAM disk (initrd) (optional). |
| 748 | |
| 749 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 750 | as the root filesystem (optional). |
| 751 | |
| 752 | - :term:`GRUB_GFXSERIAL`: Set this to "1" to have |
| 753 | graphics and serial in the boot menu. |
| 754 | |
| 755 | - :term:`LABELS`: A list of targets for the automatic |
| 756 | configuration. |
| 757 | |
| 758 | - :term:`APPEND`: An override list of append strings for |
| 759 | each ``LABEL``. |
| 760 | |
| 761 | - :term:`GRUB_OPTS`: Additional options to add to the |
| 762 | configuration (optional). Options are delimited using semi-colon |
| 763 | characters (``;``). |
| 764 | |
| 765 | - :term:`GRUB_TIMEOUT`: Timeout before executing |
| 766 | the default ``LABEL`` (optional). |
| 767 | |
| 768 | .. _ref-classes-gsettings: |
| 769 | |
| 770 | ``gsettings.bbclass`` |
| 771 | ===================== |
| 772 | |
| 773 | The ``gsettings`` class provides common functionality for recipes that |
| 774 | need to install GSettings (glib) schemas. The schemas are assumed to be |
| 775 | part of the main package. Appropriate post-install and post-remove |
| 776 | (postinst/postrm) scriptlets are added to register and unregister the |
| 777 | schemas in the target image. |
| 778 | |
| 779 | .. _ref-classes-gtk-doc: |
| 780 | |
| 781 | ``gtk-doc.bbclass`` |
| 782 | =================== |
| 783 | |
| 784 | The ``gtk-doc`` class is a helper class to pull in the appropriate |
| 785 | ``gtk-doc`` dependencies and disable ``gtk-doc``. |
| 786 | |
| 787 | .. _ref-classes-gtk-icon-cache: |
| 788 | |
| 789 | ``gtk-icon-cache.bbclass`` |
| 790 | ========================== |
| 791 | |
| 792 | The ``gtk-icon-cache`` class generates the proper post-install and |
| 793 | post-remove (postinst/postrm) scriptlets for packages that use GTK+ and |
| 794 | install icons. These scriptlets call ``gtk-update-icon-cache`` to add |
| 795 | the fonts to GTK+'s icon cache. Since the cache files are |
| 796 | architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if |
| 797 | the postinst scriptlets need to be run on the build host during image |
| 798 | creation. |
| 799 | |
| 800 | .. _ref-classes-gtk-immodules-cache: |
| 801 | |
| 802 | ``gtk-immodules-cache.bbclass`` |
| 803 | =============================== |
| 804 | |
| 805 | The ``gtk-immodules-cache`` class generates the proper post-install and |
| 806 | post-remove (postinst/postrm) scriptlets for packages that install GTK+ |
| 807 | input method modules for virtual keyboards. These scriptlets call |
| 808 | ``gtk-update-icon-cache`` to add the input method modules to the cache. |
| 809 | Since the cache files are architecture-specific, |
| 810 | ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets |
| 811 | need to be run on the build host during image creation. |
| 812 | |
| 813 | If the input method modules being installed are in packages other than |
| 814 | the main package, set |
| 815 | :term:`GTKIMMODULES_PACKAGES` to specify |
| 816 | the packages containing the modules. |
| 817 | |
| 818 | .. _ref-classes-gzipnative: |
| 819 | |
| 820 | ``gzipnative.bbclass`` |
| 821 | ====================== |
| 822 | |
| 823 | The ``gzipnative`` class enables the use of different native versions of |
| 824 | ``gzip`` and ``pigz`` rather than the versions of these tools from the |
| 825 | build host. |
| 826 | |
| 827 | .. _ref-classes-icecc: |
| 828 | |
| 829 | ``icecc.bbclass`` |
| 830 | ================= |
| 831 | |
| 832 | The ``icecc`` class supports |
| 833 | `Icecream <https://github.com/icecc/icecream>`__, which facilitates |
| 834 | taking compile jobs and distributing them among remote machines. |
| 835 | |
| 836 | The class stages directories with symlinks from ``gcc`` and ``g++`` to |
| 837 | ``icecc``, for both native and cross compilers. Depending on each |
| 838 | configure or compile, the OpenEmbedded build system adds the directories |
| 839 | at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and |
| 840 | ``ICEC_CC`` variables, which are the paths to the ``g++`` and ``gcc`` |
| 841 | compilers, respectively. |
| 842 | |
| 843 | For the cross compiler, the class creates a ``tar.gz`` file that |
| 844 | contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which |
| 845 | is the version of the cross-compiler used in the cross-development |
| 846 | toolchain, accordingly. |
| 847 | |
| 848 | The class handles all three different compile stages (i.e native |
| 849 | ,cross-kernel and target) and creates the necessary environment |
| 850 | ``tar.gz`` file to be used by the remote machines. The class also |
| 851 | supports SDK generation. |
| 852 | |
| 853 | If :term:`ICECC_PATH` is not set in your |
| 854 | ``local.conf`` file, then the class tries to locate the ``icecc`` binary |
| 855 | using ``which``. If :term:`ICECC_ENV_EXEC` is set |
| 856 | in your ``local.conf`` file, the variable should point to the |
| 857 | ``icecc-create-env`` script provided by the user. If you do not point to |
| 858 | a user-provided script, the build system uses the default script |
| 859 | provided by the recipe ``icecc-create-env-native.bb``. |
| 860 | |
| 861 | .. note:: |
| 862 | |
| 863 | This script is a modified version and not the one that comes with |
| 864 | icecc. |
| 865 | |
| 866 | If you do not want the Icecream distributed compile support to apply to |
| 867 | specific recipes or classes, you can effectively "blacklist" them by |
| 868 | listing the recipes and classes using the |
| 869 | :term:`ICECC_USER_PACKAGE_BL` and |
| 870 | :term:`ICECC_USER_CLASS_BL`, variables, |
| 871 | respectively, in your ``local.conf`` file. Doing so causes the |
| 872 | OpenEmbedded build system to handle these compilations locally. |
| 873 | |
| 874 | Additionally, you can list recipes using the |
| 875 | :term:`ICECC_USER_PACKAGE_WL` variable in |
| 876 | your ``local.conf`` file to force ``icecc`` to be enabled for recipes |
| 877 | using an empty :term:`PARALLEL_MAKE` variable. |
| 878 | |
| 879 | Inheriting the ``icecc`` class changes all sstate signatures. |
| 880 | Consequently, if a development team has a dedicated build system that |
| 881 | populates :term:`SSTATE_MIRRORS` and they want to |
| 882 | reuse sstate from ``SSTATE_MIRRORS``, then all developers and the build |
| 883 | system need to either inherit the ``icecc`` class or nobody should. |
| 884 | |
| 885 | At the distribution level, you can inherit the ``icecc`` class to be |
| 886 | sure that all builders start with the same sstate signatures. After |
| 887 | inheriting the class, you can then disable the feature by setting the |
| 888 | :term:`ICECC_DISABLED` variable to "1" as follows: |
| 889 | :: |
| 890 | |
| 891 | INHERIT_DISTRO_append = " icecc" |
| 892 | ICECC_DISABLED ??= "1" |
| 893 | |
| 894 | This practice |
| 895 | makes sure everyone is using the same signatures but also requires |
| 896 | individuals that do want to use Icecream to enable the feature |
| 897 | individually as follows in your ``local.conf`` file: |
| 898 | :: |
| 899 | |
| 900 | ICECC_DISABLED = "" |
| 901 | |
| 902 | .. _ref-classes-image: |
| 903 | |
| 904 | ``image.bbclass`` |
| 905 | ================= |
| 906 | |
| 907 | The ``image`` class helps support creating images in different formats. |
| 908 | First, the root filesystem is created from packages using one of the |
| 909 | ``rootfs*.bbclass`` files (depending on the package format used) and |
| 910 | then one or more image files are created. |
| 911 | |
| 912 | - The ``IMAGE_FSTYPES`` variable controls the types of images to |
| 913 | generate. |
| 914 | |
| 915 | - The ``IMAGE_INSTALL`` variable controls the list of packages to |
| 916 | install into the image. |
| 917 | |
| 918 | For information on customizing images, see the |
| 919 | ":ref:`usingpoky-extend-customimage`" section |
| 920 | in the Yocto Project Development Tasks Manual. For information on how |
| 921 | images are created, see the |
| 922 | ":ref:`images-dev-environment`" section in the |
| 923 | Yocto Project Overview and Concpets Manual. |
| 924 | |
| 925 | .. _ref-classes-image-buildinfo: |
| 926 | |
| 927 | ``image-buildinfo.bbclass`` |
| 928 | =========================== |
| 929 | |
| 930 | The ``image-buildinfo`` class writes information to the target |
| 931 | filesystem on ``/etc/build``. |
| 932 | |
| 933 | .. _ref-classes-image_types: |
| 934 | |
| 935 | ``image_types.bbclass`` |
| 936 | ======================= |
| 937 | |
| 938 | The ``image_types`` class defines all of the standard image output types |
| 939 | that you can enable through the |
| 940 | :term:`IMAGE_FSTYPES` variable. You can use this |
| 941 | class as a reference on how to add support for custom image output |
| 942 | types. |
| 943 | |
| 944 | By default, the :ref:`image <ref-classes-image>` class automatically |
| 945 | enables the ``image_types`` class. The ``image`` class uses the |
| 946 | ``IMGCLASSES`` variable as follows: |
| 947 | :: |
| 948 | |
| 949 | IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}" |
| 950 | IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}" |
| 951 | IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}" |
| 952 | IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}" |
| 953 | IMGCLASSES += "image_types_wic" |
| 954 | IMGCLASSES += "rootfs-postcommands" |
| 955 | IMGCLASSES += "image-postinst-intercepts" |
| 956 | inherit ${IMGCLASSES} |
| 957 | |
| 958 | The ``image_types`` class also handles conversion and compression of images. |
| 959 | |
| 960 | .. note:: |
| 961 | |
| 962 | To build a VMware VMDK image, you need to add "wic.vmdk" to |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 963 | ``IMAGE_FSTYPES``. This would also be similar for Virtual Box Virtual Disk |
| 964 | Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 965 | |
| 966 | .. _ref-classes-image-live: |
| 967 | |
| 968 | ``image-live.bbclass`` |
| 969 | ====================== |
| 970 | |
| 971 | This class controls building "live" (i.e. HDDIMG and ISO) images. Live |
| 972 | images contain syslinux for legacy booting, as well as the bootloader |
| 973 | specified by :term:`EFI_PROVIDER` if |
| 974 | :term:`MACHINE_FEATURES` contains "efi". |
| 975 | |
| 976 | Normally, you do not use this class directly. Instead, you add "live" to |
| 977 | :term:`IMAGE_FSTYPES`. |
| 978 | |
| 979 | .. _ref-classes-image-mklibs: |
| 980 | |
| 981 | ``image-mklibs.bbclass`` |
| 982 | ======================== |
| 983 | |
| 984 | The ``image-mklibs`` class enables the use of the ``mklibs`` utility |
| 985 | during the :ref:`ref-tasks-rootfs` task, which optimizes |
| 986 | the size of libraries contained in the image. |
| 987 | |
| 988 | By default, the class is enabled in the ``local.conf.template`` using |
| 989 | the :term:`USER_CLASSES` variable as follows: |
| 990 | :: |
| 991 | |
| 992 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" |
| 993 | |
| 994 | .. _ref-classes-image-prelink: |
| 995 | |
| 996 | ``image-prelink.bbclass`` |
| 997 | ========================= |
| 998 | |
| 999 | The ``image-prelink`` class enables the use of the ``prelink`` utility |
| 1000 | during the :ref:`ref-tasks-rootfs` task, which optimizes |
| 1001 | the dynamic linking of shared libraries to reduce executable startup |
| 1002 | time. |
| 1003 | |
| 1004 | By default, the class is enabled in the ``local.conf.template`` using |
| 1005 | the :term:`USER_CLASSES` variable as follows: |
| 1006 | :: |
| 1007 | |
| 1008 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" |
| 1009 | |
| 1010 | .. _ref-classes-insane: |
| 1011 | |
| 1012 | ``insane.bbclass`` |
| 1013 | ================== |
| 1014 | |
| 1015 | The ``insane`` class adds a step to the package generation process so |
| 1016 | that output quality assurance checks are generated by the OpenEmbedded |
| 1017 | build system. A range of checks are performed that check the build's |
| 1018 | output for common problems that show up during runtime. Distribution |
| 1019 | policy usually dictates whether to include this class. |
| 1020 | |
| 1021 | You can configure the sanity checks so that specific test failures |
| 1022 | either raise a warning or an error message. Typically, failures for new |
| 1023 | tests generate a warning. Subsequent failures for the same test would |
| 1024 | then generate an error message once the metadata is in a known and good |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1025 | condition. See the ":doc:`ref-qa-checks`" Chapter for a list of all the warning |
| 1026 | and error messages you might encounter using a default configuration. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1027 | |
| 1028 | Use the :term:`WARN_QA` and |
| 1029 | :term:`ERROR_QA` variables to control the behavior of |
| 1030 | these checks at the global level (i.e. in your custom distro |
| 1031 | configuration). However, to skip one or more checks in recipes, you |
| 1032 | should use :term:`INSANE_SKIP`. For example, to skip |
| 1033 | the check for symbolic link ``.so`` files in the main package of a |
| 1034 | recipe, add the following to the recipe. You need to realize that the |
| 1035 | package name override, in this example ``${PN}``, must be used: |
| 1036 | :: |
| 1037 | |
| 1038 | INSANE_SKIP_${PN} += "dev-so" |
| 1039 | |
| 1040 | Please keep in mind that the QA checks |
| 1041 | exist in order to detect real or potential problems in the packaged |
| 1042 | output. So exercise caution when disabling these checks. |
| 1043 | |
| 1044 | The following list shows the tests you can list with the ``WARN_QA`` and |
| 1045 | ``ERROR_QA`` variables: |
| 1046 | |
| 1047 | - ``already-stripped:`` Checks that produced binaries have not |
| 1048 | already been stripped prior to the build system extracting debug |
| 1049 | symbols. It is common for upstream software projects to default to |
| 1050 | stripping debug symbols for output binaries. In order for debugging |
| 1051 | to work on the target using ``-dbg`` packages, this stripping must be |
| 1052 | disabled. |
| 1053 | |
| 1054 | - ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit |
| 1055 | size, and endianness of any binaries to ensure they match the target |
| 1056 | architecture. This test fails if any binaries do not match the type |
| 1057 | since there would be an incompatibility. The test could indicate that |
| 1058 | the wrong compiler or compiler options have been used. Sometimes |
| 1059 | software, like bootloaders, might need to bypass this check. |
| 1060 | |
| 1061 | - ``buildpaths:`` Checks for paths to locations on the build host |
| 1062 | inside the output files. Currently, this test triggers too many false |
| 1063 | positives and thus is not normally enabled. |
| 1064 | |
| 1065 | - ``build-deps:`` Determines if a build-time dependency that is |
| 1066 | specified through :term:`DEPENDS`, explicit |
| 1067 | :term:`RDEPENDS`, or task-level dependencies exists |
| 1068 | to match any runtime dependency. This determination is particularly |
| 1069 | useful to discover where runtime dependencies are detected and added |
| 1070 | during packaging. If no explicit dependency has been specified within |
| 1071 | the metadata, at the packaging stage it is too late to ensure that |
| 1072 | the dependency is built, and thus you can end up with an error when |
| 1073 | the package is installed into the image during the |
| 1074 | :ref:`ref-tasks-rootfs` task because the auto-detected |
| 1075 | dependency was not satisfied. An example of this would be where the |
| 1076 | :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically |
| 1077 | adds a dependency on the ``initscripts-functions`` package to |
| 1078 | packages that install an initscript that refers to |
| 1079 | ``/etc/init.d/functions``. The recipe should really have an explicit |
| 1080 | ``RDEPENDS`` for the package in question on ``initscripts-functions`` |
| 1081 | so that the OpenEmbedded build system is able to ensure that the |
| 1082 | ``initscripts`` recipe is actually built and thus the |
| 1083 | ``initscripts-functions`` package is made available. |
| 1084 | |
| 1085 | - ``compile-host-path:`` Checks the |
| 1086 | :ref:`ref-tasks-compile` log for indications that |
| 1087 | paths to locations on the build host were used. Using such paths |
| 1088 | might result in host contamination of the build output. |
| 1089 | |
| 1090 | - ``debug-deps:`` Checks that all packages except ``-dbg`` packages |
| 1091 | do not depend on ``-dbg`` packages, which would cause a packaging |
| 1092 | bug. |
| 1093 | |
| 1094 | - ``debug-files:`` Checks for ``.debug`` directories in anything but |
| 1095 | the ``-dbg`` package. The debug files should all be in the ``-dbg`` |
| 1096 | package. Thus, anything packaged elsewhere is incorrect packaging. |
| 1097 | |
| 1098 | - ``dep-cmp:`` Checks for invalid version comparison statements in |
| 1099 | runtime dependency relationships between packages (i.e. in |
| 1100 | :term:`RDEPENDS`, |
| 1101 | :term:`RRECOMMENDS`, |
| 1102 | :term:`RSUGGESTS`, |
| 1103 | :term:`RPROVIDES`, |
| 1104 | :term:`RREPLACES`, and |
| 1105 | :term:`RCONFLICTS` variable values). Any invalid |
| 1106 | comparisons might trigger failures or undesirable behavior when |
| 1107 | passed to the package manager. |
| 1108 | |
| 1109 | - ``desktop:`` Runs the ``desktop-file-validate`` program against any |
| 1110 | ``.desktop`` files to validate their contents against the |
| 1111 | specification for ``.desktop`` files. |
| 1112 | |
| 1113 | - ``dev-deps:`` Checks that all packages except ``-dev`` or |
| 1114 | ``-staticdev`` packages do not depend on ``-dev`` packages, which |
| 1115 | would be a packaging bug. |
| 1116 | |
| 1117 | - ``dev-so:`` Checks that the ``.so`` symbolic links are in the |
| 1118 | ``-dev`` package and not in any of the other packages. In general, |
| 1119 | these symlinks are only useful for development purposes. Thus, the |
| 1120 | ``-dev`` package is the correct location for them. Some very rare |
| 1121 | cases do exist for dynamically loaded modules where these symlinks |
| 1122 | are needed instead in the main package. |
| 1123 | |
| 1124 | - ``file-rdeps:`` Checks that file-level dependencies identified by |
| 1125 | the OpenEmbedded build system at packaging time are satisfied. For |
| 1126 | example, a shell script might start with the line ``#!/bin/bash``. |
| 1127 | This line would translate to a file dependency on ``/bin/bash``. Of |
| 1128 | the three package managers that the OpenEmbedded build system |
| 1129 | supports, only RPM directly handles file-level dependencies, |
| 1130 | resolving them automatically to packages providing the files. |
| 1131 | However, the lack of that functionality in the other two package |
| 1132 | managers does not mean the dependencies do not still need resolving. |
| 1133 | This QA check attempts to ensure that explicitly declared |
| 1134 | :term:`RDEPENDS` exist to handle any file-level |
| 1135 | dependency detected in packaged files. |
| 1136 | |
| 1137 | - ``files-invalid:`` Checks for :term:`FILES` variable |
| 1138 | values that contain "//", which is invalid. |
| 1139 | |
| 1140 | - ``host-user-contaminated:`` Checks that no package produced by the |
| 1141 | recipe contains any files outside of ``/home`` with a user or group |
| 1142 | ID that matches the user running BitBake. A match usually indicates |
| 1143 | that the files are being installed with an incorrect UID/GID, since |
| 1144 | target IDs are independent from host IDs. For additional information, |
| 1145 | see the section describing the |
| 1146 | :ref:`ref-tasks-install` task. |
| 1147 | |
| 1148 | - ``incompatible-license:`` Report when packages are excluded from |
| 1149 | being created due to being marked with a license that is in |
| 1150 | :term:`INCOMPATIBLE_LICENSE`. |
| 1151 | |
| 1152 | - ``install-host-path:`` Checks the |
| 1153 | :ref:`ref-tasks-install` log for indications that |
| 1154 | paths to locations on the build host were used. Using such paths |
| 1155 | might result in host contamination of the build output. |
| 1156 | |
| 1157 | - ``installed-vs-shipped:`` Reports when files have been installed |
| 1158 | within ``do_install`` but have not been included in any package by |
| 1159 | way of the :term:`FILES` variable. Files that do not |
| 1160 | appear in any package cannot be present in an image later on in the |
| 1161 | build process. Ideally, all installed files should be packaged or not |
| 1162 | installed at all. These files can be deleted at the end of |
| 1163 | ``do_install`` if the files are not needed in any package. |
| 1164 | |
| 1165 | - ``invalid-chars:`` Checks that the recipe metadata variables |
| 1166 | :term:`DESCRIPTION`, |
| 1167 | :term:`SUMMARY`, :term:`LICENSE`, and |
| 1168 | :term:`SECTION` do not contain non-UTF-8 characters. |
| 1169 | Some package managers do not support such characters. |
| 1170 | |
| 1171 | - ``invalid-packageconfig:`` Checks that no undefined features are |
| 1172 | being added to :term:`PACKAGECONFIG`. For |
| 1173 | example, any name "foo" for which the following form does not exist: |
| 1174 | :: |
| 1175 | |
| 1176 | PACKAGECONFIG[foo] = "..." |
| 1177 | |
| 1178 | - ``la:`` Checks ``.la`` files for any ``TMPDIR`` paths. Any ``.la`` |
| 1179 | file containing these paths is incorrect since ``libtool`` adds the |
| 1180 | correct sysroot prefix when using the files automatically itself. |
| 1181 | |
| 1182 | - ``ldflags:`` Ensures that the binaries were linked with the |
| 1183 | :term:`LDFLAGS` options provided by the build system. |
| 1184 | If this test fails, check that the ``LDFLAGS`` variable is being |
| 1185 | passed to the linker command. |
| 1186 | |
| 1187 | - ``libdir:`` Checks for libraries being installed into incorrect |
| 1188 | (possibly hardcoded) installation paths. For example, this test will |
| 1189 | catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is |
| 1190 | "lib32". Another example is when recipes install |
| 1191 | ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib". |
| 1192 | |
| 1193 | - ``libexec:`` Checks if a package contains files in |
| 1194 | ``/usr/libexec``. This check is not performed if the ``libexecdir`` |
| 1195 | variable has been set explicitly to ``/usr/libexec``. |
| 1196 | |
| 1197 | - ``packages-list:`` Checks for the same package being listed |
| 1198 | multiple times through the :term:`PACKAGES` variable |
| 1199 | value. Installing the package in this manner can cause errors during |
| 1200 | packaging. |
| 1201 | |
| 1202 | - ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an |
| 1203 | invalid format. |
| 1204 | |
| 1205 | - ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an |
| 1206 | invalid format. |
| 1207 | |
| 1208 | - ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify |
| 1209 | 'link' where the specified target already exists. |
| 1210 | |
| 1211 | - ``perms:`` Currently, this check is unused but reserved. |
| 1212 | |
| 1213 | - ``pkgconfig:`` Checks ``.pc`` files for any |
| 1214 | :term:`TMPDIR`/:term:`WORKDIR` paths. |
| 1215 | Any ``.pc`` file containing these paths is incorrect since |
| 1216 | ``pkg-config`` itself adds the correct sysroot prefix when the files |
| 1217 | are accessed. |
| 1218 | |
| 1219 | - ``pkgname:`` Checks that all packages in |
| 1220 | :term:`PACKAGES` have names that do not contain |
| 1221 | invalid characters (i.e. characters other than 0-9, a-z, ., +, and |
| 1222 | -). |
| 1223 | |
| 1224 | - ``pkgv-undefined:`` Checks to see if the ``PKGV`` variable is |
| 1225 | undefined during :ref:`ref-tasks-package`. |
| 1226 | |
| 1227 | - ``pkgvarcheck:`` Checks through the variables |
| 1228 | :term:`RDEPENDS`, |
| 1229 | :term:`RRECOMMENDS`, |
| 1230 | :term:`RSUGGESTS`, |
| 1231 | :term:`RCONFLICTS`, |
| 1232 | :term:`RPROVIDES`, |
| 1233 | :term:`RREPLACES`, :term:`FILES`, |
| 1234 | :term:`ALLOW_EMPTY`, ``pkg_preinst``, |
| 1235 | ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if |
| 1236 | there are variable sets that are not package-specific. Using these |
| 1237 | variables without a package suffix is bad practice, and might |
| 1238 | unnecessarily complicate dependencies of other packages within the |
| 1239 | same recipe or have other unintended consequences. |
| 1240 | |
| 1241 | - ``pn-overrides:`` Checks that a recipe does not have a name |
| 1242 | (:term:`PN`) value that appears in |
| 1243 | :term:`OVERRIDES`. If a recipe is named such that |
| 1244 | its ``PN`` value matches something already in ``OVERRIDES`` (e.g. |
| 1245 | ``PN`` happens to be the same as :term:`MACHINE` or |
| 1246 | :term:`DISTRO`), it can have unexpected consequences. |
| 1247 | For example, assignments such as ``FILES_${PN} = "xyz"`` effectively |
| 1248 | turn into ``FILES = "xyz"``. |
| 1249 | |
| 1250 | - ``rpaths:`` Checks for rpaths in the binaries that contain build |
| 1251 | system paths such as ``TMPDIR``. If this test fails, bad ``-rpath`` |
| 1252 | options are being passed to the linker commands and your binaries |
| 1253 | have potential security issues. |
| 1254 | |
| 1255 | - ``split-strip:`` Reports that splitting or stripping debug symbols |
| 1256 | from binaries has failed. |
| 1257 | |
| 1258 | - ``staticdev:`` Checks for static library files (``*.a``) in |
| 1259 | non-``staticdev`` packages. |
| 1260 | |
| 1261 | - ``symlink-to-sysroot:`` Checks for symlinks in packages that point |
| 1262 | into :term:`TMPDIR` on the host. Such symlinks will |
| 1263 | work on the host, but are clearly invalid when running on the target. |
| 1264 | |
| 1265 | - ``textrel:`` Checks for ELF binaries that contain relocations in |
| 1266 | their ``.text`` sections, which can result in a performance impact at |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1267 | runtime. See the explanation for the ``ELF binary`` message in |
| 1268 | ":doc:`ref-qa-checks`" for more information regarding runtime performance |
| 1269 | issues. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1270 | |
| 1271 | - ``unlisted-pkg-lics:`` Checks that all declared licenses applying |
| 1272 | for a package are also declared on the recipe level (i.e. any license |
| 1273 | in ``LICENSE_*`` should appear in :term:`LICENSE`). |
| 1274 | |
| 1275 | - ``useless-rpaths:`` Checks for dynamic library load paths (rpaths) |
| 1276 | in the binaries that by default on a standard system are searched by |
| 1277 | the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will |
| 1278 | not cause any breakage, they do waste space and are unnecessary. |
| 1279 | |
| 1280 | - ``var-undefined:`` Reports when variables fundamental to packaging |
| 1281 | (i.e. :term:`WORKDIR`, |
| 1282 | :term:`DEPLOY_DIR`, :term:`D`, |
| 1283 | :term:`PN`, and :term:`PKGD`) are undefined |
| 1284 | during :ref:`ref-tasks-package`. |
| 1285 | |
| 1286 | - ``version-going-backwards:`` If Build History is enabled, reports |
| 1287 | when a package being written out has a lower version than the |
| 1288 | previously written package under the same name. If you are placing |
| 1289 | output packages into a feed and upgrading packages on a target system |
| 1290 | using that feed, the version of a package going backwards can result |
| 1291 | in the target system not correctly upgrading to the "new" version of |
| 1292 | the package. |
| 1293 | |
| 1294 | .. note:: |
| 1295 | |
| 1296 | If you are not using runtime package management on your target |
| 1297 | system, then you do not need to worry about this situation. |
| 1298 | |
| 1299 | - ``xorg-driver-abi:`` Checks that all packages containing Xorg |
| 1300 | drivers have ABI dependencies. The ``xserver-xorg`` recipe provides |
| 1301 | driver ABI names. All drivers should depend on the ABI versions that |
| 1302 | they have been built against. Driver recipes that include |
| 1303 | ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will |
| 1304 | automatically get these versions. Consequently, you should only need |
| 1305 | to explicitly add dependencies to binary driver recipes. |
| 1306 | |
| 1307 | .. _ref-classes-insserv: |
| 1308 | |
| 1309 | ``insserv.bbclass`` |
| 1310 | =================== |
| 1311 | |
| 1312 | The ``insserv`` class uses the ``insserv`` utility to update the order |
| 1313 | of symbolic links in ``/etc/rc?.d/`` within an image based on |
| 1314 | dependencies specified by LSB headers in the ``init.d`` scripts |
| 1315 | themselves. |
| 1316 | |
| 1317 | .. _ref-classes-kernel: |
| 1318 | |
| 1319 | ``kernel.bbclass`` |
| 1320 | ================== |
| 1321 | |
| 1322 | The ``kernel`` class handles building Linux kernels. The class contains |
| 1323 | code to build all kernel trees. All needed headers are staged into the |
| 1324 | ``STAGING_KERNEL_DIR`` directory to allow out-of-tree module builds |
| 1325 | using the :ref:`module <ref-classes-module>` class. |
| 1326 | |
| 1327 | This means that each built kernel module is packaged separately and |
| 1328 | inter-module dependencies are created by parsing the ``modinfo`` output. |
| 1329 | If all modules are required, then installing the ``kernel-modules`` |
| 1330 | package installs all packages with modules and various other kernel |
| 1331 | packages such as ``kernel-vmlinux``. |
| 1332 | |
| 1333 | The ``kernel`` class contains logic that allows you to embed an initial |
| 1334 | RAM filesystem (initramfs) image when you build the kernel image. For |
| 1335 | information on how to build an initramfs, see the |
| 1336 | ":ref:`building-an-initramfs-image`" section in |
| 1337 | the Yocto Project Development Tasks Manual. |
| 1338 | |
| 1339 | Various other classes are used by the ``kernel`` and ``module`` classes |
| 1340 | internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`, |
| 1341 | :ref:`module-base <ref-classes-module-base>`, and |
| 1342 | :ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes. |
| 1343 | |
| 1344 | .. _ref-classes-kernel-arch: |
| 1345 | |
| 1346 | ``kernel-arch.bbclass`` |
| 1347 | ======================= |
| 1348 | |
| 1349 | The ``kernel-arch`` class sets the ``ARCH`` environment variable for |
| 1350 | Linux kernel compilation (including modules). |
| 1351 | |
| 1352 | .. _ref-classes-kernel-devicetree: |
| 1353 | |
| 1354 | ``kernel-devicetree.bbclass`` |
| 1355 | ============================= |
| 1356 | |
| 1357 | The ``kernel-devicetree`` class, which is inherited by the |
| 1358 | :ref:`kernel <ref-classes-kernel>` class, supports device tree |
| 1359 | generation. |
| 1360 | |
| 1361 | .. _ref-classes-kernel-fitimage: |
| 1362 | |
| 1363 | ``kernel-fitimage.bbclass`` |
| 1364 | =========================== |
| 1365 | |
| 1366 | The ``kernel-fitimage`` class provides support to pack a kernel Image, |
| 1367 | device trees and a RAM disk into a single FIT image. In theory, a FIT |
| 1368 | image can support any number of kernels, RAM disks and device-trees. |
| 1369 | However, ``kernel-fitimage`` currently only supports |
| 1370 | limited usescases: just one kernel image, an optional RAM disk, and |
| 1371 | any number of device tree. |
| 1372 | |
| 1373 | To create a FIT image, it is required that :term:`KERNEL_CLASSES` |
| 1374 | is set to "kernel-fitimage" and :term:`KERNEL_IMAGETYPE` |
| 1375 | is set to "fitImage". |
| 1376 | |
| 1377 | The options for the device tree compiler passed to mkimage -D feature |
| 1378 | when creating the FIT image are specified using the |
| 1379 | :term:`UBOOT_MKIMAGE_DTCOPTS` variable. |
| 1380 | |
| 1381 | Only a single kernel can be added to the FIT image created by |
| 1382 | ``kernel-fitimage`` and the kernel image in FIT is mandatory. The |
| 1383 | address where the kernel image is to be loaded by U-boot is |
| 1384 | specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by |
| 1385 | :term:`UBOOT_ENTRYPOINT`. |
| 1386 | |
| 1387 | Multiple device trees can be added to the FIT image created by |
| 1388 | ``kernel-fitimage`` and the device tree is optional. |
| 1389 | The address where the device tree is to be loaded by U-boot is |
| 1390 | specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1391 | and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1392 | |
| 1393 | Only a single RAM disk can be added to the FIT image created by |
| 1394 | ``kernel-fitimage`` and the RAM disk in FIT is optional. |
| 1395 | The address where the RAM disk image is to be loaded by U-boot |
| 1396 | is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by |
| 1397 | :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when |
| 1398 | :term:`INITRAMFS_IMAGE` is specified. |
| 1399 | |
| 1400 | The FIT image generated by ``kernel-fitimage`` class is signed when the |
| 1401 | variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`, |
| 1402 | :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set |
| 1403 | appropriately. The default values used for :term:`FIT_HASH_ALG` and |
| 1404 | :term:`FIT_SIGN_ALG` in ``kernel-fitimage`` are "sha256" and |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 1405 | "rsa2048" respectively. The keys for signing fitImage can be generated using |
| 1406 | the ``kernel-fitimage`` class when both :term:`FIT_GENERATE_KEYS` and |
| 1407 | :term:`UBOOT_SIGN_ENABLE` are set to "1". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1408 | |
| 1409 | |
| 1410 | .. _ref-classes-kernel-grub: |
| 1411 | |
| 1412 | ``kernel-grub.bbclass`` |
| 1413 | ======================= |
| 1414 | |
| 1415 | The ``kernel-grub`` class updates the boot area and the boot menu with |
| 1416 | the kernel as the priority boot mechanism while installing a RPM to |
| 1417 | update the kernel on a deployed target. |
| 1418 | |
| 1419 | .. _ref-classes-kernel-module-split: |
| 1420 | |
| 1421 | ``kernel-module-split.bbclass`` |
| 1422 | =============================== |
| 1423 | |
| 1424 | The ``kernel-module-split`` class provides common functionality for |
| 1425 | splitting Linux kernel modules into separate packages. |
| 1426 | |
| 1427 | .. _ref-classes-kernel-uboot: |
| 1428 | |
| 1429 | ``kernel-uboot.bbclass`` |
| 1430 | ======================== |
| 1431 | |
| 1432 | The ``kernel-uboot`` class provides support for building from |
| 1433 | vmlinux-style kernel sources. |
| 1434 | |
| 1435 | .. _ref-classes-kernel-uimage: |
| 1436 | |
| 1437 | ``kernel-uimage.bbclass`` |
| 1438 | ========================= |
| 1439 | |
| 1440 | The ``kernel-uimage`` class provides support to pack uImage. |
| 1441 | |
| 1442 | .. _ref-classes-kernel-yocto: |
| 1443 | |
| 1444 | ``kernel-yocto.bbclass`` |
| 1445 | ======================== |
| 1446 | |
| 1447 | The ``kernel-yocto`` class provides common functionality for building |
| 1448 | from linux-yocto style kernel source repositories. |
| 1449 | |
| 1450 | .. _ref-classes-kernelsrc: |
| 1451 | |
| 1452 | ``kernelsrc.bbclass`` |
| 1453 | ===================== |
| 1454 | |
| 1455 | The ``kernelsrc`` class sets the Linux kernel source and version. |
| 1456 | |
| 1457 | .. _ref-classes-lib_package: |
| 1458 | |
| 1459 | ``lib_package.bbclass`` |
| 1460 | ======================= |
| 1461 | |
| 1462 | The ``lib_package`` class supports recipes that build libraries and |
| 1463 | produce executable binaries, where those binaries should not be |
| 1464 | installed by default along with the library. Instead, the binaries are |
| 1465 | added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to |
| 1466 | make their installation optional. |
| 1467 | |
| 1468 | .. _ref-classes-libc*: |
| 1469 | |
| 1470 | ``libc*.bbclass`` |
| 1471 | ================= |
| 1472 | |
| 1473 | The ``libc*`` classes support recipes that build packages with ``libc``: |
| 1474 | |
| 1475 | - The ``libc-common`` class provides common support for building with |
| 1476 | ``libc``. |
| 1477 | |
| 1478 | - The ``libc-package`` class supports packaging up ``glibc`` and |
| 1479 | ``eglibc``. |
| 1480 | |
| 1481 | .. _ref-classes-license: |
| 1482 | |
| 1483 | ``license.bbclass`` |
| 1484 | =================== |
| 1485 | |
| 1486 | The ``license`` class provides license manifest creation and license |
| 1487 | exclusion. This class is enabled by default using the default value for |
| 1488 | the :term:`INHERIT_DISTRO` variable. |
| 1489 | |
| 1490 | .. _ref-classes-linux-kernel-base: |
| 1491 | |
| 1492 | ``linux-kernel-base.bbclass`` |
| 1493 | ============================= |
| 1494 | |
| 1495 | The ``linux-kernel-base`` class provides common functionality for |
| 1496 | recipes that build out of the Linux kernel source tree. These builds |
| 1497 | goes beyond the kernel itself. For example, the Perf recipe also |
| 1498 | inherits this class. |
| 1499 | |
| 1500 | .. _ref-classes-linuxloader: |
| 1501 | |
| 1502 | ``linuxloader.bbclass`` |
| 1503 | ======================= |
| 1504 | |
| 1505 | Provides the function ``linuxloader()``, which gives the value of the |
| 1506 | dynamic loader/linker provided on the platform. This value is used by a |
| 1507 | number of other classes. |
| 1508 | |
| 1509 | .. _ref-classes-logging: |
| 1510 | |
| 1511 | ``logging.bbclass`` |
| 1512 | =================== |
| 1513 | |
| 1514 | The ``logging`` class provides the standard shell functions used to log |
| 1515 | messages for various BitBake severity levels (i.e. ``bbplain``, |
| 1516 | ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``). |
| 1517 | |
| 1518 | This class is enabled by default since it is inherited by the ``base`` |
| 1519 | class. |
| 1520 | |
| 1521 | .. _ref-classes-meta: |
| 1522 | |
| 1523 | ``meta.bbclass`` |
| 1524 | ================ |
| 1525 | |
| 1526 | The ``meta`` class is inherited by recipes that do not build any output |
| 1527 | packages themselves, but act as a "meta" target for building other |
| 1528 | recipes. |
| 1529 | |
| 1530 | .. _ref-classes-metadata_scm: |
| 1531 | |
| 1532 | ``metadata_scm.bbclass`` |
| 1533 | ======================== |
| 1534 | |
| 1535 | The ``metadata_scm`` class provides functionality for querying the |
| 1536 | branch and revision of a Source Code Manager (SCM) repository. |
| 1537 | |
| 1538 | The :ref:`base <ref-classes-base>` class uses this class to print the |
| 1539 | revisions of each layer before starting every build. The |
| 1540 | ``metadata_scm`` class is enabled by default because it is inherited by |
| 1541 | the ``base`` class. |
| 1542 | |
| 1543 | .. _ref-classes-migrate_localcount: |
| 1544 | |
| 1545 | ``migrate_localcount.bbclass`` |
| 1546 | ============================== |
| 1547 | |
| 1548 | The ``migrate_localcount`` class verifies a recipe's localcount data and |
| 1549 | increments it appropriately. |
| 1550 | |
| 1551 | .. _ref-classes-mime: |
| 1552 | |
| 1553 | ``mime.bbclass`` |
| 1554 | ================ |
| 1555 | |
| 1556 | The ``mime`` class generates the proper post-install and post-remove |
| 1557 | (postinst/postrm) scriptlets for packages that install MIME type files. |
| 1558 | These scriptlets call ``update-mime-database`` to add the MIME types to |
| 1559 | the shared database. |
| 1560 | |
| 1561 | .. _ref-classes-mirrors: |
| 1562 | |
| 1563 | ``mirrors.bbclass`` |
| 1564 | =================== |
| 1565 | |
| 1566 | The ``mirrors`` class sets up some standard |
| 1567 | :term:`MIRRORS` entries for source code mirrors. These |
| 1568 | mirrors provide a fall-back path in case the upstream source specified |
| 1569 | in :term:`SRC_URI` within recipes is unavailable. |
| 1570 | |
| 1571 | This class is enabled by default since it is inherited by the |
| 1572 | :ref:`base <ref-classes-base>` class. |
| 1573 | |
| 1574 | .. _ref-classes-module: |
| 1575 | |
| 1576 | ``module.bbclass`` |
| 1577 | ================== |
| 1578 | |
| 1579 | The ``module`` class provides support for building out-of-tree Linux |
| 1580 | kernel modules. The class inherits the |
| 1581 | :ref:`module-base <ref-classes-module-base>` and |
| 1582 | :ref:`kernel-module-split <ref-classes-kernel-module-split>` classes, |
| 1583 | and implements the :ref:`ref-tasks-compile` and |
| 1584 | :ref:`ref-tasks-install` tasks. The class provides |
| 1585 | everything needed to build and package a kernel module. |
| 1586 | |
| 1587 | For general information on out-of-tree Linux kernel modules, see the |
| 1588 | ":ref:`kernel-dev/kernel-dev-common:incorporating out-of-tree modules`" |
| 1589 | section in the Yocto Project Linux Kernel Development Manual. |
| 1590 | |
| 1591 | .. _ref-classes-module-base: |
| 1592 | |
| 1593 | ``module-base.bbclass`` |
| 1594 | ======================= |
| 1595 | |
| 1596 | The ``module-base`` class provides the base functionality for building |
| 1597 | Linux kernel modules. Typically, a recipe that builds software that |
| 1598 | includes one or more kernel modules and has its own means of building |
| 1599 | the module inherits this class as opposed to inheriting the |
| 1600 | :ref:`module <ref-classes-module>` class. |
| 1601 | |
| 1602 | .. _ref-classes-multilib*: |
| 1603 | |
| 1604 | ``multilib*.bbclass`` |
| 1605 | ===================== |
| 1606 | |
| 1607 | The ``multilib*`` classes provide support for building libraries with |
| 1608 | different target optimizations or target architectures and installing |
| 1609 | them side-by-side in the same image. |
| 1610 | |
| 1611 | For more information on using the Multilib feature, see the |
| 1612 | ":ref:`combining-multiple-versions-library-files-into-one-image`" |
| 1613 | section in the Yocto Project Development Tasks Manual. |
| 1614 | |
| 1615 | .. _ref-classes-native: |
| 1616 | |
| 1617 | ``native.bbclass`` |
| 1618 | ================== |
| 1619 | |
| 1620 | The ``native`` class provides common functionality for recipes that |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1621 | build tools to run on the :term:`Build Host` (i.e. tools that use the compiler |
| 1622 | or other tools from the build host). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1623 | |
| 1624 | You can create a recipe that builds tools that run natively on the host |
| 1625 | a couple different ways: |
| 1626 | |
| 1627 | - Create a myrecipe\ ``-native.bb`` recipe that inherits the ``native`` |
| 1628 | class. If you use this method, you must order the inherit statement |
| 1629 | in the recipe after all other inherit statements so that the |
| 1630 | ``native`` class is inherited last. |
| 1631 | |
| 1632 | .. note:: |
| 1633 | |
| 1634 | When creating a recipe this way, the recipe name must follow this |
| 1635 | naming convention: |
| 1636 | :: |
| 1637 | |
| 1638 | myrecipe-native.bb |
| 1639 | |
| 1640 | |
| 1641 | Not using this naming convention can lead to subtle problems |
| 1642 | caused by existing code that depends on that naming convention. |
| 1643 | |
| 1644 | - Create or modify a target recipe that contains the following: |
| 1645 | :: |
| 1646 | |
| 1647 | BBCLASSEXTEND = "native" |
| 1648 | |
| 1649 | Inside the |
| 1650 | recipe, use ``_class-native`` and ``_class-target`` overrides to |
| 1651 | specify any functionality specific to the respective native or target |
| 1652 | case. |
| 1653 | |
| 1654 | Although applied differently, the ``native`` class is used with both |
| 1655 | methods. The advantage of the second method is that you do not need to |
| 1656 | have two separate recipes (assuming you need both) for native and |
| 1657 | target. All common parts of the recipe are automatically shared. |
| 1658 | |
| 1659 | .. _ref-classes-nativesdk: |
| 1660 | |
| 1661 | ``nativesdk.bbclass`` |
| 1662 | ===================== |
| 1663 | |
| 1664 | The ``nativesdk`` class provides common functionality for recipes that |
| 1665 | wish to build tools to run as part of an SDK (i.e. tools that run on |
| 1666 | :term:`SDKMACHINE`). |
| 1667 | |
| 1668 | You can create a recipe that builds tools that run on the SDK machine a |
| 1669 | couple different ways: |
| 1670 | |
| 1671 | - Create a ``nativesdk-``\ myrecipe\ ``.bb`` recipe that inherits the |
| 1672 | ``nativesdk`` class. If you use this method, you must order the |
| 1673 | inherit statement in the recipe after all other inherit statements so |
| 1674 | that the ``nativesdk`` class is inherited last. |
| 1675 | |
| 1676 | - Create a ``nativesdk`` variant of any recipe by adding the following: |
| 1677 | :: |
| 1678 | |
| 1679 | BBCLASSEXTEND = "nativesdk" |
| 1680 | |
| 1681 | Inside the |
| 1682 | recipe, use ``_class-nativesdk`` and ``_class-target`` overrides to |
| 1683 | specify any functionality specific to the respective SDK machine or |
| 1684 | target case. |
| 1685 | |
| 1686 | .. note:: |
| 1687 | |
| 1688 | When creating a recipe, you must follow this naming convention: |
| 1689 | :: |
| 1690 | |
| 1691 | nativesdk-myrecipe.bb |
| 1692 | |
| 1693 | |
| 1694 | Not doing so can lead to subtle problems because code exists that |
| 1695 | depends on the naming convention. |
| 1696 | |
| 1697 | Although applied differently, the ``nativesdk`` class is used with both |
| 1698 | methods. The advantage of the second method is that you do not need to |
| 1699 | have two separate recipes (assuming you need both) for the SDK machine |
| 1700 | and the target. All common parts of the recipe are automatically shared. |
| 1701 | |
| 1702 | .. _ref-classes-nopackages: |
| 1703 | |
| 1704 | ``nopackages.bbclass`` |
| 1705 | ====================== |
| 1706 | |
| 1707 | Disables packaging tasks for those recipes and classes where packaging |
| 1708 | is not needed. |
| 1709 | |
| 1710 | .. _ref-classes-npm: |
| 1711 | |
| 1712 | ``npm.bbclass`` |
| 1713 | =============== |
| 1714 | |
| 1715 | Provides support for building Node.js software fetched using the `node |
| 1716 | package manager (NPM) <https://en.wikipedia.org/wiki/Npm_(software)>`__. |
| 1717 | |
| 1718 | .. note:: |
| 1719 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1720 | Currently, recipes inheriting this class must use the ``npm://`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1721 | fetcher to have dependencies fetched and packaged automatically. |
| 1722 | |
| 1723 | For information on how to create NPM packages, see the |
| 1724 | ":ref:`dev-manual/dev-manual-common-tasks:creating node package manager (npm) packages`" |
| 1725 | section in the Yocto Project Development Tasks Manual. |
| 1726 | |
| 1727 | .. _ref-classes-oelint: |
| 1728 | |
| 1729 | ``oelint.bbclass`` |
| 1730 | ================== |
| 1731 | |
| 1732 | The ``oelint`` class is an obsolete lint checking tool that exists in |
| 1733 | ``meta/classes`` in the :term:`Source Directory`. |
| 1734 | |
| 1735 | A number of classes exist that could be generally useful in OE-Core but |
| 1736 | are never actually used within OE-Core itself. The ``oelint`` class is |
| 1737 | one such example. However, being aware of this class can reduce the |
| 1738 | proliferation of different versions of similar classes across multiple |
| 1739 | layers. |
| 1740 | |
| 1741 | .. _ref-classes-own-mirrors: |
| 1742 | |
| 1743 | ``own-mirrors.bbclass`` |
| 1744 | ======================= |
| 1745 | |
| 1746 | The ``own-mirrors`` class makes it easier to set up your own |
| 1747 | :term:`PREMIRRORS` from which to first fetch source |
| 1748 | before attempting to fetch it from the upstream specified in |
| 1749 | :term:`SRC_URI` within each recipe. |
| 1750 | |
| 1751 | To use this class, inherit it globally and specify |
| 1752 | :term:`SOURCE_MIRROR_URL`. Here is an example: |
| 1753 | :: |
| 1754 | |
| 1755 | INHERIT += "own-mirrors" |
| 1756 | SOURCE_MIRROR_URL = "http://example.com/my-source-mirror" |
| 1757 | |
| 1758 | You can specify only a single URL |
| 1759 | in ``SOURCE_MIRROR_URL``. |
| 1760 | |
| 1761 | .. _ref-classes-package: |
| 1762 | |
| 1763 | ``package.bbclass`` |
| 1764 | =================== |
| 1765 | |
| 1766 | The ``package`` class supports generating packages from a build's |
| 1767 | output. The core generic functionality is in ``package.bbclass``. The |
| 1768 | code specific to particular package types resides in these |
| 1769 | package-specific classes: |
| 1770 | :ref:`package_deb <ref-classes-package_deb>`, |
| 1771 | :ref:`package_rpm <ref-classes-package_rpm>`, |
| 1772 | :ref:`package_ipk <ref-classes-package_ipk>`, and |
| 1773 | :ref:`package_tar <ref-classes-package_tar>`. |
| 1774 | |
| 1775 | .. note:: |
| 1776 | |
| 1777 | The |
| 1778 | package_tar |
| 1779 | class is broken and not supported. It is recommended that you do not |
| 1780 | use this class. |
| 1781 | |
| 1782 | You can control the list of resulting package formats by using the |
| 1783 | ``PACKAGE_CLASSES`` variable defined in your ``conf/local.conf`` |
| 1784 | configuration file, which is located in the :term:`Build Directory`. |
| 1785 | When defining the variable, you can |
| 1786 | specify one or more package types. Since images are generated from |
| 1787 | packages, a packaging class is needed to enable image generation. The |
| 1788 | first class listed in this variable is used for image generation. |
| 1789 | |
| 1790 | If you take the optional step to set up a repository (package feed) on |
| 1791 | the development host that can be used by DNF, you can install packages |
| 1792 | from the feed while you are running the image on the target (i.e. |
| 1793 | runtime installation of packages). For more information, see the |
| 1794 | ":ref:`dev-manual/dev-manual-common-tasks:using runtime package management`" |
| 1795 | section in the Yocto Project Development Tasks Manual. |
| 1796 | |
| 1797 | The package-specific class you choose can affect build-time performance |
| 1798 | and has space ramifications. In general, building a package with IPK |
| 1799 | takes about thirty percent less time as compared to using RPM to build |
| 1800 | the same or similar package. This comparison takes into account a |
| 1801 | complete build of the package with all dependencies previously built. |
| 1802 | The reason for this discrepancy is because the RPM package manager |
| 1803 | creates and processes more :term:`Metadata` than the IPK package |
| 1804 | manager. Consequently, you might consider setting ``PACKAGE_CLASSES`` to |
| 1805 | "package_ipk" if you are building smaller systems. |
| 1806 | |
| 1807 | Before making your package manager decision, however, you should |
| 1808 | consider some further things about using RPM: |
| 1809 | |
| 1810 | - RPM starts to provide more abilities than IPK due to the fact that it |
| 1811 | processes more Metadata. For example, this information includes |
| 1812 | individual file types, file checksum generation and evaluation on |
| 1813 | install, sparse file support, conflict detection and resolution for |
| 1814 | Multilib systems, ACID style upgrade, and repackaging abilities for |
| 1815 | rollbacks. |
| 1816 | |
| 1817 | - For smaller systems, the extra space used for the Berkeley Database |
| 1818 | and the amount of metadata when using RPM can affect your ability to |
| 1819 | perform on-device upgrades. |
| 1820 | |
| 1821 | You can find additional information on the effects of the package class |
| 1822 | at these two Yocto Project mailing list links: |
| 1823 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1824 | - :yocto_lists:`/pipermail/poky/2011-May/006362.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1825 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1826 | - :yocto_lists:`/pipermail/poky/2011-May/006363.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1827 | |
| 1828 | .. _ref-classes-package_deb: |
| 1829 | |
| 1830 | ``package_deb.bbclass`` |
| 1831 | ======================= |
| 1832 | |
| 1833 | The ``package_deb`` class provides support for creating packages that |
| 1834 | use the Debian (i.e. ``.deb``) file format. The class ensures the |
| 1835 | packages are written out in a ``.deb`` file format to the |
| 1836 | ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory. |
| 1837 | |
| 1838 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 1839 | is enabled through the :term:`PACKAGE_CLASSES` |
| 1840 | variable in the ``local.conf`` file. |
| 1841 | |
| 1842 | .. _ref-classes-package_ipk: |
| 1843 | |
| 1844 | ``package_ipk.bbclass`` |
| 1845 | ======================= |
| 1846 | |
| 1847 | The ``package_ipk`` class provides support for creating packages that |
| 1848 | use the IPK (i.e. ``.ipk``) file format. The class ensures the packages |
| 1849 | are written out in a ``.ipk`` file format to the |
| 1850 | ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory. |
| 1851 | |
| 1852 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 1853 | is enabled through the :term:`PACKAGE_CLASSES` |
| 1854 | variable in the ``local.conf`` file. |
| 1855 | |
| 1856 | .. _ref-classes-package_rpm: |
| 1857 | |
| 1858 | ``package_rpm.bbclass`` |
| 1859 | ======================= |
| 1860 | |
| 1861 | The ``package_rpm`` class provides support for creating packages that |
| 1862 | use the RPM (i.e. ``.rpm``) file format. The class ensures the packages |
| 1863 | are written out in a ``.rpm`` file format to the |
| 1864 | ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory. |
| 1865 | |
| 1866 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 1867 | is enabled through the :term:`PACKAGE_CLASSES` |
| 1868 | variable in the ``local.conf`` file. |
| 1869 | |
| 1870 | .. _ref-classes-package_tar: |
| 1871 | |
| 1872 | ``package_tar.bbclass`` |
| 1873 | ======================= |
| 1874 | |
| 1875 | The ``package_tar`` class provides support for creating tarballs. The |
| 1876 | class ensures the packages are written out in a tarball format to the |
| 1877 | ``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory. |
| 1878 | |
| 1879 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 1880 | is enabled through the :term:`PACKAGE_CLASSES` |
| 1881 | variable in the ``local.conf`` file. |
| 1882 | |
| 1883 | .. note:: |
| 1884 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1885 | You cannot specify the ``package_tar`` class first using the |
| 1886 | ``PACKAGE_CLASSES`` variable. You must use ``.deb``, ``.ipk``, or ``.rpm`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1887 | file formats for your image or SDK. |
| 1888 | |
| 1889 | .. _ref-classes-packagedata: |
| 1890 | |
| 1891 | ``packagedata.bbclass`` |
| 1892 | ======================= |
| 1893 | |
| 1894 | The ``packagedata`` class provides common functionality for reading |
| 1895 | ``pkgdata`` files found in :term:`PKGDATA_DIR`. These |
| 1896 | files contain information about each output package produced by the |
| 1897 | OpenEmbedded build system. |
| 1898 | |
| 1899 | This class is enabled by default because it is inherited by the |
| 1900 | :ref:`package <ref-classes-package>` class. |
| 1901 | |
| 1902 | .. _ref-classes-packagegroup: |
| 1903 | |
| 1904 | ``packagegroup.bbclass`` |
| 1905 | ======================== |
| 1906 | |
| 1907 | The ``packagegroup`` class sets default values appropriate for package |
| 1908 | group recipes (e.g. ``PACKAGES``, ``PACKAGE_ARCH``, ``ALLOW_EMPTY``, and |
| 1909 | so forth). It is highly recommended that all package group recipes |
| 1910 | inherit this class. |
| 1911 | |
| 1912 | For information on how to use this class, see the |
| 1913 | ":ref:`usingpoky-extend-customimage-customtasks`" |
| 1914 | section in the Yocto Project Development Tasks Manual. |
| 1915 | |
| 1916 | Previously, this class was called the ``task`` class. |
| 1917 | |
| 1918 | .. _ref-classes-patch: |
| 1919 | |
| 1920 | ``patch.bbclass`` |
| 1921 | ================= |
| 1922 | |
| 1923 | The ``patch`` class provides all functionality for applying patches |
| 1924 | during the :ref:`ref-tasks-patch` task. |
| 1925 | |
| 1926 | This class is enabled by default because it is inherited by the |
| 1927 | :ref:`base <ref-classes-base>` class. |
| 1928 | |
| 1929 | .. _ref-classes-perlnative: |
| 1930 | |
| 1931 | ``perlnative.bbclass`` |
| 1932 | ====================== |
| 1933 | |
| 1934 | When inherited by a recipe, the ``perlnative`` class supports using the |
| 1935 | native version of Perl built by the build system rather than using the |
| 1936 | version provided by the build host. |
| 1937 | |
| 1938 | .. _ref-classes-pixbufcache: |
| 1939 | |
| 1940 | ``pixbufcache.bbclass`` |
| 1941 | ======================= |
| 1942 | |
| 1943 | The ``pixbufcache`` class generates the proper post-install and |
| 1944 | post-remove (postinst/postrm) scriptlets for packages that install |
| 1945 | pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets |
| 1946 | call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache. |
| 1947 | Since the cache files are architecture-specific, ``update_pixbuf_cache`` |
| 1948 | is run using QEMU if the postinst scriptlets need to be run on the build |
| 1949 | host during image creation. |
| 1950 | |
| 1951 | If the pixbuf loaders being installed are in packages other than the |
| 1952 | recipe's main package, set |
| 1953 | :term:`PIXBUF_PACKAGES` to specify the packages |
| 1954 | containing the loaders. |
| 1955 | |
| 1956 | .. _ref-classes-pkgconfig: |
| 1957 | |
| 1958 | ``pkgconfig.bbclass`` |
| 1959 | ===================== |
| 1960 | |
| 1961 | The ``pkgconfig`` class provides a standard way to get header and |
| 1962 | library information by using ``pkg-config``. This class aims to smooth |
| 1963 | integration of ``pkg-config`` into libraries that use it. |
| 1964 | |
| 1965 | During staging, BitBake installs ``pkg-config`` data into the |
| 1966 | ``sysroots/`` directory. By making use of sysroot functionality within |
| 1967 | ``pkg-config``, the ``pkgconfig`` class no longer has to manipulate the |
| 1968 | files. |
| 1969 | |
| 1970 | .. _ref-classes-populate-sdk: |
| 1971 | |
| 1972 | ``populate_sdk.bbclass`` |
| 1973 | ======================== |
| 1974 | |
| 1975 | The ``populate_sdk`` class provides support for SDK-only recipes. For |
| 1976 | information on advantages gained when building a cross-development |
| 1977 | toolchain using the :ref:`ref-tasks-populate_sdk` |
| 1978 | task, see the ":ref:`sdk-manual/sdk-appendix-obtain:building an sdk installer`" |
| 1979 | section in the Yocto Project Application Development and the Extensible |
| 1980 | Software Development Kit (eSDK) manual. |
| 1981 | |
| 1982 | .. _ref-classes-populate-sdk-*: |
| 1983 | |
| 1984 | ``populate_sdk_*.bbclass`` |
| 1985 | ========================== |
| 1986 | |
| 1987 | The ``populate_sdk_*`` classes support SDK creation and consist of the |
| 1988 | following classes: |
| 1989 | |
| 1990 | - ``populate_sdk_base``: The base class supporting SDK creation under |
| 1991 | all package managers (i.e. DEB, RPM, and opkg). |
| 1992 | |
| 1993 | - ``populate_sdk_deb``: Supports creation of the SDK given the Debian |
| 1994 | package manager. |
| 1995 | |
| 1996 | - ``populate_sdk_rpm``: Supports creation of the SDK given the RPM |
| 1997 | package manager. |
| 1998 | |
| 1999 | - ``populate_sdk_ipk``: Supports creation of the SDK given the opkg |
| 2000 | (IPK format) package manager. |
| 2001 | |
| 2002 | - ``populate_sdk_ext``: Supports extensible SDK creation under all |
| 2003 | package managers. |
| 2004 | |
| 2005 | The ``populate_sdk_base`` class inherits the appropriate |
| 2006 | ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on |
| 2007 | :term:`IMAGE_PKGTYPE`. |
| 2008 | |
| 2009 | The base class ensures all source and destination directories are |
| 2010 | established and then populates the SDK. After populating the SDK, the |
| 2011 | ``populate_sdk_base`` class constructs two sysroots: |
| 2012 | ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which |
| 2013 | contains the cross-compiler and associated tooling, and the target, |
| 2014 | which contains a target root filesystem that is configured for the SDK |
| 2015 | usage. These two images reside in :term:`SDK_OUTPUT`, |
| 2016 | which consists of the following: |
| 2017 | :: |
| 2018 | |
| 2019 | ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs |
| 2020 | ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs |
| 2021 | |
| 2022 | Finally, the base populate SDK class creates the toolchain environment |
| 2023 | setup script, the tarball of the SDK, and the installer. |
| 2024 | |
| 2025 | The respective ``populate_sdk_deb``, ``populate_sdk_rpm``, and |
| 2026 | ``populate_sdk_ipk`` classes each support the specific type of SDK. |
| 2027 | These classes are inherited by and used with the ``populate_sdk_base`` |
| 2028 | class. |
| 2029 | |
| 2030 | For more information on the cross-development toolchain generation, see |
| 2031 | the ":ref:`overview-manual/overview-manual-concepts:cross-development toolchain generation`" |
| 2032 | section in the Yocto Project Overview and Concepts Manual. For |
| 2033 | information on advantages gained when building a cross-development |
| 2034 | toolchain using the :ref:`ref-tasks-populate_sdk` |
| 2035 | task, see the |
| 2036 | ":ref:`sdk-manual/sdk-appendix-obtain:building an sdk installer`" |
| 2037 | section in the Yocto Project Application Development and the Extensible |
| 2038 | Software Development Kit (eSDK) manual. |
| 2039 | |
| 2040 | .. _ref-classes-prexport: |
| 2041 | |
| 2042 | ``prexport.bbclass`` |
| 2043 | ==================== |
| 2044 | |
| 2045 | The ``prexport`` class provides functionality for exporting |
| 2046 | :term:`PR` values. |
| 2047 | |
| 2048 | .. note:: |
| 2049 | |
| 2050 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2051 | when using "``bitbake-prserv-tool export``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2052 | |
| 2053 | .. _ref-classes-primport: |
| 2054 | |
| 2055 | ``primport.bbclass`` |
| 2056 | ==================== |
| 2057 | |
| 2058 | The ``primport`` class provides functionality for importing |
| 2059 | :term:`PR` values. |
| 2060 | |
| 2061 | .. note:: |
| 2062 | |
| 2063 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2064 | when using "``bitbake-prserv-tool import``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2065 | |
| 2066 | .. _ref-classes-prserv: |
| 2067 | |
| 2068 | ``prserv.bbclass`` |
| 2069 | ================== |
| 2070 | |
| 2071 | The ``prserv`` class provides functionality for using a :ref:`PR |
| 2072 | service <dev-manual/dev-manual-common-tasks:working with a pr service>` in order to |
| 2073 | automatically manage the incrementing of the :term:`PR` |
| 2074 | variable for each recipe. |
| 2075 | |
| 2076 | This class is enabled by default because it is inherited by the |
| 2077 | :ref:`package <ref-classes-package>` class. However, the OpenEmbedded |
| 2078 | build system will not enable the functionality of this class unless |
| 2079 | :term:`PRSERV_HOST` has been set. |
| 2080 | |
| 2081 | .. _ref-classes-ptest: |
| 2082 | |
| 2083 | ``ptest.bbclass`` |
| 2084 | ================= |
| 2085 | |
| 2086 | The ``ptest`` class provides functionality for packaging and installing |
| 2087 | runtime tests for recipes that build software that provides these tests. |
| 2088 | |
| 2089 | This class is intended to be inherited by individual recipes. However, |
| 2090 | the class' functionality is largely disabled unless "ptest" appears in |
| 2091 | :term:`DISTRO_FEATURES`. See the |
| 2092 | ":ref:`dev-manual/dev-manual-common-tasks:testing packages with ptest`" |
| 2093 | section in the Yocto Project Development Tasks Manual for more information |
| 2094 | on ptest. |
| 2095 | |
| 2096 | .. _ref-classes-ptest-gnome: |
| 2097 | |
| 2098 | ``ptest-gnome.bbclass`` |
| 2099 | ======================= |
| 2100 | |
| 2101 | Enables package tests (ptests) specifically for GNOME packages, which |
| 2102 | have tests intended to be executed with ``gnome-desktop-testing``. |
| 2103 | |
| 2104 | For information on setting up and running ptests, see the |
| 2105 | ":ref:`dev-manual/dev-manual-common-tasks:testing packages with ptest`" |
| 2106 | section in the Yocto Project Development Tasks Manual. |
| 2107 | |
| 2108 | .. _ref-classes-python-dir: |
| 2109 | |
| 2110 | ``python-dir.bbclass`` |
| 2111 | ====================== |
| 2112 | |
| 2113 | The ``python-dir`` class provides the base version, location, and site |
| 2114 | package location for Python. |
| 2115 | |
| 2116 | .. _ref-classes-python3native: |
| 2117 | |
| 2118 | ``python3native.bbclass`` |
| 2119 | ========================= |
| 2120 | |
| 2121 | The ``python3native`` class supports using the native version of Python |
| 2122 | 3 built by the build system rather than support of the version provided |
| 2123 | by the build host. |
| 2124 | |
| 2125 | .. _ref-classes-pythonnative: |
| 2126 | |
| 2127 | ``pythonnative.bbclass`` |
| 2128 | ======================== |
| 2129 | |
| 2130 | When inherited by a recipe, the ``pythonnative`` class supports using |
| 2131 | the native version of Python built by the build system rather than using |
| 2132 | the version provided by the build host. |
| 2133 | |
| 2134 | .. _ref-classes-qemu: |
| 2135 | |
| 2136 | ``qemu.bbclass`` |
| 2137 | ================ |
| 2138 | |
| 2139 | The ``qemu`` class provides functionality for recipes that either need |
| 2140 | QEMU or test for the existence of QEMU. Typically, this class is used to |
| 2141 | run programs for a target system on the build host using QEMU's |
| 2142 | application emulation mode. |
| 2143 | |
| 2144 | .. _ref-classes-recipe_sanity: |
| 2145 | |
| 2146 | ``recipe_sanity.bbclass`` |
| 2147 | ========================= |
| 2148 | |
| 2149 | The ``recipe_sanity`` class checks for the presence of any host system |
| 2150 | recipe prerequisites that might affect the build (e.g. variables that |
| 2151 | are set or software that is present). |
| 2152 | |
| 2153 | .. _ref-classes-relocatable: |
| 2154 | |
| 2155 | ``relocatable.bbclass`` |
| 2156 | ======================= |
| 2157 | |
| 2158 | The ``relocatable`` class enables relocation of binaries when they are |
| 2159 | installed into the sysroot. |
| 2160 | |
| 2161 | This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class |
| 2162 | and is used by both the :ref:`cross <ref-classes-cross>` and |
| 2163 | :ref:`native <ref-classes-native>` classes. |
| 2164 | |
| 2165 | .. _ref-classes-remove-libtool: |
| 2166 | |
| 2167 | ``remove-libtool.bbclass`` |
| 2168 | ========================== |
| 2169 | |
| 2170 | The ``remove-libtool`` class adds a post function to the |
| 2171 | :ref:`ref-tasks-install` task to remove all ``.la`` files |
| 2172 | installed by ``libtool``. Removing these files results in them being |
| 2173 | absent from both the sysroot and target packages. |
| 2174 | |
| 2175 | If a recipe needs the ``.la`` files to be installed, then the recipe can |
| 2176 | override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows: |
| 2177 | :: |
| 2178 | |
| 2179 | REMOVE_LIBTOOL_LA = "0" |
| 2180 | |
| 2181 | .. note:: |
| 2182 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2183 | The ``remove-libtool`` class is not enabled by default. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2184 | |
| 2185 | .. _ref-classes-report-error: |
| 2186 | |
| 2187 | ``report-error.bbclass`` |
| 2188 | ======================== |
| 2189 | |
| 2190 | The ``report-error`` class supports enabling the :ref:`error reporting |
| 2191 | tool <dev-manual/dev-manual-common-tasks:using the error reporting tool>`", |
| 2192 | which allows you to submit build error information to a central database. |
| 2193 | |
| 2194 | The class collects debug information for recipe, recipe version, task, |
| 2195 | machine, distro, build system, target system, host distro, branch, |
| 2196 | commit, and log. From the information, report files using a JSON format |
| 2197 | are created and stored in |
| 2198 | ``${``\ :term:`LOG_DIR`\ ``}/error-report``. |
| 2199 | |
| 2200 | .. _ref-classes-rm-work: |
| 2201 | |
| 2202 | ``rm_work.bbclass`` |
| 2203 | =================== |
| 2204 | |
| 2205 | The ``rm_work`` class supports deletion of temporary workspace, which |
| 2206 | can ease your hard drive demands during builds. |
| 2207 | |
| 2208 | The OpenEmbedded build system can use a substantial amount of disk space |
| 2209 | during the build process. A portion of this space is the work files |
| 2210 | under the ``${TMPDIR}/work`` directory for each recipe. Once the build |
| 2211 | system generates the packages for a recipe, the work files for that |
| 2212 | recipe are no longer needed. However, by default, the build system |
| 2213 | preserves these files for inspection and possible debugging purposes. If |
| 2214 | you would rather have these files deleted to save disk space as the |
| 2215 | build progresses, you can enable ``rm_work`` by adding the following to |
| 2216 | your ``local.conf`` file, which is found in the :term:`Build Directory`. |
| 2217 | :: |
| 2218 | |
| 2219 | INHERIT += "rm_work" |
| 2220 | |
| 2221 | If you are |
| 2222 | modifying and building source code out of the work directory for a |
| 2223 | recipe, enabling ``rm_work`` will potentially result in your changes to |
| 2224 | the source being lost. To exclude some recipes from having their work |
| 2225 | directories deleted by ``rm_work``, you can add the names of the recipe |
| 2226 | or recipes you are working on to the ``RM_WORK_EXCLUDE`` variable, which |
| 2227 | can also be set in your ``local.conf`` file. Here is an example: |
| 2228 | :: |
| 2229 | |
| 2230 | RM_WORK_EXCLUDE += "busybox glibc" |
| 2231 | |
| 2232 | .. _ref-classes-rootfs*: |
| 2233 | |
| 2234 | ``rootfs*.bbclass`` |
| 2235 | =================== |
| 2236 | |
| 2237 | The ``rootfs*`` classes support creating the root filesystem for an |
| 2238 | image and consist of the following classes: |
| 2239 | |
| 2240 | - The ``rootfs-postcommands`` class, which defines filesystem |
| 2241 | post-processing functions for image recipes. |
| 2242 | |
| 2243 | - The ``rootfs_deb`` class, which supports creation of root filesystems |
| 2244 | for images built using ``.deb`` packages. |
| 2245 | |
| 2246 | - The ``rootfs_rpm`` class, which supports creation of root filesystems |
| 2247 | for images built using ``.rpm`` packages. |
| 2248 | |
| 2249 | - The ``rootfs_ipk`` class, which supports creation of root filesystems |
| 2250 | for images built using ``.ipk`` packages. |
| 2251 | |
| 2252 | - The ``rootfsdebugfiles`` class, which installs additional files found |
| 2253 | on the build host directly into the root filesystem. |
| 2254 | |
| 2255 | The root filesystem is created from packages using one of the |
| 2256 | ``rootfs*.bbclass`` files as determined by the |
| 2257 | :term:`PACKAGE_CLASSES` variable. |
| 2258 | |
| 2259 | For information on how root filesystem images are created, see the |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2260 | ":ref:`image-generation-dev-environment`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2261 | section in the Yocto Project Overview and Concepts Manual. |
| 2262 | |
| 2263 | .. _ref-classes-sanity: |
| 2264 | |
| 2265 | ``sanity.bbclass`` |
| 2266 | ================== |
| 2267 | |
| 2268 | The ``sanity`` class checks to see if prerequisite software is present |
| 2269 | on the host system so that users can be notified of potential problems |
| 2270 | that might affect their build. The class also performs basic user |
| 2271 | configuration checks from the ``local.conf`` configuration file to |
| 2272 | prevent common mistakes that cause build failures. Distribution policy |
| 2273 | usually determines whether to include this class. |
| 2274 | |
| 2275 | .. _ref-classes-scons: |
| 2276 | |
| 2277 | ``scons.bbclass`` |
| 2278 | ================= |
| 2279 | |
| 2280 | The ``scons`` class supports recipes that need to build software that |
| 2281 | uses the SCons build system. You can use the |
| 2282 | :term:`EXTRA_OESCONS` variable to specify |
| 2283 | additional configuration options you want to pass SCons command line. |
| 2284 | |
| 2285 | .. _ref-classes-sdl: |
| 2286 | |
| 2287 | ``sdl.bbclass`` |
| 2288 | =============== |
| 2289 | |
| 2290 | The ``sdl`` class supports recipes that need to build software that uses |
| 2291 | the Simple DirectMedia Layer (SDL) library. |
| 2292 | |
| 2293 | .. _ref-classes-setuptools: |
| 2294 | |
| 2295 | ``setuptools.bbclass`` |
| 2296 | ====================== |
| 2297 | |
| 2298 | The ``setuptools`` class supports Python version 2.x extensions that use |
| 2299 | build systems based on ``setuptools``. If your recipe uses these build |
| 2300 | systems, the recipe needs to inherit the ``setuptools`` class. |
| 2301 | |
| 2302 | .. _ref-classes-setuptools3: |
| 2303 | |
| 2304 | ``setuptools3.bbclass`` |
| 2305 | ======================= |
| 2306 | |
| 2307 | The ``setuptools3`` class supports Python version 3.x extensions that |
| 2308 | use build systems based on ``setuptools3``. If your recipe uses these |
| 2309 | build systems, the recipe needs to inherit the ``setuptools3`` class. |
| 2310 | |
| 2311 | .. _ref-classes-sign_rpm: |
| 2312 | |
| 2313 | ``sign_rpm.bbclass`` |
| 2314 | ==================== |
| 2315 | |
| 2316 | The ``sign_rpm`` class supports generating signed RPM packages. |
| 2317 | |
| 2318 | .. _ref-classes-sip: |
| 2319 | |
| 2320 | ``sip.bbclass`` |
| 2321 | =============== |
| 2322 | |
| 2323 | The ``sip`` class supports recipes that build or package SIP-based |
| 2324 | Python bindings. |
| 2325 | |
| 2326 | .. _ref-classes-siteconfig: |
| 2327 | |
| 2328 | ``siteconfig.bbclass`` |
| 2329 | ====================== |
| 2330 | |
| 2331 | The ``siteconfig`` class provides functionality for handling site |
| 2332 | configuration. The class is used by the |
| 2333 | :ref:`autotools <ref-classes-autotools>` class to accelerate the |
| 2334 | :ref:`ref-tasks-configure` task. |
| 2335 | |
| 2336 | .. _ref-classes-siteinfo: |
| 2337 | |
| 2338 | ``siteinfo.bbclass`` |
| 2339 | ==================== |
| 2340 | |
| 2341 | The ``siteinfo`` class provides information about the targets that might |
| 2342 | be needed by other classes or recipes. |
| 2343 | |
| 2344 | As an example, consider Autotools, which can require tests that must |
| 2345 | execute on the target hardware. Since this is not possible in general |
| 2346 | when cross compiling, site information is used to provide cached test |
| 2347 | results so these tests can be skipped over but still make the correct |
| 2348 | values available. The ``meta/site directory`` contains test results |
| 2349 | sorted into different categories such as architecture, endianness, and |
| 2350 | the ``libc`` used. Site information provides a list of files containing |
| 2351 | data relevant to the current build in the ``CONFIG_SITE`` variable that |
| 2352 | Autotools automatically picks up. |
| 2353 | |
| 2354 | The class also provides variables like ``SITEINFO_ENDIANNESS`` and |
| 2355 | ``SITEINFO_BITS`` that can be used elsewhere in the metadata. |
| 2356 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2357 | .. _ref-classes-sstate: |
| 2358 | |
| 2359 | ``sstate.bbclass`` |
| 2360 | ================== |
| 2361 | |
| 2362 | The ``sstate`` class provides support for Shared State (sstate). By |
| 2363 | default, the class is enabled through the |
| 2364 | :term:`INHERIT_DISTRO` variable's default value. |
| 2365 | |
| 2366 | For more information on sstate, see the |
| 2367 | ":ref:`overview-manual/overview-manual-concepts:shared state cache`" |
| 2368 | section in the Yocto Project Overview and Concepts Manual. |
| 2369 | |
| 2370 | .. _ref-classes-staging: |
| 2371 | |
| 2372 | ``staging.bbclass`` |
| 2373 | =================== |
| 2374 | |
| 2375 | The ``staging`` class installs files into individual recipe work |
| 2376 | directories for sysroots. The class contains the following key tasks: |
| 2377 | |
| 2378 | - The :ref:`ref-tasks-populate_sysroot` task, |
| 2379 | which is responsible for handing the files that end up in the recipe |
| 2380 | sysroots. |
| 2381 | |
| 2382 | - The |
| 2383 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 2384 | task (a "partner" task to the ``populate_sysroot`` task), which |
| 2385 | installs the files into the individual recipe work directories (i.e. |
| 2386 | :term:`WORKDIR`). |
| 2387 | |
| 2388 | The code in the ``staging`` class is complex and basically works in two |
| 2389 | stages: |
| 2390 | |
| 2391 | - *Stage One:* The first stage addresses recipes that have files they |
| 2392 | want to share with other recipes that have dependencies on the |
| 2393 | originating recipe. Normally these dependencies are installed through |
| 2394 | the :ref:`ref-tasks-install` task into |
| 2395 | ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task |
| 2396 | copies a subset of these files into ``${SYSROOT_DESTDIR}``. This |
| 2397 | subset of files is controlled by the |
| 2398 | :term:`SYSROOT_DIRS`, |
| 2399 | :term:`SYSROOT_DIRS_NATIVE`, and |
| 2400 | :term:`SYSROOT_DIRS_BLACKLIST` |
| 2401 | variables. |
| 2402 | |
| 2403 | .. note:: |
| 2404 | |
| 2405 | Additionally, a recipe can customize the files further by |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2406 | declaring a processing function in the ``SYSROOT_PREPROCESS_FUNCS`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2407 | variable. |
| 2408 | |
| 2409 | A shared state (sstate) object is built from these files and the |
| 2410 | files are placed into a subdirectory of |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2411 | :ref:`structure-build-tmp-sysroots-components`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2412 | The files are scanned for hardcoded paths to the original |
| 2413 | installation location. If the location is found in text files, the |
| 2414 | hardcoded locations are replaced by tokens and a list of the files |
| 2415 | needing such replacements is created. These adjustments are referred |
| 2416 | to as "FIXMEs". The list of files that are scanned for paths is |
| 2417 | controlled by the :term:`SSTATE_SCAN_FILES` |
| 2418 | variable. |
| 2419 | |
| 2420 | - *Stage Two:* The second stage addresses recipes that want to use |
| 2421 | something from another recipe and declare a dependency on that recipe |
| 2422 | through the :term:`DEPENDS` variable. The recipe will |
| 2423 | have a |
| 2424 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 2425 | task and when this task executes, it creates the ``recipe-sysroot`` |
| 2426 | and ``recipe-sysroot-native`` in the recipe work directory (i.e. |
| 2427 | :term:`WORKDIR`). The OpenEmbedded build system |
| 2428 | creates hard links to copies of the relevant files from |
| 2429 | ``sysroots-components`` into the recipe work directory. |
| 2430 | |
| 2431 | .. note:: |
| 2432 | |
| 2433 | If hard links are not possible, the build system uses actual |
| 2434 | copies. |
| 2435 | |
| 2436 | The build system then addresses any "FIXMEs" to paths as defined from |
| 2437 | the list created in the first stage. |
| 2438 | |
| 2439 | Finally, any files in ``${bindir}`` within the sysroot that have the |
| 2440 | prefix "``postinst-``" are executed. |
| 2441 | |
| 2442 | .. note:: |
| 2443 | |
| 2444 | Although such sysroot post installation scripts are not |
| 2445 | recommended for general use, the files do allow some issues such |
| 2446 | as user creation and module indexes to be addressed. |
| 2447 | |
| 2448 | Because recipes can have other dependencies outside of ``DEPENDS`` |
| 2449 | (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``), |
| 2450 | the sysroot creation function ``extend_recipe_sysroot`` is also added |
| 2451 | as a pre-function for those tasks whose dependencies are not through |
| 2452 | ``DEPENDS`` but operate similarly. |
| 2453 | |
| 2454 | When installing dependencies into the sysroot, the code traverses the |
| 2455 | dependency graph and processes dependencies in exactly the same way |
| 2456 | as the dependencies would or would not be when installed from sstate. |
| 2457 | This processing means, for example, a native tool would have its |
| 2458 | native dependencies added but a target library would not have its |
| 2459 | dependencies traversed or installed. The same sstate dependency code |
| 2460 | is used so that builds should be identical regardless of whether |
| 2461 | sstate was used or not. For a closer look, see the |
| 2462 | ``setscene_depvalid()`` function in the |
| 2463 | :ref:`sstate <ref-classes-sstate>` class. |
| 2464 | |
| 2465 | The build system is careful to maintain manifests of the files it |
| 2466 | installs so that any given dependency can be installed as needed. The |
| 2467 | sstate hash of the installed item is also stored so that if it |
| 2468 | changes, the build system can reinstall it. |
| 2469 | |
| 2470 | .. _ref-classes-syslinux: |
| 2471 | |
| 2472 | ``syslinux.bbclass`` |
| 2473 | ==================== |
| 2474 | |
| 2475 | The ``syslinux`` class provides syslinux-specific functions for building |
| 2476 | bootable images. |
| 2477 | |
| 2478 | The class supports the following variables: |
| 2479 | |
| 2480 | - :term:`INITRD`: Indicates list of filesystem images to |
| 2481 | concatenate and use as an initial RAM disk (initrd). This variable is |
| 2482 | optional. |
| 2483 | |
| 2484 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 2485 | as the root filesystem. This variable is optional. |
| 2486 | |
| 2487 | - :term:`AUTO_SYSLINUXMENU`: Enables creating |
| 2488 | an automatic menu when set to "1". |
| 2489 | |
| 2490 | - :term:`LABELS`: Lists targets for automatic |
| 2491 | configuration. |
| 2492 | |
| 2493 | - :term:`APPEND`: Lists append string overrides for each |
| 2494 | label. |
| 2495 | |
| 2496 | - :term:`SYSLINUX_OPTS`: Lists additional options |
| 2497 | to add to the syslinux file. Semicolon characters separate multiple |
| 2498 | options. |
| 2499 | |
| 2500 | - :term:`SYSLINUX_SPLASH`: Lists a background |
| 2501 | for the VGA boot menu when you are using the boot menu. |
| 2502 | |
| 2503 | - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set |
| 2504 | to "console=ttyX" to change kernel boot default console. |
| 2505 | |
| 2506 | - :term:`SYSLINUX_SERIAL`: Sets an alternate |
| 2507 | serial port. Or, turns off serial when the variable is set with an |
| 2508 | empty string. |
| 2509 | |
| 2510 | - :term:`SYSLINUX_SERIAL_TTY`: Sets an |
| 2511 | alternate "console=tty..." kernel boot argument. |
| 2512 | |
| 2513 | .. _ref-classes-systemd: |
| 2514 | |
| 2515 | ``systemd.bbclass`` |
| 2516 | =================== |
| 2517 | |
| 2518 | The ``systemd`` class provides support for recipes that install systemd |
| 2519 | unit files. |
| 2520 | |
| 2521 | The functionality for this class is disabled unless you have "systemd" |
| 2522 | in :term:`DISTRO_FEATURES`. |
| 2523 | |
| 2524 | Under this class, the recipe or Makefile (i.e. whatever the recipe is |
| 2525 | calling during the :ref:`ref-tasks-install` task) |
| 2526 | installs unit files into |
| 2527 | ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit |
| 2528 | files being installed go into packages other than the main package, you |
| 2529 | need to set :term:`SYSTEMD_PACKAGES` in your |
| 2530 | recipe to identify the packages in which the files will be installed. |
| 2531 | |
| 2532 | You should set :term:`SYSTEMD_SERVICE` to the |
| 2533 | name of the service file. You should also use a package name override to |
| 2534 | indicate the package to which the value applies. If the value applies to |
| 2535 | the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here |
| 2536 | is an example from the connman recipe: |
| 2537 | :: |
| 2538 | |
| 2539 | SYSTEMD_SERVICE_${PN} = "connman.service" |
| 2540 | |
| 2541 | Services are set up to start on boot automatically |
| 2542 | unless you have set |
| 2543 | :term:`SYSTEMD_AUTO_ENABLE` to "disable". |
| 2544 | |
| 2545 | For more information on ``systemd``, see the |
| 2546 | ":ref:`dev-manual/dev-manual-common-tasks:selecting an initialization manager`" |
| 2547 | section in the Yocto Project Development Tasks Manual. |
| 2548 | |
| 2549 | .. _ref-classes-systemd-boot: |
| 2550 | |
| 2551 | ``systemd-boot.bbclass`` |
| 2552 | ======================== |
| 2553 | |
| 2554 | The ``systemd-boot`` class provides functions specific to the |
| 2555 | systemd-boot bootloader for building bootable images. This is an |
| 2556 | internal class and is not intended to be used directly. |
| 2557 | |
| 2558 | .. note:: |
| 2559 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2560 | The ``systemd-boot`` class is a result from merging the ``gummiboot`` class |
| 2561 | used in previous Yocto Project releases with the ``systemd`` project. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2562 | |
| 2563 | Set the :term:`EFI_PROVIDER` variable to |
| 2564 | "systemd-boot" to use this class. Doing so creates a standalone EFI |
| 2565 | bootloader that is not dependent on systemd. |
| 2566 | |
| 2567 | For information on more variables used and supported in this class, see |
| 2568 | the :term:`SYSTEMD_BOOT_CFG`, |
| 2569 | :term:`SYSTEMD_BOOT_ENTRIES`, and |
| 2570 | :term:`SYSTEMD_BOOT_TIMEOUT` variables. |
| 2571 | |
| 2572 | You can also see the `Systemd-boot |
| 2573 | documentation <http://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__ |
| 2574 | for more information. |
| 2575 | |
| 2576 | .. _ref-classes-terminal: |
| 2577 | |
| 2578 | ``terminal.bbclass`` |
| 2579 | ==================== |
| 2580 | |
| 2581 | The ``terminal`` class provides support for starting a terminal session. |
| 2582 | The :term:`OE_TERMINAL` variable controls which |
| 2583 | terminal emulator is used for the session. |
| 2584 | |
| 2585 | Other classes use the ``terminal`` class anywhere a separate terminal |
| 2586 | session needs to be started. For example, the |
| 2587 | :ref:`patch <ref-classes-patch>` class assuming |
| 2588 | :term:`PATCHRESOLVE` is set to "user", the |
| 2589 | :ref:`cml1 <ref-classes-cml1>` class, and the |
| 2590 | :ref:`devshell <ref-classes-devshell>` class all use the ``terminal`` |
| 2591 | class. |
| 2592 | |
| 2593 | .. _ref-classes-testimage*: |
| 2594 | |
| 2595 | ``testimage*.bbclass`` |
| 2596 | ====================== |
| 2597 | |
| 2598 | The ``testimage*`` classes support running automated tests against |
| 2599 | images using QEMU and on actual hardware. The classes handle loading the |
| 2600 | tests and starting the image. To use the classes, you need to perform |
| 2601 | steps to set up the environment. |
| 2602 | |
| 2603 | .. note:: |
| 2604 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2605 | Best practices include using :term:`IMAGE_CLASSES` rather than |
| 2606 | :term:`INHERIT` to inherit the ``testimage`` class for automated image |
| 2607 | testing. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2608 | |
| 2609 | The tests are commands that run on the target system over ``ssh``. Each |
| 2610 | test is written in Python and makes use of the ``unittest`` module. |
| 2611 | |
| 2612 | The ``testimage.bbclass`` runs tests on an image when called using the |
| 2613 | following: |
| 2614 | :: |
| 2615 | |
| 2616 | $ bitbake -c testimage image |
| 2617 | |
| 2618 | The ``testimage-auto`` class |
| 2619 | runs tests on an image after the image is constructed (i.e. |
| 2620 | :term:`TESTIMAGE_AUTO` must be set to "1"). |
| 2621 | |
| 2622 | For information on how to enable, run, and create new tests, see the |
| 2623 | ":ref:`dev-manual/dev-manual-common-tasks:performing automated runtime testing`" |
| 2624 | section in the Yocto Project Development Tasks Manual. |
| 2625 | |
| 2626 | .. _ref-classes-testsdk: |
| 2627 | |
| 2628 | ``testsdk.bbclass`` |
| 2629 | =================== |
| 2630 | |
| 2631 | This class supports running automated tests against software development |
| 2632 | kits (SDKs). The ``testsdk`` class runs tests on an SDK when called |
| 2633 | using the following: |
| 2634 | :: |
| 2635 | |
| 2636 | $ bitbake -c testsdk image |
| 2637 | |
| 2638 | .. note:: |
| 2639 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2640 | Best practices include using :term:`IMAGE_CLASSES` rather than |
| 2641 | :term:`INHERIT` to inherit the ``testsdk`` class for automated SDK |
| 2642 | testing. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2643 | |
| 2644 | .. _ref-classes-texinfo: |
| 2645 | |
| 2646 | ``texinfo.bbclass`` |
| 2647 | =================== |
| 2648 | |
| 2649 | This class should be inherited by recipes whose upstream packages invoke |
| 2650 | the ``texinfo`` utilities at build-time. Native and cross recipes are |
| 2651 | made to use the dummy scripts provided by ``texinfo-dummy-native``, for |
| 2652 | improved performance. Target architecture recipes use the genuine |
| 2653 | Texinfo utilities. By default, they use the Texinfo utilities on the |
| 2654 | host system. |
| 2655 | |
| 2656 | .. note:: |
| 2657 | |
| 2658 | If you want to use the Texinfo recipe shipped with the build system, |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2659 | you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo |
| 2660 | from :term:`SANITY_REQUIRED_UTILITIES`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2661 | |
| 2662 | .. _ref-classes-toaster: |
| 2663 | |
| 2664 | ``toaster.bbclass`` |
| 2665 | =================== |
| 2666 | |
| 2667 | The ``toaster`` class collects information about packages and images and |
| 2668 | sends them as events that the BitBake user interface can receive. The |
| 2669 | class is enabled when the Toaster user interface is running. |
| 2670 | |
| 2671 | This class is not intended to be used directly. |
| 2672 | |
| 2673 | .. _ref-classes-toolchain-scripts: |
| 2674 | |
| 2675 | ``toolchain-scripts.bbclass`` |
| 2676 | ============================= |
| 2677 | |
| 2678 | The ``toolchain-scripts`` class provides the scripts used for setting up |
| 2679 | the environment for installed SDKs. |
| 2680 | |
| 2681 | .. _ref-classes-typecheck: |
| 2682 | |
| 2683 | ``typecheck.bbclass`` |
| 2684 | ===================== |
| 2685 | |
| 2686 | The ``typecheck`` class provides support for validating the values of |
| 2687 | variables set at the configuration level against their defined types. |
| 2688 | The OpenEmbedded build system allows you to define the type of a |
| 2689 | variable using the "type" varflag. Here is an example: |
| 2690 | :: |
| 2691 | |
| 2692 | IMAGE_FEATURES[type] = "list" |
| 2693 | |
| 2694 | .. _ref-classes-uboot-config: |
| 2695 | |
| 2696 | ``uboot-config.bbclass`` |
| 2697 | ======================== |
| 2698 | |
| 2699 | The ``uboot-config`` class provides support for U-Boot configuration for |
| 2700 | a machine. Specify the machine in your recipe as follows: |
| 2701 | :: |
| 2702 | |
| 2703 | UBOOT_CONFIG ??= <default> |
| 2704 | UBOOT_CONFIG[foo] = "config,images" |
| 2705 | |
| 2706 | You can also specify the machine using this method: |
| 2707 | :: |
| 2708 | |
| 2709 | UBOOT_MACHINE = "config" |
| 2710 | |
| 2711 | See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional |
| 2712 | information. |
| 2713 | |
| 2714 | .. _ref-classes-uninative: |
| 2715 | |
| 2716 | ``uninative.bbclass`` |
| 2717 | ===================== |
| 2718 | |
| 2719 | Attempts to isolate the build system from the host distribution's C |
| 2720 | library in order to make re-use of native shared state artifacts across |
| 2721 | different host distributions practical. With this class enabled, a |
| 2722 | tarball containing a pre-built C library is downloaded at the start of |
| 2723 | the build. In the Poky reference distribution this is enabled by default |
| 2724 | through ``meta/conf/distro/include/yocto-uninative.inc``. Other |
| 2725 | distributions that do not derive from poky can also |
| 2726 | "``require conf/distro/include/yocto-uninative.inc``" to use this. |
| 2727 | Alternatively if you prefer, you can build the uninative-tarball recipe |
| 2728 | yourself, publish the resulting tarball (e.g. via HTTP) and set |
| 2729 | ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an |
| 2730 | example, see the ``meta/conf/distro/include/yocto-uninative.inc``. |
| 2731 | |
| 2732 | The ``uninative`` class is also used unconditionally by the extensible |
| 2733 | SDK. When building the extensible SDK, ``uninative-tarball`` is built |
| 2734 | and the resulting tarball is included within the SDK. |
| 2735 | |
| 2736 | .. _ref-classes-update-alternatives: |
| 2737 | |
| 2738 | ``update-alternatives.bbclass`` |
| 2739 | =============================== |
| 2740 | |
| 2741 | The ``update-alternatives`` class helps the alternatives system when |
| 2742 | multiple sources provide the same command. This situation occurs when |
| 2743 | several programs that have the same or similar function are installed |
| 2744 | with the same name. For example, the ``ar`` command is available from |
| 2745 | the ``busybox``, ``binutils`` and ``elfutils`` packages. The |
| 2746 | ``update-alternatives`` class handles renaming the binaries so that |
| 2747 | multiple packages can be installed without conflicts. The ``ar`` command |
| 2748 | still works regardless of which packages are installed or subsequently |
| 2749 | removed. The class renames the conflicting binary in each package and |
| 2750 | symlinks the highest priority binary during installation or removal of |
| 2751 | packages. |
| 2752 | |
| 2753 | To use this class, you need to define a number of variables: |
| 2754 | |
| 2755 | - :term:`ALTERNATIVE` |
| 2756 | |
| 2757 | - :term:`ALTERNATIVE_LINK_NAME` |
| 2758 | |
| 2759 | - :term:`ALTERNATIVE_TARGET` |
| 2760 | |
| 2761 | - :term:`ALTERNATIVE_PRIORITY` |
| 2762 | |
| 2763 | These variables list alternative commands needed by a package, provide |
| 2764 | pathnames for links, default links for targets, and so forth. For |
| 2765 | details on how to use this class, see the comments in the |
| 2766 | :yocto_git:`update-alternatives.bbclass </cgit/cgit.cgi/poky/tree/meta/classes/update-alternatives.bbclass>` |
| 2767 | file. |
| 2768 | |
| 2769 | .. note:: |
| 2770 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2771 | You can use the ``update-alternatives`` command directly in your recipes. |
| 2772 | However, this class simplifies things in most cases. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2773 | |
| 2774 | .. _ref-classes-update-rc.d: |
| 2775 | |
| 2776 | ``update-rc.d.bbclass`` |
| 2777 | ======================= |
| 2778 | |
| 2779 | The ``update-rc.d`` class uses ``update-rc.d`` to safely install an |
| 2780 | initialization script on behalf of the package. The OpenEmbedded build |
| 2781 | system takes care of details such as making sure the script is stopped |
| 2782 | before a package is removed and started when the package is installed. |
| 2783 | |
| 2784 | Three variables control this class: ``INITSCRIPT_PACKAGES``, |
| 2785 | ``INITSCRIPT_NAME`` and ``INITSCRIPT_PARAMS``. See the variable links |
| 2786 | for details. |
| 2787 | |
| 2788 | .. _ref-classes-useradd: |
| 2789 | |
| 2790 | ``useradd*.bbclass`` |
| 2791 | ==================== |
| 2792 | |
| 2793 | The ``useradd*`` classes support the addition of users or groups for |
| 2794 | usage by the package on the target. For example, if you have packages |
| 2795 | that contain system services that should be run under their own user or |
| 2796 | group, you can use these classes to enable creation of the user or |
| 2797 | group. The ``meta-skeleton/recipes-skeleton/useradd/useradd-example.bb`` |
| 2798 | recipe in the :term:`Source Directory` provides a simple |
| 2799 | example that shows how to add three users and groups to two packages. |
| 2800 | See the ``useradd-example.bb`` recipe for more information on how to use |
| 2801 | these classes. |
| 2802 | |
| 2803 | The ``useradd_base`` class provides basic functionality for user or |
| 2804 | groups settings. |
| 2805 | |
| 2806 | The ``useradd*`` classes support the |
| 2807 | :term:`USERADD_PACKAGES`, |
| 2808 | :term:`USERADD_PARAM`, |
| 2809 | :term:`GROUPADD_PARAM`, and |
| 2810 | :term:`GROUPMEMS_PARAM` variables. |
| 2811 | |
| 2812 | The ``useradd-staticids`` class supports the addition of users or groups |
| 2813 | that have static user identification (``uid``) and group identification |
| 2814 | (``gid``) values. |
| 2815 | |
| 2816 | The default behavior of the OpenEmbedded build system for assigning |
| 2817 | ``uid`` and ``gid`` values when packages add users and groups during |
| 2818 | package install time is to add them dynamically. This works fine for |
| 2819 | programs that do not care what the values of the resulting users and |
| 2820 | groups become. In these cases, the order of the installation determines |
| 2821 | the final ``uid`` and ``gid`` values. However, if non-deterministic |
| 2822 | ``uid`` and ``gid`` values are a problem, you can override the default, |
| 2823 | dynamic application of these values by setting static values. When you |
| 2824 | set static values, the OpenEmbedded build system looks in |
| 2825 | :term:`BBPATH` for ``files/passwd`` and ``files/group`` |
| 2826 | files for the values. |
| 2827 | |
| 2828 | To use static ``uid`` and ``gid`` values, you need to set some |
| 2829 | variables. See the :term:`USERADDEXTENSION`, |
| 2830 | :term:`USERADD_UID_TABLES`, |
| 2831 | :term:`USERADD_GID_TABLES`, and |
| 2832 | :term:`USERADD_ERROR_DYNAMIC` variables. |
| 2833 | You can also see the :ref:`useradd <ref-classes-useradd>` class for |
| 2834 | additional information. |
| 2835 | |
| 2836 | .. note:: |
| 2837 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2838 | You do not use the ``useradd-staticids`` class directly. You either enable |
| 2839 | or disable the class by setting the ``USERADDEXTENSION`` variable. If you |
| 2840 | enable or disable the class in a configured system, :term:`TMPDIR` might |
| 2841 | contain incorrect ``uid`` and ``gid`` values. Deleting the ``TMPDIR`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2842 | directory will correct this condition. |
| 2843 | |
| 2844 | .. _ref-classes-utility-tasks: |
| 2845 | |
| 2846 | ``utility-tasks.bbclass`` |
| 2847 | ========================= |
| 2848 | |
| 2849 | The ``utility-tasks`` class provides support for various "utility" type |
| 2850 | tasks that are applicable to all recipes, such as |
| 2851 | :ref:`ref-tasks-clean` and |
| 2852 | :ref:`ref-tasks-listtasks`. |
| 2853 | |
| 2854 | This class is enabled by default because it is inherited by the |
| 2855 | :ref:`base <ref-classes-base>` class. |
| 2856 | |
| 2857 | .. _ref-classes-utils: |
| 2858 | |
| 2859 | ``utils.bbclass`` |
| 2860 | ================= |
| 2861 | |
| 2862 | The ``utils`` class provides some useful Python functions that are |
| 2863 | typically used in inline Python expressions (e.g. ``${@...}``). One |
| 2864 | example use is for ``bb.utils.contains()``. |
| 2865 | |
| 2866 | This class is enabled by default because it is inherited by the |
| 2867 | :ref:`base <ref-classes-base>` class. |
| 2868 | |
| 2869 | .. _ref-classes-vala: |
| 2870 | |
| 2871 | ``vala.bbclass`` |
| 2872 | ================ |
| 2873 | |
| 2874 | The ``vala`` class supports recipes that need to build software written |
| 2875 | using the Vala programming language. |
| 2876 | |
| 2877 | .. _ref-classes-waf: |
| 2878 | |
| 2879 | ``waf.bbclass`` |
| 2880 | =============== |
| 2881 | |
| 2882 | The ``waf`` class supports recipes that need to build software that uses |
| 2883 | the Waf build system. You can use the |
| 2884 | :term:`EXTRA_OECONF` or |
| 2885 | :term:`PACKAGECONFIG_CONFARGS` variables |
| 2886 | to specify additional configuration options to be passed on the Waf |
| 2887 | command line. |