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