blob: a8afe9f2dcb6e0e34719a0cd3561260fcc1a5957 [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
380.. _ref-classes-cml1:
381
Andrew Geissler517393d2023-01-13 08:55:19 -0600382``cml1``
383========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500384
Andrew Geissler517393d2023-01-13 08:55:19 -0600385The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600386build configuration system. "cml" stands for "Configuration Menu Language", which
387originates from the Linux kernel but is also used in other projects such as U-Boot
388and BusyBox. It could have been called "kconfig" too.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500389
390.. _ref-classes-compress_doc:
391
Andrew Geissler517393d2023-01-13 08:55:19 -0600392``compress_doc``
393================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500394
395Enables compression for man pages and info pages. This class is intended
396to be inherited globally. The default compression mechanism is gz (gzip)
397but you can select an alternative mechanism by setting the
398:term:`DOC_COMPRESS` variable.
399
400.. _ref-classes-copyleft_compliance:
401
Andrew Geissler517393d2023-01-13 08:55:19 -0600402``copyleft_compliance``
403=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500404
Andrew Geissler517393d2023-01-13 08:55:19 -0600405The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
406of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500407class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600408in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500409
410.. _ref-classes-copyleft_filter:
411
Andrew Geissler517393d2023-01-13 08:55:19 -0600412``copyleft_filter``
413===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500414
Andrew Geissler517393d2023-01-13 08:55:19 -0600415A class used by the :ref:`ref-classes-archiver` and
416:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500417for filtering licenses. The ``copyleft_filter`` class is an internal
418class and is not intended to be used directly.
419
420.. _ref-classes-core-image:
421
Andrew Geissler517393d2023-01-13 08:55:19 -0600422``core-image``
423==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500424
Andrew Geissler517393d2023-01-13 08:55:19 -0600425The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500426``core-image-*`` image recipes, such as support for additional
427:term:`IMAGE_FEATURES`.
428
429.. _ref-classes-cpan:
430
Andrew Geissler517393d2023-01-13 08:55:19 -0600431``cpan*``
432=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500433
Patrick Williams2390b1b2022-11-03 13:47:49 -0500434The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500435
436Recipes for Perl modules are simple. These recipes usually only need to
437point to the source's archive and then inherit the proper class file.
438Building is split into two methods depending on which method the module
439authors used.
440
441- Modules that use old ``Makefile.PL``-based build system require
442 ``cpan.bbclass`` in their recipes.
443
444- Modules that use ``Build.PL``-based build system require using
445 ``cpan_build.bbclass`` in their recipes.
446
Patrick Williams2390b1b2022-11-03 13:47:49 -0500447Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500448support.
449
Patrick Williams975a06f2022-10-21 14:42:47 -0500450.. _ref-classes-create-spdx:
451
Andrew Geissler517393d2023-01-13 08:55:19 -0600452``create-spdx``
453===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500454
Andrew Geissler517393d2023-01-13 08:55:19 -0600455The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600456automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
457and SDK contents.
458
459This class is meant to be inherited globally from a configuration file::
460
461 INHERIT += "create-spdx"
462
463The toplevel :term:`SPDX` output file is generated in JSON format as a
464``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
465:term:`Build Directory`. There are other related files in the same directory,
466as well as in ``tmp/deploy/spdx``.
467
468The exact behaviour of this class, and the amount of output can be controlled
469by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
470:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
471
472See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600473":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600474section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500475
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500476.. _ref-classes-cross:
477
Andrew Geissler517393d2023-01-13 08:55:19 -0600478``cross``
479=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500480
Andrew Geissler517393d2023-01-13 08:55:19 -0600481The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500482cross-compilation tools.
483
484.. _ref-classes-cross-canadian:
485
Andrew Geissler517393d2023-01-13 08:55:19 -0600486``cross-canadian``
487==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500488
Andrew Geissler517393d2023-01-13 08:55:19 -0600489The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500490the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600491":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500492section in the Yocto Project Overview and Concepts Manual for more
493discussion on these cross-compilation tools.
494
495.. _ref-classes-crosssdk:
496
Andrew Geissler517393d2023-01-13 08:55:19 -0600497``crosssdk``
498============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500499
Andrew Geissler517393d2023-01-13 08:55:19 -0600500The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500501cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600502":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500503section in the Yocto Project Overview and Concepts Manual for more
504discussion on these cross-compilation tools.
505
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500506.. _ref-classes-cve-check:
507
Andrew Geissler517393d2023-01-13 08:55:19 -0600508``cve-check``
509=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500510
Andrew Geissler517393d2023-01-13 08:55:19 -0600511The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500512and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500513inherited globally from a configuration file::
514
515 INHERIT += "cve-check"
516
Patrick Williams2390b1b2022-11-03 13:47:49 -0500517To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
518add following line to the build configuration file::
519
520 include cve-extra-exclusions.inc
521
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500522You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500523``-c cve_check`` to BitBake.
524
525After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
526and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
527
528When building, the CVE checker will emit build time warnings for any detected
529issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
530and version being compiled and no patches to address the issue are applied. Other states
531for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
532applied, and ``Ignored`` meaning that the issue can be ignored.
533
534The ``Patched`` state of a CVE issue is detected from patch files with the format
535``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
536CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
537
Patrick Williams2a254922023-08-11 09:48:11 -0500538If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
539mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
Patrick Williams2390b1b2022-11-03 13:47:49 -0500540
Patrick Williams2a254922023-08-11 09:48:11 -0500541 CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500542
543If CVE check reports that a recipe contains false positives or false negatives, these may be
544fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
545:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
546database vendor and product pairs using the syntax::
547
548 CVE_PRODUCT = "flex_project:flex"
549
550where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
551if the default recipe version :term:`PV` does not match the version numbers of the software component
552in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
553CVE database compatible version number, for example::
554
555 CVE_VERSION = "2.39"
556
557Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
558via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
559
560Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
561patching and updating the software should be done as a regular process. The data and assumptions
562required for CVE checker to reliably detect issues are frequently broken in various ways.
563These can only be detected by reviewing the details of the issues and iterating over the generated reports,
564and following what happens in other Linux distributions and in the greater open source community.
565
566You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600567":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500568section in the Development Tasks Manual.
569
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500570.. _ref-classes-debian:
571
Andrew Geissler517393d2023-01-13 08:55:19 -0600572``debian``
573==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500574
Andrew Geissler517393d2023-01-13 08:55:19 -0600575The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500576Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
577``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
578name and version as part of the package name.
579
580If a recipe creates packages for multiple libraries (shared object files
581of ``.so`` type), use the :term:`LEAD_SONAME`
582variable in the recipe to specify the library on which to apply the
583naming scheme.
584
585.. _ref-classes-deploy:
586
Andrew Geissler517393d2023-01-13 08:55:19 -0600587``deploy``
588==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500589
Andrew Geissler517393d2023-01-13 08:55:19 -0600590The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500591:term:`DEPLOY_DIR_IMAGE` directory. The main
592function of this class is to allow the deploy step to be accelerated by
593shared state. Recipes that inherit this class should define their own
594:ref:`ref-tasks-deploy` function to copy the files to be
595deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
596add the task at the appropriate place, which is usually after
597:ref:`ref-tasks-compile` or
598:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500599staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500600
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500601.. _ref-classes-devicetree:
602
603``devicetree``
604==============
605
606The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
607device tree source files that are not in the kernel tree.
608
609The compilation of out-of-tree device tree sources is the same as the kernel
610in-tree device tree compilation process. This includes the ability to include
611sources from the kernel such as SoC ``dtsi`` files as well as C header files,
612such as ``gpio.h``.
613
614The :ref:`ref-tasks-compile` task will compile two kinds of files:
615
616- Regular device tree sources with a ``.dts`` extension.
617
618- Device tree overlays, detected from the presence of the ``/plugin/;``
619 string in the file contents.
620
Patrick Williams520786c2023-06-25 16:20:36 -0500621This class deploys the generated device tree binaries into
622``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
623what the :ref:`ref-classes-kernel-devicetree` class does, with the added
624``devicetree`` subdirectory to avoid name clashes. Additionally, the device
625trees are populated into the sysroot for access via the sysroot from within
626other recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500627
Patrick Williamsb542dec2023-06-09 01:26:37 -0500628By default, all device tree sources located in :term:`DT_FILES_PATH` directory
629are compiled. To select only particular sources, set :term:`DT_FILES` to
630a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
631convenience, both ``.dts`` and ``.dtb`` extensions can be used.
632
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500633An extra padding is appended to non-overlay device trees binaries. This
634can typically be used as extra space for adding extra properties at boot time.
Patrick Williamsb542dec2023-06-09 01:26:37 -0500635The padding size can be modified by setting :term:`DT_PADDING_SIZE`
636to the desired size, in bytes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500637
638See :oe_git:`devicetree.bbclass sources
639</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
640for further variables controlling this class.
641
642Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
643recipe inheriting this class::
644
645 inherit devicetree
646 COMPATIBLE_MACHINE = "^mymachine$"
647 SRC_URI:mymachine = "file://mymachine.dts"
648
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500649.. _ref-classes-devshell:
650
Andrew Geissler517393d2023-01-13 08:55:19 -0600651``devshell``
652============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500653
Andrew Geissler517393d2023-01-13 08:55:19 -0600654The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
655policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500656section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600657information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500658
659.. _ref-classes-devupstream:
660
Andrew Geissler517393d2023-01-13 08:55:19 -0600661``devupstream``
662===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500663
Andrew Geissler517393d2023-01-13 08:55:19 -0600664The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500665:term:`BBCLASSEXTEND` to add a variant of the
666recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500667tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500668
669 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000670 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500671 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500672
673Adding the above statements to your recipe creates a variant that has
674:term:`DEFAULT_PREFERENCE` set to "-1".
675Consequently, you need to select the variant of the recipe to use it.
676Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500677``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500678
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500679 DEPENDS:append:class-devupstream = " gperf-native"
680 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500681 touch ${S}/README
682 }
683
684The class
685currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600686recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500687
Andrew Geissler09036742021-06-25 14:25:14 -0500688The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600689support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500690functionality can be added in a future release.
691
692Support for other version control systems such as Subversion is limited
693due to BitBake's automatic fetch dependencies (e.g.
694``subversion-native``).
695
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500696.. _ref-classes-externalsrc:
697
Andrew Geissler517393d2023-01-13 08:55:19 -0600698``externalsrc``
699===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500700
Andrew Geissler517393d2023-01-13 08:55:19 -0600701The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500702that is external to the OpenEmbedded build system. Building software
703from an external source tree means that the build system's normal fetch,
704unpack, and patch process is not used.
705
706By default, the OpenEmbedded build system uses the :term:`S`
707and :term:`B` variables to locate unpacked recipe source code
708and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600709:ref:`ref-classes-externalsrc` class, you use the
710:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500711ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500712
713By default, this class expects the source code to support recipe builds
714that use the :term:`B` variable to point to the directory in
715which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500716from the recipes. By default, the :term:`B` directory is set to the
717following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500718
Andrew Geissler5199d832021-09-24 16:47:35 -0500719 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500720
721See these variables for more information:
722:term:`WORKDIR`, :term:`BPN`, and
723:term:`PV`,
724
Andrew Geissler517393d2023-01-13 08:55:19 -0600725For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500726``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600727For information on how to use the :ref:`ref-classes-externalsrc` class, see the
728":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500729section in the Yocto Project Development Tasks Manual.
730
731.. _ref-classes-extrausers:
732
Andrew Geissler517393d2023-01-13 08:55:19 -0600733``extrausers``
734==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500735
Andrew Geissler517393d2023-01-13 08:55:19 -0600736The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500737to be applied at the image level. Inheriting this class either globally
738or from an image recipe allows additional user and group operations to
739be performed using the
740:term:`EXTRA_USERS_PARAMS` variable.
741
742.. note::
743
Andrew Geissler517393d2023-01-13 08:55:19 -0600744 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500745 class are not tied to a specific recipe outside of the recipe for the
746 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600747 whole. Use the :ref:`ref-classes-useradd` class to add user and group
748 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500749
Andrew Geisslerc926e172021-05-07 16:11:35 -0500750Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500751
752 inherit extrausers
753 EXTRA_USERS_PARAMS = "\
754 useradd -p '' tester; \
755 groupadd developers; \
756 userdel nobody; \
757 groupdel -g video; \
758 groupmod -g 1020 developers; \
759 usermod -s /bin/sh tester; \
760 "
761
762Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000763passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500764
Andrew Geissler9aee5002022-03-30 16:27:02 +0000765 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500766
Andrew Geissler9aee5002022-03-30 16:27:02 +0000767The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500768
769 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500770 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500771 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500772 useradd -p '${PASSWD}' tester-jim; \
773 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500774 "
775
Andrew Geisslereff27472021-10-29 15:35:00 -0500776Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500777
778 inherit extrausers
779 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500780 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500781 "
782
Patrick Williams03907ee2022-05-01 06:28:52 -0500783.. note::
784
785 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500786 generally a good idea or even legal in some jurisdictions. It is
787 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500788 image.
789
790
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600791.. _ref-classes-features_check:
792
Andrew Geissler517393d2023-01-13 08:55:19 -0600793``features_check``
794==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600795
Andrew Geissler517393d2023-01-13 08:55:19 -0600796The :ref:`ref-classes-features_check` class allows individual recipes to check
797for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
798or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600799
800This class provides support for the following variables:
801
802- :term:`REQUIRED_DISTRO_FEATURES`
803- :term:`CONFLICT_DISTRO_FEATURES`
804- :term:`ANY_OF_DISTRO_FEATURES`
805- ``REQUIRED_MACHINE_FEATURES``
806- ``CONFLICT_MACHINE_FEATURES``
807- ``ANY_OF_MACHINE_FEATURES``
808- ``REQUIRED_COMBINED_FEATURES``
809- ``CONFLICT_COMBINED_FEATURES``
810- ``ANY_OF_COMBINED_FEATURES``
811
812If any conditions specified in the recipe using the above
813variables are not met, the recipe will be skipped, and if the
814build system attempts to build the recipe then an error will be
815triggered.
816
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500817.. _ref-classes-fontcache:
818
Andrew Geissler517393d2023-01-13 08:55:19 -0600819``fontcache``
820=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500821
Andrew Geissler517393d2023-01-13 08:55:19 -0600822The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500823post-remove (postinst and postrm) scriptlets for font packages. These
824scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
825to the font information cache. Since the cache files are
826architecture-specific, ``fc-cache`` runs using QEMU if the postinst
827scriptlets need to be run on the build host during image creation.
828
829If the fonts being installed are in packages other than the main
830package, set :term:`FONT_PACKAGES` to specify the
831packages containing the fonts.
832
833.. _ref-classes-fs-uuid:
834
Andrew Geissler517393d2023-01-13 08:55:19 -0600835``fs-uuid``
836===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500837
Andrew Geissler517393d2023-01-13 08:55:19 -0600838The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500839``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600840by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500841works on ``ext`` file systems and depends on ``tune2fs``.
842
843.. _ref-classes-gconf:
844
Andrew Geissler517393d2023-01-13 08:55:19 -0600845``gconf``
846=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500847
Andrew Geissler517393d2023-01-13 08:55:19 -0600848The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500849to install GConf schemas. The schemas will be put into a separate
850package (``${``\ :term:`PN`\ ``}-gconf``) that is created
851automatically when this class is inherited. This package uses the
852appropriate post-install and post-remove (postinst/postrm) scriptlets to
853register and unregister the schemas in the target image.
854
855.. _ref-classes-gettext:
856
Andrew Geissler517393d2023-01-13 08:55:19 -0600857``gettext``
858===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500859
Andrew Geissler517393d2023-01-13 08:55:19 -0600860The :ref:`ref-classes-gettext` class provides support for building
861software that uses the GNU ``gettext`` internationalization and localization
862system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500863class.
864
Patrick Williams975a06f2022-10-21 14:42:47 -0500865.. _ref-classes-github-releases:
866
Andrew Geissler517393d2023-01-13 08:55:19 -0600867``github-releases``
868===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500869
Andrew Geissler517393d2023-01-13 08:55:19 -0600870For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500871class sets up a standard way for checking available upstream versions
872(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
873
Andrew Geissler517393d2023-01-13 08:55:19 -0600874To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500875and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
876then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
877in the value you set for :term:`SRC_URI` within the recipe.
878
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500879.. _ref-classes-gnomebase:
880
Andrew Geissler517393d2023-01-13 08:55:19 -0600881``gnomebase``
882=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500883
Andrew Geissler517393d2023-01-13 08:55:19 -0600884The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500885software from the GNOME stack. This class sets
886:term:`SRC_URI` to download the source from the GNOME
887mirrors as well as extending :term:`FILES` with the typical
888GNOME installation paths.
889
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600890.. _ref-classes-go:
891
892``go``
893======
894
895The :ref:`ref-classes-go` class supports building Go programs. The behavior of
896this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
897by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
898
899To build a Go program with the Yocto Project, you can use the
900:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
901recipe as an example.
902
903.. _ref-classes-go-mod:
904
905``go-mod``
906==========
907
908The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
909:ref:`ref-classes-go` class.
910
911See the associated :term:`GO_WORKDIR` variable.
912
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500913.. _ref-classes-gobject-introspection:
914
Andrew Geissler517393d2023-01-13 08:55:19 -0600915``gobject-introspection``
916=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500917
918Provides support for recipes building software that supports GObject
919introspection. This functionality is only enabled if the
920"gobject-introspection-data" feature is in
921:term:`DISTRO_FEATURES` as well as
922"qemu-usermode" being in
923:term:`MACHINE_FEATURES`.
924
925.. note::
926
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500927 This functionality is :ref:`backfilled <ref-features-backfill>` by default
928 and, if not applicable, should be disabled through
929 :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
Andrew Geissler09036742021-06-25 14:25:14 -0500930 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500931
932.. _ref-classes-grub-efi:
933
Andrew Geissler517393d2023-01-13 08:55:19 -0600934``grub-efi``
935============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500936
Andrew Geissler517393d2023-01-13 08:55:19 -0600937The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500938building bootable images.
939
940This class supports several variables:
941
942- :term:`INITRD`: Indicates list of filesystem images to
943 concatenate and use as an initial RAM disk (initrd) (optional).
944
945- :term:`ROOTFS`: Indicates a filesystem image to include
946 as the root filesystem (optional).
947
948- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
949 graphics and serial in the boot menu.
950
951- :term:`LABELS`: A list of targets for the automatic
952 configuration.
953
954- :term:`APPEND`: An override list of append strings for
955 each ``LABEL``.
956
957- :term:`GRUB_OPTS`: Additional options to add to the
958 configuration (optional). Options are delimited using semi-colon
959 characters (``;``).
960
961- :term:`GRUB_TIMEOUT`: Timeout before executing
962 the default ``LABEL`` (optional).
963
964.. _ref-classes-gsettings:
965
Andrew Geissler517393d2023-01-13 08:55:19 -0600966``gsettings``
967=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500968
Andrew Geissler517393d2023-01-13 08:55:19 -0600969The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500970need to install GSettings (glib) schemas. The schemas are assumed to be
971part of the main package. Appropriate post-install and post-remove
972(postinst/postrm) scriptlets are added to register and unregister the
973schemas in the target image.
974
975.. _ref-classes-gtk-doc:
976
Andrew Geissler517393d2023-01-13 08:55:19 -0600977``gtk-doc``
978===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500979
Andrew Geissler517393d2023-01-13 08:55:19 -0600980The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500981``gtk-doc`` dependencies and disable ``gtk-doc``.
982
983.. _ref-classes-gtk-icon-cache:
984
Andrew Geissler517393d2023-01-13 08:55:19 -0600985``gtk-icon-cache``
986==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500987
Andrew Geissler517393d2023-01-13 08:55:19 -0600988The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500989post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
990install icons. These scriptlets call ``gtk-update-icon-cache`` to add
991the fonts to GTK+'s icon cache. Since the cache files are
992architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
993the postinst scriptlets need to be run on the build host during image
994creation.
995
996.. _ref-classes-gtk-immodules-cache:
997
Andrew Geissler517393d2023-01-13 08:55:19 -0600998``gtk-immodules-cache``
999=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001000
Andrew Geissler517393d2023-01-13 08:55:19 -06001001The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001002post-remove (postinst/postrm) scriptlets for packages that install GTK+
1003input method modules for virtual keyboards. These scriptlets call
1004``gtk-update-icon-cache`` to add the input method modules to the cache.
1005Since the cache files are architecture-specific,
1006``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
1007need to be run on the build host during image creation.
1008
1009If the input method modules being installed are in packages other than
1010the main package, set
1011:term:`GTKIMMODULES_PACKAGES` to specify
1012the packages containing the modules.
1013
1014.. _ref-classes-gzipnative:
1015
Andrew Geissler517393d2023-01-13 08:55:19 -06001016``gzipnative``
1017==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001018
Andrew Geissler517393d2023-01-13 08:55:19 -06001019The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001020``gzip`` and ``pigz`` rather than the versions of these tools from the
1021build host.
1022
1023.. _ref-classes-icecc:
1024
Andrew Geissler517393d2023-01-13 08:55:19 -06001025``icecc``
1026=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001027
Andrew Geissler517393d2023-01-13 08:55:19 -06001028The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001029`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1030taking compile jobs and distributing them among remote machines.
1031
1032The class stages directories with symlinks from ``gcc`` and ``g++`` to
1033``icecc``, for both native and cross compilers. Depending on each
1034configure or compile, the OpenEmbedded build system adds the directories
1035at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001036``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001037compilers, respectively.
1038
1039For the cross compiler, the class creates a ``tar.gz`` file that
1040contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1041is the version of the cross-compiler used in the cross-development
1042toolchain, accordingly.
1043
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001044The class handles all three different compile stages (i.e native,
1045cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001046``tar.gz`` file to be used by the remote machines. The class also
1047supports SDK generation.
1048
1049If :term:`ICECC_PATH` is not set in your
1050``local.conf`` file, then the class tries to locate the ``icecc`` binary
1051using ``which``. If :term:`ICECC_ENV_EXEC` is set
1052in your ``local.conf`` file, the variable should point to the
1053``icecc-create-env`` script provided by the user. If you do not point to
1054a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001055provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1056</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001057
1058.. note::
1059
1060 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001061 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001062
1063If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001064specific recipes or classes, you can ask them to be ignored by Icecream
1065by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001066:term:`ICECC_RECIPE_DISABLE` and
1067:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001068respectively, in your ``local.conf`` file. Doing so causes the
1069OpenEmbedded build system to handle these compilations locally.
1070
1071Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001072:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001073your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1074using an empty :term:`PARALLEL_MAKE` variable.
1075
Andrew Geissler517393d2023-01-13 08:55:19 -06001076Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001077Consequently, if a development team has a dedicated build system that
1078populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001079reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001080system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001081
Andrew Geissler517393d2023-01-13 08:55:19 -06001082At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001083sure that all builders start with the same sstate signatures. After
1084inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001085:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001086
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001087 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001088 ICECC_DISABLED ??= "1"
1089
1090This practice
1091makes sure everyone is using the same signatures but also requires
1092individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001093individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001094
1095 ICECC_DISABLED = ""
1096
1097.. _ref-classes-image:
1098
Andrew Geissler517393d2023-01-13 08:55:19 -06001099``image``
1100=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001101
Andrew Geissler517393d2023-01-13 08:55:19 -06001102The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001103First, the root filesystem is created from packages using one of the
1104``rootfs*.bbclass`` files (depending on the package format used) and
1105then one or more image files are created.
1106
Andrew Geissler09036742021-06-25 14:25:14 -05001107- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001108 generate.
1109
Andrew Geissler09036742021-06-25 14:25:14 -05001110- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001111 install into the image.
1112
1113For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001114":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001115in the Yocto Project Development Tasks Manual. For information on how
1116images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001117":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001118Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001119
1120.. _ref-classes-image-buildinfo:
1121
Andrew Geissler517393d2023-01-13 08:55:19 -06001122``image-buildinfo``
1123===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001124
Andrew Geissler517393d2023-01-13 08:55:19 -06001125The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001126build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001127by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001128This can be useful for manually determining the origin of any given
1129image. It writes out two sections:
1130
Andrew Geissler517393d2023-01-13 08:55:19 -06001131#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001132 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1133 :term:`DISTRO_VERSION`)
1134
Andrew Geissler517393d2023-01-13 08:55:19 -06001135#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001136 build.
1137
1138Additionally, when building an SDK it will write the same contents
1139to ``/buildinfo`` by default (as specified by
1140:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001141
1142.. _ref-classes-image_types:
1143
Andrew Geissler517393d2023-01-13 08:55:19 -06001144``image_types``
1145===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001146
Andrew Geissler517393d2023-01-13 08:55:19 -06001147The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001148that you can enable through the
1149:term:`IMAGE_FSTYPES` variable. You can use this
1150class as a reference on how to add support for custom image output
1151types.
1152
Andrew Geissler517393d2023-01-13 08:55:19 -06001153By default, the :ref:`ref-classes-image` class automatically
1154enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001155``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001156
1157 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1158 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1159 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1160 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1161 IMGCLASSES += "image_types_wic"
1162 IMGCLASSES += "rootfs-postcommands"
1163 IMGCLASSES += "image-postinst-intercepts"
1164 inherit ${IMGCLASSES}
1165
Andrew Geissler517393d2023-01-13 08:55:19 -06001166The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001167
1168.. note::
1169
1170 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001171 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001172 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001173
1174.. _ref-classes-image-live:
1175
Andrew Geissler517393d2023-01-13 08:55:19 -06001176``image-live``
1177==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001178
1179This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1180images contain syslinux for legacy booting, as well as the bootloader
1181specified by :term:`EFI_PROVIDER` if
1182:term:`MACHINE_FEATURES` contains "efi".
1183
1184Normally, you do not use this class directly. Instead, you add "live" to
1185:term:`IMAGE_FSTYPES`.
1186
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001187.. _ref-classes-insane:
1188
Andrew Geissler517393d2023-01-13 08:55:19 -06001189``insane``
1190==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001191
Andrew Geissler517393d2023-01-13 08:55:19 -06001192The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001193that output quality assurance checks are generated by the OpenEmbedded
1194build system. A range of checks are performed that check the build's
1195output for common problems that show up during runtime. Distribution
1196policy usually dictates whether to include this class.
1197
1198You can configure the sanity checks so that specific test failures
1199either raise a warning or an error message. Typically, failures for new
1200tests generate a warning. Subsequent failures for the same test would
1201then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001202condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001203and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001204
1205Use the :term:`WARN_QA` and
1206:term:`ERROR_QA` variables to control the behavior of
1207these checks at the global level (i.e. in your custom distro
1208configuration). However, to skip one or more checks in recipes, you
1209should use :term:`INSANE_SKIP`. For example, to skip
1210the check for symbolic link ``.so`` files in the main package of a
1211recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001212package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001213
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001214 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001215
1216Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001217are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001218output. So exercise caution when disabling these checks.
1219
Andrew Geissler09036742021-06-25 14:25:14 -05001220Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001221:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001222
1223- ``already-stripped:`` Checks that produced binaries have not
1224 already been stripped prior to the build system extracting debug
1225 symbols. It is common for upstream software projects to default to
1226 stripping debug symbols for output binaries. In order for debugging
1227 to work on the target using ``-dbg`` packages, this stripping must be
1228 disabled.
1229
1230- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1231 size, and endianness of any binaries to ensure they match the target
1232 architecture. This test fails if any binaries do not match the type
1233 since there would be an incompatibility. The test could indicate that
1234 the wrong compiler or compiler options have been used. Sometimes
1235 software, like bootloaders, might need to bypass this check.
1236
1237- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001238 inside the output files. Not only can these leak information about
1239 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001240
1241- ``build-deps:`` Determines if a build-time dependency that is
1242 specified through :term:`DEPENDS`, explicit
1243 :term:`RDEPENDS`, or task-level dependencies exists
1244 to match any runtime dependency. This determination is particularly
1245 useful to discover where runtime dependencies are detected and added
1246 during packaging. If no explicit dependency has been specified within
1247 the metadata, at the packaging stage it is too late to ensure that
1248 the dependency is built, and thus you can end up with an error when
1249 the package is installed into the image during the
1250 :ref:`ref-tasks-rootfs` task because the auto-detected
1251 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001252 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001253 adds a dependency on the ``initscripts-functions`` package to
1254 packages that install an initscript that refers to
1255 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001256 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001257 so that the OpenEmbedded build system is able to ensure that the
1258 ``initscripts`` recipe is actually built and thus the
1259 ``initscripts-functions`` package is made available.
1260
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001261- ``configure-gettext:`` Checks that if a recipe is building something
1262 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1263 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1264 class to ensure that gettext is available during the build.
1265
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001266- ``compile-host-path:`` Checks the
1267 :ref:`ref-tasks-compile` log for indications that
1268 paths to locations on the build host were used. Using such paths
1269 might result in host contamination of the build output.
1270
1271- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1272 do not depend on ``-dbg`` packages, which would cause a packaging
1273 bug.
1274
1275- ``debug-files:`` Checks for ``.debug`` directories in anything but
1276 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1277 package. Thus, anything packaged elsewhere is incorrect packaging.
1278
1279- ``dep-cmp:`` Checks for invalid version comparison statements in
1280 runtime dependency relationships between packages (i.e. in
1281 :term:`RDEPENDS`,
1282 :term:`RRECOMMENDS`,
1283 :term:`RSUGGESTS`,
1284 :term:`RPROVIDES`,
1285 :term:`RREPLACES`, and
1286 :term:`RCONFLICTS` variable values). Any invalid
1287 comparisons might trigger failures or undesirable behavior when
1288 passed to the package manager.
1289
1290- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1291 ``.desktop`` files to validate their contents against the
1292 specification for ``.desktop`` files.
1293
1294- ``dev-deps:`` Checks that all packages except ``-dev`` or
1295 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1296 would be a packaging bug.
1297
1298- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1299 ``-dev`` package and not in any of the other packages. In general,
1300 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001301 ``-dev`` package is the correct location for them. In very rare
1302 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001303 are needed instead in the main package.
1304
Patrick Williams03907ee2022-05-01 06:28:52 -05001305- ``empty-dirs:`` Checks that packages are not installing files to
1306 directories that are normally expected to be empty (such as ``/tmp``)
1307 The list of directories that are checked is specified by the
1308 :term:`QA_EMPTY_DIRS` variable.
1309
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001310- ``file-rdeps:`` Checks that file-level dependencies identified by
1311 the OpenEmbedded build system at packaging time are satisfied. For
1312 example, a shell script might start with the line ``#!/bin/bash``.
1313 This line would translate to a file dependency on ``/bin/bash``. Of
1314 the three package managers that the OpenEmbedded build system
1315 supports, only RPM directly handles file-level dependencies,
1316 resolving them automatically to packages providing the files.
1317 However, the lack of that functionality in the other two package
1318 managers does not mean the dependencies do not still need resolving.
1319 This QA check attempts to ensure that explicitly declared
1320 :term:`RDEPENDS` exist to handle any file-level
1321 dependency detected in packaged files.
1322
1323- ``files-invalid:`` Checks for :term:`FILES` variable
1324 values that contain "//", which is invalid.
1325
1326- ``host-user-contaminated:`` Checks that no package produced by the
1327 recipe contains any files outside of ``/home`` with a user or group
1328 ID that matches the user running BitBake. A match usually indicates
1329 that the files are being installed with an incorrect UID/GID, since
1330 target IDs are independent from host IDs. For additional information,
1331 see the section describing the
1332 :ref:`ref-tasks-install` task.
1333
1334- ``incompatible-license:`` Report when packages are excluded from
1335 being created due to being marked with a license that is in
1336 :term:`INCOMPATIBLE_LICENSE`.
1337
1338- ``install-host-path:`` Checks the
1339 :ref:`ref-tasks-install` log for indications that
1340 paths to locations on the build host were used. Using such paths
1341 might result in host contamination of the build output.
1342
1343- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001344 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001345 way of the :term:`FILES` variable. Files that do not
1346 appear in any package cannot be present in an image later on in the
1347 build process. Ideally, all installed files should be packaged or not
1348 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001349 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001350
1351- ``invalid-chars:`` Checks that the recipe metadata variables
1352 :term:`DESCRIPTION`,
1353 :term:`SUMMARY`, :term:`LICENSE`, and
1354 :term:`SECTION` do not contain non-UTF-8 characters.
1355 Some package managers do not support such characters.
1356
1357- ``invalid-packageconfig:`` Checks that no undefined features are
1358 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001359 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001360
1361 PACKAGECONFIG[foo] = "..."
1362
Andrew Geissler09036742021-06-25 14:25:14 -05001363- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001364 file containing these paths is incorrect since ``libtool`` adds the
1365 correct sysroot prefix when using the files automatically itself.
1366
1367- ``ldflags:`` Ensures that the binaries were linked with the
1368 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001369 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001370 passed to the linker command.
1371
1372- ``libdir:`` Checks for libraries being installed into incorrect
1373 (possibly hardcoded) installation paths. For example, this test will
1374 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1375 "lib32". Another example is when recipes install
1376 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1377
1378- ``libexec:`` Checks if a package contains files in
1379 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1380 variable has been set explicitly to ``/usr/libexec``.
1381
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001382- ``mime:`` Check that if a package contains mime type files (``.xml``
1383 files in ``${datadir}/mime/packages``) that the recipe also inherits
1384 the :ref:`ref-classes-mime` class in order to ensure that these get
1385 properly installed.
1386
1387- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1388 'MimeType' key present, that the recipe inherits the
1389 :ref:`ref-classes-mime-xdg` class that is required in order for that
1390 to be activated.
1391
1392- ``missing-update-alternatives:`` Check that if a recipe sets the
1393 :term:`ALTERNATIVE` variable that the recipe also inherits
1394 :ref:`ref-classes-update-alternatives` such that the alternative will
1395 be correctly set up.
1396
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001397- ``packages-list:`` Checks for the same package being listed
1398 multiple times through the :term:`PACKAGES` variable
1399 value. Installing the package in this manner can cause errors during
1400 packaging.
1401
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001402- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1403 them to apply incorrectly if the underlying code changes.
1404
1405- ``patch-status-core:`` Checks that the Upstream-Status is specified
1406 and valid in the headers of patches for recipes in the OE-Core layer.
1407
1408- ``patch-status-noncore:`` Checks that the Upstream-Status is specified
1409 and valid in the headers of patches for recipes in layers other than
1410 OE-Core.
1411
1412- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1413 installed and packaged by a recipe.
1414
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001415- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1416 invalid format.
1417
1418- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1419 invalid format.
1420
1421- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1422 'link' where the specified target already exists.
1423
1424- ``perms:`` Currently, this check is unused but reserved.
1425
1426- ``pkgconfig:`` Checks ``.pc`` files for any
1427 :term:`TMPDIR`/:term:`WORKDIR` paths.
1428 Any ``.pc`` file containing these paths is incorrect since
1429 ``pkg-config`` itself adds the correct sysroot prefix when the files
1430 are accessed.
1431
1432- ``pkgname:`` Checks that all packages in
1433 :term:`PACKAGES` have names that do not contain
1434 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1435 -).
1436
Andrew Geissler09036742021-06-25 14:25:14 -05001437- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001438 undefined during :ref:`ref-tasks-package`.
1439
1440- ``pkgvarcheck:`` Checks through the variables
1441 :term:`RDEPENDS`,
1442 :term:`RRECOMMENDS`,
1443 :term:`RSUGGESTS`,
1444 :term:`RCONFLICTS`,
1445 :term:`RPROVIDES`,
1446 :term:`RREPLACES`, :term:`FILES`,
1447 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1448 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1449 there are variable sets that are not package-specific. Using these
1450 variables without a package suffix is bad practice, and might
1451 unnecessarily complicate dependencies of other packages within the
1452 same recipe or have other unintended consequences.
1453
1454- ``pn-overrides:`` Checks that a recipe does not have a name
1455 (:term:`PN`) value that appears in
1456 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001457 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1458 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001459 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001460 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001461 turn into ``FILES = "xyz"``.
1462
1463- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001464 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001465 options are being passed to the linker commands and your binaries
1466 have potential security issues.
1467
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001468- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1469 in a packaged script is not longer than 128 characters, which can cause
1470 an error at runtime depending on the operating system.
1471
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001472- ``split-strip:`` Reports that splitting or stripping debug symbols
1473 from binaries has failed.
1474
1475- ``staticdev:`` Checks for static library files (``*.a``) in
1476 non-``staticdev`` packages.
1477
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001478- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1479 does not contain a reference to ``${PN}`` (instead of the correct
1480 ``${BPN}``) nor refers to unstable Github archive tarballs.
1481
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001482- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1483 into :term:`TMPDIR` on the host. Such symlinks will
1484 work on the host, but are clearly invalid when running on the target.
1485
1486- ``textrel:`` Checks for ELF binaries that contain relocations in
1487 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001488 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001489 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001490 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001491
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001492- ``unhandled-features-check:`` check that if one of the variables that
1493 the :ref:`ref-classes-features_check` class supports (e.g.
Patrick Williamsb542dec2023-06-09 01:26:37 -05001494 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001495 also inherits :ref:`ref-classes-features_check` in order for the
1496 requirement to actually work.
1497
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001498- ``unimplemented-ptest:`` Checks that ptests are implemented for upstream
1499 tests.
1500
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001501- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1502 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001503 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001504
1505- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1506 in the binaries that by default on a standard system are searched by
1507 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1508 not cause any breakage, they do waste space and are unnecessary.
1509
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001510- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1511 check will ensure that no package installs files to root (``/bin``,
1512 ``/sbin``, ``/lib``, ``/lib64``) directories.
1513
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001514- ``var-undefined:`` Reports when variables fundamental to packaging
1515 (i.e. :term:`WORKDIR`,
1516 :term:`DEPLOY_DIR`, :term:`D`,
1517 :term:`PN`, and :term:`PKGD`) are undefined
1518 during :ref:`ref-tasks-package`.
1519
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001520- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1521 class is enabled, reports when a package being written out has a lower
1522 version than the previously written package under the same name. If
1523 you are placing output packages into a feed and upgrading packages on
1524 a target system using that feed, the version of a package going
1525 backwards can result in the target system not correctly upgrading to
1526 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001527
1528 .. note::
1529
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001530 This is only relevant when you are using runtime package management
1531 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001532
1533- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1534 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1535 driver ABI names. All drivers should depend on the ABI versions that
1536 they have been built against. Driver recipes that include
1537 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1538 automatically get these versions. Consequently, you should only need
1539 to explicitly add dependencies to binary driver recipes.
1540
1541.. _ref-classes-insserv:
1542
Andrew Geissler517393d2023-01-13 08:55:19 -06001543``insserv``
1544===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001545
Andrew Geissler517393d2023-01-13 08:55:19 -06001546The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001547of symbolic links in ``/etc/rc?.d/`` within an image based on
1548dependencies specified by LSB headers in the ``init.d`` scripts
1549themselves.
1550
1551.. _ref-classes-kernel:
1552
Andrew Geissler517393d2023-01-13 08:55:19 -06001553``kernel``
1554==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001555
Andrew Geissler517393d2023-01-13 08:55:19 -06001556The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001557code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001558:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001559using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001560
Andrew Geissler3eeda902023-05-19 10:14:02 -05001561If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
1562:ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
1563so it is automatically used as the kernel configuration for the build. This
1564copy is not performed in case ``.config`` already exists there: this allows
1565recipes to produce a configuration by other means in
1566``do_configure:prepend``.
1567
1568Each built kernel module is packaged separately and inter-module
1569dependencies are created by parsing the ``modinfo`` output. If all modules
1570are required, then installing the ``kernel-modules`` package installs all
1571packages with modules and various other kernel packages such as
1572``kernel-vmlinux``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001573
Andrew Geissler517393d2023-01-13 08:55:19 -06001574The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001575RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1576information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001577":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001578the Yocto Project Development Tasks Manual.
1579
Andrew Geissler517393d2023-01-13 08:55:19 -06001580Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1581internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1582:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001583
1584.. _ref-classes-kernel-arch:
1585
Andrew Geissler517393d2023-01-13 08:55:19 -06001586``kernel-arch``
1587===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001588
Andrew Geissler517393d2023-01-13 08:55:19 -06001589The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001590Linux kernel compilation (including modules).
1591
1592.. _ref-classes-kernel-devicetree:
1593
Andrew Geissler517393d2023-01-13 08:55:19 -06001594``kernel-devicetree``
1595=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001596
Andrew Geissler517393d2023-01-13 08:55:19 -06001597The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1598:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001599
Patrick Williamsb542dec2023-06-09 01:26:37 -05001600Its behavior is mainly controlled by the following variables:
1601
1602- :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
1603- :term:`KERNEL_DTBDEST`: directory where to install DTB files
1604- :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
1605- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1606- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1607
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001608.. _ref-classes-kernel-fitimage:
1609
Andrew Geissler517393d2023-01-13 08:55:19 -06001610``kernel-fitimage``
1611===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001612
Andrew Geissler517393d2023-01-13 08:55:19 -06001613The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
Patrick Williamsb542dec2023-06-09 01:26:37 -05001614device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001615into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001616of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1617However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001618limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001619an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Patrick Williamsb542dec2023-06-09 01:26:37 -05001620device trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001621
1622To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Patrick Williams2a254922023-08-11 09:48:11 -05001623is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
1624:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001625
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001626The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001627when creating the FIT image are specified using the
1628:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1629
1630Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001631:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001632address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001633specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
Andrew Geissler3eeda902023-05-19 10:14:02 -05001634:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1635is necessary if such addresses are 64 bit ones.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001636
1637Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001638:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001639The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001640specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001641and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001642
1643Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001644:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001645The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001646is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
Patrick Williams2a254922023-08-11 09:48:11 -05001647:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
1648:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
1649is not set to 1.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001650
Andrew Geissler517393d2023-01-13 08:55:19 -06001651Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1652:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1653In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001654in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001655When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1656The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Patrick Williams2a254922023-08-11 09:48:11 -05001657is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001658The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001659by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1660
1661Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001662:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001663The boot script is specified in the ITS file as a text file containing
1664U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001665U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001666So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001667class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
Patrick Williams2a254922023-08-11 09:48:11 -05001668load the boot script from the FIT image and execute it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001669
Patrick Williams2a254922023-08-11 09:48:11 -05001670The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001671variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1672:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1673appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001674:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Patrick Williams2a254922023-08-11 09:48:11 -05001675"rsa2048" respectively. The keys for signing the FIT image can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001676the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001677:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001678
1679
1680.. _ref-classes-kernel-grub:
1681
Andrew Geissler517393d2023-01-13 08:55:19 -06001682``kernel-grub``
1683===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001684
Andrew Geissler517393d2023-01-13 08:55:19 -06001685The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001686the kernel as the priority boot mechanism while installing a RPM to
1687update the kernel on a deployed target.
1688
1689.. _ref-classes-kernel-module-split:
1690
Andrew Geissler517393d2023-01-13 08:55:19 -06001691``kernel-module-split``
1692=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001693
Andrew Geissler517393d2023-01-13 08:55:19 -06001694The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001695splitting Linux kernel modules into separate packages.
1696
1697.. _ref-classes-kernel-uboot:
1698
Andrew Geissler517393d2023-01-13 08:55:19 -06001699``kernel-uboot``
1700================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001701
Andrew Geissler517393d2023-01-13 08:55:19 -06001702The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001703vmlinux-style kernel sources.
1704
1705.. _ref-classes-kernel-uimage:
1706
Andrew Geissler517393d2023-01-13 08:55:19 -06001707``kernel-uimage``
1708=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001709
Andrew Geissler517393d2023-01-13 08:55:19 -06001710The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001711
1712.. _ref-classes-kernel-yocto:
1713
Andrew Geissler517393d2023-01-13 08:55:19 -06001714``kernel-yocto``
1715================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001716
Andrew Geissler517393d2023-01-13 08:55:19 -06001717The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001718from linux-yocto style kernel source repositories.
1719
1720.. _ref-classes-kernelsrc:
1721
Andrew Geissler517393d2023-01-13 08:55:19 -06001722``kernelsrc``
1723=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001724
Andrew Geissler517393d2023-01-13 08:55:19 -06001725The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001726
1727.. _ref-classes-lib_package:
1728
Andrew Geissler517393d2023-01-13 08:55:19 -06001729``lib_package``
1730===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001731
Andrew Geissler517393d2023-01-13 08:55:19 -06001732The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001733produce executable binaries, where those binaries should not be
1734installed by default along with the library. Instead, the binaries are
1735added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1736make their installation optional.
1737
1738.. _ref-classes-libc*:
1739
Andrew Geissler517393d2023-01-13 08:55:19 -06001740``libc*``
1741=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001742
Andrew Geissler517393d2023-01-13 08:55:19 -06001743The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001744
Patrick Williams2390b1b2022-11-03 13:47:49 -05001745- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001746 ``libc``.
1747
Patrick Williams2390b1b2022-11-03 13:47:49 -05001748- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001749 ``eglibc``.
1750
1751.. _ref-classes-license:
1752
Andrew Geissler517393d2023-01-13 08:55:19 -06001753``license``
1754===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001755
Andrew Geissler517393d2023-01-13 08:55:19 -06001756The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001757exclusion. This class is enabled by default using the default value for
1758the :term:`INHERIT_DISTRO` variable.
1759
1760.. _ref-classes-linux-kernel-base:
1761
Andrew Geissler517393d2023-01-13 08:55:19 -06001762``linux-kernel-base``
1763=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001764
Andrew Geissler517393d2023-01-13 08:55:19 -06001765The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001766recipes that build out of the Linux kernel source tree. These builds
1767goes beyond the kernel itself. For example, the Perf recipe also
1768inherits this class.
1769
1770.. _ref-classes-linuxloader:
1771
Andrew Geissler517393d2023-01-13 08:55:19 -06001772``linuxloader``
1773===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001774
1775Provides the function ``linuxloader()``, which gives the value of the
1776dynamic loader/linker provided on the platform. This value is used by a
1777number of other classes.
1778
1779.. _ref-classes-logging:
1780
Andrew Geissler517393d2023-01-13 08:55:19 -06001781``logging``
1782===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001783
Andrew Geissler517393d2023-01-13 08:55:19 -06001784The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001785messages for various BitBake severity levels (i.e. ``bbplain``,
1786``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1787
Andrew Geissler517393d2023-01-13 08:55:19 -06001788This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001789class.
1790
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001791.. _ref-classes-meson:
1792
1793``meson``
1794=========
1795
1796The :ref:`ref-classes-meson` class allows to create recipes that build software
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001797using the `Meson <https://mesonbuild.com/>`__ build system. You can use the
1798:term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON`
1799variables to specify additional configuration options to be passed using the
1800``meson`` command line.
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001801
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001802.. _ref-classes-metadata_scm:
1803
Andrew Geissler517393d2023-01-13 08:55:19 -06001804``metadata_scm``
1805================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001806
Andrew Geissler517393d2023-01-13 08:55:19 -06001807The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001808branch and revision of a Source Code Manager (SCM) repository.
1809
Andrew Geissler517393d2023-01-13 08:55:19 -06001810The :ref:`ref-classes-base` class uses this class to print the revisions of
1811each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1812class is enabled by default because it is inherited by the
1813:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001814
1815.. _ref-classes-migrate_localcount:
1816
Andrew Geissler517393d2023-01-13 08:55:19 -06001817``migrate_localcount``
1818======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001819
Andrew Geissler517393d2023-01-13 08:55:19 -06001820The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001821increments it appropriately.
1822
1823.. _ref-classes-mime:
1824
Andrew Geissler517393d2023-01-13 08:55:19 -06001825``mime``
1826========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001827
Andrew Geissler517393d2023-01-13 08:55:19 -06001828The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001829(postinst/postrm) scriptlets for packages that install MIME type files.
1830These scriptlets call ``update-mime-database`` to add the MIME types to
1831the shared database.
1832
Patrick Williams7784c422022-11-17 07:29:11 -06001833.. _ref-classes-mime-xdg:
1834
Andrew Geissler517393d2023-01-13 08:55:19 -06001835``mime-xdg``
1836============
Patrick Williams7784c422022-11-17 07:29:11 -06001837
Andrew Geissler517393d2023-01-13 08:55:19 -06001838The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001839post-install and post-remove (postinst/postrm) scriptlets for packages
1840that install ``.desktop`` files containing ``MimeType`` entries.
1841These scriptlets call ``update-desktop-database`` to add the MIME types
1842to the database of MIME types handled by desktop files.
1843
1844Thanks to this class, when users open a file through a file browser
1845on recently created images, they don't have to choose the application
1846to open the file from the pool of all known applications, even the ones
1847that cannot open the selected file.
1848
1849If you have recipes installing their ``.desktop`` files as absolute
1850symbolic links, the detection of such files cannot be done by the current
1851implementation of this class. In this case, you have to add the corresponding
1852package names to the :term:`MIME_XDG_PACKAGES` variable.
1853
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001854.. _ref-classes-mirrors:
1855
Andrew Geissler517393d2023-01-13 08:55:19 -06001856``mirrors``
1857===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001858
Andrew Geissler517393d2023-01-13 08:55:19 -06001859The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001860:term:`MIRRORS` entries for source code mirrors. These
1861mirrors provide a fall-back path in case the upstream source specified
1862in :term:`SRC_URI` within recipes is unavailable.
1863
1864This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001865:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001866
1867.. _ref-classes-module:
1868
Andrew Geissler517393d2023-01-13 08:55:19 -06001869``module``
1870==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001871
Andrew Geissler517393d2023-01-13 08:55:19 -06001872The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1873kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1874:ref:`ref-classes-kernel-module-split` classes, and implements the
1875:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001876everything needed to build and package a kernel module.
1877
1878For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001879":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001880section in the Yocto Project Linux Kernel Development Manual.
1881
1882.. _ref-classes-module-base:
1883
Andrew Geissler517393d2023-01-13 08:55:19 -06001884``module-base``
1885===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001886
Andrew Geissler517393d2023-01-13 08:55:19 -06001887The :ref:`ref-classes-module-base` class provides the base functionality for
1888building Linux kernel modules. Typically, a recipe that builds software that
1889includes one or more kernel modules and has its own means of building the module
1890inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1891class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001892
1893.. _ref-classes-multilib*:
1894
Andrew Geissler517393d2023-01-13 08:55:19 -06001895``multilib*``
1896=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001897
Andrew Geissler517393d2023-01-13 08:55:19 -06001898The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001899different target optimizations or target architectures and installing
1900them side-by-side in the same image.
1901
1902For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001903":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001904section in the Yocto Project Development Tasks Manual.
1905
1906.. _ref-classes-native:
1907
Andrew Geissler517393d2023-01-13 08:55:19 -06001908``native``
1909==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001910
Andrew Geissler517393d2023-01-13 08:55:19 -06001911The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001912build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1913or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001914
1915You can create a recipe that builds tools that run natively on the host
1916a couple different ways:
1917
Andrew Geissler517393d2023-01-13 08:55:19 -06001918- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001919 class. If you use this method, you must order the inherit statement
1920 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001921 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001922
1923 .. note::
1924
1925 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001926 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001927
1928 myrecipe-native.bb
1929
1930
1931 Not using this naming convention can lead to subtle problems
1932 caused by existing code that depends on that naming convention.
1933
Andrew Geisslerc926e172021-05-07 16:11:35 -05001934- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001935
1936 BBCLASSEXTEND = "native"
1937
1938 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001939 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001940 specify any functionality specific to the respective native or target
1941 case.
1942
Andrew Geissler517393d2023-01-13 08:55:19 -06001943Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001944methods. The advantage of the second method is that you do not need to
1945have two separate recipes (assuming you need both) for native and
1946target. All common parts of the recipe are automatically shared.
1947
1948.. _ref-classes-nativesdk:
1949
Andrew Geissler517393d2023-01-13 08:55:19 -06001950``nativesdk``
1951=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001952
Andrew Geissler517393d2023-01-13 08:55:19 -06001953The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001954wish to build tools to run as part of an SDK (i.e. tools that run on
1955:term:`SDKMACHINE`).
1956
1957You can create a recipe that builds tools that run on the SDK machine a
1958couple different ways:
1959
Andrew Geisslereff27472021-10-29 15:35:00 -05001960- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001961 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001962 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001963 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001964
Andrew Geissler517393d2023-01-13 08:55:19 -06001965- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001966
1967 BBCLASSEXTEND = "nativesdk"
1968
1969 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001970 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001971 specify any functionality specific to the respective SDK machine or
1972 target case.
1973
1974.. note::
1975
Andrew Geisslerc926e172021-05-07 16:11:35 -05001976 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001977
1978 nativesdk-myrecipe.bb
1979
1980
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001981 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001982 depends on the naming convention.
1983
Andrew Geissler517393d2023-01-13 08:55:19 -06001984Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001985methods. The advantage of the second method is that you do not need to
1986have two separate recipes (assuming you need both) for the SDK machine
1987and the target. All common parts of the recipe are automatically shared.
1988
1989.. _ref-classes-nopackages:
1990
Andrew Geissler517393d2023-01-13 08:55:19 -06001991``nopackages``
1992==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001993
1994Disables packaging tasks for those recipes and classes where packaging
1995is not needed.
1996
1997.. _ref-classes-npm:
1998
Andrew Geissler517393d2023-01-13 08:55:19 -06001999``npm``
2000=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002001
Patrick Williams7784c422022-11-17 07:29:11 -06002002Provides support for building Node.js software fetched using the
2003:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002004
2005.. note::
2006
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002007 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002008 fetcher to have dependencies fetched and packaged automatically.
2009
2010For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002011":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002012section in the Yocto Project Development Tasks Manual.
2013
2014.. _ref-classes-oelint:
2015
Andrew Geissler517393d2023-01-13 08:55:19 -06002016``oelint``
2017==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002018
Andrew Geissler517393d2023-01-13 08:55:19 -06002019The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002020``meta/classes`` in the :term:`Source Directory`.
2021
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002022There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06002023are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002024one such example. However, being aware of this class can reduce the
2025proliferation of different versions of similar classes across multiple
2026layers.
2027
Andrew Geissler5199d832021-09-24 16:47:35 -05002028.. _ref-classes-overlayfs:
2029
Andrew Geissler517393d2023-01-13 08:55:19 -06002030``overlayfs``
2031=============
Andrew Geissler5199d832021-09-24 16:47:35 -05002032
Andrew Geissler595f6302022-01-24 19:11:47 +00002033It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05002034But a lot of different applications might want to have read-write access to
2035some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00002036overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06002037between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05002038to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00002039root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05002040
2041To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
2042layer in your machine configuration. The underlying file system can be anything that
2043is supported by ``overlayfs``. This has to be done in your machine configuration::
2044
2045 OVERLAYFS_MOUNT_POINT[data] = "/data"
2046
2047.. note::
2048
2049 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2050 * Only the existence of the systemd mount unit file is checked, not its contents.
2051 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002052 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 -05002053
2054The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2055(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2056
2057Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2058
2059 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2060
2061To support several mount points you can use a different variable flag. Assuming we
2062want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002063survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2064file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002065
2066In your machine configuration::
2067
2068 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2069
2070and then in your recipe::
2071
2072 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2073
Andrew Geissler595f6302022-01-24 19:11:47 +00002074On a practical note, your application recipe might require multiple
2075overlays to be mounted before running to avoid writing to the underlying
2076file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002077To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002078helper service for mounting overlays. This helper service is named
2079``${PN}-overlays.service`` and can be depended on in your application recipe
2080(named ``application`` in the following example) ``systemd`` unit by adding
2081to the unit the following::
2082
2083 [Unit]
2084 After=application-overlays.service
2085 Requires=application-overlays.service
2086
Andrew Geissler5199d832021-09-24 16:47:35 -05002087.. note::
2088
2089 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002090 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002091
2092.. _ref-classes-overlayfs-etc:
2093
Andrew Geissler517393d2023-01-13 08:55:19 -06002094``overlayfs-etc``
2095=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002096
2097In order to have the ``/etc`` directory in overlayfs a special handling at early
2098boot stage is required. The idea is to supply a custom init script that mounts
2099``/etc`` before launching the actual init program, because the latter already
2100requires ``/etc`` to be mounted.
2101
2102Example usage in image recipe::
2103
2104 IMAGE_FEATURES += "overlayfs-etc"
2105
2106.. note::
2107
2108 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2109
2110Your machine configuration should define at least the device, mount point, and file system type
2111you are going to use for ``overlayfs``::
2112
2113 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2114 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2115 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2116
2117To control more mount options you should consider setting mount options
2118(``defaults`` is used by default)::
2119
2120 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2121
2122The class provides two options for ``/sbin/init`` generation:
2123
2124- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2125 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2126 that you won't need to change any kernel parameters in order to make it work,
2127 but it poses a restriction that package-management can't be used, because updating
2128 the init manager would remove the generated script.
2129
2130- If you wish to keep original init as is, you can set::
2131
2132 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2133
2134 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2135 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002136
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002137.. _ref-classes-own-mirrors:
2138
Andrew Geissler517393d2023-01-13 08:55:19 -06002139``own-mirrors``
2140===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002141
Andrew Geissler517393d2023-01-13 08:55:19 -06002142The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002143:term:`PREMIRRORS` from which to first fetch source
2144before attempting to fetch it from the upstream specified in
2145:term:`SRC_URI` within each recipe.
2146
2147To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002148:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002149
2150 INHERIT += "own-mirrors"
2151 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2152
2153You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002154in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002155
2156.. _ref-classes-package:
2157
Andrew Geissler517393d2023-01-13 08:55:19 -06002158``package``
2159===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002160
Andrew Geissler517393d2023-01-13 08:55:19 -06002161The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002162output. The core generic functionality is in ``package.bbclass``. The
2163code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002164package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002165:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002166
2167You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002168:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002169configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002170When defining the variable, you can specify one or more package types.
2171Since images are generated from packages, a packaging class is needed
2172to enable image generation. The first class listed in this variable is
2173used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002174
2175If you take the optional step to set up a repository (package feed) on
2176the development host that can be used by DNF, you can install packages
2177from the feed while you are running the image on the target (i.e.
2178runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002179":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002180section in the Yocto Project Development Tasks Manual.
2181
2182The package-specific class you choose can affect build-time performance
2183and has space ramifications. In general, building a package with IPK
2184takes about thirty percent less time as compared to using RPM to build
2185the same or similar package. This comparison takes into account a
2186complete build of the package with all dependencies previously built.
2187The reason for this discrepancy is because the RPM package manager
2188creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002189manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002190":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002191
2192Before making your package manager decision, however, you should
2193consider some further things about using RPM:
2194
2195- RPM starts to provide more abilities than IPK due to the fact that it
2196 processes more Metadata. For example, this information includes
2197 individual file types, file checksum generation and evaluation on
2198 install, sparse file support, conflict detection and resolution for
2199 Multilib systems, ACID style upgrade, and repackaging abilities for
2200 rollbacks.
2201
2202- For smaller systems, the extra space used for the Berkeley Database
2203 and the amount of metadata when using RPM can affect your ability to
2204 perform on-device upgrades.
2205
2206You can find additional information on the effects of the package class
2207at these two Yocto Project mailing list links:
2208
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002209- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002210
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002211- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002212
2213.. _ref-classes-package_deb:
2214
Andrew Geissler517393d2023-01-13 08:55:19 -06002215``package_deb``
2216===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002217
Andrew Geissler517393d2023-01-13 08:55:19 -06002218The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002219use the Debian (i.e. ``.deb``) file format. The class ensures the
2220packages are written out in a ``.deb`` file format to the
2221``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2222
Andrew Geissler517393d2023-01-13 08:55:19 -06002223This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002224is enabled through the :term:`PACKAGE_CLASSES`
2225variable in the ``local.conf`` file.
2226
2227.. _ref-classes-package_ipk:
2228
Andrew Geissler517393d2023-01-13 08:55:19 -06002229``package_ipk``
2230===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002231
Andrew Geissler517393d2023-01-13 08:55:19 -06002232The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002233use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2234are written out in a ``.ipk`` file format to the
2235``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2236
Andrew Geissler517393d2023-01-13 08:55:19 -06002237This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002238is enabled through the :term:`PACKAGE_CLASSES`
2239variable in the ``local.conf`` file.
2240
2241.. _ref-classes-package_rpm:
2242
Andrew Geissler517393d2023-01-13 08:55:19 -06002243``package_rpm``
2244===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002245
Andrew Geissler517393d2023-01-13 08:55:19 -06002246The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002247use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2248are written out in a ``.rpm`` file format to the
2249``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` 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
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002255.. _ref-classes-packagedata:
2256
Andrew Geissler517393d2023-01-13 08:55:19 -06002257``packagedata``
2258===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002259
Andrew Geissler517393d2023-01-13 08:55:19 -06002260The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002261``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2262files contain information about each output package produced by the
2263OpenEmbedded build system.
2264
2265This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002266:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002267
2268.. _ref-classes-packagegroup:
2269
Andrew Geissler517393d2023-01-13 08:55:19 -06002270``packagegroup``
2271================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002272
Andrew Geissler517393d2023-01-13 08:55:19 -06002273The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002274group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002275so forth). It is highly recommended that all package group recipes
2276inherit this class.
2277
2278For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002279":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002280section in the Yocto Project Development Tasks Manual.
2281
2282Previously, this class was called the ``task`` class.
2283
2284.. _ref-classes-patch:
2285
Andrew Geissler517393d2023-01-13 08:55:19 -06002286``patch``
2287=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002288
Andrew Geissler517393d2023-01-13 08:55:19 -06002289The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002290during the :ref:`ref-tasks-patch` task.
2291
2292This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002293:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002294
2295.. _ref-classes-perlnative:
2296
Andrew Geissler517393d2023-01-13 08:55:19 -06002297``perlnative``
2298==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002299
Andrew Geissler517393d2023-01-13 08:55:19 -06002300When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002301native version of Perl built by the build system rather than using the
2302version provided by the build host.
2303
Patrick Williams975a06f2022-10-21 14:42:47 -05002304.. _ref-classes-pypi:
2305
Andrew Geissler517393d2023-01-13 08:55:19 -06002306``pypi``
2307========
Patrick Williams975a06f2022-10-21 14:42:47 -05002308
Andrew Geissler517393d2023-01-13 08:55:19 -06002309The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002310Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2311By default it determines the PyPI package name based upon :term:`BPN`
2312(stripping the "python-" or "python3-" prefix off if present), however in
2313some cases you may need to set it manually in the recipe by setting
2314:term:`PYPI_PACKAGE`.
2315
Andrew Geissler517393d2023-01-13 08:55:19 -06002316Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002317:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2318and :term:`CVE_PRODUCT`.
2319
Patrick Williams45852732022-04-02 08:58:32 -05002320.. _ref-classes-python_flit_core:
2321
Andrew Geissler517393d2023-01-13 08:55:19 -06002322``python_flit_core``
2323====================
Patrick Williams45852732022-04-02 08:58:32 -05002324
Andrew Geissler517393d2023-01-13 08:55:19 -06002325The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002326the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2327``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2328section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2329
2330Python modules built with ``flit_core.buildapi`` are pure Python (no
2331``C`` or ``Rust`` extensions).
2332
Andrew Geissler517393d2023-01-13 08:55:19 -06002333Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002334
Andrew Geissler9aee5002022-03-30 16:27:02 +00002335.. _ref-classes-python_pep517:
2336
Andrew Geissler517393d2023-01-13 08:55:19 -06002337``python_pep517``
2338=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002339
Andrew Geissler517393d2023-01-13 08:55:19 -06002340The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002341archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002342
Patrick Williams45852732022-04-02 08:58:32 -05002343Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002344inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002345
Andrew Geissler517393d2023-01-13 08:55:19 -06002346Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2347:ref:`ref-classes-python_setuptools_build_meta`, and
2348:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002349
2350.. _ref-classes-python_poetry_core:
2351
Andrew Geissler517393d2023-01-13 08:55:19 -06002352``python_poetry_core``
2353======================
Patrick Williams45852732022-04-02 08:58:32 -05002354
Andrew Geissler517393d2023-01-13 08:55:19 -06002355The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002356`Poetry Core <https://python-poetry.org>`__ build system.
2357
Andrew Geissler517393d2023-01-13 08:55:19 -06002358Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002359
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002360.. _ref-classes-python_pyo3:
2361
2362``python_pyo3``
2363===============
2364
2365The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2366written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2367environment for cross compilation.
2368
2369This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2370and is not meant to be used directly in recipes.
2371
2372.. _ref-classes-python-setuptools3_rust:
2373
2374``python-setuptools3_rust``
2375===========================
2376
2377The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2378extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2379to compile and distribute Python extensions written in Rust as easily
2380as if they were written in C.
2381
2382This class inherits the :ref:`ref-classes-setuptools3` and
2383:ref:`ref-classes-python_pyo3` classes.
2384
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002385.. _ref-classes-pixbufcache:
2386
Andrew Geissler517393d2023-01-13 08:55:19 -06002387``pixbufcache``
2388===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002389
Andrew Geissler517393d2023-01-13 08:55:19 -06002390The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002391post-remove (postinst/postrm) scriptlets for packages that install
2392pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2393call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2394Since the cache files are architecture-specific, ``update_pixbuf_cache``
2395is run using QEMU if the postinst scriptlets need to be run on the build
2396host during image creation.
2397
2398If the pixbuf loaders being installed are in packages other than the
2399recipe's main package, set
2400:term:`PIXBUF_PACKAGES` to specify the packages
2401containing the loaders.
2402
2403.. _ref-classes-pkgconfig:
2404
Andrew Geissler517393d2023-01-13 08:55:19 -06002405``pkgconfig``
2406=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002407
Andrew Geissler517393d2023-01-13 08:55:19 -06002408The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002409library information by using ``pkg-config``. This class aims to smooth
2410integration of ``pkg-config`` into libraries that use it.
2411
2412During staging, BitBake installs ``pkg-config`` data into the
2413``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002414``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002415files.
2416
2417.. _ref-classes-populate-sdk:
2418
Andrew Geissler517393d2023-01-13 08:55:19 -06002419``populate_sdk``
2420================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002421
Andrew Geissler517393d2023-01-13 08:55:19 -06002422The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002423information on advantages gained when building a cross-development
2424toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002425task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002426section in the Yocto Project Application Development and the Extensible
2427Software Development Kit (eSDK) manual.
2428
2429.. _ref-classes-populate-sdk-*:
2430
Andrew Geissler517393d2023-01-13 08:55:19 -06002431``populate_sdk_*``
2432==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002433
Andrew Geissler517393d2023-01-13 08:55:19 -06002434The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002435following classes:
2436
Patrick Williams2390b1b2022-11-03 13:47:49 -05002437- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002438 all package managers (i.e. DEB, RPM, and opkg).
2439
Patrick Williams2390b1b2022-11-03 13:47:49 -05002440- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002441 package manager.
2442
Patrick Williams2390b1b2022-11-03 13:47:49 -05002443- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002444 package manager.
2445
Patrick Williams2390b1b2022-11-03 13:47:49 -05002446- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002447 (IPK format) package manager.
2448
Patrick Williams2390b1b2022-11-03 13:47:49 -05002449- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002450 package managers.
2451
Patrick Williams2390b1b2022-11-03 13:47:49 -05002452The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002453``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2454:term:`IMAGE_PKGTYPE`.
2455
2456The base class ensures all source and destination directories are
2457established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002458:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002459``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2460contains the cross-compiler and associated tooling, and the target,
2461which contains a target root filesystem that is configured for the SDK
2462usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002463which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002464
2465 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2466 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2467
2468Finally, the base populate SDK class creates the toolchain environment
2469setup script, the tarball of the SDK, and the installer.
2470
Patrick Williams2390b1b2022-11-03 13:47:49 -05002471The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2472:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2473These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002474class.
2475
2476For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002477the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002478section in the Yocto Project Overview and Concepts Manual. For
2479information on advantages gained when building a cross-development
2480toolchain using the :ref:`ref-tasks-populate_sdk`
2481task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002482":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002483section in the Yocto Project Application Development and the Extensible
2484Software Development Kit (eSDK) manual.
2485
2486.. _ref-classes-prexport:
2487
Andrew Geissler517393d2023-01-13 08:55:19 -06002488``prexport``
2489============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002490
Andrew Geissler517393d2023-01-13 08:55:19 -06002491The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002492:term:`PR` values.
2493
2494.. note::
2495
2496 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002497 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002498
2499.. _ref-classes-primport:
2500
Andrew Geissler517393d2023-01-13 08:55:19 -06002501``primport``
2502============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002503
Andrew Geissler517393d2023-01-13 08:55:19 -06002504The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002505:term:`PR` values.
2506
2507.. note::
2508
2509 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002510 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002511
2512.. _ref-classes-prserv:
2513
Andrew Geissler517393d2023-01-13 08:55:19 -06002514``prserv``
2515==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002516
Andrew Geissler517393d2023-01-13 08:55:19 -06002517The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2518service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002519automatically manage the incrementing of the :term:`PR`
2520variable for each recipe.
2521
2522This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002523:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002524build system will not enable the functionality of this class unless
2525:term:`PRSERV_HOST` has been set.
2526
2527.. _ref-classes-ptest:
2528
Andrew Geissler517393d2023-01-13 08:55:19 -06002529``ptest``
2530=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002531
Andrew Geissler517393d2023-01-13 08:55:19 -06002532The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002533runtime tests for recipes that build software that provides these tests.
2534
2535This class is intended to be inherited by individual recipes. However,
2536the class' functionality is largely disabled unless "ptest" appears in
2537:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002538":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002539section in the Yocto Project Development Tasks Manual for more information
2540on ptest.
2541
Andrew Geissler5082cc72023-09-11 08:41:39 -04002542.. _ref-classes-ptest-cargo:
2543
2544``ptest-cargo``
2545===============
2546
2547The :ref:`ref-classes-ptest-cargo` class is a class which extends the
2548:ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
2549``install_ptest_cargo`` steps to respectively build and install
2550test suites defined in the ``Cargo.toml`` file, into a dedicated
2551``-ptest`` package.
2552
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002553.. _ref-classes-ptest-gnome:
2554
Andrew Geissler517393d2023-01-13 08:55:19 -06002555``ptest-gnome``
2556===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002557
2558Enables package tests (ptests) specifically for GNOME packages, which
2559have tests intended to be executed with ``gnome-desktop-testing``.
2560
2561For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002562":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002563section in the Yocto Project Development Tasks Manual.
2564
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002565.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002566
Andrew Geissler517393d2023-01-13 08:55:19 -06002567``python3-dir``
2568===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002569
Andrew Geissler517393d2023-01-13 08:55:19 -06002570The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002571package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002572
2573.. _ref-classes-python3native:
2574
Andrew Geissler517393d2023-01-13 08:55:19 -06002575``python3native``
2576=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002577
Andrew Geissler517393d2023-01-13 08:55:19 -06002578The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050025793 built by the build system rather than support of the version provided
2580by the build host.
2581
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002582.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002583
Andrew Geissler517393d2023-01-13 08:55:19 -06002584``python3targetconfig``
2585=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002586
Andrew Geissler517393d2023-01-13 08:55:19 -06002587The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050025883 built by the build system rather than support of the version provided
2589by the build host, except that the configuration for the target machine
2590is accessible (such as correct installation directories). This also adds a
2591dependency on target ``python3``, so should only be used where appropriate
2592in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002593
2594.. _ref-classes-qemu:
2595
Andrew Geissler517393d2023-01-13 08:55:19 -06002596``qemu``
2597========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002598
Andrew Geissler517393d2023-01-13 08:55:19 -06002599The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002600QEMU or test for the existence of QEMU. Typically, this class is used to
2601run programs for a target system on the build host using QEMU's
2602application emulation mode.
2603
2604.. _ref-classes-recipe_sanity:
2605
Andrew Geissler517393d2023-01-13 08:55:19 -06002606``recipe_sanity``
2607=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002608
Andrew Geissler517393d2023-01-13 08:55:19 -06002609The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002610recipe prerequisites that might affect the build (e.g. variables that
2611are set or software that is present).
2612
2613.. _ref-classes-relocatable:
2614
Andrew Geissler517393d2023-01-13 08:55:19 -06002615``relocatable``
2616===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002617
Andrew Geissler517393d2023-01-13 08:55:19 -06002618The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002619installed into the sysroot.
2620
Andrew Geissler517393d2023-01-13 08:55:19 -06002621This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2622both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002623
2624.. _ref-classes-remove-libtool:
2625
Andrew Geissler517393d2023-01-13 08:55:19 -06002626``remove-libtool``
2627==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002628
Andrew Geissler517393d2023-01-13 08:55:19 -06002629The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002630:ref:`ref-tasks-install` task to remove all ``.la`` files
2631installed by ``libtool``. Removing these files results in them being
2632absent from both the sysroot and target packages.
2633
2634If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002635override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002636
2637 REMOVE_LIBTOOL_LA = "0"
2638
2639.. note::
2640
Andrew Geissler517393d2023-01-13 08:55:19 -06002641 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002642
2643.. _ref-classes-report-error:
2644
Andrew Geissler517393d2023-01-13 08:55:19 -06002645``report-error``
2646================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002647
Andrew Geissler517393d2023-01-13 08:55:19 -06002648The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2649tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002650which allows you to submit build error information to a central database.
2651
2652The class collects debug information for recipe, recipe version, task,
2653machine, distro, build system, target system, host distro, branch,
2654commit, and log. From the information, report files using a JSON format
2655are created and stored in
2656``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2657
2658.. _ref-classes-rm-work:
2659
Andrew Geissler517393d2023-01-13 08:55:19 -06002660``rm_work``
2661===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002662
Andrew Geissler517393d2023-01-13 08:55:19 -06002663The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002664can ease your hard drive demands during builds.
2665
2666The OpenEmbedded build system can use a substantial amount of disk space
2667during the build process. A portion of this space is the work files
2668under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2669system generates the packages for a recipe, the work files for that
2670recipe are no longer needed. However, by default, the build system
2671preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002672you would rather have these files deleted to save disk space as the build
2673progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002674your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002675
2676 INHERIT += "rm_work"
2677
Andrew Geissler517393d2023-01-13 08:55:19 -06002678If you are modifying and building source code out of the work directory for a
2679recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2680changes to the source being lost. To exclude some recipes from having their work
2681directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2682recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2683which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002684
2685 RM_WORK_EXCLUDE += "busybox glibc"
2686
2687.. _ref-classes-rootfs*:
2688
Andrew Geissler517393d2023-01-13 08:55:19 -06002689``rootfs*``
2690===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002691
Andrew Geissler517393d2023-01-13 08:55:19 -06002692The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002693image and consist of the following classes:
2694
Patrick Williams2390b1b2022-11-03 13:47:49 -05002695- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002696 post-processing functions for image recipes.
2697
Patrick Williams2390b1b2022-11-03 13:47:49 -05002698- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002699 for images built using ``.deb`` packages.
2700
Patrick Williams2390b1b2022-11-03 13:47:49 -05002701- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002702 for images built using ``.rpm`` packages.
2703
Patrick Williams2390b1b2022-11-03 13:47:49 -05002704- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002705 for images built using ``.ipk`` packages.
2706
Patrick Williams2390b1b2022-11-03 13:47:49 -05002707- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002708 on the build host directly into the root filesystem.
2709
2710The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002711:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2712variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002713
2714For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002715":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002716section in the Yocto Project Overview and Concepts Manual.
2717
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002718.. _ref-classes-rust:
2719
2720``rust``
2721========
2722
2723The :ref:`ref-classes-rust` class is an internal class which is just used
2724in the "rust" recipe, to build the Rust compiler and runtime
2725library. Except for this recipe, it is not intended to be used directly.
2726
2727.. _ref-classes-rust-common:
2728
2729``rust-common``
2730===============
2731
2732The :ref:`ref-classes-rust-common` class is an internal class to the
2733:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2734intended to be used directly.
2735
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002736.. _ref-classes-sanity:
2737
Andrew Geissler517393d2023-01-13 08:55:19 -06002738``sanity``
2739==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002740
Andrew Geissler517393d2023-01-13 08:55:19 -06002741The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002742on the host system so that users can be notified of potential problems
2743that might affect their build. The class also performs basic user
2744configuration checks from the ``local.conf`` configuration file to
2745prevent common mistakes that cause build failures. Distribution policy
2746usually determines whether to include this class.
2747
2748.. _ref-classes-scons:
2749
Andrew Geissler517393d2023-01-13 08:55:19 -06002750``scons``
2751=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002752
Andrew Geissler517393d2023-01-13 08:55:19 -06002753The :ref:`ref-classes-scons` class supports recipes that need to build software
2754that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2755variable to specify additional configuration options you want to pass SCons
2756command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002757
2758.. _ref-classes-sdl:
2759
Andrew Geissler517393d2023-01-13 08:55:19 -06002760``sdl``
2761=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002762
Andrew Geissler517393d2023-01-13 08:55:19 -06002763The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002764the Simple DirectMedia Layer (SDL) library.
2765
Patrick Williams45852732022-04-02 08:58:32 -05002766.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002767
Andrew Geissler517393d2023-01-13 08:55:19 -06002768``python_setuptools_build_meta``
2769================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002770
Andrew Geissler517393d2023-01-13 08:55:19 -06002771The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2772Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002773`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2774``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2775section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2776
2777Python modules built with ``setuptools.build_meta`` can be pure Python or
2778include ``C`` or ``Rust`` extensions).
2779
Andrew Geissler517393d2023-01-13 08:55:19 -06002780Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002781
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002782.. _ref-classes-setuptools3:
2783
Andrew Geissler517393d2023-01-13 08:55:19 -06002784``setuptools3``
2785===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002786
Andrew Geissler517393d2023-01-13 08:55:19 -06002787The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2788that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2789and have not migrated to the official ``pyproject.toml`` format). If your recipe
2790uses these build systems, the recipe needs to inherit the
2791:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002792
2793 .. note::
2794
Andrew Geissler517393d2023-01-13 08:55:19 -06002795 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002796 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2797 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2798
2799 A consequence of this is that legacy software still using deprecated
2800 ``distutils`` from the Python standard library cannot be packaged as
2801 ``wheels``. A common solution is the replace
2802 ``from distutils.core import setup`` with ``from setuptools import setup``.
2803
2804 .. note::
2805
Andrew Geissler517393d2023-01-13 08:55:19 -06002806 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2807 installs the ``wheel`` binary archive. In current versions of
2808 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2809 the ``setup.py`` cannot be used with wheels, for example it creates files
2810 outside of the Python module or standard entry points, then
2811 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002812
2813.. _ref-classes-setuptools3_legacy:
2814
Andrew Geissler517393d2023-01-13 08:55:19 -06002815``setuptools3_legacy``
2816======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002817
Andrew Geissler517393d2023-01-13 08:55:19 -06002818The :ref:`ref-classes-setuptools3_legacy` class supports
2819Python version 3.x extensions that use build systems based on ``setuptools``
2820(e.g. only have a ``setup.py`` and have not migrated to the official
2821``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2822this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2823not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002824`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002825but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002826
Andrew Geissler595f6302022-01-24 19:11:47 +00002827.. _ref-classes-setuptools3-base:
2828
Andrew Geissler517393d2023-01-13 08:55:19 -06002829``setuptools3-base``
2830====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002831
Andrew Geissler517393d2023-01-13 08:55:19 -06002832The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2833other classes that support building Python version 3.x extensions. If you need
2834functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2835you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2836in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002837
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002838.. _ref-classes-sign_rpm:
2839
Andrew Geissler517393d2023-01-13 08:55:19 -06002840``sign_rpm``
2841============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002842
Andrew Geissler517393d2023-01-13 08:55:19 -06002843The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002844
2845.. _ref-classes-siteconfig:
2846
Andrew Geissler517393d2023-01-13 08:55:19 -06002847``siteconfig``
2848==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002849
Andrew Geissler517393d2023-01-13 08:55:19 -06002850The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2851configuration. The class is used by the :ref:`ref-classes-autotools` class to
2852accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002853
2854.. _ref-classes-siteinfo:
2855
Andrew Geissler517393d2023-01-13 08:55:19 -06002856``siteinfo``
2857============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002858
Andrew Geissler517393d2023-01-13 08:55:19 -06002859The :ref:`ref-classes-siteinfo` class provides information about the targets
2860that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002861
2862As an example, consider Autotools, which can require tests that must
2863execute on the target hardware. Since this is not possible in general
2864when cross compiling, site information is used to provide cached test
2865results so these tests can be skipped over but still make the correct
2866values available. The ``meta/site directory`` contains test results
2867sorted into different categories such as architecture, endianness, and
2868the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002869data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002870Autotools automatically picks up.
2871
Andrew Geissler09036742021-06-25 14:25:14 -05002872The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2873:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002874
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002875.. _ref-classes-sstate:
2876
Andrew Geissler517393d2023-01-13 08:55:19 -06002877``sstate``
2878==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002879
Andrew Geissler517393d2023-01-13 08:55:19 -06002880The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2881By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2882default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002883
2884For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002885":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002886section in the Yocto Project Overview and Concepts Manual.
2887
2888.. _ref-classes-staging:
2889
Andrew Geissler517393d2023-01-13 08:55:19 -06002890``staging``
2891===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002892
Andrew Geissler517393d2023-01-13 08:55:19 -06002893The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002894directories for sysroots. The class contains the following key tasks:
2895
2896- The :ref:`ref-tasks-populate_sysroot` task,
2897 which is responsible for handing the files that end up in the recipe
2898 sysroots.
2899
2900- The
2901 :ref:`ref-tasks-prepare_recipe_sysroot`
2902 task (a "partner" task to the ``populate_sysroot`` task), which
2903 installs the files into the individual recipe work directories (i.e.
2904 :term:`WORKDIR`).
2905
Andrew Geissler517393d2023-01-13 08:55:19 -06002906The code in the :ref:`ref-classes-staging` class is complex and basically works
2907in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002908
2909- *Stage One:* The first stage addresses recipes that have files they
2910 want to share with other recipes that have dependencies on the
2911 originating recipe. Normally these dependencies are installed through
2912 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002913 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002914 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2915 subset of files is controlled by the
2916 :term:`SYSROOT_DIRS`,
2917 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002918 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002919 variables.
2920
2921 .. note::
2922
2923 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002924 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002925 variable.
2926
2927 A shared state (sstate) object is built from these files and the
2928 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002929 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002930 The files are scanned for hardcoded paths to the original
2931 installation location. If the location is found in text files, the
2932 hardcoded locations are replaced by tokens and a list of the files
2933 needing such replacements is created. These adjustments are referred
2934 to as "FIXMEs". The list of files that are scanned for paths is
2935 controlled by the :term:`SSTATE_SCAN_FILES`
2936 variable.
2937
2938- *Stage Two:* The second stage addresses recipes that want to use
2939 something from another recipe and declare a dependency on that recipe
2940 through the :term:`DEPENDS` variable. The recipe will
2941 have a
2942 :ref:`ref-tasks-prepare_recipe_sysroot`
2943 task and when this task executes, it creates the ``recipe-sysroot``
2944 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2945 :term:`WORKDIR`). The OpenEmbedded build system
2946 creates hard links to copies of the relevant files from
2947 ``sysroots-components`` into the recipe work directory.
2948
2949 .. note::
2950
2951 If hard links are not possible, the build system uses actual
2952 copies.
2953
2954 The build system then addresses any "FIXMEs" to paths as defined from
2955 the list created in the first stage.
2956
2957 Finally, any files in ``${bindir}`` within the sysroot that have the
2958 prefix "``postinst-``" are executed.
2959
2960 .. note::
2961
2962 Although such sysroot post installation scripts are not
2963 recommended for general use, the files do allow some issues such
2964 as user creation and module indexes to be addressed.
2965
Andrew Geissler09036742021-06-25 14:25:14 -05002966 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002967 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2968 the sysroot creation function ``extend_recipe_sysroot`` is also added
2969 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002970 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002971
2972 When installing dependencies into the sysroot, the code traverses the
2973 dependency graph and processes dependencies in exactly the same way
2974 as the dependencies would or would not be when installed from sstate.
2975 This processing means, for example, a native tool would have its
2976 native dependencies added but a target library would not have its
2977 dependencies traversed or installed. The same sstate dependency code
2978 is used so that builds should be identical regardless of whether
2979 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002980 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002981
2982 The build system is careful to maintain manifests of the files it
2983 installs so that any given dependency can be installed as needed. The
2984 sstate hash of the installed item is also stored so that if it
2985 changes, the build system can reinstall it.
2986
2987.. _ref-classes-syslinux:
2988
Andrew Geissler517393d2023-01-13 08:55:19 -06002989``syslinux``
2990============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002991
Andrew Geissler517393d2023-01-13 08:55:19 -06002992The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
2993building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002994
2995The class supports the following variables:
2996
2997- :term:`INITRD`: Indicates list of filesystem images to
2998 concatenate and use as an initial RAM disk (initrd). This variable is
2999 optional.
3000
3001- :term:`ROOTFS`: Indicates a filesystem image to include
3002 as the root filesystem. This variable is optional.
3003
3004- :term:`AUTO_SYSLINUXMENU`: Enables creating
3005 an automatic menu when set to "1".
3006
3007- :term:`LABELS`: Lists targets for automatic
3008 configuration.
3009
3010- :term:`APPEND`: Lists append string overrides for each
3011 label.
3012
3013- :term:`SYSLINUX_OPTS`: Lists additional options
3014 to add to the syslinux file. Semicolon characters separate multiple
3015 options.
3016
3017- :term:`SYSLINUX_SPLASH`: Lists a background
3018 for the VGA boot menu when you are using the boot menu.
3019
3020- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
3021 to "console=ttyX" to change kernel boot default console.
3022
3023- :term:`SYSLINUX_SERIAL`: Sets an alternate
3024 serial port. Or, turns off serial when the variable is set with an
3025 empty string.
3026
3027- :term:`SYSLINUX_SERIAL_TTY`: Sets an
3028 alternate "console=tty..." kernel boot argument.
3029
3030.. _ref-classes-systemd:
3031
Andrew Geissler517393d2023-01-13 08:55:19 -06003032``systemd``
3033===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003034
Andrew Geissler517393d2023-01-13 08:55:19 -06003035The :ref:`ref-classes-systemd` class provides support for recipes that install
3036systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003037
3038The functionality for this class is disabled unless you have "systemd"
3039in :term:`DISTRO_FEATURES`.
3040
3041Under this class, the recipe or Makefile (i.e. whatever the recipe is
3042calling during the :ref:`ref-tasks-install` task)
3043installs unit files into
3044``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
3045files being installed go into packages other than the main package, you
3046need to set :term:`SYSTEMD_PACKAGES` in your
3047recipe to identify the packages in which the files will be installed.
3048
3049You should set :term:`SYSTEMD_SERVICE` to the
3050name of the service file. You should also use a package name override to
3051indicate the package to which the value applies. If the value applies to
3052the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05003053is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003054
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003055 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003056
3057Services are set up to start on boot automatically
3058unless you have set
3059:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3060
Andrew Geissler517393d2023-01-13 08:55:19 -06003061For more information on :ref:`ref-classes-systemd`, see the
3062":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003063section in the Yocto Project Development Tasks Manual.
3064
3065.. _ref-classes-systemd-boot:
3066
Andrew Geissler517393d2023-01-13 08:55:19 -06003067``systemd-boot``
3068================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003069
Andrew Geissler517393d2023-01-13 08:55:19 -06003070The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003071systemd-boot bootloader for building bootable images. This is an
3072internal class and is not intended to be used directly.
3073
3074.. note::
3075
Andrew Geissler517393d2023-01-13 08:55:19 -06003076 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003077 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003078
Andrew Geissler517393d2023-01-13 08:55:19 -06003079Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3080use this class. Doing so creates a standalone EFI bootloader that is not
3081dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003082
3083For information on more variables used and supported in this class, see
3084the :term:`SYSTEMD_BOOT_CFG`,
3085:term:`SYSTEMD_BOOT_ENTRIES`, and
3086:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3087
3088You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003089documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003090for more information.
3091
3092.. _ref-classes-terminal:
3093
Andrew Geissler517393d2023-01-13 08:55:19 -06003094``terminal``
3095============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003096
Andrew Geissler517393d2023-01-13 08:55:19 -06003097The :ref:`ref-classes-terminal` class provides support for starting a terminal
3098session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3099used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003100
Andrew Geissler517393d2023-01-13 08:55:19 -06003101Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3102terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3103class assuming :term:`PATCHRESOLVE` is set to "user", the
3104:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3105use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003106
Patrick Williams975a06f2022-10-21 14:42:47 -05003107.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003108
Andrew Geissler517393d2023-01-13 08:55:19 -06003109``testimage``
3110=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003111
Andrew Geissler517393d2023-01-13 08:55:19 -06003112The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003113images using QEMU and on actual hardware. The classes handle loading the
3114tests and starting the image. To use the classes, you need to perform
3115steps to set up the environment.
3116
Patrick Williams975a06f2022-10-21 14:42:47 -05003117To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003118
Patrick Williams975a06f2022-10-21 14:42:47 -05003119 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003120
3121The tests are commands that run on the target system over ``ssh``. Each
3122test is written in Python and makes use of the ``unittest`` module.
3123
Andrew Geissler517393d2023-01-13 08:55:19 -06003124The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003125following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003126
3127 $ bitbake -c testimage image
3128
Patrick Williams975a06f2022-10-21 14:42:47 -05003129Alternatively, if you wish to have tests automatically run for each image
3130after it is built, you can set :term:`TESTIMAGE_AUTO`::
3131
3132 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003133
3134For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003135":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003136section in the Yocto Project Development Tasks Manual.
3137
3138.. _ref-classes-testsdk:
3139
Andrew Geissler517393d2023-01-13 08:55:19 -06003140``testsdk``
3141===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003142
3143This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003144kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003145using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003146
3147 $ bitbake -c testsdk image
3148
3149.. note::
3150
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003151 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003152 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003153 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003154
3155.. _ref-classes-texinfo:
3156
Andrew Geissler517393d2023-01-13 08:55:19 -06003157``texinfo``
3158===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003159
3160This class should be inherited by recipes whose upstream packages invoke
3161the ``texinfo`` utilities at build-time. Native and cross recipes are
3162made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3163improved performance. Target architecture recipes use the genuine
3164Texinfo utilities. By default, they use the Texinfo utilities on the
3165host system.
3166
3167.. note::
3168
3169 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003170 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3171 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003172
3173.. _ref-classes-toaster:
3174
Andrew Geissler517393d2023-01-13 08:55:19 -06003175``toaster``
3176===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003177
Andrew Geissler517393d2023-01-13 08:55:19 -06003178The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003179sends them as events that the BitBake user interface can receive. The
3180class is enabled when the Toaster user interface is running.
3181
3182This class is not intended to be used directly.
3183
3184.. _ref-classes-toolchain-scripts:
3185
Andrew Geissler517393d2023-01-13 08:55:19 -06003186``toolchain-scripts``
3187=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003188
Andrew Geissler517393d2023-01-13 08:55:19 -06003189The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003190the environment for installed SDKs.
3191
3192.. _ref-classes-typecheck:
3193
Andrew Geissler517393d2023-01-13 08:55:19 -06003194``typecheck``
3195=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003196
Andrew Geissler517393d2023-01-13 08:55:19 -06003197The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003198variables set at the configuration level against their defined types.
3199The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003200variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003201
3202 IMAGE_FEATURES[type] = "list"
3203
3204.. _ref-classes-uboot-config:
3205
Andrew Geissler517393d2023-01-13 08:55:19 -06003206``uboot-config``
3207================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003208
Andrew Geissler517393d2023-01-13 08:55:19 -06003209The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003210a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003211
3212 UBOOT_CONFIG ??= <default>
3213 UBOOT_CONFIG[foo] = "config,images"
3214
Andrew Geisslerc926e172021-05-07 16:11:35 -05003215You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003216
3217 UBOOT_MACHINE = "config"
3218
3219See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3220information.
3221
Patrick Williamsb542dec2023-06-09 01:26:37 -05003222.. _ref-classes-uboot-sign:
3223
3224``uboot-sign``
3225==============
3226
3227The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
3228It is intended to be inherited from U-Boot recipes.
3229
3230Here are variables used by this class:
3231
3232- :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3233 building the FIT image.
3234- :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
3235- :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
3236- :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
3237- :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
3238- :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
3239- :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
3240- :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
3241- :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
3242- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3243- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3244- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
3245 signing.
3246- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3247 for FIT image signing.
3248- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3249- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3250 rebuilding the FIT image containing the kernel.
3251
3252See U-Boot's documentation for details about `verified boot
3253<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3254and the `signature process
3255<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3256
3257See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
3258imitates.
3259
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003260.. _ref-classes-uninative:
3261
Andrew Geissler517393d2023-01-13 08:55:19 -06003262``uninative``
3263=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003264
3265Attempts to isolate the build system from the host distribution's C
3266library in order to make re-use of native shared state artifacts across
3267different host distributions practical. With this class enabled, a
3268tarball containing a pre-built C library is downloaded at the start of
3269the build. In the Poky reference distribution this is enabled by default
3270through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3271distributions that do not derive from poky can also
3272"``require conf/distro/include/yocto-uninative.inc``" to use this.
3273Alternatively if you prefer, you can build the uninative-tarball recipe
3274yourself, publish the resulting tarball (e.g. via HTTP) and set
3275``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3276example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3277
Andrew Geissler517393d2023-01-13 08:55:19 -06003278The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003279SDK. When building the extensible SDK, ``uninative-tarball`` is built
3280and the resulting tarball is included within the SDK.
3281
3282.. _ref-classes-update-alternatives:
3283
Andrew Geissler517393d2023-01-13 08:55:19 -06003284``update-alternatives``
3285=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003286
Andrew Geissler517393d2023-01-13 08:55:19 -06003287The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003288multiple sources provide the same command. This situation occurs when
3289several programs that have the same or similar function are installed
3290with the same name. For example, the ``ar`` command is available from
3291the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003292:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003293multiple packages can be installed without conflicts. The ``ar`` command
3294still works regardless of which packages are installed or subsequently
3295removed. The class renames the conflicting binary in each package and
3296symlinks the highest priority binary during installation or removal of
3297packages.
3298
3299To use this class, you need to define a number of variables:
3300
3301- :term:`ALTERNATIVE`
3302
3303- :term:`ALTERNATIVE_LINK_NAME`
3304
3305- :term:`ALTERNATIVE_TARGET`
3306
3307- :term:`ALTERNATIVE_PRIORITY`
3308
3309These variables list alternative commands needed by a package, provide
3310pathnames for links, default links for targets, and so forth. For
3311details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003312:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003313file.
3314
3315.. note::
3316
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003317 You can use the ``update-alternatives`` command directly in your recipes.
3318 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003319
3320.. _ref-classes-update-rc.d:
3321
Andrew Geissler517393d2023-01-13 08:55:19 -06003322``update-rc.d``
3323===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003324
Andrew Geissler517393d2023-01-13 08:55:19 -06003325The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003326initialization script on behalf of the package. The OpenEmbedded build
3327system takes care of details such as making sure the script is stopped
3328before a package is removed and started when the package is installed.
3329
Andrew Geissler09036742021-06-25 14:25:14 -05003330Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3331:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003332for details.
3333
3334.. _ref-classes-useradd:
3335
Andrew Geissler517393d2023-01-13 08:55:19 -06003336``useradd*``
3337============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003338
Patrick Williams2390b1b2022-11-03 13:47:49 -05003339The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003340usage by the package on the target. For example, if you have packages
3341that contain system services that should be run under their own user or
3342group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003343group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3344</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003345recipe in the :term:`Source Directory` provides a simple
3346example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003347
Patrick Williams2390b1b2022-11-03 13:47:49 -05003348The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003349groups settings.
3350
Patrick Williams2390b1b2022-11-03 13:47:49 -05003351The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003352:term:`USERADD_PACKAGES`,
3353:term:`USERADD_PARAM`,
3354:term:`GROUPADD_PARAM`, and
3355:term:`GROUPMEMS_PARAM` variables.
3356
Patrick Williams2390b1b2022-11-03 13:47:49 -05003357The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003358that have static user identification (``uid``) and group identification
3359(``gid``) values.
3360
3361The default behavior of the OpenEmbedded build system for assigning
3362``uid`` and ``gid`` values when packages add users and groups during
3363package install time is to add them dynamically. This works fine for
3364programs that do not care what the values of the resulting users and
3365groups become. In these cases, the order of the installation determines
3366the final ``uid`` and ``gid`` values. However, if non-deterministic
3367``uid`` and ``gid`` values are a problem, you can override the default,
3368dynamic application of these values by setting static values. When you
3369set static values, the OpenEmbedded build system looks in
3370:term:`BBPATH` for ``files/passwd`` and ``files/group``
3371files for the values.
3372
Andrew Geissler517393d2023-01-13 08:55:19 -06003373To use static ``uid`` and ``gid`` values, you need to set some variables. See
3374the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3375:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3376You can also see the :ref:`ref-classes-useradd` class for additional
3377information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003378
3379.. note::
3380
Patrick Williams2390b1b2022-11-03 13:47:49 -05003381 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003382 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003383 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003384 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003385 directory will correct this condition.
3386
3387.. _ref-classes-utility-tasks:
3388
Andrew Geissler517393d2023-01-13 08:55:19 -06003389``utility-tasks``
3390=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003391
Andrew Geissler517393d2023-01-13 08:55:19 -06003392The :ref:`ref-classes-utility-tasks` class provides support for various
3393"utility" type tasks that are applicable to all recipes, such as
3394:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003395
3396This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003397:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003398
3399.. _ref-classes-utils:
3400
Andrew Geissler517393d2023-01-13 08:55:19 -06003401``utils``
3402=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003403
Andrew Geissler517393d2023-01-13 08:55:19 -06003404The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003405typically used in inline Python expressions (e.g. ``${@...}``). One
3406example use is for ``bb.utils.contains()``.
3407
3408This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003409:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003410
3411.. _ref-classes-vala:
3412
Andrew Geissler517393d2023-01-13 08:55:19 -06003413``vala``
3414========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003415
Andrew Geissler517393d2023-01-13 08:55:19 -06003416The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003417using the Vala programming language.
3418
3419.. _ref-classes-waf:
3420
Andrew Geissler517393d2023-01-13 08:55:19 -06003421``waf``
3422=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003423
Andrew Geissler517393d2023-01-13 08:55:19 -06003424The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003425the Waf build system. You can use the
3426:term:`EXTRA_OECONF` or
3427:term:`PACKAGECONFIG_CONFARGS` variables
3428to specify additional configuration options to be passed on the Waf
3429command line.