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