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