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