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