blob: ab71cbe40c3eda6f0daddd4d5926bc51cc4ee3f7 [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3*******
4Classes
5*******
6
7Class files are used to abstract common functionality and share it
8amongst multiple recipe (``.bb``) files. To use a class file, you simply
9make sure the recipe inherits the class. In most cases, when a recipe
10inherits a class it is enough to enable its features. There are cases,
11however, where in the recipe you might need to set variables or override
12some default behavior.
13
14Any :term:`Metadata` usually found in a recipe can also be
15placed in a class file. Class files are identified by the extension
Patrick Williams975a06f2022-10-21 14:42:47 -050016``.bbclass`` and are usually placed in one of a set of subdirectories
17beneath the ``meta*/`` directory found in the :term:`Source Directory`:
18
19 - ``classes-recipe/`` - classes intended to be inherited by recipes
20 individually
21 - ``classes-global/`` - classes intended to be inherited globally
22 - ``classes/`` - classes whose usage context is not clearly defined
23
Andrew Geisslerc9f78652020-09-18 14:11:35 -050024Class files can also be pointed to by
25:term:`BUILDDIR` (e.g. ``build/``) in the same way as
26``.conf`` files in the ``conf`` directory. Class files are searched for
27in :term:`BBPATH` using the same method by which ``.conf``
28files are searched.
29
30This chapter discusses only the most useful and important classes. Other
Patrick Williams975a06f2022-10-21 14:42:47 -050031classes do exist within the ``meta/classes*`` directories in the Source
Andrew Geisslerc9f78652020-09-18 14:11:35 -050032Directory. You can reference the ``.bbclass`` files directly for more
33information.
34
35.. _ref-classes-allarch:
36
Andrew Geissler517393d2023-01-13 08:55:19 -060037``allarch``
38===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039
Andrew Geissler517393d2023-01-13 08:55:19 -060040The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce
Andrew Geisslerc9f78652020-09-18 14:11:35 -050041architecture-specific output. The class disables functionality that is
42normally needed for recipes that produce executable binaries (such as
43building the cross-compiler and a C library as pre-requisites, and
44splitting out of debug symbols during packaging).
45
46.. note::
47
48 Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
49 produce packages that depend on tunings through use of the
50 :term:`RDEPENDS` and
51 :term:`TUNE_PKGARCH` variables, should never be
Andrew Geissler517393d2023-01-13 08:55:19 -060052 configured for all architectures using :ref:`ref-classes-allarch`. This is the case
Andrew Geisslerc9f78652020-09-18 14:11:35 -050053 even if the recipes do not produce architecture-specific output.
54
55 Configuring such recipes for all architectures causes the
Patrick Williams2194f502022-10-16 14:26:09 -050056 :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to
Andrew Geisslerc9f78652020-09-18 14:11:35 -050057 have different signatures for the machines with different tunings.
58 Additionally, unnecessary rebuilds occur every time an image for a
Andrew Geissler09036742021-06-25 14:25:14 -050059 different :term:`MACHINE` is built even when the recipe never changes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050060
Andrew Geissler517393d2023-01-13 08:55:19 -060061By default, all recipes inherit the :ref:`ref-classes-base` and
62:ref:`ref-classes-package` classes, which enable
Andrew Geisslerc9f78652020-09-18 14:11:35 -050063functionality needed for recipes that produce executable output. If your
64recipe, for example, only produces packages that contain configuration
65files, media files, or scripts (e.g. Python and Perl), then it should
Andrew Geissler517393d2023-01-13 08:55:19 -060066inherit the :ref:`ref-classes-allarch` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050067
68.. _ref-classes-archiver:
69
Andrew Geissler517393d2023-01-13 08:55:19 -060070``archiver``
71============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050072
Andrew Geissler517393d2023-01-13 08:55:19 -060073The :ref:`ref-classes-archiver` class supports releasing source code and other
Andrew Geisslerc9f78652020-09-18 14:11:35 -050074materials with the binaries.
75
Andrew Geissler517393d2023-01-13 08:55:19 -060076For more details on the source :ref:`ref-classes-archiver`, see the
77":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050078section in the Yocto Project Development Tasks Manual. You can also see
79the :term:`ARCHIVER_MODE` variable for information
80about the variable flags (varflags) that help control archive creation.
81
82.. _ref-classes-autotools:
83
Andrew Geissler517393d2023-01-13 08:55:19 -060084``autotools*``
85==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050086
Patrick Williams2390b1b2022-11-03 13:47:49 -050087The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the
Patrick Williams7784c422022-11-17 07:29:11 -060088:wikipedia:`GNU Autotools <GNU_Autotools>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050089
90The ``autoconf``, ``automake``, and ``libtool`` packages bring
91standardization. This class defines a set of tasks (e.g. ``configure``,
92``compile`` and so forth) that work for all Autotooled packages. It
93should usually be enough to define a few standard variables and then
94simply ``inherit autotools``. These classes can also work with software
95that emulates Autotools. For more information, see the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060096":ref:`dev-manual/new-recipe:building an autotooled package`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -050097in the Yocto Project Development Tasks Manual.
98
Patrick Williams2390b1b2022-11-03 13:47:49 -050099By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500100``autotools.bbclass`` building with ``B != S``).
101
102If the software being built by a recipe does not support using
103out-of-tree builds, you should have the recipe inherit the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500104:ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves
Andrew Geissler517393d2023-01-13 08:55:19 -0600105the same as the :ref:`ref-classes-autotools` class but builds with :term:`B`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500106== :term:`S`. This method is useful when out-of-tree build
107support is either not present or is broken.
108
109.. note::
110
111 It is recommended that out-of-tree support be fixed and used if at
112 all possible.
113
114It's useful to have some idea of how the tasks defined by the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500115:ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500116
Andrew Geissler615f2f12022-07-15 14:00:58 -0500117- :ref:`ref-tasks-configure` --- regenerates the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500118 configure script (using ``autoreconf``) and then launches it with a
119 standard set of arguments used during cross-compilation. You can pass
Andrew Geissler09036742021-06-25 14:25:14 -0500120 additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500121 or :term:`PACKAGECONFIG_CONFARGS`
122 variables.
123
Andrew Geissler615f2f12022-07-15 14:00:58 -0500124- :ref:`ref-tasks-compile` --- runs ``make`` with
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500125 arguments that specify the compiler and linker. You can pass
Andrew Geissler5f350902021-07-23 13:09:54 -0400126 additional arguments through the :term:`EXTRA_OEMAKE` variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500127
Andrew Geissler615f2f12022-07-15 14:00:58 -0500128- :ref:`ref-tasks-install` --- runs ``make install`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500129 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
130
131.. _ref-classes-base:
132
Andrew Geissler517393d2023-01-13 08:55:19 -0600133``base``
134========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500135
Andrew Geissler517393d2023-01-13 08:55:19 -0600136The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500137inherits the class. This class contains definitions for standard basic
138tasks such as fetching, unpacking, configuring (empty by default),
139compiling (runs any ``Makefile`` present), installing (empty by default)
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500140and packaging (empty by default). These tasks are often overridden or
Andrew Geissler517393d2023-01-13 08:55:19 -0600141extended by other classes such as the :ref:`ref-classes-autotools` class or the
142:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500143
144The class also contains some commonly used functions such as
145``oe_runmake``, which runs ``make`` with the arguments specified in
146:term:`EXTRA_OEMAKE` variable as well as the
147arguments passed directly to ``oe_runmake``.
148
149.. _ref-classes-bash-completion:
150
Andrew Geissler517393d2023-01-13 08:55:19 -0600151``bash-completion``
152===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500153
154Sets up packaging and dependencies appropriate for recipes that build
155software that includes bash-completion data.
156
157.. _ref-classes-bin-package:
158
Andrew Geissler517393d2023-01-13 08:55:19 -0600159``bin_package``
160===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500161
Andrew Geissler517393d2023-01-13 08:55:19 -0600162The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500163contents of a binary package (e.g. an RPM) and install those contents
164rather than building the binary from source. The binary package is
165extracted and new packages in the configured output package format are
166created. Extraction and installation of proprietary binaries is a good
167example use for this class.
168
169.. note::
170
171 For RPMs and other packages that do not contain a subdirectory, you
172 should specify an appropriate fetcher parameter to point to the
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500173 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
174 the "subpath" parameter limits the checkout to a specific subpath
175 of the tree. Here is an example where ``${BP}`` is used so that the files
176 are extracted into the subdirectory expected by the default value of
Andrew Geissler09036742021-06-25 14:25:14 -0500177 :term:`S`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500178
Andrew Geissler9aee5002022-03-30 16:27:02 +0000179 SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500180
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500181 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
182 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500183
184.. _ref-classes-binconfig:
185
Andrew Geissler517393d2023-01-13 08:55:19 -0600186``binconfig``
187=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500188
Andrew Geissler517393d2023-01-13 08:55:19 -0600189The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500190
191Before ``pkg-config`` had become widespread, libraries shipped shell
192scripts to give information about the libraries and include paths needed
193to build software (usually named ``LIBNAME-config``). This class assists
194any recipe using such scripts.
195
196During staging, the OpenEmbedded build system installs such scripts into
197the ``sysroots/`` directory. Inheriting this class results in all paths
198in these scripts being changed to point into the ``sysroots/`` directory
199so that all builds that use the script use the correct directories for
200the cross compiling layout. See the
201:term:`BINCONFIG_GLOB` variable for more
202information.
203
204.. _ref-classes-binconfig-disabled:
205
Andrew Geissler517393d2023-01-13 08:55:19 -0600206``binconfig-disabled``
207======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500208
Andrew Geissler517393d2023-01-13 08:55:19 -0600209An alternative version of the :ref:`ref-classes-binconfig`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500210class, which disables binary configuration scripts by making them return
211an error in favor of using ``pkg-config`` to query the information. The
Andrew Geissler517393d2023-01-13 08:55:19 -0600212scripts to be disabled should be specified using the :term:`BINCONFIG`
213variable within the recipe inheriting the class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500214
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500215.. _ref-classes-buildhistory:
216
Andrew Geissler517393d2023-01-13 08:55:19 -0600217``buildhistory``
218================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500219
Andrew Geissler517393d2023-01-13 08:55:19 -0600220The :ref:`ref-classes-buildhistory` class records a history of build output metadata,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500221which can be used to detect possible regressions as well as used for
222analysis of the build output. For more information on using Build
223History, see the
Andrew Geissler517393d2023-01-13 08:55:19 -0600224":ref:`dev-manual/build-quality:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500225section in the Yocto Project Development Tasks Manual.
226
227.. _ref-classes-buildstats:
228
Andrew Geissler517393d2023-01-13 08:55:19 -0600229``buildstats``
230==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500231
Andrew Geissler517393d2023-01-13 08:55:19 -0600232The :ref:`ref-classes-buildstats` class records performance statistics about each task
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500233executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
234
235When you use this class, the output goes into the
236:term:`BUILDSTATS_BASE` directory, which defaults
237to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
238``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
239chart of the entire build process and can be useful for highlighting
240bottlenecks.
241
242Collecting build statistics is enabled by default through the
243:term:`USER_CLASSES` variable from your
244``local.conf`` file. Consequently, you do not have to do anything to
245enable the class. However, if you want to disable the class, simply
Andrew Geissler517393d2023-01-13 08:55:19 -0600246remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500247
248.. _ref-classes-buildstats-summary:
249
Andrew Geissler517393d2023-01-13 08:55:19 -0600250``buildstats-summary``
251======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500252
253When inherited globally, prints statistics at the end of the build on
254sstate re-use. In order to function, this class requires the
Andrew Geissler517393d2023-01-13 08:55:19 -0600255:ref:`ref-classes-buildstats` class be enabled.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500256
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600257.. _ref-classes-cargo:
258
259``cargo``
260=========
261
262The :ref:`ref-classes-cargo` class allows to compile Rust language programs
263using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
264manager, allowing to fetch package dependencies and build your program.
265
266Using this class makes it very easy to build Rust programs. All you need
267is to use the :term:`SRC_URI` variable to point to a source repository
268which can be built by Cargo, typically one that was created by the
Andrew Geissler5082cc72023-09-11 08:41:39 -0400269``cargo new`` command, containing a ``Cargo.toml`` file, a ``Cargo.lock`` file and a ``src``
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600270subdirectory.
271
Andrew Geissler5082cc72023-09-11 08:41:39 -0400272If you want to build and package tests of the program, inherit the
273:ref:`ref-classes-ptest-cargo` class instead of :ref:`ref-classes-cargo`.
274
275You will find an example (that show also how to handle possible git source dependencies) in the
276:oe_git:`zvariant_3.12.0.bb </openembedded-core/tree/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb>`
277recipe. Another example, with only crate dependencies, is the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600278:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
279recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
280tool.
281
282This class inherits the :ref:`ref-classes-cargo_common` class.
283
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600284.. _ref-classes-cargo_c:
285
286``cargo_c``
287===========
288
289The :ref:`ref-classes-cargo_c` class can be inherited by a recipe to generate
290a Rust library that can be called by C/C++ code. The recipe which inherits this
291class has to only replace ``inherit cargo`` by ``inherit cargo_c``.
292
293See the :yocto_git:`rust-c-lib-example_git.bb
294</poky/tree/meta-selftest/recipes-devtools/rust/rust-c-lib-example_git.bb>`
295example recipe.
296
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600297.. _ref-classes-cargo_common:
298
299``cargo_common``
300================
301
302The :ref:`ref-classes-cargo_common` class is an internal class
303that is not intended to be used directly.
304
305An exception is the "rust" recipe, to build the Rust compiler and runtime
306library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
307class. This is why this class was introduced.
308
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600309.. _ref-classes-cargo-update-recipe-crates:
310
311``cargo-update-recipe-crates``
312===============================
313
314The :ref:`ref-classes-cargo-update-recipe-crates` class allows
315recipe developers to update the list of Cargo crates in :term:`SRC_URI`
316by reading the ``Cargo.lock`` file in the source tree.
317
318To do so, create a recipe for your program, for example using
319:doc:`devtool </ref-manual/devtool-reference>`,
320make it inherit the :ref:`ref-classes-cargo` and
321:ref:`ref-classes-cargo-update-recipe-crates` and run::
322
323 bitbake -c update_crates recipe
324
325This creates a ``recipe-crates.inc`` file that you can include in your
326recipe::
327
328 require ${BPN}-crates.inc
329
330That's also something you can achieve by using the
331`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
332
Andrew Geissler5082cc72023-09-11 08:41:39 -0400333.. _ref-classes-ccache:
334
Andrew Geissler517393d2023-01-13 08:55:19 -0600335``ccache``
336==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500337
Andrew Geissler517393d2023-01-13 08:55:19 -0600338The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500339This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000340
341See https://ccache.samba.org/ for information on the C/C++ Compiler
342Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
343file for details about how to enable this mechanism in your configuration
344file, how to disable it for specific recipes, and how to share ``ccache``
345files between builds.
346
347However, using the class can lead to unexpected side-effects. Thus, using
348this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500349
350.. _ref-classes-chrpath:
351
Andrew Geissler517393d2023-01-13 08:55:19 -0600352``chrpath``
353===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500354
Andrew Geissler517393d2023-01-13 08:55:19 -0600355The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
356is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
357:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500358in order to make them relocatable.
359
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500360.. _ref-classes-cmake:
361
Andrew Geissler517393d2023-01-13 08:55:19 -0600362``cmake``
363=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500364
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600365The :ref:`ref-classes-cmake` class allows recipes to build software using the
366`CMake <https://cmake.org/overview/>`__ build system. You can use the
367:term:`EXTRA_OECMAKE` variable to specify additional configuration options to
368pass to the ``cmake`` command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500369
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600370By default, the :ref:`ref-classes-cmake` class uses
371`Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
372offers better build performance. If a recipe is broken with Ninja, then the
373recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
374use GNU make instead.
375
376If you need to install custom CMake toolchain files supplied by the application
377being built, you should install them (during :ref:`ref-tasks-install`) to the
378preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500379
Patrick Williams705982a2024-01-12 09:51:57 -0600380.. _ref-classes-cmake-qemu:
381
382``cmake-qemu``
383==============
384
385The :ref:`ref-classes-cmake-qemu` class might be used instead of the
386:ref:`ref-classes-cmake` class. In addition to the features provided by the
387:ref:`ref-classes-cmake` class, the :ref:`ref-classes-cmake-qemu` class passes
388the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use
389QEMU user-mode emulation for the execution of cross-compiled binaries on the
390host machine. For more information about ``CMAKE_CROSSCOMPILING_EMULATOR``
391please refer to the `related section of the CMake documentation
392<https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__.
393
394Not all platforms are supported by QEMU. This class only works for machines with
395``qemu-usermode`` in the :ref:`ref-features-machine`. Using QEMU user-mode therefore
396involves a certain risk, which is also the reason why this feature is not part of
397the main :ref:`ref-classes-cmake` class by default.
398
399One use case is the execution of cross-compiled unit tests with CTest on the build
400machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured::
401
402 cmake --build --target test
403
404works transparently with QEMU user-mode.
405
406If the CMake project is developed with this use case in mind this works very nicely.
407This also applies to an IDE configured to use ``cmake-native`` for cross-compiling.
408
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500409.. _ref-classes-cml1:
410
Andrew Geissler517393d2023-01-13 08:55:19 -0600411``cml1``
412========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500413
Andrew Geissler517393d2023-01-13 08:55:19 -0600414The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600415build configuration system. "cml" stands for "Configuration Menu Language", which
416originates from the Linux kernel but is also used in other projects such as U-Boot
417and BusyBox. It could have been called "kconfig" too.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500418
419.. _ref-classes-compress_doc:
420
Andrew Geissler517393d2023-01-13 08:55:19 -0600421``compress_doc``
422================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500423
Patrick Williams03514f12024-04-05 07:04:11 -0500424Enables compression for manual and info pages. This class is intended
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500425to be inherited globally. The default compression mechanism is gz (gzip)
426but you can select an alternative mechanism by setting the
427:term:`DOC_COMPRESS` variable.
428
429.. _ref-classes-copyleft_compliance:
430
Andrew Geissler517393d2023-01-13 08:55:19 -0600431``copyleft_compliance``
432=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500433
Andrew Geissler517393d2023-01-13 08:55:19 -0600434The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
435of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500436class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600437in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500438
439.. _ref-classes-copyleft_filter:
440
Andrew Geissler517393d2023-01-13 08:55:19 -0600441``copyleft_filter``
442===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500443
Andrew Geissler517393d2023-01-13 08:55:19 -0600444A class used by the :ref:`ref-classes-archiver` and
445:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500446for filtering licenses. The ``copyleft_filter`` class is an internal
447class and is not intended to be used directly.
448
449.. _ref-classes-core-image:
450
Andrew Geissler517393d2023-01-13 08:55:19 -0600451``core-image``
452==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500453
Andrew Geissler517393d2023-01-13 08:55:19 -0600454The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500455``core-image-*`` image recipes, such as support for additional
456:term:`IMAGE_FEATURES`.
457
458.. _ref-classes-cpan:
459
Andrew Geissler517393d2023-01-13 08:55:19 -0600460``cpan*``
461=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500462
Patrick Williams2390b1b2022-11-03 13:47:49 -0500463The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500464
465Recipes for Perl modules are simple. These recipes usually only need to
466point to the source's archive and then inherit the proper class file.
467Building is split into two methods depending on which method the module
468authors used.
469
470- Modules that use old ``Makefile.PL``-based build system require
471 ``cpan.bbclass`` in their recipes.
472
473- Modules that use ``Build.PL``-based build system require using
474 ``cpan_build.bbclass`` in their recipes.
475
Patrick Williams2390b1b2022-11-03 13:47:49 -0500476Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500477support.
478
Patrick Williams975a06f2022-10-21 14:42:47 -0500479.. _ref-classes-create-spdx:
480
Andrew Geissler517393d2023-01-13 08:55:19 -0600481``create-spdx``
482===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500483
Andrew Geissler517393d2023-01-13 08:55:19 -0600484The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600485automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
486and SDK contents.
487
488This class is meant to be inherited globally from a configuration file::
489
490 INHERIT += "create-spdx"
491
492The toplevel :term:`SPDX` output file is generated in JSON format as a
493``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
494:term:`Build Directory`. There are other related files in the same directory,
495as well as in ``tmp/deploy/spdx``.
496
497The exact behaviour of this class, and the amount of output can be controlled
498by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
499:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
500
501See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600502":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600503section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500504
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500505.. _ref-classes-cross:
506
Andrew Geissler517393d2023-01-13 08:55:19 -0600507``cross``
508=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500509
Andrew Geissler517393d2023-01-13 08:55:19 -0600510The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500511cross-compilation tools.
512
513.. _ref-classes-cross-canadian:
514
Andrew Geissler517393d2023-01-13 08:55:19 -0600515``cross-canadian``
516==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500517
Andrew Geissler517393d2023-01-13 08:55:19 -0600518The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500519the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600520":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500521section in the Yocto Project Overview and Concepts Manual for more
522discussion on these cross-compilation tools.
523
524.. _ref-classes-crosssdk:
525
Andrew Geissler517393d2023-01-13 08:55:19 -0600526``crosssdk``
527============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500528
Andrew Geissler517393d2023-01-13 08:55:19 -0600529The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500530cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600531":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500532section in the Yocto Project Overview and Concepts Manual for more
533discussion on these cross-compilation tools.
534
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500535.. _ref-classes-cve-check:
536
Andrew Geissler517393d2023-01-13 08:55:19 -0600537``cve-check``
538=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500539
Andrew Geissler517393d2023-01-13 08:55:19 -0600540The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500541and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500542inherited globally from a configuration file::
543
544 INHERIT += "cve-check"
545
Patrick Williams2390b1b2022-11-03 13:47:49 -0500546To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
547add following line to the build configuration file::
548
549 include cve-extra-exclusions.inc
550
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500551You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500552``-c cve_check`` to BitBake.
553
554After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
555and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
556
557When building, the CVE checker will emit build time warnings for any detected
558issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
559and version being compiled and no patches to address the issue are applied. Other states
560for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
561applied, and ``Ignored`` meaning that the issue can be ignored.
562
563The ``Patched`` state of a CVE issue is detected from patch files with the format
564``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
565CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
566
Patrick Williams2a254922023-08-11 09:48:11 -0500567If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
568mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
Patrick Williams2390b1b2022-11-03 13:47:49 -0500569
Patrick Williams2a254922023-08-11 09:48:11 -0500570 CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500571
572If CVE check reports that a recipe contains false positives or false negatives, these may be
573fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
574:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
575database vendor and product pairs using the syntax::
576
577 CVE_PRODUCT = "flex_project:flex"
578
579where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
580if the default recipe version :term:`PV` does not match the version numbers of the software component
581in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
582CVE database compatible version number, for example::
583
584 CVE_VERSION = "2.39"
585
586Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
587via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
588
589Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
590patching and updating the software should be done as a regular process. The data and assumptions
591required for CVE checker to reliably detect issues are frequently broken in various ways.
592These can only be detected by reviewing the details of the issues and iterating over the generated reports,
593and following what happens in other Linux distributions and in the greater open source community.
594
595You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600596":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500597section in the Development Tasks Manual.
598
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500599.. _ref-classes-debian:
600
Andrew Geissler517393d2023-01-13 08:55:19 -0600601``debian``
602==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500603
Andrew Geissler517393d2023-01-13 08:55:19 -0600604The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500605Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
606``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
607name and version as part of the package name.
608
609If a recipe creates packages for multiple libraries (shared object files
610of ``.so`` type), use the :term:`LEAD_SONAME`
611variable in the recipe to specify the library on which to apply the
612naming scheme.
613
614.. _ref-classes-deploy:
615
Andrew Geissler517393d2023-01-13 08:55:19 -0600616``deploy``
617==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500618
Andrew Geissler517393d2023-01-13 08:55:19 -0600619The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500620:term:`DEPLOY_DIR_IMAGE` directory. The main
621function of this class is to allow the deploy step to be accelerated by
622shared state. Recipes that inherit this class should define their own
623:ref:`ref-tasks-deploy` function to copy the files to be
624deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
625add the task at the appropriate place, which is usually after
626:ref:`ref-tasks-compile` or
627:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500628staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500629
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500630.. _ref-classes-devicetree:
631
632``devicetree``
633==============
634
635The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
636device tree source files that are not in the kernel tree.
637
638The compilation of out-of-tree device tree sources is the same as the kernel
639in-tree device tree compilation process. This includes the ability to include
640sources from the kernel such as SoC ``dtsi`` files as well as C header files,
641such as ``gpio.h``.
642
643The :ref:`ref-tasks-compile` task will compile two kinds of files:
644
645- Regular device tree sources with a ``.dts`` extension.
646
647- Device tree overlays, detected from the presence of the ``/plugin/;``
648 string in the file contents.
649
Patrick Williams520786c2023-06-25 16:20:36 -0500650This class deploys the generated device tree binaries into
651``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
652what the :ref:`ref-classes-kernel-devicetree` class does, with the added
653``devicetree`` subdirectory to avoid name clashes. Additionally, the device
654trees are populated into the sysroot for access via the sysroot from within
655other recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500656
Patrick Williamsb542dec2023-06-09 01:26:37 -0500657By default, all device tree sources located in :term:`DT_FILES_PATH` directory
658are compiled. To select only particular sources, set :term:`DT_FILES` to
659a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
660convenience, both ``.dts`` and ``.dtb`` extensions can be used.
661
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500662An extra padding is appended to non-overlay device trees binaries. This
663can typically be used as extra space for adding extra properties at boot time.
Patrick Williamsb542dec2023-06-09 01:26:37 -0500664The padding size can be modified by setting :term:`DT_PADDING_SIZE`
665to the desired size, in bytes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500666
667See :oe_git:`devicetree.bbclass sources
668</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
669for further variables controlling this class.
670
671Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
672recipe inheriting this class::
673
674 inherit devicetree
675 COMPATIBLE_MACHINE = "^mymachine$"
676 SRC_URI:mymachine = "file://mymachine.dts"
677
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500678.. _ref-classes-devshell:
679
Andrew Geissler517393d2023-01-13 08:55:19 -0600680``devshell``
681============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500682
Andrew Geissler517393d2023-01-13 08:55:19 -0600683The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
684policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500685section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600686information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500687
688.. _ref-classes-devupstream:
689
Andrew Geissler517393d2023-01-13 08:55:19 -0600690``devupstream``
691===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500692
Andrew Geissler517393d2023-01-13 08:55:19 -0600693The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500694:term:`BBCLASSEXTEND` to add a variant of the
695recipe that fetches from an alternative URI (e.g. Git) instead of a
Patrick Williams39653562024-03-01 08:54:02 -0600696tarball. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500697
698 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000699 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500700 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500701
702Adding the above statements to your recipe creates a variant that has
703:term:`DEFAULT_PREFERENCE` set to "-1".
704Consequently, you need to select the variant of the recipe to use it.
705Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500706``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500707
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500708 DEPENDS:append:class-devupstream = " gperf-native"
709 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500710 touch ${S}/README
711 }
712
713The class
714currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600715recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500716
Andrew Geissler09036742021-06-25 14:25:14 -0500717The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600718support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500719functionality can be added in a future release.
720
721Support for other version control systems such as Subversion is limited
722due to BitBake's automatic fetch dependencies (e.g.
723``subversion-native``).
724
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500725.. _ref-classes-externalsrc:
726
Andrew Geissler517393d2023-01-13 08:55:19 -0600727``externalsrc``
728===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500729
Andrew Geissler517393d2023-01-13 08:55:19 -0600730The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500731that is external to the OpenEmbedded build system. Building software
732from an external source tree means that the build system's normal fetch,
733unpack, and patch process is not used.
734
735By default, the OpenEmbedded build system uses the :term:`S`
736and :term:`B` variables to locate unpacked recipe source code
737and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600738:ref:`ref-classes-externalsrc` class, you use the
739:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500740ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500741
742By default, this class expects the source code to support recipe builds
743that use the :term:`B` variable to point to the directory in
744which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500745from the recipes. By default, the :term:`B` directory is set to the
746following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500747
Andrew Geissler5199d832021-09-24 16:47:35 -0500748 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500749
750See these variables for more information:
751:term:`WORKDIR`, :term:`BPN`, and
752:term:`PV`,
753
Andrew Geissler517393d2023-01-13 08:55:19 -0600754For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500755``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600756For information on how to use the :ref:`ref-classes-externalsrc` class, see the
757":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500758section in the Yocto Project Development Tasks Manual.
759
760.. _ref-classes-extrausers:
761
Andrew Geissler517393d2023-01-13 08:55:19 -0600762``extrausers``
763==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500764
Andrew Geissler517393d2023-01-13 08:55:19 -0600765The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500766to be applied at the image level. Inheriting this class either globally
767or from an image recipe allows additional user and group operations to
768be performed using the
769:term:`EXTRA_USERS_PARAMS` variable.
770
771.. note::
772
Andrew Geissler517393d2023-01-13 08:55:19 -0600773 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500774 class are not tied to a specific recipe outside of the recipe for the
775 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600776 whole. Use the :ref:`ref-classes-useradd` class to add user and group
777 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500778
Andrew Geisslerc926e172021-05-07 16:11:35 -0500779Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500780
781 inherit extrausers
782 EXTRA_USERS_PARAMS = "\
783 useradd -p '' tester; \
784 groupadd developers; \
785 userdel nobody; \
786 groupdel -g video; \
787 groupmod -g 1020 developers; \
788 usermod -s /bin/sh tester; \
789 "
790
791Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000792passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500793
Andrew Geissler9aee5002022-03-30 16:27:02 +0000794 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500795
Andrew Geissler9aee5002022-03-30 16:27:02 +0000796The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500797
798 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500799 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500800 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500801 useradd -p '${PASSWD}' tester-jim; \
802 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500803 "
804
Andrew Geisslereff27472021-10-29 15:35:00 -0500805Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500806
807 inherit extrausers
808 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500809 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500810 "
811
Patrick Williams03907ee2022-05-01 06:28:52 -0500812.. note::
813
814 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500815 generally a good idea or even legal in some jurisdictions. It is
816 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500817 image.
818
819
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600820.. _ref-classes-features_check:
821
Andrew Geissler517393d2023-01-13 08:55:19 -0600822``features_check``
823==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600824
Andrew Geissler517393d2023-01-13 08:55:19 -0600825The :ref:`ref-classes-features_check` class allows individual recipes to check
826for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
827or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600828
829This class provides support for the following variables:
830
831- :term:`REQUIRED_DISTRO_FEATURES`
832- :term:`CONFLICT_DISTRO_FEATURES`
833- :term:`ANY_OF_DISTRO_FEATURES`
834- ``REQUIRED_MACHINE_FEATURES``
835- ``CONFLICT_MACHINE_FEATURES``
836- ``ANY_OF_MACHINE_FEATURES``
837- ``REQUIRED_COMBINED_FEATURES``
838- ``CONFLICT_COMBINED_FEATURES``
839- ``ANY_OF_COMBINED_FEATURES``
840
841If any conditions specified in the recipe using the above
842variables are not met, the recipe will be skipped, and if the
843build system attempts to build the recipe then an error will be
844triggered.
845
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500846.. _ref-classes-fontcache:
847
Andrew Geissler517393d2023-01-13 08:55:19 -0600848``fontcache``
849=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500850
Andrew Geissler517393d2023-01-13 08:55:19 -0600851The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500852post-remove (postinst and postrm) scriptlets for font packages. These
853scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
854to the font information cache. Since the cache files are
855architecture-specific, ``fc-cache`` runs using QEMU if the postinst
856scriptlets need to be run on the build host during image creation.
857
858If the fonts being installed are in packages other than the main
859package, set :term:`FONT_PACKAGES` to specify the
860packages containing the fonts.
861
862.. _ref-classes-fs-uuid:
863
Andrew Geissler517393d2023-01-13 08:55:19 -0600864``fs-uuid``
865===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500866
Andrew Geissler517393d2023-01-13 08:55:19 -0600867The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500868``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600869by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500870works on ``ext`` file systems and depends on ``tune2fs``.
871
872.. _ref-classes-gconf:
873
Andrew Geissler517393d2023-01-13 08:55:19 -0600874``gconf``
875=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500876
Andrew Geissler517393d2023-01-13 08:55:19 -0600877The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500878to install GConf schemas. The schemas will be put into a separate
879package (``${``\ :term:`PN`\ ``}-gconf``) that is created
880automatically when this class is inherited. This package uses the
881appropriate post-install and post-remove (postinst/postrm) scriptlets to
882register and unregister the schemas in the target image.
883
884.. _ref-classes-gettext:
885
Andrew Geissler517393d2023-01-13 08:55:19 -0600886``gettext``
887===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500888
Andrew Geissler517393d2023-01-13 08:55:19 -0600889The :ref:`ref-classes-gettext` class provides support for building
890software that uses the GNU ``gettext`` internationalization and localization
891system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500892class.
893
Patrick Williams975a06f2022-10-21 14:42:47 -0500894.. _ref-classes-github-releases:
895
Andrew Geissler517393d2023-01-13 08:55:19 -0600896``github-releases``
897===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500898
Andrew Geissler517393d2023-01-13 08:55:19 -0600899For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500900class sets up a standard way for checking available upstream versions
901(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
902
Andrew Geissler517393d2023-01-13 08:55:19 -0600903To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500904and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
905then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
906in the value you set for :term:`SRC_URI` within the recipe.
907
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500908.. _ref-classes-gnomebase:
909
Andrew Geissler517393d2023-01-13 08:55:19 -0600910``gnomebase``
911=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500912
Andrew Geissler517393d2023-01-13 08:55:19 -0600913The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500914software from the GNOME stack. This class sets
915:term:`SRC_URI` to download the source from the GNOME
916mirrors as well as extending :term:`FILES` with the typical
917GNOME installation paths.
918
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600919.. _ref-classes-go:
920
921``go``
922======
923
924The :ref:`ref-classes-go` class supports building Go programs. The behavior of
925this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
926by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
927
928To build a Go program with the Yocto Project, you can use the
929:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
930recipe as an example.
931
932.. _ref-classes-go-mod:
933
934``go-mod``
935==========
936
937The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
938:ref:`ref-classes-go` class.
939
940See the associated :term:`GO_WORKDIR` variable.
941
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500942.. _ref-classes-gobject-introspection:
943
Andrew Geissler517393d2023-01-13 08:55:19 -0600944``gobject-introspection``
945=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500946
947Provides support for recipes building software that supports GObject
948introspection. This functionality is only enabled if the
949"gobject-introspection-data" feature is in
950:term:`DISTRO_FEATURES` as well as
951"qemu-usermode" being in
952:term:`MACHINE_FEATURES`.
953
954.. note::
955
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500956 This functionality is :ref:`backfilled <ref-features-backfill>` by default
957 and, if not applicable, should be disabled through
958 :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
Andrew Geissler09036742021-06-25 14:25:14 -0500959 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500960
961.. _ref-classes-grub-efi:
962
Andrew Geissler517393d2023-01-13 08:55:19 -0600963``grub-efi``
964============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500965
Andrew Geissler517393d2023-01-13 08:55:19 -0600966The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500967building bootable images.
968
969This class supports several variables:
970
971- :term:`INITRD`: Indicates list of filesystem images to
972 concatenate and use as an initial RAM disk (initrd) (optional).
973
974- :term:`ROOTFS`: Indicates a filesystem image to include
975 as the root filesystem (optional).
976
977- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
978 graphics and serial in the boot menu.
979
980- :term:`LABELS`: A list of targets for the automatic
981 configuration.
982
983- :term:`APPEND`: An override list of append strings for
984 each ``LABEL``.
985
986- :term:`GRUB_OPTS`: Additional options to add to the
987 configuration (optional). Options are delimited using semi-colon
988 characters (``;``).
989
990- :term:`GRUB_TIMEOUT`: Timeout before executing
991 the default ``LABEL`` (optional).
992
993.. _ref-classes-gsettings:
994
Andrew Geissler517393d2023-01-13 08:55:19 -0600995``gsettings``
996=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500997
Andrew Geissler517393d2023-01-13 08:55:19 -0600998The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500999need to install GSettings (glib) schemas. The schemas are assumed to be
1000part of the main package. Appropriate post-install and post-remove
1001(postinst/postrm) scriptlets are added to register and unregister the
1002schemas in the target image.
1003
1004.. _ref-classes-gtk-doc:
1005
Andrew Geissler517393d2023-01-13 08:55:19 -06001006``gtk-doc``
1007===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001008
Andrew Geissler517393d2023-01-13 08:55:19 -06001009The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001010``gtk-doc`` dependencies and disable ``gtk-doc``.
1011
1012.. _ref-classes-gtk-icon-cache:
1013
Andrew Geissler517393d2023-01-13 08:55:19 -06001014``gtk-icon-cache``
1015==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001016
Andrew Geissler517393d2023-01-13 08:55:19 -06001017The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001018post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
1019install icons. These scriptlets call ``gtk-update-icon-cache`` to add
1020the fonts to GTK+'s icon cache. Since the cache files are
1021architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
1022the postinst scriptlets need to be run on the build host during image
1023creation.
1024
1025.. _ref-classes-gtk-immodules-cache:
1026
Andrew Geissler517393d2023-01-13 08:55:19 -06001027``gtk-immodules-cache``
1028=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001029
Andrew Geissler517393d2023-01-13 08:55:19 -06001030The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001031post-remove (postinst/postrm) scriptlets for packages that install GTK+
1032input method modules for virtual keyboards. These scriptlets call
1033``gtk-update-icon-cache`` to add the input method modules to the cache.
1034Since the cache files are architecture-specific,
1035``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
1036need to be run on the build host during image creation.
1037
1038If the input method modules being installed are in packages other than
1039the main package, set
1040:term:`GTKIMMODULES_PACKAGES` to specify
1041the packages containing the modules.
1042
1043.. _ref-classes-gzipnative:
1044
Andrew Geissler517393d2023-01-13 08:55:19 -06001045``gzipnative``
1046==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001047
Andrew Geissler517393d2023-01-13 08:55:19 -06001048The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001049``gzip`` and ``pigz`` rather than the versions of these tools from the
1050build host.
1051
1052.. _ref-classes-icecc:
1053
Andrew Geissler517393d2023-01-13 08:55:19 -06001054``icecc``
1055=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001056
Andrew Geissler517393d2023-01-13 08:55:19 -06001057The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001058`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1059taking compile jobs and distributing them among remote machines.
1060
1061The class stages directories with symlinks from ``gcc`` and ``g++`` to
1062``icecc``, for both native and cross compilers. Depending on each
1063configure or compile, the OpenEmbedded build system adds the directories
1064at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001065``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001066compilers, respectively.
1067
1068For the cross compiler, the class creates a ``tar.gz`` file that
1069contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1070is the version of the cross-compiler used in the cross-development
1071toolchain, accordingly.
1072
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001073The class handles all three different compile stages (i.e native,
1074cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001075``tar.gz`` file to be used by the remote machines. The class also
1076supports SDK generation.
1077
1078If :term:`ICECC_PATH` is not set in your
1079``local.conf`` file, then the class tries to locate the ``icecc`` binary
1080using ``which``. If :term:`ICECC_ENV_EXEC` is set
1081in your ``local.conf`` file, the variable should point to the
1082``icecc-create-env`` script provided by the user. If you do not point to
1083a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001084provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1085</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001086
1087.. note::
1088
1089 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001090 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001091
1092If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001093specific recipes or classes, you can ask them to be ignored by Icecream
1094by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001095:term:`ICECC_RECIPE_DISABLE` and
1096:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001097respectively, in your ``local.conf`` file. Doing so causes the
1098OpenEmbedded build system to handle these compilations locally.
1099
1100Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001101:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001102your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1103using an empty :term:`PARALLEL_MAKE` variable.
1104
Andrew Geissler517393d2023-01-13 08:55:19 -06001105Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001106Consequently, if a development team has a dedicated build system that
1107populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001108reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001109system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001110
Andrew Geissler517393d2023-01-13 08:55:19 -06001111At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001112sure that all builders start with the same sstate signatures. After
1113inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001114:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001115
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001116 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001117 ICECC_DISABLED ??= "1"
1118
1119This practice
1120makes sure everyone is using the same signatures but also requires
1121individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001122individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001123
1124 ICECC_DISABLED = ""
1125
1126.. _ref-classes-image:
1127
Andrew Geissler517393d2023-01-13 08:55:19 -06001128``image``
1129=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001130
Andrew Geissler517393d2023-01-13 08:55:19 -06001131The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001132First, the root filesystem is created from packages using one of the
1133``rootfs*.bbclass`` files (depending on the package format used) and
1134then one or more image files are created.
1135
Andrew Geissler09036742021-06-25 14:25:14 -05001136- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001137 generate.
1138
Andrew Geissler09036742021-06-25 14:25:14 -05001139- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001140 install into the image.
1141
1142For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001143":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001144in the Yocto Project Development Tasks Manual. For information on how
1145images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001146":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001147Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001148
1149.. _ref-classes-image-buildinfo:
1150
Andrew Geissler517393d2023-01-13 08:55:19 -06001151``image-buildinfo``
1152===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001153
Andrew Geissler517393d2023-01-13 08:55:19 -06001154The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001155build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001156by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001157This can be useful for manually determining the origin of any given
1158image. It writes out two sections:
1159
Andrew Geissler517393d2023-01-13 08:55:19 -06001160#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001161 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1162 :term:`DISTRO_VERSION`)
1163
Andrew Geissler517393d2023-01-13 08:55:19 -06001164#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001165 build.
1166
1167Additionally, when building an SDK it will write the same contents
1168to ``/buildinfo`` by default (as specified by
1169:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001170
1171.. _ref-classes-image_types:
1172
Andrew Geissler517393d2023-01-13 08:55:19 -06001173``image_types``
1174===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001175
Andrew Geissler517393d2023-01-13 08:55:19 -06001176The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001177that you can enable through the
1178:term:`IMAGE_FSTYPES` variable. You can use this
1179class as a reference on how to add support for custom image output
1180types.
1181
Andrew Geissler517393d2023-01-13 08:55:19 -06001182By default, the :ref:`ref-classes-image` class automatically
1183enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001184``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001185
1186 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
Patrick Williams03514f12024-04-05 07:04:11 -05001187 # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
1188 # in the non-Linux SDK_OS case, such as mingw32
1189 inherit populate_sdk_base
1190 IMGCLASSES += "${@['', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001191 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1192 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1193 IMGCLASSES += "image_types_wic"
1194 IMGCLASSES += "rootfs-postcommands"
1195 IMGCLASSES += "image-postinst-intercepts"
Patrick Williams03514f12024-04-05 07:04:11 -05001196 IMGCLASSES += "overlayfs-etc"
1197 inherit_defer ${IMGCLASSES}
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001198
Andrew Geissler517393d2023-01-13 08:55:19 -06001199The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001200
1201.. note::
1202
1203 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001204 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001205 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001206
1207.. _ref-classes-image-live:
1208
Andrew Geissler517393d2023-01-13 08:55:19 -06001209``image-live``
1210==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001211
1212This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1213images contain syslinux for legacy booting, as well as the bootloader
1214specified by :term:`EFI_PROVIDER` if
1215:term:`MACHINE_FEATURES` contains "efi".
1216
1217Normally, you do not use this class directly. Instead, you add "live" to
1218:term:`IMAGE_FSTYPES`.
1219
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001220.. _ref-classes-insane:
1221
Andrew Geissler517393d2023-01-13 08:55:19 -06001222``insane``
1223==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001224
Andrew Geissler517393d2023-01-13 08:55:19 -06001225The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001226that output quality assurance checks are generated by the OpenEmbedded
1227build system. A range of checks are performed that check the build's
1228output for common problems that show up during runtime. Distribution
1229policy usually dictates whether to include this class.
1230
1231You can configure the sanity checks so that specific test failures
1232either raise a warning or an error message. Typically, failures for new
1233tests generate a warning. Subsequent failures for the same test would
1234then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001235condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001236and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001237
1238Use the :term:`WARN_QA` and
1239:term:`ERROR_QA` variables to control the behavior of
1240these checks at the global level (i.e. in your custom distro
1241configuration). However, to skip one or more checks in recipes, you
1242should use :term:`INSANE_SKIP`. For example, to skip
1243the check for symbolic link ``.so`` files in the main package of a
1244recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001245package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001246
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001247 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001248
1249Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001250are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001251output. So exercise caution when disabling these checks.
1252
Patrick Williams39653562024-03-01 08:54:02 -06001253The tests you can list with the :term:`WARN_QA` and
1254:term:`ERROR_QA` variables are:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001255
1256- ``already-stripped:`` Checks that produced binaries have not
1257 already been stripped prior to the build system extracting debug
1258 symbols. It is common for upstream software projects to default to
1259 stripping debug symbols for output binaries. In order for debugging
1260 to work on the target using ``-dbg`` packages, this stripping must be
1261 disabled.
1262
1263- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1264 size, and endianness of any binaries to ensure they match the target
1265 architecture. This test fails if any binaries do not match the type
1266 since there would be an incompatibility. The test could indicate that
1267 the wrong compiler or compiler options have been used. Sometimes
1268 software, like bootloaders, might need to bypass this check.
1269
1270- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001271 inside the output files. Not only can these leak information about
1272 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001273
1274- ``build-deps:`` Determines if a build-time dependency that is
1275 specified through :term:`DEPENDS`, explicit
1276 :term:`RDEPENDS`, or task-level dependencies exists
1277 to match any runtime dependency. This determination is particularly
1278 useful to discover where runtime dependencies are detected and added
1279 during packaging. If no explicit dependency has been specified within
1280 the metadata, at the packaging stage it is too late to ensure that
1281 the dependency is built, and thus you can end up with an error when
1282 the package is installed into the image during the
1283 :ref:`ref-tasks-rootfs` task because the auto-detected
1284 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001285 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001286 adds a dependency on the ``initscripts-functions`` package to
1287 packages that install an initscript that refers to
1288 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001289 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001290 so that the OpenEmbedded build system is able to ensure that the
1291 ``initscripts`` recipe is actually built and thus the
1292 ``initscripts-functions`` package is made available.
1293
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001294- ``configure-gettext:`` Checks that if a recipe is building something
1295 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1296 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1297 class to ensure that gettext is available during the build.
1298
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001299- ``compile-host-path:`` Checks the
1300 :ref:`ref-tasks-compile` log for indications that
1301 paths to locations on the build host were used. Using such paths
1302 might result in host contamination of the build output.
1303
Patrick Williamsb58112e2024-03-07 11:16:36 -06001304- ``cve_status_not_in_db:`` Checks for each component if CVEs that are ignored
1305 via :term:`CVE_STATUS`, that those are (still) reported for this component
1306 in the NIST database. If not, a warning is printed. This check is disabled
1307 by default.
1308
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001309- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1310 do not depend on ``-dbg`` packages, which would cause a packaging
1311 bug.
1312
1313- ``debug-files:`` Checks for ``.debug`` directories in anything but
1314 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1315 package. Thus, anything packaged elsewhere is incorrect packaging.
1316
1317- ``dep-cmp:`` Checks for invalid version comparison statements in
1318 runtime dependency relationships between packages (i.e. in
1319 :term:`RDEPENDS`,
1320 :term:`RRECOMMENDS`,
1321 :term:`RSUGGESTS`,
1322 :term:`RPROVIDES`,
1323 :term:`RREPLACES`, and
1324 :term:`RCONFLICTS` variable values). Any invalid
1325 comparisons might trigger failures or undesirable behavior when
1326 passed to the package manager.
1327
1328- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1329 ``.desktop`` files to validate their contents against the
1330 specification for ``.desktop`` files.
1331
1332- ``dev-deps:`` Checks that all packages except ``-dev`` or
1333 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1334 would be a packaging bug.
1335
1336- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1337 ``-dev`` package and not in any of the other packages. In general,
1338 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001339 ``-dev`` package is the correct location for them. In very rare
1340 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001341 are needed instead in the main package.
1342
Patrick Williams03907ee2022-05-01 06:28:52 -05001343- ``empty-dirs:`` Checks that packages are not installing files to
1344 directories that are normally expected to be empty (such as ``/tmp``)
1345 The list of directories that are checked is specified by the
1346 :term:`QA_EMPTY_DIRS` variable.
1347
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001348- ``file-rdeps:`` Checks that file-level dependencies identified by
1349 the OpenEmbedded build system at packaging time are satisfied. For
1350 example, a shell script might start with the line ``#!/bin/bash``.
1351 This line would translate to a file dependency on ``/bin/bash``. Of
1352 the three package managers that the OpenEmbedded build system
1353 supports, only RPM directly handles file-level dependencies,
1354 resolving them automatically to packages providing the files.
1355 However, the lack of that functionality in the other two package
1356 managers does not mean the dependencies do not still need resolving.
1357 This QA check attempts to ensure that explicitly declared
1358 :term:`RDEPENDS` exist to handle any file-level
1359 dependency detected in packaged files.
1360
1361- ``files-invalid:`` Checks for :term:`FILES` variable
1362 values that contain "//", which is invalid.
1363
1364- ``host-user-contaminated:`` Checks that no package produced by the
1365 recipe contains any files outside of ``/home`` with a user or group
1366 ID that matches the user running BitBake. A match usually indicates
1367 that the files are being installed with an incorrect UID/GID, since
1368 target IDs are independent from host IDs. For additional information,
1369 see the section describing the
1370 :ref:`ref-tasks-install` task.
1371
1372- ``incompatible-license:`` Report when packages are excluded from
1373 being created due to being marked with a license that is in
1374 :term:`INCOMPATIBLE_LICENSE`.
1375
1376- ``install-host-path:`` Checks the
1377 :ref:`ref-tasks-install` log for indications that
1378 paths to locations on the build host were used. Using such paths
1379 might result in host contamination of the build output.
1380
1381- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001382 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001383 way of the :term:`FILES` variable. Files that do not
1384 appear in any package cannot be present in an image later on in the
1385 build process. Ideally, all installed files should be packaged or not
1386 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001387 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001388
1389- ``invalid-chars:`` Checks that the recipe metadata variables
1390 :term:`DESCRIPTION`,
1391 :term:`SUMMARY`, :term:`LICENSE`, and
1392 :term:`SECTION` do not contain non-UTF-8 characters.
1393 Some package managers do not support such characters.
1394
1395- ``invalid-packageconfig:`` Checks that no undefined features are
1396 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001397 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001398
1399 PACKAGECONFIG[foo] = "..."
1400
Andrew Geissler09036742021-06-25 14:25:14 -05001401- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001402 file containing these paths is incorrect since ``libtool`` adds the
1403 correct sysroot prefix when using the files automatically itself.
1404
1405- ``ldflags:`` Ensures that the binaries were linked with the
1406 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001407 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001408 passed to the linker command.
1409
1410- ``libdir:`` Checks for libraries being installed into incorrect
1411 (possibly hardcoded) installation paths. For example, this test will
1412 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1413 "lib32". Another example is when recipes install
1414 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1415
1416- ``libexec:`` Checks if a package contains files in
1417 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1418 variable has been set explicitly to ``/usr/libexec``.
1419
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001420- ``mime:`` Check that if a package contains mime type files (``.xml``
1421 files in ``${datadir}/mime/packages``) that the recipe also inherits
1422 the :ref:`ref-classes-mime` class in order to ensure that these get
1423 properly installed.
1424
1425- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1426 'MimeType' key present, that the recipe inherits the
1427 :ref:`ref-classes-mime-xdg` class that is required in order for that
1428 to be activated.
1429
1430- ``missing-update-alternatives:`` Check that if a recipe sets the
1431 :term:`ALTERNATIVE` variable that the recipe also inherits
1432 :ref:`ref-classes-update-alternatives` such that the alternative will
1433 be correctly set up.
1434
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001435- ``packages-list:`` Checks for the same package being listed
1436 multiple times through the :term:`PACKAGES` variable
1437 value. Installing the package in this manner can cause errors during
1438 packaging.
1439
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001440- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1441 them to apply incorrectly if the underlying code changes.
1442
1443- ``patch-status-core:`` Checks that the Upstream-Status is specified
1444 and valid in the headers of patches for recipes in the OE-Core layer.
1445
1446- ``patch-status-noncore:`` Checks that the Upstream-Status is specified
1447 and valid in the headers of patches for recipes in layers other than
1448 OE-Core.
1449
1450- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1451 installed and packaged by a recipe.
1452
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001453- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1454 invalid format.
1455
1456- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1457 invalid format.
1458
1459- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1460 'link' where the specified target already exists.
1461
1462- ``perms:`` Currently, this check is unused but reserved.
1463
1464- ``pkgconfig:`` Checks ``.pc`` files for any
1465 :term:`TMPDIR`/:term:`WORKDIR` paths.
1466 Any ``.pc`` file containing these paths is incorrect since
1467 ``pkg-config`` itself adds the correct sysroot prefix when the files
1468 are accessed.
1469
1470- ``pkgname:`` Checks that all packages in
1471 :term:`PACKAGES` have names that do not contain
1472 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1473 -).
1474
Andrew Geissler09036742021-06-25 14:25:14 -05001475- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001476 undefined during :ref:`ref-tasks-package`.
1477
1478- ``pkgvarcheck:`` Checks through the variables
1479 :term:`RDEPENDS`,
1480 :term:`RRECOMMENDS`,
1481 :term:`RSUGGESTS`,
1482 :term:`RCONFLICTS`,
1483 :term:`RPROVIDES`,
1484 :term:`RREPLACES`, :term:`FILES`,
1485 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1486 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1487 there are variable sets that are not package-specific. Using these
1488 variables without a package suffix is bad practice, and might
1489 unnecessarily complicate dependencies of other packages within the
1490 same recipe or have other unintended consequences.
1491
1492- ``pn-overrides:`` Checks that a recipe does not have a name
1493 (:term:`PN`) value that appears in
1494 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001495 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1496 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001497 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001498 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001499 turn into ``FILES = "xyz"``.
1500
1501- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001502 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001503 options are being passed to the linker commands and your binaries
1504 have potential security issues.
1505
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001506- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1507 in a packaged script is not longer than 128 characters, which can cause
1508 an error at runtime depending on the operating system.
1509
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001510- ``split-strip:`` Reports that splitting or stripping debug symbols
1511 from binaries has failed.
1512
1513- ``staticdev:`` Checks for static library files (``*.a``) in
1514 non-``staticdev`` packages.
1515
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001516- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1517 does not contain a reference to ``${PN}`` (instead of the correct
1518 ``${BPN}``) nor refers to unstable Github archive tarballs.
1519
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001520- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1521 into :term:`TMPDIR` on the host. Such symlinks will
1522 work on the host, but are clearly invalid when running on the target.
1523
1524- ``textrel:`` Checks for ELF binaries that contain relocations in
1525 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001526 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001527 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001528 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001529
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001530- ``unhandled-features-check:`` check that if one of the variables that
1531 the :ref:`ref-classes-features_check` class supports (e.g.
Patrick Williamsb542dec2023-06-09 01:26:37 -05001532 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001533 also inherits :ref:`ref-classes-features_check` in order for the
1534 requirement to actually work.
1535
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001536- ``unimplemented-ptest:`` Checks that ptests are implemented for upstream
1537 tests.
1538
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001539- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1540 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001541 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001542
1543- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1544 in the binaries that by default on a standard system are searched by
1545 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1546 not cause any breakage, they do waste space and are unnecessary.
1547
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001548- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1549 check will ensure that no package installs files to root (``/bin``,
1550 ``/sbin``, ``/lib``, ``/lib64``) directories.
1551
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001552- ``var-undefined:`` Reports when variables fundamental to packaging
1553 (i.e. :term:`WORKDIR`,
1554 :term:`DEPLOY_DIR`, :term:`D`,
1555 :term:`PN`, and :term:`PKGD`) are undefined
1556 during :ref:`ref-tasks-package`.
1557
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001558- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1559 class is enabled, reports when a package being written out has a lower
1560 version than the previously written package under the same name. If
1561 you are placing output packages into a feed and upgrading packages on
1562 a target system using that feed, the version of a package going
1563 backwards can result in the target system not correctly upgrading to
1564 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001565
1566 .. note::
1567
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001568 This is only relevant when you are using runtime package management
1569 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001570
1571- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1572 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1573 driver ABI names. All drivers should depend on the ABI versions that
1574 they have been built against. Driver recipes that include
1575 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1576 automatically get these versions. Consequently, you should only need
1577 to explicitly add dependencies to binary driver recipes.
1578
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001579.. _ref-classes-kernel:
1580
Andrew Geissler517393d2023-01-13 08:55:19 -06001581``kernel``
1582==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001583
Andrew Geissler517393d2023-01-13 08:55:19 -06001584The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001585code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001586:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001587using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001588
Andrew Geissler3eeda902023-05-19 10:14:02 -05001589If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
1590:ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
1591so it is automatically used as the kernel configuration for the build. This
1592copy is not performed in case ``.config`` already exists there: this allows
1593recipes to produce a configuration by other means in
1594``do_configure:prepend``.
1595
1596Each built kernel module is packaged separately and inter-module
1597dependencies are created by parsing the ``modinfo`` output. If all modules
1598are required, then installing the ``kernel-modules`` package installs all
1599packages with modules and various other kernel packages such as
1600``kernel-vmlinux``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001601
Andrew Geissler517393d2023-01-13 08:55:19 -06001602The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001603RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1604information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001605":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001606the Yocto Project Development Tasks Manual.
1607
Andrew Geissler517393d2023-01-13 08:55:19 -06001608Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1609internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1610:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001611
1612.. _ref-classes-kernel-arch:
1613
Andrew Geissler517393d2023-01-13 08:55:19 -06001614``kernel-arch``
1615===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001616
Andrew Geissler517393d2023-01-13 08:55:19 -06001617The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001618Linux kernel compilation (including modules).
1619
1620.. _ref-classes-kernel-devicetree:
1621
Andrew Geissler517393d2023-01-13 08:55:19 -06001622``kernel-devicetree``
1623=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001624
Andrew Geissler517393d2023-01-13 08:55:19 -06001625The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1626:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001627
Patrick Williamsb542dec2023-06-09 01:26:37 -05001628Its behavior is mainly controlled by the following variables:
1629
1630- :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
1631- :term:`KERNEL_DTBDEST`: directory where to install DTB files
1632- :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
1633- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1634- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1635
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001636.. _ref-classes-kernel-fitimage:
1637
Andrew Geissler517393d2023-01-13 08:55:19 -06001638``kernel-fitimage``
1639===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001640
Andrew Geissler517393d2023-01-13 08:55:19 -06001641The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
Patrick Williamsb542dec2023-06-09 01:26:37 -05001642device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001643into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001644of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1645However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001646limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001647an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Patrick Williamsb542dec2023-06-09 01:26:37 -05001648device trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001649
1650To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Patrick Williams2a254922023-08-11 09:48:11 -05001651is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
1652:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001653
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001654The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001655when creating the FIT image are specified using the
1656:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1657
1658Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001659:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001660address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001661specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
Andrew Geissler3eeda902023-05-19 10:14:02 -05001662:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1663is necessary if such addresses are 64 bit ones.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001664
1665Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001666:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001667The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001668specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001669and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001670
1671Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001672:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001673The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001674is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
Patrick Williams2a254922023-08-11 09:48:11 -05001675:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
1676:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
1677is not set to 1.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001678
Andrew Geissler517393d2023-01-13 08:55:19 -06001679Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1680:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1681In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001682in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001683When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1684The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Patrick Williams2a254922023-08-11 09:48:11 -05001685is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001686The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001687by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1688
1689Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001690:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001691The boot script is specified in the ITS file as a text file containing
1692U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001693U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001694So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001695class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
Patrick Williams2a254922023-08-11 09:48:11 -05001696load the boot script from the FIT image and execute it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001697
Patrick Williams2a254922023-08-11 09:48:11 -05001698The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001699variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1700:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1701appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001702:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Patrick Williams2a254922023-08-11 09:48:11 -05001703"rsa2048" respectively. The keys for signing the FIT image can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001704the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001705:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001706
1707
1708.. _ref-classes-kernel-grub:
1709
Andrew Geissler517393d2023-01-13 08:55:19 -06001710``kernel-grub``
1711===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001712
Andrew Geissler517393d2023-01-13 08:55:19 -06001713The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001714the kernel as the priority boot mechanism while installing a RPM to
1715update the kernel on a deployed target.
1716
1717.. _ref-classes-kernel-module-split:
1718
Andrew Geissler517393d2023-01-13 08:55:19 -06001719``kernel-module-split``
1720=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001721
Andrew Geissler517393d2023-01-13 08:55:19 -06001722The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001723splitting Linux kernel modules into separate packages.
1724
1725.. _ref-classes-kernel-uboot:
1726
Andrew Geissler517393d2023-01-13 08:55:19 -06001727``kernel-uboot``
1728================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001729
Andrew Geissler517393d2023-01-13 08:55:19 -06001730The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001731vmlinux-style kernel sources.
1732
1733.. _ref-classes-kernel-uimage:
1734
Andrew Geissler517393d2023-01-13 08:55:19 -06001735``kernel-uimage``
1736=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001737
Andrew Geissler517393d2023-01-13 08:55:19 -06001738The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001739
1740.. _ref-classes-kernel-yocto:
1741
Andrew Geissler517393d2023-01-13 08:55:19 -06001742``kernel-yocto``
1743================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001744
Andrew Geissler517393d2023-01-13 08:55:19 -06001745The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001746from linux-yocto style kernel source repositories.
1747
1748.. _ref-classes-kernelsrc:
1749
Andrew Geissler517393d2023-01-13 08:55:19 -06001750``kernelsrc``
1751=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001752
Andrew Geissler517393d2023-01-13 08:55:19 -06001753The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001754
1755.. _ref-classes-lib_package:
1756
Andrew Geissler517393d2023-01-13 08:55:19 -06001757``lib_package``
1758===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001759
Andrew Geissler517393d2023-01-13 08:55:19 -06001760The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001761produce executable binaries, where those binaries should not be
1762installed by default along with the library. Instead, the binaries are
1763added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1764make their installation optional.
1765
1766.. _ref-classes-libc*:
1767
Andrew Geissler517393d2023-01-13 08:55:19 -06001768``libc*``
1769=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001770
Andrew Geissler517393d2023-01-13 08:55:19 -06001771The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001772
Patrick Williams2390b1b2022-11-03 13:47:49 -05001773- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001774 ``libc``.
1775
Patrick Williams2390b1b2022-11-03 13:47:49 -05001776- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001777 ``eglibc``.
1778
1779.. _ref-classes-license:
1780
Andrew Geissler517393d2023-01-13 08:55:19 -06001781``license``
1782===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001783
Andrew Geissler517393d2023-01-13 08:55:19 -06001784The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001785exclusion. This class is enabled by default using the default value for
1786the :term:`INHERIT_DISTRO` variable.
1787
1788.. _ref-classes-linux-kernel-base:
1789
Andrew Geissler517393d2023-01-13 08:55:19 -06001790``linux-kernel-base``
1791=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001792
Andrew Geissler517393d2023-01-13 08:55:19 -06001793The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001794recipes that build out of the Linux kernel source tree. These builds
1795goes beyond the kernel itself. For example, the Perf recipe also
1796inherits this class.
1797
1798.. _ref-classes-linuxloader:
1799
Andrew Geissler517393d2023-01-13 08:55:19 -06001800``linuxloader``
1801===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001802
1803Provides the function ``linuxloader()``, which gives the value of the
1804dynamic loader/linker provided on the platform. This value is used by a
1805number of other classes.
1806
1807.. _ref-classes-logging:
1808
Andrew Geissler517393d2023-01-13 08:55:19 -06001809``logging``
1810===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001811
Andrew Geissler517393d2023-01-13 08:55:19 -06001812The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001813messages for various BitBake severity levels (i.e. ``bbplain``,
1814``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1815
Andrew Geissler517393d2023-01-13 08:55:19 -06001816This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001817class.
1818
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001819.. _ref-classes-meson:
1820
1821``meson``
1822=========
1823
1824The :ref:`ref-classes-meson` class allows to create recipes that build software
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001825using the `Meson <https://mesonbuild.com/>`__ build system. You can use the
1826:term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON`
1827variables to specify additional configuration options to be passed using the
1828``meson`` command line.
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001829
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001830.. _ref-classes-metadata_scm:
1831
Andrew Geissler517393d2023-01-13 08:55:19 -06001832``metadata_scm``
1833================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001834
Andrew Geissler517393d2023-01-13 08:55:19 -06001835The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001836branch and revision of a Source Code Manager (SCM) repository.
1837
Andrew Geissler517393d2023-01-13 08:55:19 -06001838The :ref:`ref-classes-base` class uses this class to print the revisions of
1839each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1840class is enabled by default because it is inherited by the
1841:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001842
1843.. _ref-classes-migrate_localcount:
1844
Andrew Geissler517393d2023-01-13 08:55:19 -06001845``migrate_localcount``
1846======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001847
Andrew Geissler517393d2023-01-13 08:55:19 -06001848The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001849increments it appropriately.
1850
1851.. _ref-classes-mime:
1852
Andrew Geissler517393d2023-01-13 08:55:19 -06001853``mime``
1854========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001855
Andrew Geissler517393d2023-01-13 08:55:19 -06001856The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001857(postinst/postrm) scriptlets for packages that install MIME type files.
1858These scriptlets call ``update-mime-database`` to add the MIME types to
1859the shared database.
1860
Patrick Williams7784c422022-11-17 07:29:11 -06001861.. _ref-classes-mime-xdg:
1862
Andrew Geissler517393d2023-01-13 08:55:19 -06001863``mime-xdg``
1864============
Patrick Williams7784c422022-11-17 07:29:11 -06001865
Andrew Geissler517393d2023-01-13 08:55:19 -06001866The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001867post-install and post-remove (postinst/postrm) scriptlets for packages
1868that install ``.desktop`` files containing ``MimeType`` entries.
1869These scriptlets call ``update-desktop-database`` to add the MIME types
1870to the database of MIME types handled by desktop files.
1871
1872Thanks to this class, when users open a file through a file browser
1873on recently created images, they don't have to choose the application
1874to open the file from the pool of all known applications, even the ones
1875that cannot open the selected file.
1876
1877If you have recipes installing their ``.desktop`` files as absolute
1878symbolic links, the detection of such files cannot be done by the current
1879implementation of this class. In this case, you have to add the corresponding
1880package names to the :term:`MIME_XDG_PACKAGES` variable.
1881
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001882.. _ref-classes-mirrors:
1883
Andrew Geissler517393d2023-01-13 08:55:19 -06001884``mirrors``
1885===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001886
Andrew Geissler517393d2023-01-13 08:55:19 -06001887The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001888:term:`MIRRORS` entries for source code mirrors. These
1889mirrors provide a fall-back path in case the upstream source specified
1890in :term:`SRC_URI` within recipes is unavailable.
1891
1892This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001893:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001894
1895.. _ref-classes-module:
1896
Andrew Geissler517393d2023-01-13 08:55:19 -06001897``module``
1898==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001899
Andrew Geissler517393d2023-01-13 08:55:19 -06001900The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1901kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1902:ref:`ref-classes-kernel-module-split` classes, and implements the
1903:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001904everything needed to build and package a kernel module.
1905
1906For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001907":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001908section in the Yocto Project Linux Kernel Development Manual.
1909
1910.. _ref-classes-module-base:
1911
Andrew Geissler517393d2023-01-13 08:55:19 -06001912``module-base``
1913===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001914
Andrew Geissler517393d2023-01-13 08:55:19 -06001915The :ref:`ref-classes-module-base` class provides the base functionality for
1916building Linux kernel modules. Typically, a recipe that builds software that
1917includes one or more kernel modules and has its own means of building the module
1918inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1919class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001920
1921.. _ref-classes-multilib*:
1922
Andrew Geissler517393d2023-01-13 08:55:19 -06001923``multilib*``
1924=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001925
Andrew Geissler517393d2023-01-13 08:55:19 -06001926The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001927different target optimizations or target architectures and installing
1928them side-by-side in the same image.
1929
1930For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001931":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001932section in the Yocto Project Development Tasks Manual.
1933
1934.. _ref-classes-native:
1935
Andrew Geissler517393d2023-01-13 08:55:19 -06001936``native``
1937==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001938
Andrew Geissler517393d2023-01-13 08:55:19 -06001939The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001940build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1941or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001942
1943You can create a recipe that builds tools that run natively on the host
1944a couple different ways:
1945
Andrew Geissler517393d2023-01-13 08:55:19 -06001946- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001947 class. If you use this method, you must order the inherit statement
1948 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001949 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001950
1951 .. note::
1952
1953 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001954 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001955
1956 myrecipe-native.bb
1957
1958
1959 Not using this naming convention can lead to subtle problems
1960 caused by existing code that depends on that naming convention.
1961
Andrew Geisslerc926e172021-05-07 16:11:35 -05001962- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001963
1964 BBCLASSEXTEND = "native"
1965
1966 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001967 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001968 specify any functionality specific to the respective native or target
1969 case.
1970
Andrew Geissler517393d2023-01-13 08:55:19 -06001971Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001972methods. The advantage of the second method is that you do not need to
1973have two separate recipes (assuming you need both) for native and
1974target. All common parts of the recipe are automatically shared.
1975
1976.. _ref-classes-nativesdk:
1977
Andrew Geissler517393d2023-01-13 08:55:19 -06001978``nativesdk``
1979=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001980
Andrew Geissler517393d2023-01-13 08:55:19 -06001981The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001982wish to build tools to run as part of an SDK (i.e. tools that run on
1983:term:`SDKMACHINE`).
1984
1985You can create a recipe that builds tools that run on the SDK machine a
1986couple different ways:
1987
Andrew Geisslereff27472021-10-29 15:35:00 -05001988- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001989 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001990 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001991 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001992
Andrew Geissler517393d2023-01-13 08:55:19 -06001993- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001994
1995 BBCLASSEXTEND = "nativesdk"
1996
1997 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001998 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001999 specify any functionality specific to the respective SDK machine or
2000 target case.
2001
2002.. note::
2003
Andrew Geisslerc926e172021-05-07 16:11:35 -05002004 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002005
2006 nativesdk-myrecipe.bb
2007
2008
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002009 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002010 depends on the naming convention.
2011
Andrew Geissler517393d2023-01-13 08:55:19 -06002012Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002013methods. The advantage of the second method is that you do not need to
2014have two separate recipes (assuming you need both) for the SDK machine
2015and the target. All common parts of the recipe are automatically shared.
2016
2017.. _ref-classes-nopackages:
2018
Andrew Geissler517393d2023-01-13 08:55:19 -06002019``nopackages``
2020==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002021
2022Disables packaging tasks for those recipes and classes where packaging
2023is not needed.
2024
2025.. _ref-classes-npm:
2026
Andrew Geissler517393d2023-01-13 08:55:19 -06002027``npm``
2028=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002029
Patrick Williams7784c422022-11-17 07:29:11 -06002030Provides support for building Node.js software fetched using the
2031:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002032
2033.. note::
2034
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002035 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002036 fetcher to have dependencies fetched and packaged automatically.
2037
2038For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002039":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002040section in the Yocto Project Development Tasks Manual.
2041
2042.. _ref-classes-oelint:
2043
Andrew Geissler517393d2023-01-13 08:55:19 -06002044``oelint``
2045==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002046
Andrew Geissler517393d2023-01-13 08:55:19 -06002047The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002048``meta/classes`` in the :term:`Source Directory`.
2049
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002050There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06002051are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002052one such example. However, being aware of this class can reduce the
2053proliferation of different versions of similar classes across multiple
2054layers.
2055
Andrew Geissler5199d832021-09-24 16:47:35 -05002056.. _ref-classes-overlayfs:
2057
Andrew Geissler517393d2023-01-13 08:55:19 -06002058``overlayfs``
2059=============
Andrew Geissler5199d832021-09-24 16:47:35 -05002060
Andrew Geissler595f6302022-01-24 19:11:47 +00002061It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05002062But a lot of different applications might want to have read-write access to
2063some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00002064overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06002065between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05002066to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00002067root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05002068
2069To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
2070layer in your machine configuration. The underlying file system can be anything that
2071is supported by ``overlayfs``. This has to be done in your machine configuration::
2072
2073 OVERLAYFS_MOUNT_POINT[data] = "/data"
2074
2075.. note::
2076
2077 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2078 * Only the existence of the systemd mount unit file is checked, not its contents.
2079 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002080 to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__.
Andrew Geissler5199d832021-09-24 16:47:35 -05002081
2082The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2083(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2084
2085Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2086
2087 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2088
2089To support several mount points you can use a different variable flag. Assuming we
2090want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002091survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2092file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002093
2094In your machine configuration::
2095
2096 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2097
2098and then in your recipe::
2099
2100 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2101
Andrew Geissler595f6302022-01-24 19:11:47 +00002102On a practical note, your application recipe might require multiple
2103overlays to be mounted before running to avoid writing to the underlying
2104file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002105To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002106helper service for mounting overlays. This helper service is named
2107``${PN}-overlays.service`` and can be depended on in your application recipe
2108(named ``application`` in the following example) ``systemd`` unit by adding
2109to the unit the following::
2110
2111 [Unit]
2112 After=application-overlays.service
2113 Requires=application-overlays.service
2114
Andrew Geissler5199d832021-09-24 16:47:35 -05002115.. note::
2116
2117 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002118 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002119
2120.. _ref-classes-overlayfs-etc:
2121
Andrew Geissler517393d2023-01-13 08:55:19 -06002122``overlayfs-etc``
2123=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002124
2125In order to have the ``/etc`` directory in overlayfs a special handling at early
2126boot stage is required. The idea is to supply a custom init script that mounts
2127``/etc`` before launching the actual init program, because the latter already
2128requires ``/etc`` to be mounted.
2129
2130Example usage in image recipe::
2131
2132 IMAGE_FEATURES += "overlayfs-etc"
2133
2134.. note::
2135
2136 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2137
2138Your machine configuration should define at least the device, mount point, and file system type
2139you are going to use for ``overlayfs``::
2140
2141 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2142 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2143 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2144
2145To control more mount options you should consider setting mount options
2146(``defaults`` is used by default)::
2147
2148 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2149
2150The class provides two options for ``/sbin/init`` generation:
2151
2152- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2153 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2154 that you won't need to change any kernel parameters in order to make it work,
2155 but it poses a restriction that package-management can't be used, because updating
2156 the init manager would remove the generated script.
2157
2158- If you wish to keep original init as is, you can set::
2159
2160 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2161
2162 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2163 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002164
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002165.. _ref-classes-own-mirrors:
2166
Andrew Geissler517393d2023-01-13 08:55:19 -06002167``own-mirrors``
2168===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002169
Andrew Geissler517393d2023-01-13 08:55:19 -06002170The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002171:term:`PREMIRRORS` from which to first fetch source
2172before attempting to fetch it from the upstream specified in
2173:term:`SRC_URI` within each recipe.
2174
2175To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002176:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002177
2178 INHERIT += "own-mirrors"
2179 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2180
2181You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002182in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002183
2184.. _ref-classes-package:
2185
Andrew Geissler517393d2023-01-13 08:55:19 -06002186``package``
2187===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002188
Andrew Geissler517393d2023-01-13 08:55:19 -06002189The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002190output. The core generic functionality is in ``package.bbclass``. The
2191code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002192package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002193:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002194
2195You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002196:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002197configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002198When defining the variable, you can specify one or more package types.
2199Since images are generated from packages, a packaging class is needed
2200to enable image generation. The first class listed in this variable is
2201used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002202
2203If you take the optional step to set up a repository (package feed) on
2204the development host that can be used by DNF, you can install packages
2205from the feed while you are running the image on the target (i.e.
2206runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002207":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002208section in the Yocto Project Development Tasks Manual.
2209
2210The package-specific class you choose can affect build-time performance
2211and has space ramifications. In general, building a package with IPK
2212takes about thirty percent less time as compared to using RPM to build
2213the same or similar package. This comparison takes into account a
2214complete build of the package with all dependencies previously built.
2215The reason for this discrepancy is because the RPM package manager
2216creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002217manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002218":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002219
2220Before making your package manager decision, however, you should
2221consider some further things about using RPM:
2222
2223- RPM starts to provide more abilities than IPK due to the fact that it
2224 processes more Metadata. For example, this information includes
2225 individual file types, file checksum generation and evaluation on
2226 install, sparse file support, conflict detection and resolution for
2227 Multilib systems, ACID style upgrade, and repackaging abilities for
2228 rollbacks.
2229
2230- For smaller systems, the extra space used for the Berkeley Database
2231 and the amount of metadata when using RPM can affect your ability to
2232 perform on-device upgrades.
2233
2234You can find additional information on the effects of the package class
2235at these two Yocto Project mailing list links:
2236
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002237- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002238
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002239- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002240
2241.. _ref-classes-package_deb:
2242
Andrew Geissler517393d2023-01-13 08:55:19 -06002243``package_deb``
2244===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002245
Andrew Geissler517393d2023-01-13 08:55:19 -06002246The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002247use the Debian (i.e. ``.deb``) file format. The class ensures the
2248packages are written out in a ``.deb`` file format to the
2249``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2250
Andrew Geissler517393d2023-01-13 08:55:19 -06002251This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002252is enabled through the :term:`PACKAGE_CLASSES`
2253variable in the ``local.conf`` file.
2254
2255.. _ref-classes-package_ipk:
2256
Andrew Geissler517393d2023-01-13 08:55:19 -06002257``package_ipk``
2258===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002259
Andrew Geissler517393d2023-01-13 08:55:19 -06002260The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002261use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2262are written out in a ``.ipk`` file format to the
2263``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2264
Andrew Geissler517393d2023-01-13 08:55:19 -06002265This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002266is enabled through the :term:`PACKAGE_CLASSES`
2267variable in the ``local.conf`` file.
2268
2269.. _ref-classes-package_rpm:
2270
Andrew Geissler517393d2023-01-13 08:55:19 -06002271``package_rpm``
2272===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002273
Andrew Geissler517393d2023-01-13 08:55:19 -06002274The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002275use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2276are written out in a ``.rpm`` file format to the
2277``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2278
Andrew Geissler517393d2023-01-13 08:55:19 -06002279This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002280is enabled through the :term:`PACKAGE_CLASSES`
2281variable in the ``local.conf`` file.
2282
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002283.. _ref-classes-packagedata:
2284
Andrew Geissler517393d2023-01-13 08:55:19 -06002285``packagedata``
2286===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002287
Andrew Geissler517393d2023-01-13 08:55:19 -06002288The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002289``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2290files contain information about each output package produced by the
2291OpenEmbedded build system.
2292
2293This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002294:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002295
2296.. _ref-classes-packagegroup:
2297
Andrew Geissler517393d2023-01-13 08:55:19 -06002298``packagegroup``
2299================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002300
Andrew Geissler517393d2023-01-13 08:55:19 -06002301The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002302group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002303so forth). It is highly recommended that all package group recipes
2304inherit this class.
2305
2306For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002307":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002308section in the Yocto Project Development Tasks Manual.
2309
2310Previously, this class was called the ``task`` class.
2311
2312.. _ref-classes-patch:
2313
Andrew Geissler517393d2023-01-13 08:55:19 -06002314``patch``
2315=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002316
Andrew Geissler517393d2023-01-13 08:55:19 -06002317The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002318during the :ref:`ref-tasks-patch` task.
2319
2320This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002321:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002322
2323.. _ref-classes-perlnative:
2324
Andrew Geissler517393d2023-01-13 08:55:19 -06002325``perlnative``
2326==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002327
Andrew Geissler517393d2023-01-13 08:55:19 -06002328When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002329native version of Perl built by the build system rather than using the
2330version provided by the build host.
2331
Patrick Williams975a06f2022-10-21 14:42:47 -05002332.. _ref-classes-pypi:
2333
Andrew Geissler517393d2023-01-13 08:55:19 -06002334``pypi``
2335========
Patrick Williams975a06f2022-10-21 14:42:47 -05002336
Andrew Geissler517393d2023-01-13 08:55:19 -06002337The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002338Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2339By default it determines the PyPI package name based upon :term:`BPN`
2340(stripping the "python-" or "python3-" prefix off if present), however in
2341some cases you may need to set it manually in the recipe by setting
2342:term:`PYPI_PACKAGE`.
2343
Andrew Geissler517393d2023-01-13 08:55:19 -06002344Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002345:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2346and :term:`CVE_PRODUCT`.
2347
Patrick Williams45852732022-04-02 08:58:32 -05002348.. _ref-classes-python_flit_core:
2349
Andrew Geissler517393d2023-01-13 08:55:19 -06002350``python_flit_core``
2351====================
Patrick Williams45852732022-04-02 08:58:32 -05002352
Andrew Geissler517393d2023-01-13 08:55:19 -06002353The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002354the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2355``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2356section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2357
2358Python modules built with ``flit_core.buildapi`` are pure Python (no
2359``C`` or ``Rust`` extensions).
2360
Andrew Geissler517393d2023-01-13 08:55:19 -06002361Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002362
Andrew Geissler9aee5002022-03-30 16:27:02 +00002363.. _ref-classes-python_pep517:
2364
Andrew Geissler517393d2023-01-13 08:55:19 -06002365``python_pep517``
2366=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002367
Andrew Geissler517393d2023-01-13 08:55:19 -06002368The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002369archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002370
Patrick Williams45852732022-04-02 08:58:32 -05002371Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002372inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002373
Andrew Geissler517393d2023-01-13 08:55:19 -06002374Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2375:ref:`ref-classes-python_setuptools_build_meta`, and
2376:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002377
2378.. _ref-classes-python_poetry_core:
2379
Andrew Geissler517393d2023-01-13 08:55:19 -06002380``python_poetry_core``
2381======================
Patrick Williams45852732022-04-02 08:58:32 -05002382
Andrew Geissler517393d2023-01-13 08:55:19 -06002383The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002384`Poetry Core <https://python-poetry.org>`__ build system.
2385
Andrew Geissler517393d2023-01-13 08:55:19 -06002386Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002387
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002388.. _ref-classes-python_pyo3:
2389
2390``python_pyo3``
2391===============
2392
2393The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2394written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2395environment for cross compilation.
2396
2397This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2398and is not meant to be used directly in recipes.
2399
2400.. _ref-classes-python-setuptools3_rust:
2401
2402``python-setuptools3_rust``
2403===========================
2404
2405The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2406extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2407to compile and distribute Python extensions written in Rust as easily
2408as if they were written in C.
2409
2410This class inherits the :ref:`ref-classes-setuptools3` and
2411:ref:`ref-classes-python_pyo3` classes.
2412
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002413.. _ref-classes-pixbufcache:
2414
Andrew Geissler517393d2023-01-13 08:55:19 -06002415``pixbufcache``
2416===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002417
Andrew Geissler517393d2023-01-13 08:55:19 -06002418The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002419post-remove (postinst/postrm) scriptlets for packages that install
2420pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2421call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2422Since the cache files are architecture-specific, ``update_pixbuf_cache``
2423is run using QEMU if the postinst scriptlets need to be run on the build
2424host during image creation.
2425
2426If the pixbuf loaders being installed are in packages other than the
2427recipe's main package, set
2428:term:`PIXBUF_PACKAGES` to specify the packages
2429containing the loaders.
2430
2431.. _ref-classes-pkgconfig:
2432
Andrew Geissler517393d2023-01-13 08:55:19 -06002433``pkgconfig``
2434=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002435
Andrew Geissler517393d2023-01-13 08:55:19 -06002436The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002437library information by using ``pkg-config``. This class aims to smooth
2438integration of ``pkg-config`` into libraries that use it.
2439
2440During staging, BitBake installs ``pkg-config`` data into the
2441``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002442``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002443files.
2444
2445.. _ref-classes-populate-sdk:
2446
Andrew Geissler517393d2023-01-13 08:55:19 -06002447``populate_sdk``
2448================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002449
Andrew Geissler517393d2023-01-13 08:55:19 -06002450The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002451information on advantages gained when building a cross-development
2452toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002453task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002454section in the Yocto Project Application Development and the Extensible
2455Software Development Kit (eSDK) manual.
2456
2457.. _ref-classes-populate-sdk-*:
2458
Andrew Geissler517393d2023-01-13 08:55:19 -06002459``populate_sdk_*``
2460==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002461
Andrew Geissler517393d2023-01-13 08:55:19 -06002462The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002463following classes:
2464
Patrick Williams2390b1b2022-11-03 13:47:49 -05002465- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002466 all package managers (i.e. DEB, RPM, and opkg).
2467
Patrick Williams2390b1b2022-11-03 13:47:49 -05002468- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002469 package manager.
2470
Patrick Williams2390b1b2022-11-03 13:47:49 -05002471- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002472 package manager.
2473
Patrick Williams2390b1b2022-11-03 13:47:49 -05002474- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002475 (IPK format) package manager.
2476
Patrick Williams2390b1b2022-11-03 13:47:49 -05002477- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002478 package managers.
2479
Patrick Williams2390b1b2022-11-03 13:47:49 -05002480The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002481``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2482:term:`IMAGE_PKGTYPE`.
2483
2484The base class ensures all source and destination directories are
2485established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002486:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002487``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2488contains the cross-compiler and associated tooling, and the target,
2489which contains a target root filesystem that is configured for the SDK
2490usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002491which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002492
2493 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2494 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2495
2496Finally, the base populate SDK class creates the toolchain environment
2497setup script, the tarball of the SDK, and the installer.
2498
Patrick Williams2390b1b2022-11-03 13:47:49 -05002499The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2500:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2501These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002502class.
2503
2504For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002505the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002506section in the Yocto Project Overview and Concepts Manual. For
2507information on advantages gained when building a cross-development
2508toolchain using the :ref:`ref-tasks-populate_sdk`
2509task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002510":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002511section in the Yocto Project Application Development and the Extensible
2512Software Development Kit (eSDK) manual.
2513
2514.. _ref-classes-prexport:
2515
Andrew Geissler517393d2023-01-13 08:55:19 -06002516``prexport``
2517============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002518
Andrew Geissler517393d2023-01-13 08:55:19 -06002519The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002520:term:`PR` values.
2521
2522.. note::
2523
2524 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002525 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002526
2527.. _ref-classes-primport:
2528
Andrew Geissler517393d2023-01-13 08:55:19 -06002529``primport``
2530============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002531
Andrew Geissler517393d2023-01-13 08:55:19 -06002532The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002533:term:`PR` values.
2534
2535.. note::
2536
2537 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002538 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002539
2540.. _ref-classes-prserv:
2541
Andrew Geissler517393d2023-01-13 08:55:19 -06002542``prserv``
2543==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002544
Andrew Geissler517393d2023-01-13 08:55:19 -06002545The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2546service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002547automatically manage the incrementing of the :term:`PR`
2548variable for each recipe.
2549
2550This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002551:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002552build system will not enable the functionality of this class unless
2553:term:`PRSERV_HOST` has been set.
2554
2555.. _ref-classes-ptest:
2556
Andrew Geissler517393d2023-01-13 08:55:19 -06002557``ptest``
2558=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002559
Andrew Geissler517393d2023-01-13 08:55:19 -06002560The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002561runtime tests for recipes that build software that provides these tests.
2562
2563This class is intended to be inherited by individual recipes. However,
2564the class' functionality is largely disabled unless "ptest" appears in
2565:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002566":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002567section in the Yocto Project Development Tasks Manual for more information
2568on ptest.
2569
Andrew Geissler5082cc72023-09-11 08:41:39 -04002570.. _ref-classes-ptest-cargo:
2571
2572``ptest-cargo``
2573===============
2574
2575The :ref:`ref-classes-ptest-cargo` class is a class which extends the
2576:ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
2577``install_ptest_cargo`` steps to respectively build and install
2578test suites defined in the ``Cargo.toml`` file, into a dedicated
2579``-ptest`` package.
2580
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002581.. _ref-classes-ptest-gnome:
2582
Andrew Geissler517393d2023-01-13 08:55:19 -06002583``ptest-gnome``
2584===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002585
2586Enables package tests (ptests) specifically for GNOME packages, which
2587have tests intended to be executed with ``gnome-desktop-testing``.
2588
2589For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002590":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002591section in the Yocto Project Development Tasks Manual.
2592
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002593.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002594
Andrew Geissler517393d2023-01-13 08:55:19 -06002595``python3-dir``
2596===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002597
Andrew Geissler517393d2023-01-13 08:55:19 -06002598The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002599package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002600
2601.. _ref-classes-python3native:
2602
Andrew Geissler517393d2023-01-13 08:55:19 -06002603``python3native``
2604=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002605
Andrew Geissler517393d2023-01-13 08:55:19 -06002606The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050026073 built by the build system rather than support of the version provided
2608by the build host.
2609
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002610.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002611
Andrew Geissler517393d2023-01-13 08:55:19 -06002612``python3targetconfig``
2613=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002614
Andrew Geissler517393d2023-01-13 08:55:19 -06002615The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050026163 built by the build system rather than support of the version provided
2617by the build host, except that the configuration for the target machine
2618is accessible (such as correct installation directories). This also adds a
2619dependency on target ``python3``, so should only be used where appropriate
2620in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002621
2622.. _ref-classes-qemu:
2623
Andrew Geissler517393d2023-01-13 08:55:19 -06002624``qemu``
2625========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002626
Andrew Geissler517393d2023-01-13 08:55:19 -06002627The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002628QEMU or test for the existence of QEMU. Typically, this class is used to
2629run programs for a target system on the build host using QEMU's
2630application emulation mode.
2631
2632.. _ref-classes-recipe_sanity:
2633
Andrew Geissler517393d2023-01-13 08:55:19 -06002634``recipe_sanity``
2635=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002636
Andrew Geissler517393d2023-01-13 08:55:19 -06002637The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002638recipe prerequisites that might affect the build (e.g. variables that
2639are set or software that is present).
2640
2641.. _ref-classes-relocatable:
2642
Andrew Geissler517393d2023-01-13 08:55:19 -06002643``relocatable``
2644===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002645
Andrew Geissler517393d2023-01-13 08:55:19 -06002646The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002647installed into the sysroot.
2648
Andrew Geissler517393d2023-01-13 08:55:19 -06002649This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2650both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002651
2652.. _ref-classes-remove-libtool:
2653
Andrew Geissler517393d2023-01-13 08:55:19 -06002654``remove-libtool``
2655==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002656
Andrew Geissler517393d2023-01-13 08:55:19 -06002657The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002658:ref:`ref-tasks-install` task to remove all ``.la`` files
2659installed by ``libtool``. Removing these files results in them being
2660absent from both the sysroot and target packages.
2661
2662If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002663override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002664
2665 REMOVE_LIBTOOL_LA = "0"
2666
2667.. note::
2668
Andrew Geissler517393d2023-01-13 08:55:19 -06002669 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002670
2671.. _ref-classes-report-error:
2672
Andrew Geissler517393d2023-01-13 08:55:19 -06002673``report-error``
2674================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002675
Andrew Geissler517393d2023-01-13 08:55:19 -06002676The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2677tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002678which allows you to submit build error information to a central database.
2679
2680The class collects debug information for recipe, recipe version, task,
2681machine, distro, build system, target system, host distro, branch,
2682commit, and log. From the information, report files using a JSON format
2683are created and stored in
2684``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2685
2686.. _ref-classes-rm-work:
2687
Andrew Geissler517393d2023-01-13 08:55:19 -06002688``rm_work``
2689===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002690
Andrew Geissler517393d2023-01-13 08:55:19 -06002691The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002692can ease your hard drive demands during builds.
2693
2694The OpenEmbedded build system can use a substantial amount of disk space
2695during the build process. A portion of this space is the work files
2696under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2697system generates the packages for a recipe, the work files for that
2698recipe are no longer needed. However, by default, the build system
2699preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002700you would rather have these files deleted to save disk space as the build
2701progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002702your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002703
2704 INHERIT += "rm_work"
2705
Andrew Geissler517393d2023-01-13 08:55:19 -06002706If you are modifying and building source code out of the work directory for a
2707recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2708changes to the source being lost. To exclude some recipes from having their work
2709directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2710recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2711which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002712
2713 RM_WORK_EXCLUDE += "busybox glibc"
2714
2715.. _ref-classes-rootfs*:
2716
Andrew Geissler517393d2023-01-13 08:55:19 -06002717``rootfs*``
2718===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002719
Andrew Geissler517393d2023-01-13 08:55:19 -06002720The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002721image and consist of the following classes:
2722
Patrick Williams2390b1b2022-11-03 13:47:49 -05002723- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002724 post-processing functions for image recipes.
2725
Patrick Williams2390b1b2022-11-03 13:47:49 -05002726- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002727 for images built using ``.deb`` packages.
2728
Patrick Williams2390b1b2022-11-03 13:47:49 -05002729- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002730 for images built using ``.rpm`` packages.
2731
Patrick Williams2390b1b2022-11-03 13:47:49 -05002732- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002733 for images built using ``.ipk`` packages.
2734
Patrick Williams2390b1b2022-11-03 13:47:49 -05002735- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002736 on the build host directly into the root filesystem.
2737
2738The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002739:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2740variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002741
2742For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002743":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002744section in the Yocto Project Overview and Concepts Manual.
2745
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002746.. _ref-classes-rust:
2747
2748``rust``
2749========
2750
2751The :ref:`ref-classes-rust` class is an internal class which is just used
2752in the "rust" recipe, to build the Rust compiler and runtime
2753library. Except for this recipe, it is not intended to be used directly.
2754
2755.. _ref-classes-rust-common:
2756
2757``rust-common``
2758===============
2759
2760The :ref:`ref-classes-rust-common` class is an internal class to the
2761:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2762intended to be used directly.
2763
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002764.. _ref-classes-sanity:
2765
Andrew Geissler517393d2023-01-13 08:55:19 -06002766``sanity``
2767==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002768
Andrew Geissler517393d2023-01-13 08:55:19 -06002769The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002770on the host system so that users can be notified of potential problems
2771that might affect their build. The class also performs basic user
2772configuration checks from the ``local.conf`` configuration file to
2773prevent common mistakes that cause build failures. Distribution policy
2774usually determines whether to include this class.
2775
2776.. _ref-classes-scons:
2777
Andrew Geissler517393d2023-01-13 08:55:19 -06002778``scons``
2779=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002780
Andrew Geissler517393d2023-01-13 08:55:19 -06002781The :ref:`ref-classes-scons` class supports recipes that need to build software
2782that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2783variable to specify additional configuration options you want to pass SCons
2784command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002785
2786.. _ref-classes-sdl:
2787
Andrew Geissler517393d2023-01-13 08:55:19 -06002788``sdl``
2789=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002790
Andrew Geissler517393d2023-01-13 08:55:19 -06002791The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002792the Simple DirectMedia Layer (SDL) library.
2793
Patrick Williams45852732022-04-02 08:58:32 -05002794.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002795
Andrew Geissler517393d2023-01-13 08:55:19 -06002796``python_setuptools_build_meta``
2797================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002798
Andrew Geissler517393d2023-01-13 08:55:19 -06002799The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2800Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002801`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2802``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2803section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2804
2805Python modules built with ``setuptools.build_meta`` can be pure Python or
2806include ``C`` or ``Rust`` extensions).
2807
Andrew Geissler517393d2023-01-13 08:55:19 -06002808Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002809
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002810.. _ref-classes-setuptools3:
2811
Andrew Geissler517393d2023-01-13 08:55:19 -06002812``setuptools3``
2813===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002814
Andrew Geissler517393d2023-01-13 08:55:19 -06002815The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2816that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2817and have not migrated to the official ``pyproject.toml`` format). If your recipe
2818uses these build systems, the recipe needs to inherit the
2819:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002820
2821 .. note::
2822
Andrew Geissler517393d2023-01-13 08:55:19 -06002823 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002824 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2825 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2826
2827 A consequence of this is that legacy software still using deprecated
2828 ``distutils`` from the Python standard library cannot be packaged as
2829 ``wheels``. A common solution is the replace
2830 ``from distutils.core import setup`` with ``from setuptools import setup``.
2831
2832 .. note::
2833
Andrew Geissler517393d2023-01-13 08:55:19 -06002834 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2835 installs the ``wheel`` binary archive. In current versions of
2836 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2837 the ``setup.py`` cannot be used with wheels, for example it creates files
2838 outside of the Python module or standard entry points, then
2839 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002840
2841.. _ref-classes-setuptools3_legacy:
2842
Andrew Geissler517393d2023-01-13 08:55:19 -06002843``setuptools3_legacy``
2844======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002845
Andrew Geissler517393d2023-01-13 08:55:19 -06002846The :ref:`ref-classes-setuptools3_legacy` class supports
2847Python version 3.x extensions that use build systems based on ``setuptools``
2848(e.g. only have a ``setup.py`` and have not migrated to the official
2849``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2850this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2851not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002852`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002853but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002854
Andrew Geissler595f6302022-01-24 19:11:47 +00002855.. _ref-classes-setuptools3-base:
2856
Andrew Geissler517393d2023-01-13 08:55:19 -06002857``setuptools3-base``
2858====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002859
Andrew Geissler517393d2023-01-13 08:55:19 -06002860The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2861other classes that support building Python version 3.x extensions. If you need
2862functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2863you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2864in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002865
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002866.. _ref-classes-sign_rpm:
2867
Andrew Geissler517393d2023-01-13 08:55:19 -06002868``sign_rpm``
2869============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002870
Andrew Geissler517393d2023-01-13 08:55:19 -06002871The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002872
2873.. _ref-classes-siteconfig:
2874
Andrew Geissler517393d2023-01-13 08:55:19 -06002875``siteconfig``
2876==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002877
Andrew Geissler517393d2023-01-13 08:55:19 -06002878The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2879configuration. The class is used by the :ref:`ref-classes-autotools` class to
2880accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002881
2882.. _ref-classes-siteinfo:
2883
Andrew Geissler517393d2023-01-13 08:55:19 -06002884``siteinfo``
2885============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002886
Andrew Geissler517393d2023-01-13 08:55:19 -06002887The :ref:`ref-classes-siteinfo` class provides information about the targets
2888that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002889
2890As an example, consider Autotools, which can require tests that must
2891execute on the target hardware. Since this is not possible in general
2892when cross compiling, site information is used to provide cached test
2893results so these tests can be skipped over but still make the correct
2894values available. The ``meta/site directory`` contains test results
2895sorted into different categories such as architecture, endianness, and
2896the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002897data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002898Autotools automatically picks up.
2899
Andrew Geissler09036742021-06-25 14:25:14 -05002900The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2901:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002902
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002903.. _ref-classes-sstate:
2904
Andrew Geissler517393d2023-01-13 08:55:19 -06002905``sstate``
2906==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002907
Andrew Geissler517393d2023-01-13 08:55:19 -06002908The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2909By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2910default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002911
2912For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002913":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002914section in the Yocto Project Overview and Concepts Manual.
2915
2916.. _ref-classes-staging:
2917
Andrew Geissler517393d2023-01-13 08:55:19 -06002918``staging``
2919===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002920
Andrew Geissler517393d2023-01-13 08:55:19 -06002921The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002922directories for sysroots. The class contains the following key tasks:
2923
2924- The :ref:`ref-tasks-populate_sysroot` task,
2925 which is responsible for handing the files that end up in the recipe
2926 sysroots.
2927
2928- The
2929 :ref:`ref-tasks-prepare_recipe_sysroot`
2930 task (a "partner" task to the ``populate_sysroot`` task), which
2931 installs the files into the individual recipe work directories (i.e.
2932 :term:`WORKDIR`).
2933
Andrew Geissler517393d2023-01-13 08:55:19 -06002934The code in the :ref:`ref-classes-staging` class is complex and basically works
2935in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002936
2937- *Stage One:* The first stage addresses recipes that have files they
2938 want to share with other recipes that have dependencies on the
2939 originating recipe. Normally these dependencies are installed through
2940 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002941 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002942 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2943 subset of files is controlled by the
2944 :term:`SYSROOT_DIRS`,
2945 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002946 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002947 variables.
2948
2949 .. note::
2950
2951 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002952 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002953 variable.
2954
2955 A shared state (sstate) object is built from these files and the
2956 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002957 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002958 The files are scanned for hardcoded paths to the original
2959 installation location. If the location is found in text files, the
2960 hardcoded locations are replaced by tokens and a list of the files
2961 needing such replacements is created. These adjustments are referred
2962 to as "FIXMEs". The list of files that are scanned for paths is
2963 controlled by the :term:`SSTATE_SCAN_FILES`
2964 variable.
2965
2966- *Stage Two:* The second stage addresses recipes that want to use
2967 something from another recipe and declare a dependency on that recipe
2968 through the :term:`DEPENDS` variable. The recipe will
2969 have a
2970 :ref:`ref-tasks-prepare_recipe_sysroot`
2971 task and when this task executes, it creates the ``recipe-sysroot``
2972 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2973 :term:`WORKDIR`). The OpenEmbedded build system
2974 creates hard links to copies of the relevant files from
2975 ``sysroots-components`` into the recipe work directory.
2976
2977 .. note::
2978
2979 If hard links are not possible, the build system uses actual
2980 copies.
2981
2982 The build system then addresses any "FIXMEs" to paths as defined from
2983 the list created in the first stage.
2984
2985 Finally, any files in ``${bindir}`` within the sysroot that have the
2986 prefix "``postinst-``" are executed.
2987
2988 .. note::
2989
2990 Although such sysroot post installation scripts are not
2991 recommended for general use, the files do allow some issues such
2992 as user creation and module indexes to be addressed.
2993
Andrew Geissler09036742021-06-25 14:25:14 -05002994 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002995 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2996 the sysroot creation function ``extend_recipe_sysroot`` is also added
2997 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002998 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002999
3000 When installing dependencies into the sysroot, the code traverses the
3001 dependency graph and processes dependencies in exactly the same way
3002 as the dependencies would or would not be when installed from sstate.
3003 This processing means, for example, a native tool would have its
3004 native dependencies added but a target library would not have its
3005 dependencies traversed or installed. The same sstate dependency code
3006 is used so that builds should be identical regardless of whether
3007 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003008 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003009
3010 The build system is careful to maintain manifests of the files it
3011 installs so that any given dependency can be installed as needed. The
3012 sstate hash of the installed item is also stored so that if it
3013 changes, the build system can reinstall it.
3014
3015.. _ref-classes-syslinux:
3016
Andrew Geissler517393d2023-01-13 08:55:19 -06003017``syslinux``
3018============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003019
Andrew Geissler517393d2023-01-13 08:55:19 -06003020The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
3021building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003022
3023The class supports the following variables:
3024
3025- :term:`INITRD`: Indicates list of filesystem images to
3026 concatenate and use as an initial RAM disk (initrd). This variable is
3027 optional.
3028
3029- :term:`ROOTFS`: Indicates a filesystem image to include
3030 as the root filesystem. This variable is optional.
3031
3032- :term:`AUTO_SYSLINUXMENU`: Enables creating
3033 an automatic menu when set to "1".
3034
3035- :term:`LABELS`: Lists targets for automatic
3036 configuration.
3037
3038- :term:`APPEND`: Lists append string overrides for each
3039 label.
3040
3041- :term:`SYSLINUX_OPTS`: Lists additional options
3042 to add to the syslinux file. Semicolon characters separate multiple
3043 options.
3044
3045- :term:`SYSLINUX_SPLASH`: Lists a background
3046 for the VGA boot menu when you are using the boot menu.
3047
3048- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
3049 to "console=ttyX" to change kernel boot default console.
3050
3051- :term:`SYSLINUX_SERIAL`: Sets an alternate
3052 serial port. Or, turns off serial when the variable is set with an
3053 empty string.
3054
3055- :term:`SYSLINUX_SERIAL_TTY`: Sets an
3056 alternate "console=tty..." kernel boot argument.
3057
3058.. _ref-classes-systemd:
3059
Andrew Geissler517393d2023-01-13 08:55:19 -06003060``systemd``
3061===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003062
Andrew Geissler517393d2023-01-13 08:55:19 -06003063The :ref:`ref-classes-systemd` class provides support for recipes that install
3064systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003065
3066The functionality for this class is disabled unless you have "systemd"
3067in :term:`DISTRO_FEATURES`.
3068
3069Under this class, the recipe or Makefile (i.e. whatever the recipe is
3070calling during the :ref:`ref-tasks-install` task)
3071installs unit files into
3072``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
3073files being installed go into packages other than the main package, you
3074need to set :term:`SYSTEMD_PACKAGES` in your
3075recipe to identify the packages in which the files will be installed.
3076
3077You should set :term:`SYSTEMD_SERVICE` to the
3078name of the service file. You should also use a package name override to
3079indicate the package to which the value applies. If the value applies to
3080the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05003081is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003082
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003083 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003084
3085Services are set up to start on boot automatically
3086unless you have set
3087:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3088
Andrew Geissler517393d2023-01-13 08:55:19 -06003089For more information on :ref:`ref-classes-systemd`, see the
3090":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003091section in the Yocto Project Development Tasks Manual.
3092
3093.. _ref-classes-systemd-boot:
3094
Andrew Geissler517393d2023-01-13 08:55:19 -06003095``systemd-boot``
3096================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003097
Andrew Geissler517393d2023-01-13 08:55:19 -06003098The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003099systemd-boot bootloader for building bootable images. This is an
3100internal class and is not intended to be used directly.
3101
3102.. note::
3103
Andrew Geissler517393d2023-01-13 08:55:19 -06003104 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003105 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003106
Andrew Geissler517393d2023-01-13 08:55:19 -06003107Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3108use this class. Doing so creates a standalone EFI bootloader that is not
3109dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003110
3111For information on more variables used and supported in this class, see
3112the :term:`SYSTEMD_BOOT_CFG`,
3113:term:`SYSTEMD_BOOT_ENTRIES`, and
3114:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3115
3116You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003117documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003118for more information.
3119
3120.. _ref-classes-terminal:
3121
Andrew Geissler517393d2023-01-13 08:55:19 -06003122``terminal``
3123============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003124
Andrew Geissler517393d2023-01-13 08:55:19 -06003125The :ref:`ref-classes-terminal` class provides support for starting a terminal
3126session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3127used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003128
Andrew Geissler517393d2023-01-13 08:55:19 -06003129Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3130terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3131class assuming :term:`PATCHRESOLVE` is set to "user", the
3132:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3133use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003134
Patrick Williams975a06f2022-10-21 14:42:47 -05003135.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003136
Andrew Geissler517393d2023-01-13 08:55:19 -06003137``testimage``
3138=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003139
Andrew Geissler517393d2023-01-13 08:55:19 -06003140The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003141images using QEMU and on actual hardware. The classes handle loading the
3142tests and starting the image. To use the classes, you need to perform
3143steps to set up the environment.
3144
Patrick Williams975a06f2022-10-21 14:42:47 -05003145To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003146
Patrick Williams975a06f2022-10-21 14:42:47 -05003147 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003148
3149The tests are commands that run on the target system over ``ssh``. Each
3150test is written in Python and makes use of the ``unittest`` module.
3151
Andrew Geissler517393d2023-01-13 08:55:19 -06003152The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003153following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003154
3155 $ bitbake -c testimage image
3156
Patrick Williams975a06f2022-10-21 14:42:47 -05003157Alternatively, if you wish to have tests automatically run for each image
3158after it is built, you can set :term:`TESTIMAGE_AUTO`::
3159
3160 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003161
3162For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003163":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003164section in the Yocto Project Development Tasks Manual.
3165
3166.. _ref-classes-testsdk:
3167
Andrew Geissler517393d2023-01-13 08:55:19 -06003168``testsdk``
3169===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003170
3171This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003172kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003173using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003174
3175 $ bitbake -c testsdk image
3176
3177.. note::
3178
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003179 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003180 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003181 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003182
3183.. _ref-classes-texinfo:
3184
Andrew Geissler517393d2023-01-13 08:55:19 -06003185``texinfo``
3186===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003187
3188This class should be inherited by recipes whose upstream packages invoke
3189the ``texinfo`` utilities at build-time. Native and cross recipes are
3190made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3191improved performance. Target architecture recipes use the genuine
3192Texinfo utilities. By default, they use the Texinfo utilities on the
3193host system.
3194
3195.. note::
3196
3197 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003198 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3199 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003200
3201.. _ref-classes-toaster:
3202
Andrew Geissler517393d2023-01-13 08:55:19 -06003203``toaster``
3204===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003205
Andrew Geissler517393d2023-01-13 08:55:19 -06003206The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003207sends them as events that the BitBake user interface can receive. The
3208class is enabled when the Toaster user interface is running.
3209
3210This class is not intended to be used directly.
3211
3212.. _ref-classes-toolchain-scripts:
3213
Andrew Geissler517393d2023-01-13 08:55:19 -06003214``toolchain-scripts``
3215=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003216
Andrew Geissler517393d2023-01-13 08:55:19 -06003217The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003218the environment for installed SDKs.
3219
3220.. _ref-classes-typecheck:
3221
Andrew Geissler517393d2023-01-13 08:55:19 -06003222``typecheck``
3223=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003224
Andrew Geissler517393d2023-01-13 08:55:19 -06003225The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003226variables set at the configuration level against their defined types.
3227The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003228variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003229
3230 IMAGE_FEATURES[type] = "list"
3231
3232.. _ref-classes-uboot-config:
3233
Andrew Geissler517393d2023-01-13 08:55:19 -06003234``uboot-config``
3235================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003236
Andrew Geissler517393d2023-01-13 08:55:19 -06003237The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003238a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003239
3240 UBOOT_CONFIG ??= <default>
Patrick Williams705982a2024-01-12 09:51:57 -06003241 UBOOT_CONFIG[foo] = "config,images,binary"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003242
Andrew Geisslerc926e172021-05-07 16:11:35 -05003243You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003244
3245 UBOOT_MACHINE = "config"
3246
3247See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3248information.
3249
Patrick Williamsb542dec2023-06-09 01:26:37 -05003250.. _ref-classes-uboot-sign:
3251
3252``uboot-sign``
3253==============
3254
3255The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
3256It is intended to be inherited from U-Boot recipes.
3257
Patrick Williams39653562024-03-01 08:54:02 -06003258The variables used by this class are:
Patrick Williamsb542dec2023-06-09 01:26:37 -05003259
3260- :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3261 building the FIT image.
3262- :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
3263- :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
3264- :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
3265- :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
3266- :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
3267- :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
3268- :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
3269- :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
3270- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3271- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3272- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
3273 signing.
3274- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3275 for FIT image signing.
3276- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3277- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3278 rebuilding the FIT image containing the kernel.
3279
3280See U-Boot's documentation for details about `verified boot
3281<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3282and the `signature process
3283<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3284
3285See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
3286imitates.
3287
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003288.. _ref-classes-uninative:
3289
Andrew Geissler517393d2023-01-13 08:55:19 -06003290``uninative``
3291=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003292
3293Attempts to isolate the build system from the host distribution's C
3294library in order to make re-use of native shared state artifacts across
3295different host distributions practical. With this class enabled, a
3296tarball containing a pre-built C library is downloaded at the start of
3297the build. In the Poky reference distribution this is enabled by default
3298through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3299distributions that do not derive from poky can also
3300"``require conf/distro/include/yocto-uninative.inc``" to use this.
3301Alternatively if you prefer, you can build the uninative-tarball recipe
3302yourself, publish the resulting tarball (e.g. via HTTP) and set
3303``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3304example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3305
Andrew Geissler517393d2023-01-13 08:55:19 -06003306The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003307SDK. When building the extensible SDK, ``uninative-tarball`` is built
3308and the resulting tarball is included within the SDK.
3309
3310.. _ref-classes-update-alternatives:
3311
Andrew Geissler517393d2023-01-13 08:55:19 -06003312``update-alternatives``
3313=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003314
Andrew Geissler517393d2023-01-13 08:55:19 -06003315The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003316multiple sources provide the same command. This situation occurs when
3317several programs that have the same or similar function are installed
3318with the same name. For example, the ``ar`` command is available from
3319the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003320:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003321multiple packages can be installed without conflicts. The ``ar`` command
3322still works regardless of which packages are installed or subsequently
3323removed. The class renames the conflicting binary in each package and
3324symlinks the highest priority binary during installation or removal of
3325packages.
3326
3327To use this class, you need to define a number of variables:
3328
3329- :term:`ALTERNATIVE`
3330
3331- :term:`ALTERNATIVE_LINK_NAME`
3332
3333- :term:`ALTERNATIVE_TARGET`
3334
3335- :term:`ALTERNATIVE_PRIORITY`
3336
3337These variables list alternative commands needed by a package, provide
3338pathnames for links, default links for targets, and so forth. For
3339details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003340:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003341file.
3342
3343.. note::
3344
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003345 You can use the ``update-alternatives`` command directly in your recipes.
3346 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003347
3348.. _ref-classes-update-rc.d:
3349
Andrew Geissler517393d2023-01-13 08:55:19 -06003350``update-rc.d``
3351===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003352
Andrew Geissler517393d2023-01-13 08:55:19 -06003353The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003354initialization script on behalf of the package. The OpenEmbedded build
3355system takes care of details such as making sure the script is stopped
3356before a package is removed and started when the package is installed.
3357
Andrew Geissler09036742021-06-25 14:25:14 -05003358Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3359:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003360for details.
3361
3362.. _ref-classes-useradd:
3363
Andrew Geissler517393d2023-01-13 08:55:19 -06003364``useradd*``
3365============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003366
Patrick Williams2390b1b2022-11-03 13:47:49 -05003367The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003368usage by the package on the target. For example, if you have packages
3369that contain system services that should be run under their own user or
3370group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003371group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3372</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003373recipe in the :term:`Source Directory` provides a simple
3374example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003375
Patrick Williams2390b1b2022-11-03 13:47:49 -05003376The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003377groups settings.
3378
Patrick Williams2390b1b2022-11-03 13:47:49 -05003379The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003380:term:`USERADD_PACKAGES`,
3381:term:`USERADD_PARAM`,
3382:term:`GROUPADD_PARAM`, and
3383:term:`GROUPMEMS_PARAM` variables.
3384
Patrick Williams2390b1b2022-11-03 13:47:49 -05003385The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003386that have static user identification (``uid``) and group identification
3387(``gid``) values.
3388
3389The default behavior of the OpenEmbedded build system for assigning
3390``uid`` and ``gid`` values when packages add users and groups during
3391package install time is to add them dynamically. This works fine for
3392programs that do not care what the values of the resulting users and
3393groups become. In these cases, the order of the installation determines
3394the final ``uid`` and ``gid`` values. However, if non-deterministic
3395``uid`` and ``gid`` values are a problem, you can override the default,
3396dynamic application of these values by setting static values. When you
3397set static values, the OpenEmbedded build system looks in
3398:term:`BBPATH` for ``files/passwd`` and ``files/group``
3399files for the values.
3400
Andrew Geissler517393d2023-01-13 08:55:19 -06003401To use static ``uid`` and ``gid`` values, you need to set some variables. See
3402the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3403:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3404You can also see the :ref:`ref-classes-useradd` class for additional
3405information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003406
3407.. note::
3408
Patrick Williams2390b1b2022-11-03 13:47:49 -05003409 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003410 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003411 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003412 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003413 directory will correct this condition.
3414
3415.. _ref-classes-utility-tasks:
3416
Andrew Geissler517393d2023-01-13 08:55:19 -06003417``utility-tasks``
3418=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003419
Andrew Geissler517393d2023-01-13 08:55:19 -06003420The :ref:`ref-classes-utility-tasks` class provides support for various
3421"utility" type tasks that are applicable to all recipes, such as
3422:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003423
3424This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003425:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003426
3427.. _ref-classes-utils:
3428
Andrew Geissler517393d2023-01-13 08:55:19 -06003429``utils``
3430=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003431
Andrew Geissler517393d2023-01-13 08:55:19 -06003432The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003433typically used in inline Python expressions (e.g. ``${@...}``). One
3434example use is for ``bb.utils.contains()``.
3435
3436This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003437:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003438
3439.. _ref-classes-vala:
3440
Andrew Geissler517393d2023-01-13 08:55:19 -06003441``vala``
3442========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003443
Andrew Geissler517393d2023-01-13 08:55:19 -06003444The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003445using the Vala programming language.
3446
3447.. _ref-classes-waf:
3448
Andrew Geissler517393d2023-01-13 08:55:19 -06003449``waf``
3450=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003451
Andrew Geissler517393d2023-01-13 08:55:19 -06003452The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003453the Waf build system. You can use the
3454:term:`EXTRA_OECONF` or
3455:term:`PACKAGECONFIG_CONFARGS` variables
3456to specify additional configuration options to be passed on the Waf
3457command line.