xref: /OK3568_Linux_fs/yocto/poky/documentation/ref-manual/classes.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun*******
4*4882a593SmuzhiyunClasses
5*4882a593Smuzhiyun*******
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunClass files are used to abstract common functionality and share it
8*4882a593Smuzhiyunamongst multiple recipe (``.bb``) files. To use a class file, you simply
9*4882a593Smuzhiyunmake sure the recipe inherits the class. In most cases, when a recipe
10*4882a593Smuzhiyuninherits a class it is enough to enable its features. There are cases,
11*4882a593Smuzhiyunhowever, where in the recipe you might need to set variables or override
12*4882a593Smuzhiyunsome default behavior.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAny :term:`Metadata` usually found in a recipe can also be
15*4882a593Smuzhiyunplaced in a class file. Class files are identified by the extension
16*4882a593Smuzhiyun``.bbclass`` and are usually placed in a ``classes/`` directory beneath
17*4882a593Smuzhiyunthe ``meta*/`` directory found in the :term:`Source Directory`.
18*4882a593SmuzhiyunClass files can also be pointed to by
19*4882a593Smuzhiyun:term:`BUILDDIR` (e.g. ``build/``) in the same way as
20*4882a593Smuzhiyun``.conf`` files in the ``conf`` directory. Class files are searched for
21*4882a593Smuzhiyunin :term:`BBPATH` using the same method by which ``.conf``
22*4882a593Smuzhiyunfiles are searched.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunThis chapter discusses only the most useful and important classes. Other
25*4882a593Smuzhiyunclasses do exist within the ``meta/classes`` directory in the Source
26*4882a593SmuzhiyunDirectory. You can reference the ``.bbclass`` files directly for more
27*4882a593Smuzhiyuninformation.
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun.. _ref-classes-allarch:
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun``allarch.bbclass``
32*4882a593Smuzhiyun===================
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunThe ``allarch`` class is inherited by recipes that do not produce
35*4882a593Smuzhiyunarchitecture-specific output. The class disables functionality that is
36*4882a593Smuzhiyunnormally needed for recipes that produce executable binaries (such as
37*4882a593Smuzhiyunbuilding the cross-compiler and a C library as pre-requisites, and
38*4882a593Smuzhiyunsplitting out of debug symbols during packaging).
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun.. note::
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun   Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
43*4882a593Smuzhiyun   produce packages that depend on tunings through use of the
44*4882a593Smuzhiyun   :term:`RDEPENDS` and
45*4882a593Smuzhiyun   :term:`TUNE_PKGARCH` variables, should never be
46*4882a593Smuzhiyun   configured for all architectures using ``allarch``. This is the case
47*4882a593Smuzhiyun   even if the recipes do not produce architecture-specific output.
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun   Configuring such recipes for all architectures causes the
50*4882a593Smuzhiyun   ``do_package_write_*`` tasks to
51*4882a593Smuzhiyun   have different signatures for the machines with different tunings.
52*4882a593Smuzhiyun   Additionally, unnecessary rebuilds occur every time an image for a
53*4882a593Smuzhiyun   different :term:`MACHINE` is built even when the recipe never changes.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunBy default, all recipes inherit the :ref:`base <ref-classes-base>` and
56*4882a593Smuzhiyun:ref:`package <ref-classes-package>` classes, which enable
57*4882a593Smuzhiyunfunctionality needed for recipes that produce executable output. If your
58*4882a593Smuzhiyunrecipe, for example, only produces packages that contain configuration
59*4882a593Smuzhiyunfiles, media files, or scripts (e.g. Python and Perl), then it should
60*4882a593Smuzhiyuninherit the ``allarch`` class.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun.. _ref-classes-archiver:
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun``archiver.bbclass``
65*4882a593Smuzhiyun====================
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunThe ``archiver`` class supports releasing source code and other
68*4882a593Smuzhiyunmaterials with the binaries.
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunFor more details on the source archiver, see the
71*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
72*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual. You can also see
73*4882a593Smuzhiyunthe :term:`ARCHIVER_MODE` variable for information
74*4882a593Smuzhiyunabout the variable flags (varflags) that help control archive creation.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun.. _ref-classes-autotools:
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun``autotools*.bbclass``
79*4882a593Smuzhiyun======================
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunThe ``autotools*`` classes support Autotooled packages.
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunThe ``autoconf``, ``automake``, and ``libtool`` packages bring
84*4882a593Smuzhiyunstandardization. This class defines a set of tasks (e.g. ``configure``,
85*4882a593Smuzhiyun``compile`` and so forth) that work for all Autotooled packages. It
86*4882a593Smuzhiyunshould usually be enough to define a few standard variables and then
87*4882a593Smuzhiyunsimply ``inherit autotools``. These classes can also work with software
88*4882a593Smuzhiyunthat emulates Autotools. For more information, see the
89*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:autotooled package`" section
90*4882a593Smuzhiyunin the Yocto Project Development Tasks Manual.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunBy default, the ``autotools*`` classes use out-of-tree builds (i.e.
93*4882a593Smuzhiyun``autotools.bbclass`` building with ``B != S``).
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunIf the software being built by a recipe does not support using
96*4882a593Smuzhiyunout-of-tree builds, you should have the recipe inherit the
97*4882a593Smuzhiyun``autotools-brokensep`` class. The ``autotools-brokensep`` class behaves
98*4882a593Smuzhiyunthe same as the ``autotools`` class but builds with :term:`B`
99*4882a593Smuzhiyun== :term:`S`. This method is useful when out-of-tree build
100*4882a593Smuzhiyunsupport is either not present or is broken.
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun.. note::
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun   It is recommended that out-of-tree support be fixed and used if at
105*4882a593Smuzhiyun   all possible.
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunIt's useful to have some idea of how the tasks defined by the
108*4882a593Smuzhiyun``autotools*`` classes work and what they do behind the scenes.
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun-  :ref:`ref-tasks-configure` - Regenerates the
111*4882a593Smuzhiyun   configure script (using ``autoreconf``) and then launches it with a
112*4882a593Smuzhiyun   standard set of arguments used during cross-compilation. You can pass
113*4882a593Smuzhiyun   additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
114*4882a593Smuzhiyun   or :term:`PACKAGECONFIG_CONFARGS`
115*4882a593Smuzhiyun   variables.
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun-  :ref:`ref-tasks-compile` - Runs ``make`` with
118*4882a593Smuzhiyun   arguments that specify the compiler and linker. You can pass
119*4882a593Smuzhiyun   additional arguments through the :term:`EXTRA_OEMAKE` variable.
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun-  :ref:`ref-tasks-install` - Runs ``make install`` and
122*4882a593Smuzhiyun   passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun.. _ref-classes-base:
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun``base.bbclass``
127*4882a593Smuzhiyun================
128*4882a593Smuzhiyun
129*4882a593SmuzhiyunThe ``base`` class is special in that every ``.bb`` file implicitly
130*4882a593Smuzhiyuninherits the class. This class contains definitions for standard basic
131*4882a593Smuzhiyuntasks such as fetching, unpacking, configuring (empty by default),
132*4882a593Smuzhiyuncompiling (runs any ``Makefile`` present), installing (empty by default)
133*4882a593Smuzhiyunand packaging (empty by default). These classes are often overridden or
134*4882a593Smuzhiyunextended by other classes such as the
135*4882a593Smuzhiyun:ref:`autotools <ref-classes-autotools>` class or the
136*4882a593Smuzhiyun:ref:`package <ref-classes-package>` class.
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunThe class also contains some commonly used functions such as
139*4882a593Smuzhiyun``oe_runmake``, which runs ``make`` with the arguments specified in
140*4882a593Smuzhiyun:term:`EXTRA_OEMAKE` variable as well as the
141*4882a593Smuzhiyunarguments passed directly to ``oe_runmake``.
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun.. _ref-classes-bash-completion:
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun``bash-completion.bbclass``
146*4882a593Smuzhiyun===========================
147*4882a593Smuzhiyun
148*4882a593SmuzhiyunSets up packaging and dependencies appropriate for recipes that build
149*4882a593Smuzhiyunsoftware that includes bash-completion data.
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun.. _ref-classes-bin-package:
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun``bin_package.bbclass``
154*4882a593Smuzhiyun=======================
155*4882a593Smuzhiyun
156*4882a593SmuzhiyunThe ``bin_package`` class is a helper class for recipes that extract the
157*4882a593Smuzhiyuncontents of a binary package (e.g. an RPM) and install those contents
158*4882a593Smuzhiyunrather than building the binary from source. The binary package is
159*4882a593Smuzhiyunextracted and new packages in the configured output package format are
160*4882a593Smuzhiyuncreated. Extraction and installation of proprietary binaries is a good
161*4882a593Smuzhiyunexample use for this class.
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun.. note::
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun   For RPMs and other packages that do not contain a subdirectory, you
166*4882a593Smuzhiyun   should specify an appropriate fetcher parameter to point to the
167*4882a593Smuzhiyun   subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
168*4882a593Smuzhiyun   the "subpath" parameter limits the checkout to a specific subpath
169*4882a593Smuzhiyun   of the tree. Here is an example where ``${BP}`` is used so that the files
170*4882a593Smuzhiyun   are extracted into the subdirectory expected by the default value of
171*4882a593Smuzhiyun   :term:`S`::
172*4882a593Smuzhiyun
173*4882a593Smuzhiyun      SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun   See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
176*4882a593Smuzhiyun   more information on supported BitBake Fetchers.
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun.. _ref-classes-binconfig:
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun``binconfig.bbclass``
181*4882a593Smuzhiyun=====================
182*4882a593Smuzhiyun
183*4882a593SmuzhiyunThe ``binconfig`` class helps to correct paths in shell scripts.
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunBefore ``pkg-config`` had become widespread, libraries shipped shell
186*4882a593Smuzhiyunscripts to give information about the libraries and include paths needed
187*4882a593Smuzhiyunto build software (usually named ``LIBNAME-config``). This class assists
188*4882a593Smuzhiyunany recipe using such scripts.
189*4882a593Smuzhiyun
190*4882a593SmuzhiyunDuring staging, the OpenEmbedded build system installs such scripts into
191*4882a593Smuzhiyunthe ``sysroots/`` directory. Inheriting this class results in all paths
192*4882a593Smuzhiyunin these scripts being changed to point into the ``sysroots/`` directory
193*4882a593Smuzhiyunso that all builds that use the script use the correct directories for
194*4882a593Smuzhiyunthe cross compiling layout. See the
195*4882a593Smuzhiyun:term:`BINCONFIG_GLOB` variable for more
196*4882a593Smuzhiyuninformation.
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun.. _ref-classes-binconfig-disabled:
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun``binconfig-disabled.bbclass``
201*4882a593Smuzhiyun==============================
202*4882a593Smuzhiyun
203*4882a593SmuzhiyunAn alternative version of the :ref:`binconfig <ref-classes-binconfig>`
204*4882a593Smuzhiyunclass, which disables binary configuration scripts by making them return
205*4882a593Smuzhiyunan error in favor of using ``pkg-config`` to query the information. The
206*4882a593Smuzhiyunscripts to be disabled should be specified using the
207*4882a593Smuzhiyun:term:`BINCONFIG` variable within the recipe inheriting
208*4882a593Smuzhiyunthe class.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun.. _ref-classes-buildhistory:
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun``buildhistory.bbclass``
213*4882a593Smuzhiyun========================
214*4882a593Smuzhiyun
215*4882a593SmuzhiyunThe ``buildhistory`` class records a history of build output metadata,
216*4882a593Smuzhiyunwhich can be used to detect possible regressions as well as used for
217*4882a593Smuzhiyunanalysis of the build output. For more information on using Build
218*4882a593SmuzhiyunHistory, see the
219*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:maintaining build output quality`"
220*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun.. _ref-classes-buildstats:
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun``buildstats.bbclass``
225*4882a593Smuzhiyun======================
226*4882a593Smuzhiyun
227*4882a593SmuzhiyunThe ``buildstats`` class records performance statistics about each task
228*4882a593Smuzhiyunexecuted during the build (e.g. elapsed time, CPU usage, and I/O usage).
229*4882a593Smuzhiyun
230*4882a593SmuzhiyunWhen you use this class, the output goes into the
231*4882a593Smuzhiyun:term:`BUILDSTATS_BASE` directory, which defaults
232*4882a593Smuzhiyunto ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
233*4882a593Smuzhiyun``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
234*4882a593Smuzhiyunchart of the entire build process and can be useful for highlighting
235*4882a593Smuzhiyunbottlenecks.
236*4882a593Smuzhiyun
237*4882a593SmuzhiyunCollecting build statistics is enabled by default through the
238*4882a593Smuzhiyun:term:`USER_CLASSES` variable from your
239*4882a593Smuzhiyun``local.conf`` file. Consequently, you do not have to do anything to
240*4882a593Smuzhiyunenable the class. However, if you want to disable the class, simply
241*4882a593Smuzhiyunremove "buildstats" from the :term:`USER_CLASSES` list.
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun.. _ref-classes-buildstats-summary:
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun``buildstats-summary.bbclass``
246*4882a593Smuzhiyun==============================
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunWhen inherited globally, prints statistics at the end of the build on
249*4882a593Smuzhiyunsstate re-use. In order to function, this class requires the
250*4882a593Smuzhiyun:ref:`buildstats <ref-classes-buildstats>` class be enabled.
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun.. _ref-classes-ccache:
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun``ccache.bbclass``
255*4882a593Smuzhiyun==================
256*4882a593Smuzhiyun
257*4882a593SmuzhiyunThe ``ccache`` class enables the C/C++ Compiler Cache for the build.
258*4882a593SmuzhiyunThis class is used to give a minor performance boost during the build.
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunSee https://ccache.samba.org/ for information on the C/C++ Compiler
261*4882a593SmuzhiyunCache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
262*4882a593Smuzhiyunfile for details about how to enable this mechanism in your configuration
263*4882a593Smuzhiyunfile, how to disable it for specific recipes, and how to share ``ccache``
264*4882a593Smuzhiyunfiles between builds.
265*4882a593Smuzhiyun
266*4882a593SmuzhiyunHowever, using the class can lead to unexpected side-effects. Thus, using
267*4882a593Smuzhiyunthis class is not recommended.
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun.. _ref-classes-chrpath:
270*4882a593Smuzhiyun
271*4882a593Smuzhiyun``chrpath.bbclass``
272*4882a593Smuzhiyun===================
273*4882a593Smuzhiyun
274*4882a593SmuzhiyunThe ``chrpath`` class is a wrapper around the "chrpath" utility, which
275*4882a593Smuzhiyunis used during the build process for ``nativesdk``, ``cross``, and
276*4882a593Smuzhiyun``cross-canadian`` recipes to change ``RPATH`` records within binaries
277*4882a593Smuzhiyunin order to make them relocatable.
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun.. _ref-classes-cmake:
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun``cmake.bbclass``
282*4882a593Smuzhiyun=================
283*4882a593Smuzhiyun
284*4882a593SmuzhiyunThe ``cmake`` class allows for recipes that need to build software using
285*4882a593Smuzhiyunthe `CMake <https://cmake.org/overview/>`__ build system. You can use
286*4882a593Smuzhiyunthe :term:`EXTRA_OECMAKE` variable to specify
287*4882a593Smuzhiyunadditional configuration options to be passed using the ``cmake``
288*4882a593Smuzhiyuncommand line.
289*4882a593Smuzhiyun
290*4882a593SmuzhiyunOn the occasion that you would be installing custom CMake toolchain
291*4882a593Smuzhiyunfiles supplied by the application being built, you should install them
292*4882a593Smuzhiyunto the preferred CMake Module directory: ``${D}${datadir}/cmake/``
293*4882a593SmuzhiyunModules during
294*4882a593Smuzhiyun:ref:`ref-tasks-install`.
295*4882a593Smuzhiyun
296*4882a593Smuzhiyun.. _ref-classes-cml1:
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun``cml1.bbclass``
299*4882a593Smuzhiyun================
300*4882a593Smuzhiyun
301*4882a593SmuzhiyunThe ``cml1`` class provides basic support for the Linux kernel style
302*4882a593Smuzhiyunbuild configuration system.
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun.. _ref-classes-compress_doc:
305*4882a593Smuzhiyun
306*4882a593Smuzhiyun``compress_doc.bbclass``
307*4882a593Smuzhiyun========================
308*4882a593Smuzhiyun
309*4882a593SmuzhiyunEnables compression for man pages and info pages. This class is intended
310*4882a593Smuzhiyunto be inherited globally. The default compression mechanism is gz (gzip)
311*4882a593Smuzhiyunbut you can select an alternative mechanism by setting the
312*4882a593Smuzhiyun:term:`DOC_COMPRESS` variable.
313*4882a593Smuzhiyun
314*4882a593Smuzhiyun.. _ref-classes-copyleft_compliance:
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun``copyleft_compliance.bbclass``
317*4882a593Smuzhiyun===============================
318*4882a593Smuzhiyun
319*4882a593SmuzhiyunThe ``copyleft_compliance`` class preserves source code for the purposes
320*4882a593Smuzhiyunof license compliance. This class is an alternative to the ``archiver``
321*4882a593Smuzhiyunclass and is still used by some users even though it has been deprecated
322*4882a593Smuzhiyunin favor of the :ref:`archiver <ref-classes-archiver>` class.
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun.. _ref-classes-copyleft_filter:
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun``copyleft_filter.bbclass``
327*4882a593Smuzhiyun===========================
328*4882a593Smuzhiyun
329*4882a593SmuzhiyunA class used by the :ref:`archiver <ref-classes-archiver>` and
330*4882a593Smuzhiyun:ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes
331*4882a593Smuzhiyunfor filtering licenses. The ``copyleft_filter`` class is an internal
332*4882a593Smuzhiyunclass and is not intended to be used directly.
333*4882a593Smuzhiyun
334*4882a593Smuzhiyun.. _ref-classes-core-image:
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun``core-image.bbclass``
337*4882a593Smuzhiyun======================
338*4882a593Smuzhiyun
339*4882a593SmuzhiyunThe ``core-image`` class provides common definitions for the
340*4882a593Smuzhiyun``core-image-*`` image recipes, such as support for additional
341*4882a593Smuzhiyun:term:`IMAGE_FEATURES`.
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun.. _ref-classes-cpan:
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun``cpan*.bbclass``
346*4882a593Smuzhiyun=================
347*4882a593Smuzhiyun
348*4882a593SmuzhiyunThe ``cpan*`` classes support Perl modules.
349*4882a593Smuzhiyun
350*4882a593SmuzhiyunRecipes for Perl modules are simple. These recipes usually only need to
351*4882a593Smuzhiyunpoint to the source's archive and then inherit the proper class file.
352*4882a593SmuzhiyunBuilding is split into two methods depending on which method the module
353*4882a593Smuzhiyunauthors used.
354*4882a593Smuzhiyun
355*4882a593Smuzhiyun-  Modules that use old ``Makefile.PL``-based build system require
356*4882a593Smuzhiyun   ``cpan.bbclass`` in their recipes.
357*4882a593Smuzhiyun
358*4882a593Smuzhiyun-  Modules that use ``Build.PL``-based build system require using
359*4882a593Smuzhiyun   ``cpan_build.bbclass`` in their recipes.
360*4882a593Smuzhiyun
361*4882a593SmuzhiyunBoth build methods inherit the ``cpan-base`` class for basic Perl
362*4882a593Smuzhiyunsupport.
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun.. _ref-classes-create-spdx:
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun``create-spdx.bbclass``
367*4882a593Smuzhiyun=======================
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunThe :ref:`create-spdx <ref-classes-create-spdx>` class provides support for
370*4882a593Smuzhiyunautomatically creating :term:`SPDX` :term:`SBOM` documents based upon image
371*4882a593Smuzhiyunand SDK contents.
372*4882a593Smuzhiyun
373*4882a593SmuzhiyunThis class is meant to be inherited globally from a configuration file::
374*4882a593Smuzhiyun
375*4882a593Smuzhiyun   INHERIT += "create-spdx"
376*4882a593Smuzhiyun
377*4882a593SmuzhiyunThe toplevel :term:`SPDX` output file is generated in JSON format as a
378*4882a593Smuzhiyun``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
379*4882a593Smuzhiyun:term:`Build Directory`. There are other related files in the same directory,
380*4882a593Smuzhiyunas well as in ``tmp/deploy/spdx``.
381*4882a593Smuzhiyun
382*4882a593SmuzhiyunThe exact behaviour of this class, and the amount of output can be controlled
383*4882a593Smuzhiyunby the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
384*4882a593Smuzhiyun:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
385*4882a593Smuzhiyun
386*4882a593SmuzhiyunSee the description of these variables and the
387*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:creating a software bill of materials`"
388*4882a593Smuzhiyunsection in the Yocto Project Development Manual for more details.
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun.. _ref-classes-cross:
391*4882a593Smuzhiyun
392*4882a593Smuzhiyun``cross.bbclass``
393*4882a593Smuzhiyun=================
394*4882a593Smuzhiyun
395*4882a593SmuzhiyunThe ``cross`` class provides support for the recipes that build the
396*4882a593Smuzhiyuncross-compilation tools.
397*4882a593Smuzhiyun
398*4882a593Smuzhiyun.. _ref-classes-cross-canadian:
399*4882a593Smuzhiyun
400*4882a593Smuzhiyun``cross-canadian.bbclass``
401*4882a593Smuzhiyun==========================
402*4882a593Smuzhiyun
403*4882a593SmuzhiyunThe ``cross-canadian`` class provides support for the recipes that build
404*4882a593Smuzhiyunthe Canadian Cross-compilation tools for SDKs. See the
405*4882a593Smuzhiyun":ref:`overview-manual/concepts:cross-development toolchain generation`"
406*4882a593Smuzhiyunsection in the Yocto Project Overview and Concepts Manual for more
407*4882a593Smuzhiyundiscussion on these cross-compilation tools.
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun.. _ref-classes-crosssdk:
410*4882a593Smuzhiyun
411*4882a593Smuzhiyun``crosssdk.bbclass``
412*4882a593Smuzhiyun====================
413*4882a593Smuzhiyun
414*4882a593SmuzhiyunThe ``crosssdk`` class provides support for the recipes that build the
415*4882a593Smuzhiyuncross-compilation tools used for building SDKs. See the
416*4882a593Smuzhiyun":ref:`overview-manual/concepts:cross-development toolchain generation`"
417*4882a593Smuzhiyunsection in the Yocto Project Overview and Concepts Manual for more
418*4882a593Smuzhiyundiscussion on these cross-compilation tools.
419*4882a593Smuzhiyun
420*4882a593Smuzhiyun.. _ref-classes-cve-check:
421*4882a593Smuzhiyun
422*4882a593Smuzhiyun``cve-check.bbclass``
423*4882a593Smuzhiyun=====================
424*4882a593Smuzhiyun
425*4882a593SmuzhiyunThe :ref:`cve-check <ref-classes-cve-check>` class looks for known CVEs (Common Vulnerabilities
426*4882a593Smuzhiyunand Exposures) while building with BitBake. This class is meant to be
427*4882a593Smuzhiyuninherited globally from a configuration file::
428*4882a593Smuzhiyun
429*4882a593Smuzhiyun   INHERIT += "cve-check"
430*4882a593Smuzhiyun
431*4882a593SmuzhiyunTo filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
432*4882a593Smuzhiyunadd following line to the build configuration file::
433*4882a593Smuzhiyun
434*4882a593Smuzhiyun   include cve-extra-exclusions.inc
435*4882a593Smuzhiyun
436*4882a593SmuzhiyunYou can also look for vulnerabilities in specific packages by passing
437*4882a593Smuzhiyun``-c cve_check`` to BitBake.
438*4882a593Smuzhiyun
439*4882a593SmuzhiyunAfter building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
440*4882a593Smuzhiyunand image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
441*4882a593Smuzhiyun
442*4882a593SmuzhiyunWhen building, the CVE checker will emit build time warnings for any detected
443*4882a593Smuzhiyunissues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
444*4882a593Smuzhiyunand version being compiled and no patches to address the issue are applied. Other states
445*4882a593Smuzhiyunfor detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
446*4882a593Smuzhiyunapplied, and ``Ignored`` meaning that the issue can be ignored.
447*4882a593Smuzhiyun
448*4882a593SmuzhiyunThe ``Patched`` state of a CVE issue is detected from patch files with the format
449*4882a593Smuzhiyun``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
450*4882a593SmuzhiyunCVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
451*4882a593Smuzhiyun
452*4882a593SmuzhiyunIf the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported
453*4882a593Smuzhiyunas ``Ignored``. Multiple CVEs can be listed separated by spaces. Example::
454*4882a593Smuzhiyun
455*4882a593Smuzhiyun   CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511"
456*4882a593Smuzhiyun
457*4882a593SmuzhiyunIf CVE check reports that a recipe contains false positives or false negatives, these may be
458*4882a593Smuzhiyunfixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
459*4882a593Smuzhiyun:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
460*4882a593Smuzhiyundatabase vendor and product pairs using the syntax::
461*4882a593Smuzhiyun
462*4882a593Smuzhiyun   CVE_PRODUCT = "flex_project:flex"
463*4882a593Smuzhiyun
464*4882a593Smuzhiyunwhere ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
465*4882a593Smuzhiyunif the default recipe version :term:`PV` does not match the version numbers of the software component
466*4882a593Smuzhiyunin upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
467*4882a593SmuzhiyunCVE database compatible version number, for example::
468*4882a593Smuzhiyun
469*4882a593Smuzhiyun   CVE_VERSION = "2.39"
470*4882a593Smuzhiyun
471*4882a593SmuzhiyunAny bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
472*4882a593Smuzhiyunvia the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
473*4882a593Smuzhiyun
474*4882a593SmuzhiyunUsers should note that security is a process, not a product, and thus also CVE checking, analyzing results,
475*4882a593Smuzhiyunpatching and updating the software should be done as a regular process. The data and assumptions
476*4882a593Smuzhiyunrequired for CVE checker to reliably detect issues are frequently broken in various ways.
477*4882a593SmuzhiyunThese can only be detected by reviewing the details of the issues and iterating over the generated reports,
478*4882a593Smuzhiyunand following what happens in other Linux distributions and in the greater open source community.
479*4882a593Smuzhiyun
480*4882a593SmuzhiyunYou will find some more details in the
481*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:checking for vulnerabilities`"
482*4882a593Smuzhiyunsection in the Development Tasks Manual.
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun.. _ref-classes-debian:
485*4882a593Smuzhiyun
486*4882a593Smuzhiyun``debian.bbclass``
487*4882a593Smuzhiyun==================
488*4882a593Smuzhiyun
489*4882a593SmuzhiyunThe ``debian`` class renames output packages so that they follow the
490*4882a593SmuzhiyunDebian naming policy (i.e. ``glibc`` becomes ``libc6`` and
491*4882a593Smuzhiyun``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
492*4882a593Smuzhiyunname and version as part of the package name.
493*4882a593Smuzhiyun
494*4882a593SmuzhiyunIf a recipe creates packages for multiple libraries (shared object files
495*4882a593Smuzhiyunof ``.so`` type), use the :term:`LEAD_SONAME`
496*4882a593Smuzhiyunvariable in the recipe to specify the library on which to apply the
497*4882a593Smuzhiyunnaming scheme.
498*4882a593Smuzhiyun
499*4882a593Smuzhiyun.. _ref-classes-deploy:
500*4882a593Smuzhiyun
501*4882a593Smuzhiyun``deploy.bbclass``
502*4882a593Smuzhiyun==================
503*4882a593Smuzhiyun
504*4882a593SmuzhiyunThe ``deploy`` class handles deploying files to the
505*4882a593Smuzhiyun:term:`DEPLOY_DIR_IMAGE` directory. The main
506*4882a593Smuzhiyunfunction of this class is to allow the deploy step to be accelerated by
507*4882a593Smuzhiyunshared state. Recipes that inherit this class should define their own
508*4882a593Smuzhiyun:ref:`ref-tasks-deploy` function to copy the files to be
509*4882a593Smuzhiyundeployed to :term:`DEPLOYDIR`, and use ``addtask`` to
510*4882a593Smuzhiyunadd the task at the appropriate place, which is usually after
511*4882a593Smuzhiyun:ref:`ref-tasks-compile` or
512*4882a593Smuzhiyun:ref:`ref-tasks-install`. The class then takes care of
513*4882a593Smuzhiyunstaging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
514*4882a593Smuzhiyun
515*4882a593Smuzhiyun.. _ref-classes-devshell:
516*4882a593Smuzhiyun
517*4882a593Smuzhiyun``devshell.bbclass``
518*4882a593Smuzhiyun====================
519*4882a593Smuzhiyun
520*4882a593SmuzhiyunThe ``devshell`` class adds the ``do_devshell`` task. Distribution
521*4882a593Smuzhiyunpolicy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
522*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual for more
523*4882a593Smuzhiyuninformation about using ``devshell``.
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun.. _ref-classes-devupstream:
526*4882a593Smuzhiyun
527*4882a593Smuzhiyun``devupstream.bbclass``
528*4882a593Smuzhiyun=======================
529*4882a593Smuzhiyun
530*4882a593SmuzhiyunThe ``devupstream`` class uses
531*4882a593Smuzhiyun:term:`BBCLASSEXTEND` to add a variant of the
532*4882a593Smuzhiyunrecipe that fetches from an alternative URI (e.g. Git) instead of a
533*4882a593Smuzhiyuntarball. Following is an example::
534*4882a593Smuzhiyun
535*4882a593Smuzhiyun   BBCLASSEXTEND = "devupstream:target"
536*4882a593Smuzhiyun   SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
537*4882a593Smuzhiyun   SRCREV:class-devupstream = "abcd1234"
538*4882a593Smuzhiyun
539*4882a593SmuzhiyunAdding the above statements to your recipe creates a variant that has
540*4882a593Smuzhiyun:term:`DEFAULT_PREFERENCE` set to "-1".
541*4882a593SmuzhiyunConsequently, you need to select the variant of the recipe to use it.
542*4882a593SmuzhiyunAny development-specific adjustments can be done by using the
543*4882a593Smuzhiyun``class-devupstream`` override. Here is an example::
544*4882a593Smuzhiyun
545*4882a593Smuzhiyun   DEPENDS:append:class-devupstream = " gperf-native"
546*4882a593Smuzhiyun   do_configure:prepend:class-devupstream() {
547*4882a593Smuzhiyun       touch ${S}/README
548*4882a593Smuzhiyun   }
549*4882a593Smuzhiyun
550*4882a593SmuzhiyunThe class
551*4882a593Smuzhiyuncurrently only supports creating a development variant of the target
552*4882a593Smuzhiyunrecipe, not ``native`` or ``nativesdk`` variants.
553*4882a593Smuzhiyun
554*4882a593SmuzhiyunThe :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
555*4882a593Smuzhiyunsupport for ``native`` and ``nativesdk`` variants. Consequently, this
556*4882a593Smuzhiyunfunctionality can be added in a future release.
557*4882a593Smuzhiyun
558*4882a593SmuzhiyunSupport for other version control systems such as Subversion is limited
559*4882a593Smuzhiyundue to BitBake's automatic fetch dependencies (e.g.
560*4882a593Smuzhiyun``subversion-native``).
561*4882a593Smuzhiyun
562*4882a593Smuzhiyun.. _ref-classes-externalsrc:
563*4882a593Smuzhiyun
564*4882a593Smuzhiyun``externalsrc.bbclass``
565*4882a593Smuzhiyun=======================
566*4882a593Smuzhiyun
567*4882a593SmuzhiyunThe ``externalsrc`` class supports building software from source code
568*4882a593Smuzhiyunthat is external to the OpenEmbedded build system. Building software
569*4882a593Smuzhiyunfrom an external source tree means that the build system's normal fetch,
570*4882a593Smuzhiyununpack, and patch process is not used.
571*4882a593Smuzhiyun
572*4882a593SmuzhiyunBy default, the OpenEmbedded build system uses the :term:`S`
573*4882a593Smuzhiyunand :term:`B` variables to locate unpacked recipe source code
574*4882a593Smuzhiyunand to build it, respectively. When your recipe inherits the
575*4882a593Smuzhiyun``externalsrc`` class, you use the
576*4882a593Smuzhiyun:term:`EXTERNALSRC` and
577*4882a593Smuzhiyun:term:`EXTERNALSRC_BUILD` variables to
578*4882a593Smuzhiyunultimately define :term:`S` and :term:`B`.
579*4882a593Smuzhiyun
580*4882a593SmuzhiyunBy default, this class expects the source code to support recipe builds
581*4882a593Smuzhiyunthat use the :term:`B` variable to point to the directory in
582*4882a593Smuzhiyunwhich the OpenEmbedded build system places the generated objects built
583*4882a593Smuzhiyunfrom the recipes. By default, the :term:`B` directory is set to the
584*4882a593Smuzhiyunfollowing, which is separate from the source directory (:term:`S`)::
585*4882a593Smuzhiyun
586*4882a593Smuzhiyun   ${WORKDIR}/${BPN}-{PV}/
587*4882a593Smuzhiyun
588*4882a593SmuzhiyunSee these variables for more information:
589*4882a593Smuzhiyun:term:`WORKDIR`, :term:`BPN`, and
590*4882a593Smuzhiyun:term:`PV`,
591*4882a593Smuzhiyun
592*4882a593SmuzhiyunFor more information on the ``externalsrc`` class, see the comments in
593*4882a593Smuzhiyun``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
594*4882a593SmuzhiyunFor information on how to use the
595*4882a593Smuzhiyun``externalsrc`` class, see the
596*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:building software from an external source`"
597*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
598*4882a593Smuzhiyun
599*4882a593Smuzhiyun.. _ref-classes-extrausers:
600*4882a593Smuzhiyun
601*4882a593Smuzhiyun``extrausers.bbclass``
602*4882a593Smuzhiyun======================
603*4882a593Smuzhiyun
604*4882a593SmuzhiyunThe ``extrausers`` class allows additional user and group configuration
605*4882a593Smuzhiyunto be applied at the image level. Inheriting this class either globally
606*4882a593Smuzhiyunor from an image recipe allows additional user and group operations to
607*4882a593Smuzhiyunbe performed using the
608*4882a593Smuzhiyun:term:`EXTRA_USERS_PARAMS` variable.
609*4882a593Smuzhiyun
610*4882a593Smuzhiyun.. note::
611*4882a593Smuzhiyun
612*4882a593Smuzhiyun   The user and group operations added using the
613*4882a593Smuzhiyun   :ref:`extrausers <ref-classes-extrausers>`
614*4882a593Smuzhiyun   class are not tied to a specific recipe outside of the recipe for the
615*4882a593Smuzhiyun   image. Thus, the operations can be performed across the image as a
616*4882a593Smuzhiyun   whole. Use the
617*4882a593Smuzhiyun   :ref:`useradd <ref-classes-useradd>`
618*4882a593Smuzhiyun   class to add user and group configuration to a specific recipe.
619*4882a593Smuzhiyun
620*4882a593SmuzhiyunHere is an example that uses this class in an image recipe::
621*4882a593Smuzhiyun
622*4882a593Smuzhiyun   inherit extrausers
623*4882a593Smuzhiyun   EXTRA_USERS_PARAMS = "\
624*4882a593Smuzhiyun       useradd -p '' tester; \
625*4882a593Smuzhiyun       groupadd developers; \
626*4882a593Smuzhiyun       userdel nobody; \
627*4882a593Smuzhiyun       groupdel -g video; \
628*4882a593Smuzhiyun       groupmod -g 1020 developers; \
629*4882a593Smuzhiyun       usermod -s /bin/sh tester; \
630*4882a593Smuzhiyun       "
631*4882a593Smuzhiyun
632*4882a593SmuzhiyunHere is an example that adds two users named "tester-jim" and "tester-sue" and assigns
633*4882a593Smuzhiyunpasswords. First on host, create the (escaped) password hash::
634*4882a593Smuzhiyun
635*4882a593Smuzhiyun   printf "%q" $(mkpasswd -m sha256crypt tester01)
636*4882a593Smuzhiyun
637*4882a593SmuzhiyunThe resulting hash is set to a variable and used in ``useradd`` command parameters::
638*4882a593Smuzhiyun
639*4882a593Smuzhiyun   inherit extrausers
640*4882a593Smuzhiyun   PASSWD = "\$X\$ABC123\$A-Long-Hash"
641*4882a593Smuzhiyun   EXTRA_USERS_PARAMS = "\
642*4882a593Smuzhiyun       useradd -p '${PASSWD}' tester-jim; \
643*4882a593Smuzhiyun       useradd -p '${PASSWD}' tester-sue; \
644*4882a593Smuzhiyun       "
645*4882a593Smuzhiyun
646*4882a593SmuzhiyunFinally, here is an example that sets the root password::
647*4882a593Smuzhiyun
648*4882a593Smuzhiyun   inherit extrausers
649*4882a593Smuzhiyun   EXTRA_USERS_PARAMS = "\
650*4882a593Smuzhiyun       usermod -p '${PASSWD}' root; \
651*4882a593Smuzhiyun       "
652*4882a593Smuzhiyun
653*4882a593Smuzhiyun.. note::
654*4882a593Smuzhiyun
655*4882a593Smuzhiyun   From a security perspective, hardcoding a default password is not
656*4882a593Smuzhiyun   generally a good idea or even legal in some jurisdictions. It is
657*4882a593Smuzhiyun   recommended that you do not do this if you are building a production
658*4882a593Smuzhiyun   image.
659*4882a593Smuzhiyun
660*4882a593Smuzhiyun
661*4882a593Smuzhiyun.. _ref-classes-features_check:
662*4882a593Smuzhiyun
663*4882a593Smuzhiyun``features_check.bbclass``
664*4882a593Smuzhiyun=================================
665*4882a593Smuzhiyun
666*4882a593SmuzhiyunThe ``features_check`` class allows individual recipes to check
667*4882a593Smuzhiyunfor required and conflicting
668*4882a593Smuzhiyun:term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`.
669*4882a593Smuzhiyun
670*4882a593SmuzhiyunThis class provides support for the following variables:
671*4882a593Smuzhiyun
672*4882a593Smuzhiyun- :term:`REQUIRED_DISTRO_FEATURES`
673*4882a593Smuzhiyun- :term:`CONFLICT_DISTRO_FEATURES`
674*4882a593Smuzhiyun- :term:`ANY_OF_DISTRO_FEATURES`
675*4882a593Smuzhiyun- ``REQUIRED_MACHINE_FEATURES``
676*4882a593Smuzhiyun- ``CONFLICT_MACHINE_FEATURES``
677*4882a593Smuzhiyun- ``ANY_OF_MACHINE_FEATURES``
678*4882a593Smuzhiyun- ``REQUIRED_COMBINED_FEATURES``
679*4882a593Smuzhiyun- ``CONFLICT_COMBINED_FEATURES``
680*4882a593Smuzhiyun- ``ANY_OF_COMBINED_FEATURES``
681*4882a593Smuzhiyun
682*4882a593SmuzhiyunIf any conditions specified in the recipe using the above
683*4882a593Smuzhiyunvariables are not met, the recipe will be skipped, and if the
684*4882a593Smuzhiyunbuild system attempts to build the recipe then an error will be
685*4882a593Smuzhiyuntriggered.
686*4882a593Smuzhiyun
687*4882a593Smuzhiyun.. _ref-classes-fontcache:
688*4882a593Smuzhiyun
689*4882a593Smuzhiyun``fontcache.bbclass``
690*4882a593Smuzhiyun=====================
691*4882a593Smuzhiyun
692*4882a593SmuzhiyunThe ``fontcache`` class generates the proper post-install and
693*4882a593Smuzhiyunpost-remove (postinst and postrm) scriptlets for font packages. These
694*4882a593Smuzhiyunscriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
695*4882a593Smuzhiyunto the font information cache. Since the cache files are
696*4882a593Smuzhiyunarchitecture-specific, ``fc-cache`` runs using QEMU if the postinst
697*4882a593Smuzhiyunscriptlets need to be run on the build host during image creation.
698*4882a593Smuzhiyun
699*4882a593SmuzhiyunIf the fonts being installed are in packages other than the main
700*4882a593Smuzhiyunpackage, set :term:`FONT_PACKAGES` to specify the
701*4882a593Smuzhiyunpackages containing the fonts.
702*4882a593Smuzhiyun
703*4882a593Smuzhiyun.. _ref-classes-fs-uuid:
704*4882a593Smuzhiyun
705*4882a593Smuzhiyun``fs-uuid.bbclass``
706*4882a593Smuzhiyun===================
707*4882a593Smuzhiyun
708*4882a593SmuzhiyunThe ``fs-uuid`` class extracts UUID from
709*4882a593Smuzhiyun``${``\ :term:`ROOTFS`\ ``}``, which must have been built
710*4882a593Smuzhiyunby the time that this function gets called. The ``fs-uuid`` class only
711*4882a593Smuzhiyunworks on ``ext`` file systems and depends on ``tune2fs``.
712*4882a593Smuzhiyun
713*4882a593Smuzhiyun.. _ref-classes-gconf:
714*4882a593Smuzhiyun
715*4882a593Smuzhiyun``gconf.bbclass``
716*4882a593Smuzhiyun=================
717*4882a593Smuzhiyun
718*4882a593SmuzhiyunThe ``gconf`` class provides common functionality for recipes that need
719*4882a593Smuzhiyunto install GConf schemas. The schemas will be put into a separate
720*4882a593Smuzhiyunpackage (``${``\ :term:`PN`\ ``}-gconf``) that is created
721*4882a593Smuzhiyunautomatically when this class is inherited. This package uses the
722*4882a593Smuzhiyunappropriate post-install and post-remove (postinst/postrm) scriptlets to
723*4882a593Smuzhiyunregister and unregister the schemas in the target image.
724*4882a593Smuzhiyun
725*4882a593Smuzhiyun.. _ref-classes-gettext:
726*4882a593Smuzhiyun
727*4882a593Smuzhiyun``gettext.bbclass``
728*4882a593Smuzhiyun===================
729*4882a593Smuzhiyun
730*4882a593SmuzhiyunThe ``gettext`` class provides support for building software that uses
731*4882a593Smuzhiyunthe GNU ``gettext`` internationalization and localization system. All
732*4882a593Smuzhiyunrecipes building software that use ``gettext`` should inherit this
733*4882a593Smuzhiyunclass.
734*4882a593Smuzhiyun
735*4882a593Smuzhiyun.. _ref-classes-gnomebase:
736*4882a593Smuzhiyun
737*4882a593Smuzhiyun``gnomebase.bbclass``
738*4882a593Smuzhiyun=====================
739*4882a593Smuzhiyun
740*4882a593SmuzhiyunThe ``gnomebase`` class is the base class for recipes that build
741*4882a593Smuzhiyunsoftware from the GNOME stack. This class sets
742*4882a593Smuzhiyun:term:`SRC_URI` to download the source from the GNOME
743*4882a593Smuzhiyunmirrors as well as extending :term:`FILES` with the typical
744*4882a593SmuzhiyunGNOME installation paths.
745*4882a593Smuzhiyun
746*4882a593Smuzhiyun.. _ref-classes-gobject-introspection:
747*4882a593Smuzhiyun
748*4882a593Smuzhiyun``gobject-introspection.bbclass``
749*4882a593Smuzhiyun=================================
750*4882a593Smuzhiyun
751*4882a593SmuzhiyunProvides support for recipes building software that supports GObject
752*4882a593Smuzhiyunintrospection. This functionality is only enabled if the
753*4882a593Smuzhiyun"gobject-introspection-data" feature is in
754*4882a593Smuzhiyun:term:`DISTRO_FEATURES` as well as
755*4882a593Smuzhiyun"qemu-usermode" being in
756*4882a593Smuzhiyun:term:`MACHINE_FEATURES`.
757*4882a593Smuzhiyun
758*4882a593Smuzhiyun.. note::
759*4882a593Smuzhiyun
760*4882a593Smuzhiyun   This functionality is backfilled by default and, if not applicable,
761*4882a593Smuzhiyun   should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
762*4882a593Smuzhiyun   :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
763*4882a593Smuzhiyun
764*4882a593Smuzhiyun.. _ref-classes-grub-efi:
765*4882a593Smuzhiyun
766*4882a593Smuzhiyun``grub-efi.bbclass``
767*4882a593Smuzhiyun====================
768*4882a593Smuzhiyun
769*4882a593SmuzhiyunThe ``grub-efi`` class provides ``grub-efi``-specific functions for
770*4882a593Smuzhiyunbuilding bootable images.
771*4882a593Smuzhiyun
772*4882a593SmuzhiyunThis class supports several variables:
773*4882a593Smuzhiyun
774*4882a593Smuzhiyun-  :term:`INITRD`: Indicates list of filesystem images to
775*4882a593Smuzhiyun   concatenate and use as an initial RAM disk (initrd) (optional).
776*4882a593Smuzhiyun
777*4882a593Smuzhiyun-  :term:`ROOTFS`: Indicates a filesystem image to include
778*4882a593Smuzhiyun   as the root filesystem (optional).
779*4882a593Smuzhiyun
780*4882a593Smuzhiyun-  :term:`GRUB_GFXSERIAL`: Set this to "1" to have
781*4882a593Smuzhiyun   graphics and serial in the boot menu.
782*4882a593Smuzhiyun
783*4882a593Smuzhiyun-  :term:`LABELS`: A list of targets for the automatic
784*4882a593Smuzhiyun   configuration.
785*4882a593Smuzhiyun
786*4882a593Smuzhiyun-  :term:`APPEND`: An override list of append strings for
787*4882a593Smuzhiyun   each ``LABEL``.
788*4882a593Smuzhiyun
789*4882a593Smuzhiyun-  :term:`GRUB_OPTS`: Additional options to add to the
790*4882a593Smuzhiyun   configuration (optional). Options are delimited using semi-colon
791*4882a593Smuzhiyun   characters (``;``).
792*4882a593Smuzhiyun
793*4882a593Smuzhiyun-  :term:`GRUB_TIMEOUT`: Timeout before executing
794*4882a593Smuzhiyun   the default ``LABEL`` (optional).
795*4882a593Smuzhiyun
796*4882a593Smuzhiyun.. _ref-classes-gsettings:
797*4882a593Smuzhiyun
798*4882a593Smuzhiyun``gsettings.bbclass``
799*4882a593Smuzhiyun=====================
800*4882a593Smuzhiyun
801*4882a593SmuzhiyunThe ``gsettings`` class provides common functionality for recipes that
802*4882a593Smuzhiyunneed to install GSettings (glib) schemas. The schemas are assumed to be
803*4882a593Smuzhiyunpart of the main package. Appropriate post-install and post-remove
804*4882a593Smuzhiyun(postinst/postrm) scriptlets are added to register and unregister the
805*4882a593Smuzhiyunschemas in the target image.
806*4882a593Smuzhiyun
807*4882a593Smuzhiyun.. _ref-classes-gtk-doc:
808*4882a593Smuzhiyun
809*4882a593Smuzhiyun``gtk-doc.bbclass``
810*4882a593Smuzhiyun===================
811*4882a593Smuzhiyun
812*4882a593SmuzhiyunThe ``gtk-doc`` class is a helper class to pull in the appropriate
813*4882a593Smuzhiyun``gtk-doc`` dependencies and disable ``gtk-doc``.
814*4882a593Smuzhiyun
815*4882a593Smuzhiyun.. _ref-classes-gtk-icon-cache:
816*4882a593Smuzhiyun
817*4882a593Smuzhiyun``gtk-icon-cache.bbclass``
818*4882a593Smuzhiyun==========================
819*4882a593Smuzhiyun
820*4882a593SmuzhiyunThe ``gtk-icon-cache`` class generates the proper post-install and
821*4882a593Smuzhiyunpost-remove (postinst/postrm) scriptlets for packages that use GTK+ and
822*4882a593Smuzhiyuninstall icons. These scriptlets call ``gtk-update-icon-cache`` to add
823*4882a593Smuzhiyunthe fonts to GTK+'s icon cache. Since the cache files are
824*4882a593Smuzhiyunarchitecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
825*4882a593Smuzhiyunthe postinst scriptlets need to be run on the build host during image
826*4882a593Smuzhiyuncreation.
827*4882a593Smuzhiyun
828*4882a593Smuzhiyun.. _ref-classes-gtk-immodules-cache:
829*4882a593Smuzhiyun
830*4882a593Smuzhiyun``gtk-immodules-cache.bbclass``
831*4882a593Smuzhiyun===============================
832*4882a593Smuzhiyun
833*4882a593SmuzhiyunThe ``gtk-immodules-cache`` class generates the proper post-install and
834*4882a593Smuzhiyunpost-remove (postinst/postrm) scriptlets for packages that install GTK+
835*4882a593Smuzhiyuninput method modules for virtual keyboards. These scriptlets call
836*4882a593Smuzhiyun``gtk-update-icon-cache`` to add the input method modules to the cache.
837*4882a593SmuzhiyunSince the cache files are architecture-specific,
838*4882a593Smuzhiyun``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
839*4882a593Smuzhiyunneed to be run on the build host during image creation.
840*4882a593Smuzhiyun
841*4882a593SmuzhiyunIf the input method modules being installed are in packages other than
842*4882a593Smuzhiyunthe main package, set
843*4882a593Smuzhiyun:term:`GTKIMMODULES_PACKAGES` to specify
844*4882a593Smuzhiyunthe packages containing the modules.
845*4882a593Smuzhiyun
846*4882a593Smuzhiyun.. _ref-classes-gzipnative:
847*4882a593Smuzhiyun
848*4882a593Smuzhiyun``gzipnative.bbclass``
849*4882a593Smuzhiyun======================
850*4882a593Smuzhiyun
851*4882a593SmuzhiyunThe ``gzipnative`` class enables the use of different native versions of
852*4882a593Smuzhiyun``gzip`` and ``pigz`` rather than the versions of these tools from the
853*4882a593Smuzhiyunbuild host.
854*4882a593Smuzhiyun
855*4882a593Smuzhiyun.. _ref-classes-icecc:
856*4882a593Smuzhiyun
857*4882a593Smuzhiyun``icecc.bbclass``
858*4882a593Smuzhiyun=================
859*4882a593Smuzhiyun
860*4882a593SmuzhiyunThe ``icecc`` class supports
861*4882a593Smuzhiyun`Icecream <https://github.com/icecc/icecream>`__, which facilitates
862*4882a593Smuzhiyuntaking compile jobs and distributing them among remote machines.
863*4882a593Smuzhiyun
864*4882a593SmuzhiyunThe class stages directories with symlinks from ``gcc`` and ``g++`` to
865*4882a593Smuzhiyun``icecc``, for both native and cross compilers. Depending on each
866*4882a593Smuzhiyunconfigure or compile, the OpenEmbedded build system adds the directories
867*4882a593Smuzhiyunat the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
868*4882a593Smuzhiyun``ICEC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
869*4882a593Smuzhiyuncompilers, respectively.
870*4882a593Smuzhiyun
871*4882a593SmuzhiyunFor the cross compiler, the class creates a ``tar.gz`` file that
872*4882a593Smuzhiyuncontains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
873*4882a593Smuzhiyunis the version of the cross-compiler used in the cross-development
874*4882a593Smuzhiyuntoolchain, accordingly.
875*4882a593Smuzhiyun
876*4882a593SmuzhiyunThe class handles all three different compile stages (i.e native
877*4882a593Smuzhiyun,cross-kernel and target) and creates the necessary environment
878*4882a593Smuzhiyun``tar.gz`` file to be used by the remote machines. The class also
879*4882a593Smuzhiyunsupports SDK generation.
880*4882a593Smuzhiyun
881*4882a593SmuzhiyunIf :term:`ICECC_PATH` is not set in your
882*4882a593Smuzhiyun``local.conf`` file, then the class tries to locate the ``icecc`` binary
883*4882a593Smuzhiyunusing ``which``. If :term:`ICECC_ENV_EXEC` is set
884*4882a593Smuzhiyunin your ``local.conf`` file, the variable should point to the
885*4882a593Smuzhiyun``icecc-create-env`` script provided by the user. If you do not point to
886*4882a593Smuzhiyuna user-provided script, the build system uses the default script
887*4882a593Smuzhiyunprovided by the recipe ``icecc-create-env-native.bb``.
888*4882a593Smuzhiyun
889*4882a593Smuzhiyun.. note::
890*4882a593Smuzhiyun
891*4882a593Smuzhiyun   This script is a modified version and not the one that comes with
892*4882a593Smuzhiyun   icecc.
893*4882a593Smuzhiyun
894*4882a593SmuzhiyunIf you do not want the Icecream distributed compile support to apply to
895*4882a593Smuzhiyunspecific recipes or classes, you can ask them to be ignored by Icecream
896*4882a593Smuzhiyunby listing the recipes and classes using the
897*4882a593Smuzhiyun:term:`ICECC_RECIPE_DISABLE` and
898*4882a593Smuzhiyun:term:`ICECC_CLASS_DISABLE` variables,
899*4882a593Smuzhiyunrespectively, in your ``local.conf`` file. Doing so causes the
900*4882a593SmuzhiyunOpenEmbedded build system to handle these compilations locally.
901*4882a593Smuzhiyun
902*4882a593SmuzhiyunAdditionally, you can list recipes using the
903*4882a593Smuzhiyun:term:`ICECC_RECIPE_ENABLE` variable in
904*4882a593Smuzhiyunyour ``local.conf`` file to force ``icecc`` to be enabled for recipes
905*4882a593Smuzhiyunusing an empty :term:`PARALLEL_MAKE` variable.
906*4882a593Smuzhiyun
907*4882a593SmuzhiyunInheriting the ``icecc`` class changes all sstate signatures.
908*4882a593SmuzhiyunConsequently, if a development team has a dedicated build system that
909*4882a593Smuzhiyunpopulates :term:`SSTATE_MIRRORS` and they want to
910*4882a593Smuzhiyunreuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
911*4882a593Smuzhiyunsystem need to either inherit the ``icecc`` class or nobody should.
912*4882a593Smuzhiyun
913*4882a593SmuzhiyunAt the distribution level, you can inherit the ``icecc`` class to be
914*4882a593Smuzhiyunsure that all builders start with the same sstate signatures. After
915*4882a593Smuzhiyuninheriting the class, you can then disable the feature by setting the
916*4882a593Smuzhiyun:term:`ICECC_DISABLED` variable to "1" as follows::
917*4882a593Smuzhiyun
918*4882a593Smuzhiyun   INHERIT_DISTRO:append = " icecc"
919*4882a593Smuzhiyun   ICECC_DISABLED ??= "1"
920*4882a593Smuzhiyun
921*4882a593SmuzhiyunThis practice
922*4882a593Smuzhiyunmakes sure everyone is using the same signatures but also requires
923*4882a593Smuzhiyunindividuals that do want to use Icecream to enable the feature
924*4882a593Smuzhiyunindividually as follows in your ``local.conf`` file::
925*4882a593Smuzhiyun
926*4882a593Smuzhiyun   ICECC_DISABLED = ""
927*4882a593Smuzhiyun
928*4882a593Smuzhiyun.. _ref-classes-image:
929*4882a593Smuzhiyun
930*4882a593Smuzhiyun``image.bbclass``
931*4882a593Smuzhiyun=================
932*4882a593Smuzhiyun
933*4882a593SmuzhiyunThe ``image`` class helps support creating images in different formats.
934*4882a593SmuzhiyunFirst, the root filesystem is created from packages using one of the
935*4882a593Smuzhiyun``rootfs*.bbclass`` files (depending on the package format used) and
936*4882a593Smuzhiyunthen one or more image files are created.
937*4882a593Smuzhiyun
938*4882a593Smuzhiyun-  The :term:`IMAGE_FSTYPES` variable controls the types of images to
939*4882a593Smuzhiyun   generate.
940*4882a593Smuzhiyun
941*4882a593Smuzhiyun-  The :term:`IMAGE_INSTALL` variable controls the list of packages to
942*4882a593Smuzhiyun   install into the image.
943*4882a593Smuzhiyun
944*4882a593SmuzhiyunFor information on customizing images, see the
945*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:customizing images`" section
946*4882a593Smuzhiyunin the Yocto Project Development Tasks Manual. For information on how
947*4882a593Smuzhiyunimages are created, see the
948*4882a593Smuzhiyun":ref:`overview-manual/concepts:images`" section in the
949*4882a593SmuzhiyunYocto Project Overview and Concepts Manual.
950*4882a593Smuzhiyun
951*4882a593Smuzhiyun.. _ref-classes-image-buildinfo:
952*4882a593Smuzhiyun
953*4882a593Smuzhiyun``image-buildinfo.bbclass``
954*4882a593Smuzhiyun===========================
955*4882a593Smuzhiyun
956*4882a593SmuzhiyunThe ``image-buildinfo`` class writes information to the target
957*4882a593Smuzhiyunfilesystem on ``/etc/build``.
958*4882a593Smuzhiyun
959*4882a593Smuzhiyun.. _ref-classes-image_types:
960*4882a593Smuzhiyun
961*4882a593Smuzhiyun``image_types.bbclass``
962*4882a593Smuzhiyun=======================
963*4882a593Smuzhiyun
964*4882a593SmuzhiyunThe ``image_types`` class defines all of the standard image output types
965*4882a593Smuzhiyunthat you can enable through the
966*4882a593Smuzhiyun:term:`IMAGE_FSTYPES` variable. You can use this
967*4882a593Smuzhiyunclass as a reference on how to add support for custom image output
968*4882a593Smuzhiyuntypes.
969*4882a593Smuzhiyun
970*4882a593SmuzhiyunBy default, the :ref:`image <ref-classes-image>` class automatically
971*4882a593Smuzhiyunenables the ``image_types`` class. The ``image`` class uses the
972*4882a593Smuzhiyun``IMGCLASSES`` variable as follows::
973*4882a593Smuzhiyun
974*4882a593Smuzhiyun   IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
975*4882a593Smuzhiyun   IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
976*4882a593Smuzhiyun   IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
977*4882a593Smuzhiyun   IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
978*4882a593Smuzhiyun   IMGCLASSES += "image_types_wic"
979*4882a593Smuzhiyun   IMGCLASSES += "rootfs-postcommands"
980*4882a593Smuzhiyun   IMGCLASSES += "image-postinst-intercepts"
981*4882a593Smuzhiyun   inherit ${IMGCLASSES}
982*4882a593Smuzhiyun
983*4882a593SmuzhiyunThe ``image_types`` class also handles conversion and compression of images.
984*4882a593Smuzhiyun
985*4882a593Smuzhiyun.. note::
986*4882a593Smuzhiyun
987*4882a593Smuzhiyun   To build a VMware VMDK image, you need to add "wic.vmdk" to
988*4882a593Smuzhiyun   :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
989*4882a593Smuzhiyun   Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
990*4882a593Smuzhiyun
991*4882a593Smuzhiyun.. _ref-classes-image-live:
992*4882a593Smuzhiyun
993*4882a593Smuzhiyun``image-live.bbclass``
994*4882a593Smuzhiyun======================
995*4882a593Smuzhiyun
996*4882a593SmuzhiyunThis class controls building "live" (i.e. HDDIMG and ISO) images. Live
997*4882a593Smuzhiyunimages contain syslinux for legacy booting, as well as the bootloader
998*4882a593Smuzhiyunspecified by :term:`EFI_PROVIDER` if
999*4882a593Smuzhiyun:term:`MACHINE_FEATURES` contains "efi".
1000*4882a593Smuzhiyun
1001*4882a593SmuzhiyunNormally, you do not use this class directly. Instead, you add "live" to
1002*4882a593Smuzhiyun:term:`IMAGE_FSTYPES`.
1003*4882a593Smuzhiyun
1004*4882a593Smuzhiyun.. _ref-classes-insane:
1005*4882a593Smuzhiyun
1006*4882a593Smuzhiyun``insane.bbclass``
1007*4882a593Smuzhiyun==================
1008*4882a593Smuzhiyun
1009*4882a593SmuzhiyunThe ``insane`` class adds a step to the package generation process so
1010*4882a593Smuzhiyunthat output quality assurance checks are generated by the OpenEmbedded
1011*4882a593Smuzhiyunbuild system. A range of checks are performed that check the build's
1012*4882a593Smuzhiyunoutput for common problems that show up during runtime. Distribution
1013*4882a593Smuzhiyunpolicy usually dictates whether to include this class.
1014*4882a593Smuzhiyun
1015*4882a593SmuzhiyunYou can configure the sanity checks so that specific test failures
1016*4882a593Smuzhiyuneither raise a warning or an error message. Typically, failures for new
1017*4882a593Smuzhiyuntests generate a warning. Subsequent failures for the same test would
1018*4882a593Smuzhiyunthen generate an error message once the metadata is in a known and good
1019*4882a593Smuzhiyuncondition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
1020*4882a593Smuzhiyunand error messages you might encounter using a default configuration.
1021*4882a593Smuzhiyun
1022*4882a593SmuzhiyunUse the :term:`WARN_QA` and
1023*4882a593Smuzhiyun:term:`ERROR_QA` variables to control the behavior of
1024*4882a593Smuzhiyunthese checks at the global level (i.e. in your custom distro
1025*4882a593Smuzhiyunconfiguration). However, to skip one or more checks in recipes, you
1026*4882a593Smuzhiyunshould use :term:`INSANE_SKIP`. For example, to skip
1027*4882a593Smuzhiyunthe check for symbolic link ``.so`` files in the main package of a
1028*4882a593Smuzhiyunrecipe, add the following to the recipe. You need to realize that the
1029*4882a593Smuzhiyunpackage name override, in this example ``${PN}``, must be used::
1030*4882a593Smuzhiyun
1031*4882a593Smuzhiyun   INSANE_SKIP:${PN} += "dev-so"
1032*4882a593Smuzhiyun
1033*4882a593SmuzhiyunPlease keep in mind that the QA checks
1034*4882a593Smuzhiyunare meant to detect real or potential problems in the packaged
1035*4882a593Smuzhiyunoutput. So exercise caution when disabling these checks.
1036*4882a593Smuzhiyun
1037*4882a593SmuzhiyunHere are the tests you can list with the :term:`WARN_QA` and
1038*4882a593Smuzhiyun:term:`ERROR_QA` variables:
1039*4882a593Smuzhiyun
1040*4882a593Smuzhiyun-  ``already-stripped:`` Checks that produced binaries have not
1041*4882a593Smuzhiyun   already been stripped prior to the build system extracting debug
1042*4882a593Smuzhiyun   symbols. It is common for upstream software projects to default to
1043*4882a593Smuzhiyun   stripping debug symbols for output binaries. In order for debugging
1044*4882a593Smuzhiyun   to work on the target using ``-dbg`` packages, this stripping must be
1045*4882a593Smuzhiyun   disabled.
1046*4882a593Smuzhiyun
1047*4882a593Smuzhiyun-  ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1048*4882a593Smuzhiyun   size, and endianness of any binaries to ensure they match the target
1049*4882a593Smuzhiyun   architecture. This test fails if any binaries do not match the type
1050*4882a593Smuzhiyun   since there would be an incompatibility. The test could indicate that
1051*4882a593Smuzhiyun   the wrong compiler or compiler options have been used. Sometimes
1052*4882a593Smuzhiyun   software, like bootloaders, might need to bypass this check.
1053*4882a593Smuzhiyun
1054*4882a593Smuzhiyun-  ``buildpaths:`` Checks for paths to locations on the build host
1055*4882a593Smuzhiyun   inside the output files. Currently, this test triggers too many false
1056*4882a593Smuzhiyun   positives and thus is not normally enabled.
1057*4882a593Smuzhiyun
1058*4882a593Smuzhiyun-  ``build-deps:`` Determines if a build-time dependency that is
1059*4882a593Smuzhiyun   specified through :term:`DEPENDS`, explicit
1060*4882a593Smuzhiyun   :term:`RDEPENDS`, or task-level dependencies exists
1061*4882a593Smuzhiyun   to match any runtime dependency. This determination is particularly
1062*4882a593Smuzhiyun   useful to discover where runtime dependencies are detected and added
1063*4882a593Smuzhiyun   during packaging. If no explicit dependency has been specified within
1064*4882a593Smuzhiyun   the metadata, at the packaging stage it is too late to ensure that
1065*4882a593Smuzhiyun   the dependency is built, and thus you can end up with an error when
1066*4882a593Smuzhiyun   the package is installed into the image during the
1067*4882a593Smuzhiyun   :ref:`ref-tasks-rootfs` task because the auto-detected
1068*4882a593Smuzhiyun   dependency was not satisfied. An example of this would be where the
1069*4882a593Smuzhiyun   :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically
1070*4882a593Smuzhiyun   adds a dependency on the ``initscripts-functions`` package to
1071*4882a593Smuzhiyun   packages that install an initscript that refers to
1072*4882a593Smuzhiyun   ``/etc/init.d/functions``. The recipe should really have an explicit
1073*4882a593Smuzhiyun   :term:`RDEPENDS` for the package in question on ``initscripts-functions``
1074*4882a593Smuzhiyun   so that the OpenEmbedded build system is able to ensure that the
1075*4882a593Smuzhiyun   ``initscripts`` recipe is actually built and thus the
1076*4882a593Smuzhiyun   ``initscripts-functions`` package is made available.
1077*4882a593Smuzhiyun
1078*4882a593Smuzhiyun-  ``compile-host-path:`` Checks the
1079*4882a593Smuzhiyun   :ref:`ref-tasks-compile` log for indications that
1080*4882a593Smuzhiyun   paths to locations on the build host were used. Using such paths
1081*4882a593Smuzhiyun   might result in host contamination of the build output.
1082*4882a593Smuzhiyun
1083*4882a593Smuzhiyun-  ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1084*4882a593Smuzhiyun   do not depend on ``-dbg`` packages, which would cause a packaging
1085*4882a593Smuzhiyun   bug.
1086*4882a593Smuzhiyun
1087*4882a593Smuzhiyun-  ``debug-files:`` Checks for ``.debug`` directories in anything but
1088*4882a593Smuzhiyun   the ``-dbg`` package. The debug files should all be in the ``-dbg``
1089*4882a593Smuzhiyun   package. Thus, anything packaged elsewhere is incorrect packaging.
1090*4882a593Smuzhiyun
1091*4882a593Smuzhiyun-  ``dep-cmp:`` Checks for invalid version comparison statements in
1092*4882a593Smuzhiyun   runtime dependency relationships between packages (i.e. in
1093*4882a593Smuzhiyun   :term:`RDEPENDS`,
1094*4882a593Smuzhiyun   :term:`RRECOMMENDS`,
1095*4882a593Smuzhiyun   :term:`RSUGGESTS`,
1096*4882a593Smuzhiyun   :term:`RPROVIDES`,
1097*4882a593Smuzhiyun   :term:`RREPLACES`, and
1098*4882a593Smuzhiyun   :term:`RCONFLICTS` variable values). Any invalid
1099*4882a593Smuzhiyun   comparisons might trigger failures or undesirable behavior when
1100*4882a593Smuzhiyun   passed to the package manager.
1101*4882a593Smuzhiyun
1102*4882a593Smuzhiyun-  ``desktop:`` Runs the ``desktop-file-validate`` program against any
1103*4882a593Smuzhiyun   ``.desktop`` files to validate their contents against the
1104*4882a593Smuzhiyun   specification for ``.desktop`` files.
1105*4882a593Smuzhiyun
1106*4882a593Smuzhiyun-  ``dev-deps:`` Checks that all packages except ``-dev`` or
1107*4882a593Smuzhiyun   ``-staticdev`` packages do not depend on ``-dev`` packages, which
1108*4882a593Smuzhiyun   would be a packaging bug.
1109*4882a593Smuzhiyun
1110*4882a593Smuzhiyun-  ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1111*4882a593Smuzhiyun   ``-dev`` package and not in any of the other packages. In general,
1112*4882a593Smuzhiyun   these symlinks are only useful for development purposes. Thus, the
1113*4882a593Smuzhiyun   ``-dev`` package is the correct location for them. In very rare
1114*4882a593Smuzhiyun   cases, such as dynamically loaded modules, these symlinks
1115*4882a593Smuzhiyun   are needed instead in the main package.
1116*4882a593Smuzhiyun
1117*4882a593Smuzhiyun-  ``empty-dirs:`` Checks that packages are not installing files to
1118*4882a593Smuzhiyun   directories that are normally expected to be empty (such as ``/tmp``)
1119*4882a593Smuzhiyun   The list of directories that are checked is specified by the
1120*4882a593Smuzhiyun   :term:`QA_EMPTY_DIRS` variable.
1121*4882a593Smuzhiyun
1122*4882a593Smuzhiyun-  ``file-rdeps:`` Checks that file-level dependencies identified by
1123*4882a593Smuzhiyun   the OpenEmbedded build system at packaging time are satisfied. For
1124*4882a593Smuzhiyun   example, a shell script might start with the line ``#!/bin/bash``.
1125*4882a593Smuzhiyun   This line would translate to a file dependency on ``/bin/bash``. Of
1126*4882a593Smuzhiyun   the three package managers that the OpenEmbedded build system
1127*4882a593Smuzhiyun   supports, only RPM directly handles file-level dependencies,
1128*4882a593Smuzhiyun   resolving them automatically to packages providing the files.
1129*4882a593Smuzhiyun   However, the lack of that functionality in the other two package
1130*4882a593Smuzhiyun   managers does not mean the dependencies do not still need resolving.
1131*4882a593Smuzhiyun   This QA check attempts to ensure that explicitly declared
1132*4882a593Smuzhiyun   :term:`RDEPENDS` exist to handle any file-level
1133*4882a593Smuzhiyun   dependency detected in packaged files.
1134*4882a593Smuzhiyun
1135*4882a593Smuzhiyun-  ``files-invalid:`` Checks for :term:`FILES` variable
1136*4882a593Smuzhiyun   values that contain "//", which is invalid.
1137*4882a593Smuzhiyun
1138*4882a593Smuzhiyun-  ``host-user-contaminated:`` Checks that no package produced by the
1139*4882a593Smuzhiyun   recipe contains any files outside of ``/home`` with a user or group
1140*4882a593Smuzhiyun   ID that matches the user running BitBake. A match usually indicates
1141*4882a593Smuzhiyun   that the files are being installed with an incorrect UID/GID, since
1142*4882a593Smuzhiyun   target IDs are independent from host IDs. For additional information,
1143*4882a593Smuzhiyun   see the section describing the
1144*4882a593Smuzhiyun   :ref:`ref-tasks-install` task.
1145*4882a593Smuzhiyun
1146*4882a593Smuzhiyun-  ``incompatible-license:`` Report when packages are excluded from
1147*4882a593Smuzhiyun   being created due to being marked with a license that is in
1148*4882a593Smuzhiyun   :term:`INCOMPATIBLE_LICENSE`.
1149*4882a593Smuzhiyun
1150*4882a593Smuzhiyun-  ``install-host-path:`` Checks the
1151*4882a593Smuzhiyun   :ref:`ref-tasks-install` log for indications that
1152*4882a593Smuzhiyun   paths to locations on the build host were used. Using such paths
1153*4882a593Smuzhiyun   might result in host contamination of the build output.
1154*4882a593Smuzhiyun
1155*4882a593Smuzhiyun-  ``installed-vs-shipped:`` Reports when files have been installed
1156*4882a593Smuzhiyun   within ``do_install`` but have not been included in any package by
1157*4882a593Smuzhiyun   way of the :term:`FILES` variable. Files that do not
1158*4882a593Smuzhiyun   appear in any package cannot be present in an image later on in the
1159*4882a593Smuzhiyun   build process. Ideally, all installed files should be packaged or not
1160*4882a593Smuzhiyun   installed at all. These files can be deleted at the end of
1161*4882a593Smuzhiyun   ``do_install`` if the files are not needed in any package.
1162*4882a593Smuzhiyun
1163*4882a593Smuzhiyun-  ``invalid-chars:`` Checks that the recipe metadata variables
1164*4882a593Smuzhiyun   :term:`DESCRIPTION`,
1165*4882a593Smuzhiyun   :term:`SUMMARY`, :term:`LICENSE`, and
1166*4882a593Smuzhiyun   :term:`SECTION` do not contain non-UTF-8 characters.
1167*4882a593Smuzhiyun   Some package managers do not support such characters.
1168*4882a593Smuzhiyun
1169*4882a593Smuzhiyun-  ``invalid-packageconfig:`` Checks that no undefined features are
1170*4882a593Smuzhiyun   being added to :term:`PACKAGECONFIG`. For
1171*4882a593Smuzhiyun   example, any name "foo" for which the following form does not exist::
1172*4882a593Smuzhiyun
1173*4882a593Smuzhiyun      PACKAGECONFIG[foo] = "..."
1174*4882a593Smuzhiyun
1175*4882a593Smuzhiyun-  ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
1176*4882a593Smuzhiyun   file containing these paths is incorrect since ``libtool`` adds the
1177*4882a593Smuzhiyun   correct sysroot prefix when using the files automatically itself.
1178*4882a593Smuzhiyun
1179*4882a593Smuzhiyun-  ``ldflags:`` Ensures that the binaries were linked with the
1180*4882a593Smuzhiyun   :term:`LDFLAGS` options provided by the build system.
1181*4882a593Smuzhiyun   If this test fails, check that the :term:`LDFLAGS` variable is being
1182*4882a593Smuzhiyun   passed to the linker command.
1183*4882a593Smuzhiyun
1184*4882a593Smuzhiyun-  ``libdir:`` Checks for libraries being installed into incorrect
1185*4882a593Smuzhiyun   (possibly hardcoded) installation paths. For example, this test will
1186*4882a593Smuzhiyun   catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1187*4882a593Smuzhiyun   "lib32". Another example is when recipes install
1188*4882a593Smuzhiyun   ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1189*4882a593Smuzhiyun
1190*4882a593Smuzhiyun-  ``libexec:`` Checks if a package contains files in
1191*4882a593Smuzhiyun   ``/usr/libexec``. This check is not performed if the ``libexecdir``
1192*4882a593Smuzhiyun   variable has been set explicitly to ``/usr/libexec``.
1193*4882a593Smuzhiyun
1194*4882a593Smuzhiyun-  ``packages-list:`` Checks for the same package being listed
1195*4882a593Smuzhiyun   multiple times through the :term:`PACKAGES` variable
1196*4882a593Smuzhiyun   value. Installing the package in this manner can cause errors during
1197*4882a593Smuzhiyun   packaging.
1198*4882a593Smuzhiyun
1199*4882a593Smuzhiyun-  ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1200*4882a593Smuzhiyun   invalid format.
1201*4882a593Smuzhiyun
1202*4882a593Smuzhiyun-  ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1203*4882a593Smuzhiyun   invalid format.
1204*4882a593Smuzhiyun
1205*4882a593Smuzhiyun-  ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1206*4882a593Smuzhiyun   'link' where the specified target already exists.
1207*4882a593Smuzhiyun
1208*4882a593Smuzhiyun-  ``perms:`` Currently, this check is unused but reserved.
1209*4882a593Smuzhiyun
1210*4882a593Smuzhiyun-  ``pkgconfig:`` Checks ``.pc`` files for any
1211*4882a593Smuzhiyun   :term:`TMPDIR`/:term:`WORKDIR` paths.
1212*4882a593Smuzhiyun   Any ``.pc`` file containing these paths is incorrect since
1213*4882a593Smuzhiyun   ``pkg-config`` itself adds the correct sysroot prefix when the files
1214*4882a593Smuzhiyun   are accessed.
1215*4882a593Smuzhiyun
1216*4882a593Smuzhiyun-  ``pkgname:`` Checks that all packages in
1217*4882a593Smuzhiyun   :term:`PACKAGES` have names that do not contain
1218*4882a593Smuzhiyun   invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1219*4882a593Smuzhiyun   -).
1220*4882a593Smuzhiyun
1221*4882a593Smuzhiyun-  ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
1222*4882a593Smuzhiyun   undefined during :ref:`ref-tasks-package`.
1223*4882a593Smuzhiyun
1224*4882a593Smuzhiyun-  ``pkgvarcheck:`` Checks through the variables
1225*4882a593Smuzhiyun   :term:`RDEPENDS`,
1226*4882a593Smuzhiyun   :term:`RRECOMMENDS`,
1227*4882a593Smuzhiyun   :term:`RSUGGESTS`,
1228*4882a593Smuzhiyun   :term:`RCONFLICTS`,
1229*4882a593Smuzhiyun   :term:`RPROVIDES`,
1230*4882a593Smuzhiyun   :term:`RREPLACES`, :term:`FILES`,
1231*4882a593Smuzhiyun   :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1232*4882a593Smuzhiyun   ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1233*4882a593Smuzhiyun   there are variable sets that are not package-specific. Using these
1234*4882a593Smuzhiyun   variables without a package suffix is bad practice, and might
1235*4882a593Smuzhiyun   unnecessarily complicate dependencies of other packages within the
1236*4882a593Smuzhiyun   same recipe or have other unintended consequences.
1237*4882a593Smuzhiyun
1238*4882a593Smuzhiyun-  ``pn-overrides:`` Checks that a recipe does not have a name
1239*4882a593Smuzhiyun   (:term:`PN`) value that appears in
1240*4882a593Smuzhiyun   :term:`OVERRIDES`. If a recipe is named such that
1241*4882a593Smuzhiyun   its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1242*4882a593Smuzhiyun   :term:`PN` happens to be the same as :term:`MACHINE` or
1243*4882a593Smuzhiyun   :term:`DISTRO`), it can have unexpected consequences.
1244*4882a593Smuzhiyun   For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
1245*4882a593Smuzhiyun   turn into ``FILES = "xyz"``.
1246*4882a593Smuzhiyun
1247*4882a593Smuzhiyun-  ``rpaths:`` Checks for rpaths in the binaries that contain build
1248*4882a593Smuzhiyun   system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
1249*4882a593Smuzhiyun   options are being passed to the linker commands and your binaries
1250*4882a593Smuzhiyun   have potential security issues.
1251*4882a593Smuzhiyun
1252*4882a593Smuzhiyun-  ``split-strip:`` Reports that splitting or stripping debug symbols
1253*4882a593Smuzhiyun   from binaries has failed.
1254*4882a593Smuzhiyun
1255*4882a593Smuzhiyun-  ``staticdev:`` Checks for static library files (``*.a``) in
1256*4882a593Smuzhiyun   non-``staticdev`` packages.
1257*4882a593Smuzhiyun
1258*4882a593Smuzhiyun-  ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1259*4882a593Smuzhiyun   into :term:`TMPDIR` on the host. Such symlinks will
1260*4882a593Smuzhiyun   work on the host, but are clearly invalid when running on the target.
1261*4882a593Smuzhiyun
1262*4882a593Smuzhiyun-  ``textrel:`` Checks for ELF binaries that contain relocations in
1263*4882a593Smuzhiyun   their ``.text`` sections, which can result in a performance impact at
1264*4882a593Smuzhiyun   runtime. See the explanation for the ``ELF binary`` message in
1265*4882a593Smuzhiyun   ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
1266*4882a593Smuzhiyun   issues.
1267*4882a593Smuzhiyun
1268*4882a593Smuzhiyun-  ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1269*4882a593Smuzhiyun   for a package are also declared on the recipe level (i.e. any license
1270*4882a593Smuzhiyun   in ``LICENSE:*`` should appear in :term:`LICENSE`).
1271*4882a593Smuzhiyun
1272*4882a593Smuzhiyun-  ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1273*4882a593Smuzhiyun   in the binaries that by default on a standard system are searched by
1274*4882a593Smuzhiyun   the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1275*4882a593Smuzhiyun   not cause any breakage, they do waste space and are unnecessary.
1276*4882a593Smuzhiyun
1277*4882a593Smuzhiyun-  ``var-undefined:`` Reports when variables fundamental to packaging
1278*4882a593Smuzhiyun   (i.e. :term:`WORKDIR`,
1279*4882a593Smuzhiyun   :term:`DEPLOY_DIR`, :term:`D`,
1280*4882a593Smuzhiyun   :term:`PN`, and :term:`PKGD`) are undefined
1281*4882a593Smuzhiyun   during :ref:`ref-tasks-package`.
1282*4882a593Smuzhiyun
1283*4882a593Smuzhiyun-  ``version-going-backwards:`` If Build History is enabled, reports
1284*4882a593Smuzhiyun   when a package being written out has a lower version than the
1285*4882a593Smuzhiyun   previously written package under the same name. If you are placing
1286*4882a593Smuzhiyun   output packages into a feed and upgrading packages on a target system
1287*4882a593Smuzhiyun   using that feed, the version of a package going backwards can result
1288*4882a593Smuzhiyun   in the target system not correctly upgrading to the "new" version of
1289*4882a593Smuzhiyun   the package.
1290*4882a593Smuzhiyun
1291*4882a593Smuzhiyun   .. note::
1292*4882a593Smuzhiyun
1293*4882a593Smuzhiyun      This is only relevant when you are using runtime package management
1294*4882a593Smuzhiyun      on your target system.
1295*4882a593Smuzhiyun
1296*4882a593Smuzhiyun-  ``xorg-driver-abi:`` Checks that all packages containing Xorg
1297*4882a593Smuzhiyun   drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1298*4882a593Smuzhiyun   driver ABI names. All drivers should depend on the ABI versions that
1299*4882a593Smuzhiyun   they have been built against. Driver recipes that include
1300*4882a593Smuzhiyun   ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1301*4882a593Smuzhiyun   automatically get these versions. Consequently, you should only need
1302*4882a593Smuzhiyun   to explicitly add dependencies to binary driver recipes.
1303*4882a593Smuzhiyun
1304*4882a593Smuzhiyun.. _ref-classes-insserv:
1305*4882a593Smuzhiyun
1306*4882a593Smuzhiyun``insserv.bbclass``
1307*4882a593Smuzhiyun===================
1308*4882a593Smuzhiyun
1309*4882a593SmuzhiyunThe ``insserv`` class uses the ``insserv`` utility to update the order
1310*4882a593Smuzhiyunof symbolic links in ``/etc/rc?.d/`` within an image based on
1311*4882a593Smuzhiyundependencies specified by LSB headers in the ``init.d`` scripts
1312*4882a593Smuzhiyunthemselves.
1313*4882a593Smuzhiyun
1314*4882a593Smuzhiyun.. _ref-classes-kernel:
1315*4882a593Smuzhiyun
1316*4882a593Smuzhiyun``kernel.bbclass``
1317*4882a593Smuzhiyun==================
1318*4882a593Smuzhiyun
1319*4882a593SmuzhiyunThe ``kernel`` class handles building Linux kernels. The class contains
1320*4882a593Smuzhiyuncode to build all kernel trees. All needed headers are staged into the
1321*4882a593Smuzhiyun:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
1322*4882a593Smuzhiyunusing the :ref:`module <ref-classes-module>` class.
1323*4882a593Smuzhiyun
1324*4882a593SmuzhiyunThis means that each built kernel module is packaged separately and
1325*4882a593Smuzhiyuninter-module dependencies are created by parsing the ``modinfo`` output.
1326*4882a593SmuzhiyunIf all modules are required, then installing the ``kernel-modules``
1327*4882a593Smuzhiyunpackage installs all packages with modules and various other kernel
1328*4882a593Smuzhiyunpackages such as ``kernel-vmlinux``.
1329*4882a593Smuzhiyun
1330*4882a593SmuzhiyunThe ``kernel`` class contains logic that allows you to embed an initial
1331*4882a593SmuzhiyunRAM filesystem (initramfs) image when you build the kernel image. For
1332*4882a593Smuzhiyuninformation on how to build an initramfs, see the
1333*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section in
1334*4882a593Smuzhiyunthe Yocto Project Development Tasks Manual.
1335*4882a593Smuzhiyun
1336*4882a593SmuzhiyunVarious other classes are used by the ``kernel`` and ``module`` classes
1337*4882a593Smuzhiyuninternally including the :ref:`kernel-arch <ref-classes-kernel-arch>`,
1338*4882a593Smuzhiyun:ref:`module-base <ref-classes-module-base>`, and
1339*4882a593Smuzhiyun:ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes.
1340*4882a593Smuzhiyun
1341*4882a593Smuzhiyun.. _ref-classes-kernel-arch:
1342*4882a593Smuzhiyun
1343*4882a593Smuzhiyun``kernel-arch.bbclass``
1344*4882a593Smuzhiyun=======================
1345*4882a593Smuzhiyun
1346*4882a593SmuzhiyunThe ``kernel-arch`` class sets the ``ARCH`` environment variable for
1347*4882a593SmuzhiyunLinux kernel compilation (including modules).
1348*4882a593Smuzhiyun
1349*4882a593Smuzhiyun.. _ref-classes-kernel-devicetree:
1350*4882a593Smuzhiyun
1351*4882a593Smuzhiyun``kernel-devicetree.bbclass``
1352*4882a593Smuzhiyun=============================
1353*4882a593Smuzhiyun
1354*4882a593SmuzhiyunThe ``kernel-devicetree`` class, which is inherited by the
1355*4882a593Smuzhiyun:ref:`kernel <ref-classes-kernel>` class, supports device tree
1356*4882a593Smuzhiyungeneration.
1357*4882a593Smuzhiyun
1358*4882a593Smuzhiyun.. _ref-classes-kernel-fitimage:
1359*4882a593Smuzhiyun
1360*4882a593Smuzhiyun``kernel-fitimage.bbclass``
1361*4882a593Smuzhiyun===========================
1362*4882a593Smuzhiyun
1363*4882a593SmuzhiyunThe ``kernel-fitimage`` class provides support to pack a kernel image,
1364*4882a593Smuzhiyundevice trees, a U-boot script, a Initramfs bundle and a RAM disk
1365*4882a593Smuzhiyuninto a single FIT image. In theory, a FIT image can support any number
1366*4882a593Smuzhiyunof kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
1367*4882a593SmuzhiyunHowever, ``kernel-fitimage`` currently only supports
1368*4882a593Smuzhiyunlimited usescases: just one kernel image, an optional U-boot script,
1369*4882a593Smuzhiyunan optional Initramfs bundle, an optional RAM disk, and any number of
1370*4882a593Smuzhiyundevice tree.
1371*4882a593Smuzhiyun
1372*4882a593SmuzhiyunTo create a FIT image, it is required that :term:`KERNEL_CLASSES`
1373*4882a593Smuzhiyunis set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE`
1374*4882a593Smuzhiyunis set to "fitImage".
1375*4882a593Smuzhiyun
1376*4882a593SmuzhiyunThe options for the device tree compiler passed to ``mkimage -D``
1377*4882a593Smuzhiyunwhen creating the FIT image are specified using the
1378*4882a593Smuzhiyun:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1379*4882a593Smuzhiyun
1380*4882a593SmuzhiyunOnly a single kernel can be added to the FIT image created by
1381*4882a593Smuzhiyun``kernel-fitimage`` and the kernel image in FIT is mandatory. The
1382*4882a593Smuzhiyunaddress where the kernel image is to be loaded by U-Boot is
1383*4882a593Smuzhiyunspecified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1384*4882a593Smuzhiyun:term:`UBOOT_ENTRYPOINT`.
1385*4882a593Smuzhiyun
1386*4882a593SmuzhiyunMultiple device trees can be added to the FIT image created by
1387*4882a593Smuzhiyun``kernel-fitimage`` and the device tree is optional.
1388*4882a593SmuzhiyunThe address where the device tree is to be loaded by U-Boot is
1389*4882a593Smuzhiyunspecified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
1390*4882a593Smuzhiyunand by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
1391*4882a593Smuzhiyun
1392*4882a593SmuzhiyunOnly a single RAM disk can be added to the FIT image created by
1393*4882a593Smuzhiyun``kernel-fitimage`` and the RAM disk in FIT is optional.
1394*4882a593SmuzhiyunThe address where the RAM disk image is to be loaded by U-Boot
1395*4882a593Smuzhiyunis specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1396*4882a593Smuzhiyun:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
1397*4882a593Smuzhiyun:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1398*4882a593Smuzhiyunis set to 0.
1399*4882a593Smuzhiyun
1400*4882a593SmuzhiyunOnly a single Initramfs bundle can be added to the FIT image created by
1401*4882a593Smuzhiyun``kernel-fitimage`` and the Initramfs bundle in FIT is optional.
1402*4882a593SmuzhiyunIn case of Initramfs, the kernel is configured to be bundled with the root filesystem
1403*4882a593Smuzhiyunin the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
1404*4882a593SmuzhiyunWhen the kernel is copied to RAM and executed, it unpacks the Initramfs root filesystem.
1405*4882a593SmuzhiyunThe Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE`
1406*4882a593Smuzhiyunis specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
1407*4882a593SmuzhiyunThe address where the Initramfs bundle is to be loaded by U-boot is specified
1408*4882a593Smuzhiyunby :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1409*4882a593Smuzhiyun
1410*4882a593SmuzhiyunOnly a single U-boot boot script can be added to the FIT image created by
1411*4882a593Smuzhiyun``kernel-fitimage`` and the boot script is optional.
1412*4882a593SmuzhiyunThe boot script is specified in the ITS file as a text file containing
1413*4882a593SmuzhiyunU-boot commands. When using a boot script the user should configure the
1414*4882a593SmuzhiyunU-boot ``do_install`` task to copy the script to sysroot.
1415*4882a593SmuzhiyunSo the script can be included in the FIT image by the ``kernel-fitimage``
1416*4882a593Smuzhiyunclass. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1417*4882a593Smuzhiyunload the boot script from the FIT image and executes it.
1418*4882a593Smuzhiyun
1419*4882a593SmuzhiyunThe FIT image generated by ``kernel-fitimage`` class is signed when the
1420*4882a593Smuzhiyunvariables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1421*4882a593Smuzhiyun:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1422*4882a593Smuzhiyunappropriately. The default values used for :term:`FIT_HASH_ALG` and
1423*4882a593Smuzhiyun:term:`FIT_SIGN_ALG` in ``kernel-fitimage`` are "sha256" and
1424*4882a593Smuzhiyun"rsa2048" respectively. The keys for signing fitImage can be generated using
1425*4882a593Smuzhiyunthe ``kernel-fitimage`` class when both :term:`FIT_GENERATE_KEYS` and
1426*4882a593Smuzhiyun:term:`UBOOT_SIGN_ENABLE` are set to "1".
1427*4882a593Smuzhiyun
1428*4882a593Smuzhiyun
1429*4882a593Smuzhiyun.. _ref-classes-kernel-grub:
1430*4882a593Smuzhiyun
1431*4882a593Smuzhiyun``kernel-grub.bbclass``
1432*4882a593Smuzhiyun=======================
1433*4882a593Smuzhiyun
1434*4882a593SmuzhiyunThe ``kernel-grub`` class updates the boot area and the boot menu with
1435*4882a593Smuzhiyunthe kernel as the priority boot mechanism while installing a RPM to
1436*4882a593Smuzhiyunupdate the kernel on a deployed target.
1437*4882a593Smuzhiyun
1438*4882a593Smuzhiyun.. _ref-classes-kernel-module-split:
1439*4882a593Smuzhiyun
1440*4882a593Smuzhiyun``kernel-module-split.bbclass``
1441*4882a593Smuzhiyun===============================
1442*4882a593Smuzhiyun
1443*4882a593SmuzhiyunThe ``kernel-module-split`` class provides common functionality for
1444*4882a593Smuzhiyunsplitting Linux kernel modules into separate packages.
1445*4882a593Smuzhiyun
1446*4882a593Smuzhiyun.. _ref-classes-kernel-uboot:
1447*4882a593Smuzhiyun
1448*4882a593Smuzhiyun``kernel-uboot.bbclass``
1449*4882a593Smuzhiyun========================
1450*4882a593Smuzhiyun
1451*4882a593SmuzhiyunThe ``kernel-uboot`` class provides support for building from
1452*4882a593Smuzhiyunvmlinux-style kernel sources.
1453*4882a593Smuzhiyun
1454*4882a593Smuzhiyun.. _ref-classes-kernel-uimage:
1455*4882a593Smuzhiyun
1456*4882a593Smuzhiyun``kernel-uimage.bbclass``
1457*4882a593Smuzhiyun=========================
1458*4882a593Smuzhiyun
1459*4882a593SmuzhiyunThe ``kernel-uimage`` class provides support to pack uImage.
1460*4882a593Smuzhiyun
1461*4882a593Smuzhiyun.. _ref-classes-kernel-yocto:
1462*4882a593Smuzhiyun
1463*4882a593Smuzhiyun``kernel-yocto.bbclass``
1464*4882a593Smuzhiyun========================
1465*4882a593Smuzhiyun
1466*4882a593SmuzhiyunThe ``kernel-yocto`` class provides common functionality for building
1467*4882a593Smuzhiyunfrom linux-yocto style kernel source repositories.
1468*4882a593Smuzhiyun
1469*4882a593Smuzhiyun.. _ref-classes-kernelsrc:
1470*4882a593Smuzhiyun
1471*4882a593Smuzhiyun``kernelsrc.bbclass``
1472*4882a593Smuzhiyun=====================
1473*4882a593Smuzhiyun
1474*4882a593SmuzhiyunThe ``kernelsrc`` class sets the Linux kernel source and version.
1475*4882a593Smuzhiyun
1476*4882a593Smuzhiyun.. _ref-classes-lib_package:
1477*4882a593Smuzhiyun
1478*4882a593Smuzhiyun``lib_package.bbclass``
1479*4882a593Smuzhiyun=======================
1480*4882a593Smuzhiyun
1481*4882a593SmuzhiyunThe ``lib_package`` class supports recipes that build libraries and
1482*4882a593Smuzhiyunproduce executable binaries, where those binaries should not be
1483*4882a593Smuzhiyuninstalled by default along with the library. Instead, the binaries are
1484*4882a593Smuzhiyunadded to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1485*4882a593Smuzhiyunmake their installation optional.
1486*4882a593Smuzhiyun
1487*4882a593Smuzhiyun.. _ref-classes-libc*:
1488*4882a593Smuzhiyun
1489*4882a593Smuzhiyun``libc*.bbclass``
1490*4882a593Smuzhiyun=================
1491*4882a593Smuzhiyun
1492*4882a593SmuzhiyunThe ``libc*`` classes support recipes that build packages with ``libc``:
1493*4882a593Smuzhiyun
1494*4882a593Smuzhiyun-  The ``libc-common`` class provides common support for building with
1495*4882a593Smuzhiyun   ``libc``.
1496*4882a593Smuzhiyun
1497*4882a593Smuzhiyun-  The ``libc-package`` class supports packaging up ``glibc`` and
1498*4882a593Smuzhiyun   ``eglibc``.
1499*4882a593Smuzhiyun
1500*4882a593Smuzhiyun.. _ref-classes-license:
1501*4882a593Smuzhiyun
1502*4882a593Smuzhiyun``license.bbclass``
1503*4882a593Smuzhiyun===================
1504*4882a593Smuzhiyun
1505*4882a593SmuzhiyunThe ``license`` class provides license manifest creation and license
1506*4882a593Smuzhiyunexclusion. This class is enabled by default using the default value for
1507*4882a593Smuzhiyunthe :term:`INHERIT_DISTRO` variable.
1508*4882a593Smuzhiyun
1509*4882a593Smuzhiyun.. _ref-classes-linux-kernel-base:
1510*4882a593Smuzhiyun
1511*4882a593Smuzhiyun``linux-kernel-base.bbclass``
1512*4882a593Smuzhiyun=============================
1513*4882a593Smuzhiyun
1514*4882a593SmuzhiyunThe ``linux-kernel-base`` class provides common functionality for
1515*4882a593Smuzhiyunrecipes that build out of the Linux kernel source tree. These builds
1516*4882a593Smuzhiyungoes beyond the kernel itself. For example, the Perf recipe also
1517*4882a593Smuzhiyuninherits this class.
1518*4882a593Smuzhiyun
1519*4882a593Smuzhiyun.. _ref-classes-linuxloader:
1520*4882a593Smuzhiyun
1521*4882a593Smuzhiyun``linuxloader.bbclass``
1522*4882a593Smuzhiyun=======================
1523*4882a593Smuzhiyun
1524*4882a593SmuzhiyunProvides the function ``linuxloader()``, which gives the value of the
1525*4882a593Smuzhiyundynamic loader/linker provided on the platform. This value is used by a
1526*4882a593Smuzhiyunnumber of other classes.
1527*4882a593Smuzhiyun
1528*4882a593Smuzhiyun.. _ref-classes-logging:
1529*4882a593Smuzhiyun
1530*4882a593Smuzhiyun``logging.bbclass``
1531*4882a593Smuzhiyun===================
1532*4882a593Smuzhiyun
1533*4882a593SmuzhiyunThe ``logging`` class provides the standard shell functions used to log
1534*4882a593Smuzhiyunmessages for various BitBake severity levels (i.e. ``bbplain``,
1535*4882a593Smuzhiyun``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1536*4882a593Smuzhiyun
1537*4882a593SmuzhiyunThis class is enabled by default since it is inherited by the ``base``
1538*4882a593Smuzhiyunclass.
1539*4882a593Smuzhiyun
1540*4882a593Smuzhiyun.. _ref-classes-metadata_scm:
1541*4882a593Smuzhiyun
1542*4882a593Smuzhiyun``metadata_scm.bbclass``
1543*4882a593Smuzhiyun========================
1544*4882a593Smuzhiyun
1545*4882a593SmuzhiyunThe ``metadata_scm`` class provides functionality for querying the
1546*4882a593Smuzhiyunbranch and revision of a Source Code Manager (SCM) repository.
1547*4882a593Smuzhiyun
1548*4882a593SmuzhiyunThe :ref:`base <ref-classes-base>` class uses this class to print the
1549*4882a593Smuzhiyunrevisions of each layer before starting every build. The
1550*4882a593Smuzhiyun``metadata_scm`` class is enabled by default because it is inherited by
1551*4882a593Smuzhiyunthe ``base`` class.
1552*4882a593Smuzhiyun
1553*4882a593Smuzhiyun.. _ref-classes-migrate_localcount:
1554*4882a593Smuzhiyun
1555*4882a593Smuzhiyun``migrate_localcount.bbclass``
1556*4882a593Smuzhiyun==============================
1557*4882a593Smuzhiyun
1558*4882a593SmuzhiyunThe ``migrate_localcount`` class verifies a recipe's localcount data and
1559*4882a593Smuzhiyunincrements it appropriately.
1560*4882a593Smuzhiyun
1561*4882a593Smuzhiyun.. _ref-classes-mime:
1562*4882a593Smuzhiyun
1563*4882a593Smuzhiyun``mime.bbclass``
1564*4882a593Smuzhiyun================
1565*4882a593Smuzhiyun
1566*4882a593SmuzhiyunThe ``mime`` class generates the proper post-install and post-remove
1567*4882a593Smuzhiyun(postinst/postrm) scriptlets for packages that install MIME type files.
1568*4882a593SmuzhiyunThese scriptlets call ``update-mime-database`` to add the MIME types to
1569*4882a593Smuzhiyunthe shared database.
1570*4882a593Smuzhiyun
1571*4882a593Smuzhiyun.. _ref-classes-mirrors:
1572*4882a593Smuzhiyun
1573*4882a593Smuzhiyun``mirrors.bbclass``
1574*4882a593Smuzhiyun===================
1575*4882a593Smuzhiyun
1576*4882a593SmuzhiyunThe ``mirrors`` class sets up some standard
1577*4882a593Smuzhiyun:term:`MIRRORS` entries for source code mirrors. These
1578*4882a593Smuzhiyunmirrors provide a fall-back path in case the upstream source specified
1579*4882a593Smuzhiyunin :term:`SRC_URI` within recipes is unavailable.
1580*4882a593Smuzhiyun
1581*4882a593SmuzhiyunThis class is enabled by default since it is inherited by the
1582*4882a593Smuzhiyun:ref:`base <ref-classes-base>` class.
1583*4882a593Smuzhiyun
1584*4882a593Smuzhiyun.. _ref-classes-module:
1585*4882a593Smuzhiyun
1586*4882a593Smuzhiyun``module.bbclass``
1587*4882a593Smuzhiyun==================
1588*4882a593Smuzhiyun
1589*4882a593SmuzhiyunThe ``module`` class provides support for building out-of-tree Linux
1590*4882a593Smuzhiyunkernel modules. The class inherits the
1591*4882a593Smuzhiyun:ref:`module-base <ref-classes-module-base>` and
1592*4882a593Smuzhiyun:ref:`kernel-module-split <ref-classes-kernel-module-split>` classes,
1593*4882a593Smuzhiyunand implements the :ref:`ref-tasks-compile` and
1594*4882a593Smuzhiyun:ref:`ref-tasks-install` tasks. The class provides
1595*4882a593Smuzhiyuneverything needed to build and package a kernel module.
1596*4882a593Smuzhiyun
1597*4882a593SmuzhiyunFor general information on out-of-tree Linux kernel modules, see the
1598*4882a593Smuzhiyun":ref:`kernel-dev/common:incorporating out-of-tree modules`"
1599*4882a593Smuzhiyunsection in the Yocto Project Linux Kernel Development Manual.
1600*4882a593Smuzhiyun
1601*4882a593Smuzhiyun.. _ref-classes-module-base:
1602*4882a593Smuzhiyun
1603*4882a593Smuzhiyun``module-base.bbclass``
1604*4882a593Smuzhiyun=======================
1605*4882a593Smuzhiyun
1606*4882a593SmuzhiyunThe ``module-base`` class provides the base functionality for building
1607*4882a593SmuzhiyunLinux kernel modules. Typically, a recipe that builds software that
1608*4882a593Smuzhiyunincludes one or more kernel modules and has its own means of building
1609*4882a593Smuzhiyunthe module inherits this class as opposed to inheriting the
1610*4882a593Smuzhiyun:ref:`module <ref-classes-module>` class.
1611*4882a593Smuzhiyun
1612*4882a593Smuzhiyun.. _ref-classes-multilib*:
1613*4882a593Smuzhiyun
1614*4882a593Smuzhiyun``multilib*.bbclass``
1615*4882a593Smuzhiyun=====================
1616*4882a593Smuzhiyun
1617*4882a593SmuzhiyunThe ``multilib*`` classes provide support for building libraries with
1618*4882a593Smuzhiyundifferent target optimizations or target architectures and installing
1619*4882a593Smuzhiyunthem side-by-side in the same image.
1620*4882a593Smuzhiyun
1621*4882a593SmuzhiyunFor more information on using the Multilib feature, see the
1622*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`"
1623*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
1624*4882a593Smuzhiyun
1625*4882a593Smuzhiyun.. _ref-classes-native:
1626*4882a593Smuzhiyun
1627*4882a593Smuzhiyun``native.bbclass``
1628*4882a593Smuzhiyun==================
1629*4882a593Smuzhiyun
1630*4882a593SmuzhiyunThe ``native`` class provides common functionality for recipes that
1631*4882a593Smuzhiyunbuild tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1632*4882a593Smuzhiyunor other tools from the build host).
1633*4882a593Smuzhiyun
1634*4882a593SmuzhiyunYou can create a recipe that builds tools that run natively on the host
1635*4882a593Smuzhiyuna couple different ways:
1636*4882a593Smuzhiyun
1637*4882a593Smuzhiyun-  Create a ``myrecipe-native.bb`` recipe that inherits the ``native``
1638*4882a593Smuzhiyun   class. If you use this method, you must order the inherit statement
1639*4882a593Smuzhiyun   in the recipe after all other inherit statements so that the
1640*4882a593Smuzhiyun   ``native`` class is inherited last.
1641*4882a593Smuzhiyun
1642*4882a593Smuzhiyun   .. note::
1643*4882a593Smuzhiyun
1644*4882a593Smuzhiyun      When creating a recipe this way, the recipe name must follow this
1645*4882a593Smuzhiyun      naming convention::
1646*4882a593Smuzhiyun
1647*4882a593Smuzhiyun         myrecipe-native.bb
1648*4882a593Smuzhiyun
1649*4882a593Smuzhiyun
1650*4882a593Smuzhiyun      Not using this naming convention can lead to subtle problems
1651*4882a593Smuzhiyun      caused by existing code that depends on that naming convention.
1652*4882a593Smuzhiyun
1653*4882a593Smuzhiyun-  Create or modify a target recipe that contains the following::
1654*4882a593Smuzhiyun
1655*4882a593Smuzhiyun      BBCLASSEXTEND = "native"
1656*4882a593Smuzhiyun
1657*4882a593Smuzhiyun   Inside the
1658*4882a593Smuzhiyun   recipe, use ``:class-native`` and ``:class-target`` overrides to
1659*4882a593Smuzhiyun   specify any functionality specific to the respective native or target
1660*4882a593Smuzhiyun   case.
1661*4882a593Smuzhiyun
1662*4882a593SmuzhiyunAlthough applied differently, the ``native`` class is used with both
1663*4882a593Smuzhiyunmethods. The advantage of the second method is that you do not need to
1664*4882a593Smuzhiyunhave two separate recipes (assuming you need both) for native and
1665*4882a593Smuzhiyuntarget. All common parts of the recipe are automatically shared.
1666*4882a593Smuzhiyun
1667*4882a593Smuzhiyun.. _ref-classes-nativesdk:
1668*4882a593Smuzhiyun
1669*4882a593Smuzhiyun``nativesdk.bbclass``
1670*4882a593Smuzhiyun=====================
1671*4882a593Smuzhiyun
1672*4882a593SmuzhiyunThe ``nativesdk`` class provides common functionality for recipes that
1673*4882a593Smuzhiyunwish to build tools to run as part of an SDK (i.e. tools that run on
1674*4882a593Smuzhiyun:term:`SDKMACHINE`).
1675*4882a593Smuzhiyun
1676*4882a593SmuzhiyunYou can create a recipe that builds tools that run on the SDK machine a
1677*4882a593Smuzhiyuncouple different ways:
1678*4882a593Smuzhiyun
1679*4882a593Smuzhiyun-  Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
1680*4882a593Smuzhiyun   ``nativesdk`` class. If you use this method, you must order the
1681*4882a593Smuzhiyun   inherit statement in the recipe after all other inherit statements so
1682*4882a593Smuzhiyun   that the ``nativesdk`` class is inherited last.
1683*4882a593Smuzhiyun
1684*4882a593Smuzhiyun-  Create a ``nativesdk`` variant of any recipe by adding the following::
1685*4882a593Smuzhiyun
1686*4882a593Smuzhiyun       BBCLASSEXTEND = "nativesdk"
1687*4882a593Smuzhiyun
1688*4882a593Smuzhiyun   Inside the
1689*4882a593Smuzhiyun   recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
1690*4882a593Smuzhiyun   specify any functionality specific to the respective SDK machine or
1691*4882a593Smuzhiyun   target case.
1692*4882a593Smuzhiyun
1693*4882a593Smuzhiyun.. note::
1694*4882a593Smuzhiyun
1695*4882a593Smuzhiyun   When creating a recipe, you must follow this naming convention::
1696*4882a593Smuzhiyun
1697*4882a593Smuzhiyun           nativesdk-myrecipe.bb
1698*4882a593Smuzhiyun
1699*4882a593Smuzhiyun
1700*4882a593Smuzhiyun   Not doing so can lead to subtle problems because there is code that
1701*4882a593Smuzhiyun   depends on the naming convention.
1702*4882a593Smuzhiyun
1703*4882a593SmuzhiyunAlthough applied differently, the ``nativesdk`` class is used with both
1704*4882a593Smuzhiyunmethods. The advantage of the second method is that you do not need to
1705*4882a593Smuzhiyunhave two separate recipes (assuming you need both) for the SDK machine
1706*4882a593Smuzhiyunand the target. All common parts of the recipe are automatically shared.
1707*4882a593Smuzhiyun
1708*4882a593Smuzhiyun.. _ref-classes-nopackages:
1709*4882a593Smuzhiyun
1710*4882a593Smuzhiyun``nopackages.bbclass``
1711*4882a593Smuzhiyun======================
1712*4882a593Smuzhiyun
1713*4882a593SmuzhiyunDisables packaging tasks for those recipes and classes where packaging
1714*4882a593Smuzhiyunis not needed.
1715*4882a593Smuzhiyun
1716*4882a593Smuzhiyun.. _ref-classes-npm:
1717*4882a593Smuzhiyun
1718*4882a593Smuzhiyun``npm.bbclass``
1719*4882a593Smuzhiyun===============
1720*4882a593Smuzhiyun
1721*4882a593SmuzhiyunProvides support for building Node.js software fetched using the `node
1722*4882a593Smuzhiyunpackage manager (NPM) <https://en.wikipedia.org/wiki/Npm_(software)>`__.
1723*4882a593Smuzhiyun
1724*4882a593Smuzhiyun.. note::
1725*4882a593Smuzhiyun
1726*4882a593Smuzhiyun   Currently, recipes inheriting this class must use the ``npm://``
1727*4882a593Smuzhiyun   fetcher to have dependencies fetched and packaged automatically.
1728*4882a593Smuzhiyun
1729*4882a593SmuzhiyunFor information on how to create NPM packages, see the
1730*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`"
1731*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
1732*4882a593Smuzhiyun
1733*4882a593Smuzhiyun.. _ref-classes-oelint:
1734*4882a593Smuzhiyun
1735*4882a593Smuzhiyun``oelint.bbclass``
1736*4882a593Smuzhiyun==================
1737*4882a593Smuzhiyun
1738*4882a593SmuzhiyunThe ``oelint`` class is an obsolete lint checking tool available in
1739*4882a593Smuzhiyun``meta/classes`` in the :term:`Source Directory`.
1740*4882a593Smuzhiyun
1741*4882a593SmuzhiyunThere are some classes that could be generally useful in OE-Core but
1742*4882a593Smuzhiyunare never actually used within OE-Core itself. The ``oelint`` class is
1743*4882a593Smuzhiyunone such example. However, being aware of this class can reduce the
1744*4882a593Smuzhiyunproliferation of different versions of similar classes across multiple
1745*4882a593Smuzhiyunlayers.
1746*4882a593Smuzhiyun
1747*4882a593Smuzhiyun.. _ref-classes-overlayfs:
1748*4882a593Smuzhiyun
1749*4882a593Smuzhiyun``overlayfs.bbclass``
1750*4882a593Smuzhiyun=======================
1751*4882a593Smuzhiyun
1752*4882a593SmuzhiyunIt's often desired in Embedded System design to have a read-only root filesystem.
1753*4882a593SmuzhiyunBut a lot of different applications might want to have read-write access to
1754*4882a593Smuzhiyunsome parts of a filesystem. It can be especially useful when your update mechanism
1755*4882a593Smuzhiyunoverwrites the whole root filesystem, but you may want your application data to be preserved
1756*4882a593Smuzhiyunbetween updates. The :ref:`overlayfs <ref-classes-overlayfs>` class provides a way
1757*4882a593Smuzhiyunto achieve that by means of ``overlayfs`` and at the same time keeping the base
1758*4882a593Smuzhiyunroot filesystem read-only.
1759*4882a593Smuzhiyun
1760*4882a593SmuzhiyunTo use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
1761*4882a593Smuzhiyunlayer in your machine configuration. The underlying file system can be anything that
1762*4882a593Smuzhiyunis supported by ``overlayfs``. This has to be done in your machine configuration::
1763*4882a593Smuzhiyun
1764*4882a593Smuzhiyun  OVERLAYFS_MOUNT_POINT[data] = "/data"
1765*4882a593Smuzhiyun
1766*4882a593Smuzhiyun.. note::
1767*4882a593Smuzhiyun
1768*4882a593Smuzhiyun  * QA checks fail to catch file existence if you redefine this variable in your recipe!
1769*4882a593Smuzhiyun  * Only the existence of the systemd mount unit file is checked, not its contents.
1770*4882a593Smuzhiyun  * To get more details on ``overlayfs``, its internals and supported operations, please refer
1771*4882a593Smuzhiyun    to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`_.
1772*4882a593Smuzhiyun
1773*4882a593SmuzhiyunThe class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
1774*4882a593Smuzhiyun(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
1775*4882a593Smuzhiyun
1776*4882a593SmuzhiyunThen you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
1777*4882a593Smuzhiyun
1778*4882a593Smuzhiyun  OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
1779*4882a593Smuzhiyun
1780*4882a593SmuzhiyunTo support several mount points you can use a different variable flag. Assuming we
1781*4882a593Smuzhiyunwant to have a writable location on the file system, but do not need that the data
1782*4882a593Smuzhiyunsurvives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
1783*4882a593Smuzhiyunfile system.
1784*4882a593Smuzhiyun
1785*4882a593SmuzhiyunIn your machine configuration::
1786*4882a593Smuzhiyun
1787*4882a593Smuzhiyun  OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
1788*4882a593Smuzhiyun
1789*4882a593Smuzhiyunand then in your recipe::
1790*4882a593Smuzhiyun
1791*4882a593Smuzhiyun  OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
1792*4882a593Smuzhiyun
1793*4882a593SmuzhiyunOn a practical note, your application recipe might require multiple
1794*4882a593Smuzhiyunoverlays to be mounted before running to avoid writing to the underlying
1795*4882a593Smuzhiyunfile system (which can be forbidden in case of read-only file system)
1796*4882a593SmuzhiyunTo achieve that :ref:`overlayfs <ref-classes-overlayfs>` provides a ``systemd``
1797*4882a593Smuzhiyunhelper service for mounting overlays. This helper service is named
1798*4882a593Smuzhiyun``${PN}-overlays.service`` and can be depended on in your application recipe
1799*4882a593Smuzhiyun(named ``application`` in the following example) ``systemd`` unit by adding
1800*4882a593Smuzhiyunto the unit the following::
1801*4882a593Smuzhiyun
1802*4882a593Smuzhiyun  [Unit]
1803*4882a593Smuzhiyun  After=application-overlays.service
1804*4882a593Smuzhiyun  Requires=application-overlays.service
1805*4882a593Smuzhiyun
1806*4882a593Smuzhiyun.. note::
1807*4882a593Smuzhiyun
1808*4882a593Smuzhiyun   The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
1809*4882a593Smuzhiyun   In order to get ``/etc`` in overlayfs, see :ref:`overlayfs-etc <ref-classes-overlayfs-etc>`.
1810*4882a593Smuzhiyun
1811*4882a593Smuzhiyun.. _ref-classes-overlayfs-etc:
1812*4882a593Smuzhiyun
1813*4882a593Smuzhiyun``overlayfs-etc.bbclass``
1814*4882a593Smuzhiyun=========================
1815*4882a593Smuzhiyun
1816*4882a593SmuzhiyunIn order to have the ``/etc`` directory in overlayfs a special handling at early
1817*4882a593Smuzhiyunboot stage is required. The idea is to supply a custom init script that mounts
1818*4882a593Smuzhiyun``/etc`` before launching the actual init program, because the latter already
1819*4882a593Smuzhiyunrequires ``/etc`` to be mounted.
1820*4882a593Smuzhiyun
1821*4882a593SmuzhiyunExample usage in image recipe::
1822*4882a593Smuzhiyun
1823*4882a593Smuzhiyun   IMAGE_FEATURES += "overlayfs-etc"
1824*4882a593Smuzhiyun
1825*4882a593Smuzhiyun.. note::
1826*4882a593Smuzhiyun
1827*4882a593Smuzhiyun   This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
1828*4882a593Smuzhiyun
1829*4882a593SmuzhiyunYour machine configuration should define at least the device, mount point, and file system type
1830*4882a593Smuzhiyunyou are going to use for ``overlayfs``::
1831*4882a593Smuzhiyun
1832*4882a593Smuzhiyun  OVERLAYFS_ETC_MOUNT_POINT = "/data"
1833*4882a593Smuzhiyun  OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
1834*4882a593Smuzhiyun  OVERLAYFS_ETC_FSTYPE ?= "ext4"
1835*4882a593Smuzhiyun
1836*4882a593SmuzhiyunTo control more mount options you should consider setting mount options
1837*4882a593Smuzhiyun(``defaults`` is used by default)::
1838*4882a593Smuzhiyun
1839*4882a593Smuzhiyun  OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
1840*4882a593Smuzhiyun
1841*4882a593SmuzhiyunThe class provides two options for ``/sbin/init`` generation:
1842*4882a593Smuzhiyun
1843*4882a593Smuzhiyun- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
1844*4882a593Smuzhiyun  and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
1845*4882a593Smuzhiyun  that you won't need to change any kernel parameters in order to make it work,
1846*4882a593Smuzhiyun  but it poses a restriction that package-management can't be used, because updating
1847*4882a593Smuzhiyun  the init manager would remove the generated script.
1848*4882a593Smuzhiyun
1849*4882a593Smuzhiyun- If you wish to keep original init as is, you can set::
1850*4882a593Smuzhiyun
1851*4882a593Smuzhiyun   OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
1852*4882a593Smuzhiyun
1853*4882a593Smuzhiyun  Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
1854*4882a593Smuzhiyun  kernel parameters manually in your bootloader configuration.
1855*4882a593Smuzhiyun
1856*4882a593Smuzhiyun.. _ref-classes-own-mirrors:
1857*4882a593Smuzhiyun
1858*4882a593Smuzhiyun``own-mirrors.bbclass``
1859*4882a593Smuzhiyun=======================
1860*4882a593Smuzhiyun
1861*4882a593SmuzhiyunThe ``own-mirrors`` class makes it easier to set up your own
1862*4882a593Smuzhiyun:term:`PREMIRRORS` from which to first fetch source
1863*4882a593Smuzhiyunbefore attempting to fetch it from the upstream specified in
1864*4882a593Smuzhiyun:term:`SRC_URI` within each recipe.
1865*4882a593Smuzhiyun
1866*4882a593SmuzhiyunTo use this class, inherit it globally and specify
1867*4882a593Smuzhiyun:term:`SOURCE_MIRROR_URL`. Here is an example::
1868*4882a593Smuzhiyun
1869*4882a593Smuzhiyun   INHERIT += "own-mirrors"
1870*4882a593Smuzhiyun   SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
1871*4882a593Smuzhiyun
1872*4882a593SmuzhiyunYou can specify only a single URL
1873*4882a593Smuzhiyunin :term:`SOURCE_MIRROR_URL`.
1874*4882a593Smuzhiyun
1875*4882a593Smuzhiyun.. _ref-classes-package:
1876*4882a593Smuzhiyun
1877*4882a593Smuzhiyun``package.bbclass``
1878*4882a593Smuzhiyun===================
1879*4882a593Smuzhiyun
1880*4882a593SmuzhiyunThe ``package`` class supports generating packages from a build's
1881*4882a593Smuzhiyunoutput. The core generic functionality is in ``package.bbclass``. The
1882*4882a593Smuzhiyuncode specific to particular package types resides in these
1883*4882a593Smuzhiyunpackage-specific classes:
1884*4882a593Smuzhiyun:ref:`package_deb <ref-classes-package_deb>`,
1885*4882a593Smuzhiyun:ref:`package_rpm <ref-classes-package_rpm>`,
1886*4882a593Smuzhiyun:ref:`package_ipk <ref-classes-package_ipk>`, and
1887*4882a593Smuzhiyun:ref:`package_tar <ref-classes-package_tar>`.
1888*4882a593Smuzhiyun
1889*4882a593Smuzhiyun.. note::
1890*4882a593Smuzhiyun
1891*4882a593Smuzhiyun   The
1892*4882a593Smuzhiyun   package_tar
1893*4882a593Smuzhiyun   class is broken and not supported. It is recommended that you do not
1894*4882a593Smuzhiyun   use this class.
1895*4882a593Smuzhiyun
1896*4882a593SmuzhiyunYou can control the list of resulting package formats by using the
1897*4882a593Smuzhiyun:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
1898*4882a593Smuzhiyunconfiguration file, which is located in the :term:`Build Directory`.
1899*4882a593SmuzhiyunWhen defining the variable, you can
1900*4882a593Smuzhiyunspecify one or more package types. Since images are generated from
1901*4882a593Smuzhiyunpackages, a packaging class is needed to enable image generation. The
1902*4882a593Smuzhiyunfirst class listed in this variable is used for image generation.
1903*4882a593Smuzhiyun
1904*4882a593SmuzhiyunIf you take the optional step to set up a repository (package feed) on
1905*4882a593Smuzhiyunthe development host that can be used by DNF, you can install packages
1906*4882a593Smuzhiyunfrom the feed while you are running the image on the target (i.e.
1907*4882a593Smuzhiyunruntime installation of packages). For more information, see the
1908*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:using runtime package management`"
1909*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
1910*4882a593Smuzhiyun
1911*4882a593SmuzhiyunThe package-specific class you choose can affect build-time performance
1912*4882a593Smuzhiyunand has space ramifications. In general, building a package with IPK
1913*4882a593Smuzhiyuntakes about thirty percent less time as compared to using RPM to build
1914*4882a593Smuzhiyunthe same or similar package. This comparison takes into account a
1915*4882a593Smuzhiyuncomplete build of the package with all dependencies previously built.
1916*4882a593SmuzhiyunThe reason for this discrepancy is because the RPM package manager
1917*4882a593Smuzhiyuncreates and processes more :term:`Metadata` than the IPK package
1918*4882a593Smuzhiyunmanager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
1919*4882a593Smuzhiyun"package_ipk" if you are building smaller systems.
1920*4882a593Smuzhiyun
1921*4882a593SmuzhiyunBefore making your package manager decision, however, you should
1922*4882a593Smuzhiyunconsider some further things about using RPM:
1923*4882a593Smuzhiyun
1924*4882a593Smuzhiyun-  RPM starts to provide more abilities than IPK due to the fact that it
1925*4882a593Smuzhiyun   processes more Metadata. For example, this information includes
1926*4882a593Smuzhiyun   individual file types, file checksum generation and evaluation on
1927*4882a593Smuzhiyun   install, sparse file support, conflict detection and resolution for
1928*4882a593Smuzhiyun   Multilib systems, ACID style upgrade, and repackaging abilities for
1929*4882a593Smuzhiyun   rollbacks.
1930*4882a593Smuzhiyun
1931*4882a593Smuzhiyun-  For smaller systems, the extra space used for the Berkeley Database
1932*4882a593Smuzhiyun   and the amount of metadata when using RPM can affect your ability to
1933*4882a593Smuzhiyun   perform on-device upgrades.
1934*4882a593Smuzhiyun
1935*4882a593SmuzhiyunYou can find additional information on the effects of the package class
1936*4882a593Smuzhiyunat these two Yocto Project mailing list links:
1937*4882a593Smuzhiyun
1938*4882a593Smuzhiyun-  :yocto_lists:`/pipermail/poky/2011-May/006362.html`
1939*4882a593Smuzhiyun
1940*4882a593Smuzhiyun-  :yocto_lists:`/pipermail/poky/2011-May/006363.html`
1941*4882a593Smuzhiyun
1942*4882a593Smuzhiyun.. _ref-classes-package_deb:
1943*4882a593Smuzhiyun
1944*4882a593Smuzhiyun``package_deb.bbclass``
1945*4882a593Smuzhiyun=======================
1946*4882a593Smuzhiyun
1947*4882a593SmuzhiyunThe ``package_deb`` class provides support for creating packages that
1948*4882a593Smuzhiyunuse the Debian (i.e. ``.deb``) file format. The class ensures the
1949*4882a593Smuzhiyunpackages are written out in a ``.deb`` file format to the
1950*4882a593Smuzhiyun``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
1951*4882a593Smuzhiyun
1952*4882a593SmuzhiyunThis class inherits the :ref:`package <ref-classes-package>` class and
1953*4882a593Smuzhiyunis enabled through the :term:`PACKAGE_CLASSES`
1954*4882a593Smuzhiyunvariable in the ``local.conf`` file.
1955*4882a593Smuzhiyun
1956*4882a593Smuzhiyun.. _ref-classes-package_ipk:
1957*4882a593Smuzhiyun
1958*4882a593Smuzhiyun``package_ipk.bbclass``
1959*4882a593Smuzhiyun=======================
1960*4882a593Smuzhiyun
1961*4882a593SmuzhiyunThe ``package_ipk`` class provides support for creating packages that
1962*4882a593Smuzhiyunuse the IPK (i.e. ``.ipk``) file format. The class ensures the packages
1963*4882a593Smuzhiyunare written out in a ``.ipk`` file format to the
1964*4882a593Smuzhiyun``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
1965*4882a593Smuzhiyun
1966*4882a593SmuzhiyunThis class inherits the :ref:`package <ref-classes-package>` class and
1967*4882a593Smuzhiyunis enabled through the :term:`PACKAGE_CLASSES`
1968*4882a593Smuzhiyunvariable in the ``local.conf`` file.
1969*4882a593Smuzhiyun
1970*4882a593Smuzhiyun.. _ref-classes-package_rpm:
1971*4882a593Smuzhiyun
1972*4882a593Smuzhiyun``package_rpm.bbclass``
1973*4882a593Smuzhiyun=======================
1974*4882a593Smuzhiyun
1975*4882a593SmuzhiyunThe ``package_rpm`` class provides support for creating packages that
1976*4882a593Smuzhiyunuse the RPM (i.e. ``.rpm``) file format. The class ensures the packages
1977*4882a593Smuzhiyunare written out in a ``.rpm`` file format to the
1978*4882a593Smuzhiyun``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
1979*4882a593Smuzhiyun
1980*4882a593SmuzhiyunThis class inherits the :ref:`package <ref-classes-package>` class and
1981*4882a593Smuzhiyunis enabled through the :term:`PACKAGE_CLASSES`
1982*4882a593Smuzhiyunvariable in the ``local.conf`` file.
1983*4882a593Smuzhiyun
1984*4882a593Smuzhiyun.. _ref-classes-package_tar:
1985*4882a593Smuzhiyun
1986*4882a593Smuzhiyun``package_tar.bbclass``
1987*4882a593Smuzhiyun=======================
1988*4882a593Smuzhiyun
1989*4882a593SmuzhiyunThe ``package_tar`` class provides support for creating tarballs. The
1990*4882a593Smuzhiyunclass ensures the packages are written out in a tarball format to the
1991*4882a593Smuzhiyun``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory.
1992*4882a593Smuzhiyun
1993*4882a593SmuzhiyunThis class inherits the :ref:`package <ref-classes-package>` class and
1994*4882a593Smuzhiyunis enabled through the :term:`PACKAGE_CLASSES`
1995*4882a593Smuzhiyunvariable in the ``local.conf`` file.
1996*4882a593Smuzhiyun
1997*4882a593Smuzhiyun.. note::
1998*4882a593Smuzhiyun
1999*4882a593Smuzhiyun   You cannot specify the ``package_tar`` class first using the
2000*4882a593Smuzhiyun   :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
2001*4882a593Smuzhiyun   file formats for your image or SDK.
2002*4882a593Smuzhiyun
2003*4882a593Smuzhiyun.. _ref-classes-packagedata:
2004*4882a593Smuzhiyun
2005*4882a593Smuzhiyun``packagedata.bbclass``
2006*4882a593Smuzhiyun=======================
2007*4882a593Smuzhiyun
2008*4882a593SmuzhiyunThe ``packagedata`` class provides common functionality for reading
2009*4882a593Smuzhiyun``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2010*4882a593Smuzhiyunfiles contain information about each output package produced by the
2011*4882a593SmuzhiyunOpenEmbedded build system.
2012*4882a593Smuzhiyun
2013*4882a593SmuzhiyunThis class is enabled by default because it is inherited by the
2014*4882a593Smuzhiyun:ref:`package <ref-classes-package>` class.
2015*4882a593Smuzhiyun
2016*4882a593Smuzhiyun.. _ref-classes-packagegroup:
2017*4882a593Smuzhiyun
2018*4882a593Smuzhiyun``packagegroup.bbclass``
2019*4882a593Smuzhiyun========================
2020*4882a593Smuzhiyun
2021*4882a593SmuzhiyunThe ``packagegroup`` class sets default values appropriate for package
2022*4882a593Smuzhiyungroup recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
2023*4882a593Smuzhiyunso forth). It is highly recommended that all package group recipes
2024*4882a593Smuzhiyuninherit this class.
2025*4882a593Smuzhiyun
2026*4882a593SmuzhiyunFor information on how to use this class, see the
2027*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:customizing images using custom package groups`"
2028*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
2029*4882a593Smuzhiyun
2030*4882a593SmuzhiyunPreviously, this class was called the ``task`` class.
2031*4882a593Smuzhiyun
2032*4882a593Smuzhiyun.. _ref-classes-patch:
2033*4882a593Smuzhiyun
2034*4882a593Smuzhiyun``patch.bbclass``
2035*4882a593Smuzhiyun=================
2036*4882a593Smuzhiyun
2037*4882a593SmuzhiyunThe ``patch`` class provides all functionality for applying patches
2038*4882a593Smuzhiyunduring the :ref:`ref-tasks-patch` task.
2039*4882a593Smuzhiyun
2040*4882a593SmuzhiyunThis class is enabled by default because it is inherited by the
2041*4882a593Smuzhiyun:ref:`base <ref-classes-base>` class.
2042*4882a593Smuzhiyun
2043*4882a593Smuzhiyun.. _ref-classes-perlnative:
2044*4882a593Smuzhiyun
2045*4882a593Smuzhiyun``perlnative.bbclass``
2046*4882a593Smuzhiyun======================
2047*4882a593Smuzhiyun
2048*4882a593SmuzhiyunWhen inherited by a recipe, the ``perlnative`` class supports using the
2049*4882a593Smuzhiyunnative version of Perl built by the build system rather than using the
2050*4882a593Smuzhiyunversion provided by the build host.
2051*4882a593Smuzhiyun
2052*4882a593Smuzhiyun.. _ref-classes-pypi:
2053*4882a593Smuzhiyun
2054*4882a593Smuzhiyun``pypi.bbclass``
2055*4882a593Smuzhiyun================
2056*4882a593Smuzhiyun
2057*4882a593SmuzhiyunThe :ref:`pypi <ref-classes-pypi>` class sets variables appropriately for recipes that build
2058*4882a593SmuzhiyunPython modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2059*4882a593SmuzhiyunBy default it determines the PyPI package name based upon :term:`BPN`
2060*4882a593Smuzhiyun(stripping the "python-" or "python3-" prefix off if present), however in
2061*4882a593Smuzhiyunsome cases you may need to set it manually in the recipe by setting
2062*4882a593Smuzhiyun:term:`PYPI_PACKAGE`.
2063*4882a593Smuzhiyun
2064*4882a593SmuzhiyunVariables set by the :ref:`pypi <ref-classes-pypi>` class include :term:`SRC_URI`, :term:`SECTION`,
2065*4882a593Smuzhiyun:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2066*4882a593Smuzhiyunand :term:`CVE_PRODUCT`.
2067*4882a593Smuzhiyun
2068*4882a593Smuzhiyun.. _ref-classes-python_flit_core:
2069*4882a593Smuzhiyun
2070*4882a593Smuzhiyun``python_flit_core.bbclass``
2071*4882a593Smuzhiyun============================
2072*4882a593Smuzhiyun
2073*4882a593SmuzhiyunThe ``python_flit_core`` class enables building Python modules which declare
2074*4882a593Smuzhiyunthe  `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2075*4882a593Smuzhiyun``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2076*4882a593Smuzhiyunsection of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2077*4882a593Smuzhiyun
2078*4882a593SmuzhiyunPython modules built with ``flit_core.buildapi`` are pure Python (no
2079*4882a593Smuzhiyun``C`` or ``Rust`` extensions).
2080*4882a593Smuzhiyun
2081*4882a593SmuzhiyunInternally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
2082*4882a593Smuzhiyun
2083*4882a593Smuzhiyun.. _ref-classes-python_pep517:
2084*4882a593Smuzhiyun
2085*4882a593Smuzhiyun``python_pep517.bbclass``
2086*4882a593Smuzhiyun=========================
2087*4882a593Smuzhiyun
2088*4882a593SmuzhiyunThe ``python_pep517`` class builds and installs a Python ``wheel`` binary
2089*4882a593Smuzhiyunarchive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
2090*4882a593Smuzhiyun
2091*4882a593SmuzhiyunRecipes wouldn't inherit this directly, instead typically another class will
2092*4882a593Smuzhiyuninherit this, add the relevant native dependencies, and set
2093*4882a593Smuzhiyun:term:`PEP517_BUILD_API` to the Python class which implements the PEP-517 build
2094*4882a593SmuzhiyunAPI.
2095*4882a593Smuzhiyun
2096*4882a593SmuzhiyunExamples of classes which do this are :ref:`python_flit_core
2097*4882a593Smuzhiyun<ref-classes-python_flit_core>`, :ref:`python_setuptools_build_meta
2098*4882a593Smuzhiyun<ref-classes-python_setuptools_build_meta>`, and :ref:`python_poetry_core
2099*4882a593Smuzhiyun<ref-classes-python_poetry_core>`.
2100*4882a593Smuzhiyun
2101*4882a593Smuzhiyun.. _ref-classes-python_poetry_core:
2102*4882a593Smuzhiyun
2103*4882a593Smuzhiyun``python_poetry_core.bbclass``
2104*4882a593Smuzhiyun==============================
2105*4882a593Smuzhiyun
2106*4882a593SmuzhiyunThe ``python_poetry_core`` class enables building Python modules which use the
2107*4882a593Smuzhiyun`Poetry Core <https://python-poetry.org>`__ build system.
2108*4882a593Smuzhiyun
2109*4882a593SmuzhiyunInternally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
2110*4882a593Smuzhiyun
2111*4882a593Smuzhiyun.. _ref-classes-pixbufcache:
2112*4882a593Smuzhiyun
2113*4882a593Smuzhiyun``pixbufcache.bbclass``
2114*4882a593Smuzhiyun=======================
2115*4882a593Smuzhiyun
2116*4882a593SmuzhiyunThe ``pixbufcache`` class generates the proper post-install and
2117*4882a593Smuzhiyunpost-remove (postinst/postrm) scriptlets for packages that install
2118*4882a593Smuzhiyunpixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2119*4882a593Smuzhiyuncall ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2120*4882a593SmuzhiyunSince the cache files are architecture-specific, ``update_pixbuf_cache``
2121*4882a593Smuzhiyunis run using QEMU if the postinst scriptlets need to be run on the build
2122*4882a593Smuzhiyunhost during image creation.
2123*4882a593Smuzhiyun
2124*4882a593SmuzhiyunIf the pixbuf loaders being installed are in packages other than the
2125*4882a593Smuzhiyunrecipe's main package, set
2126*4882a593Smuzhiyun:term:`PIXBUF_PACKAGES` to specify the packages
2127*4882a593Smuzhiyuncontaining the loaders.
2128*4882a593Smuzhiyun
2129*4882a593Smuzhiyun.. _ref-classes-pkgconfig:
2130*4882a593Smuzhiyun
2131*4882a593Smuzhiyun``pkgconfig.bbclass``
2132*4882a593Smuzhiyun=====================
2133*4882a593Smuzhiyun
2134*4882a593SmuzhiyunThe ``pkgconfig`` class provides a standard way to get header and
2135*4882a593Smuzhiyunlibrary information by using ``pkg-config``. This class aims to smooth
2136*4882a593Smuzhiyunintegration of ``pkg-config`` into libraries that use it.
2137*4882a593Smuzhiyun
2138*4882a593SmuzhiyunDuring staging, BitBake installs ``pkg-config`` data into the
2139*4882a593Smuzhiyun``sysroots/`` directory. By making use of sysroot functionality within
2140*4882a593Smuzhiyun``pkg-config``, the ``pkgconfig`` class no longer has to manipulate the
2141*4882a593Smuzhiyunfiles.
2142*4882a593Smuzhiyun
2143*4882a593Smuzhiyun.. _ref-classes-populate-sdk:
2144*4882a593Smuzhiyun
2145*4882a593Smuzhiyun``populate_sdk.bbclass``
2146*4882a593Smuzhiyun========================
2147*4882a593Smuzhiyun
2148*4882a593SmuzhiyunThe ``populate_sdk`` class provides support for SDK-only recipes. For
2149*4882a593Smuzhiyuninformation on advantages gained when building a cross-development
2150*4882a593Smuzhiyuntoolchain using the :ref:`ref-tasks-populate_sdk`
2151*4882a593Smuzhiyuntask, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
2152*4882a593Smuzhiyunsection in the Yocto Project Application Development and the Extensible
2153*4882a593SmuzhiyunSoftware Development Kit (eSDK) manual.
2154*4882a593Smuzhiyun
2155*4882a593Smuzhiyun.. _ref-classes-populate-sdk-*:
2156*4882a593Smuzhiyun
2157*4882a593Smuzhiyun``populate_sdk_*.bbclass``
2158*4882a593Smuzhiyun==========================
2159*4882a593Smuzhiyun
2160*4882a593SmuzhiyunThe ``populate_sdk_*`` classes support SDK creation and consist of the
2161*4882a593Smuzhiyunfollowing classes:
2162*4882a593Smuzhiyun
2163*4882a593Smuzhiyun-  ``populate_sdk_base``: The base class supporting SDK creation under
2164*4882a593Smuzhiyun   all package managers (i.e. DEB, RPM, and opkg).
2165*4882a593Smuzhiyun
2166*4882a593Smuzhiyun-  ``populate_sdk_deb``: Supports creation of the SDK given the Debian
2167*4882a593Smuzhiyun   package manager.
2168*4882a593Smuzhiyun
2169*4882a593Smuzhiyun-  ``populate_sdk_rpm``: Supports creation of the SDK given the RPM
2170*4882a593Smuzhiyun   package manager.
2171*4882a593Smuzhiyun
2172*4882a593Smuzhiyun-  ``populate_sdk_ipk``: Supports creation of the SDK given the opkg
2173*4882a593Smuzhiyun   (IPK format) package manager.
2174*4882a593Smuzhiyun
2175*4882a593Smuzhiyun-  ``populate_sdk_ext``: Supports extensible SDK creation under all
2176*4882a593Smuzhiyun   package managers.
2177*4882a593Smuzhiyun
2178*4882a593SmuzhiyunThe ``populate_sdk_base`` class inherits the appropriate
2179*4882a593Smuzhiyun``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2180*4882a593Smuzhiyun:term:`IMAGE_PKGTYPE`.
2181*4882a593Smuzhiyun
2182*4882a593SmuzhiyunThe base class ensures all source and destination directories are
2183*4882a593Smuzhiyunestablished and then populates the SDK. After populating the SDK, the
2184*4882a593Smuzhiyun``populate_sdk_base`` class constructs two sysroots:
2185*4882a593Smuzhiyun``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2186*4882a593Smuzhiyuncontains the cross-compiler and associated tooling, and the target,
2187*4882a593Smuzhiyunwhich contains a target root filesystem that is configured for the SDK
2188*4882a593Smuzhiyunusage. These two images reside in :term:`SDK_OUTPUT`,
2189*4882a593Smuzhiyunwhich consists of the following::
2190*4882a593Smuzhiyun
2191*4882a593Smuzhiyun   ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2192*4882a593Smuzhiyun   ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2193*4882a593Smuzhiyun
2194*4882a593SmuzhiyunFinally, the base populate SDK class creates the toolchain environment
2195*4882a593Smuzhiyunsetup script, the tarball of the SDK, and the installer.
2196*4882a593Smuzhiyun
2197*4882a593SmuzhiyunThe respective ``populate_sdk_deb``, ``populate_sdk_rpm``, and
2198*4882a593Smuzhiyun``populate_sdk_ipk`` classes each support the specific type of SDK.
2199*4882a593SmuzhiyunThese classes are inherited by and used with the ``populate_sdk_base``
2200*4882a593Smuzhiyunclass.
2201*4882a593Smuzhiyun
2202*4882a593SmuzhiyunFor more information on the cross-development toolchain generation, see
2203*4882a593Smuzhiyunthe ":ref:`overview-manual/concepts:cross-development toolchain generation`"
2204*4882a593Smuzhiyunsection in the Yocto Project Overview and Concepts Manual. For
2205*4882a593Smuzhiyuninformation on advantages gained when building a cross-development
2206*4882a593Smuzhiyuntoolchain using the :ref:`ref-tasks-populate_sdk`
2207*4882a593Smuzhiyuntask, see the
2208*4882a593Smuzhiyun":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
2209*4882a593Smuzhiyunsection in the Yocto Project Application Development and the Extensible
2210*4882a593SmuzhiyunSoftware Development Kit (eSDK) manual.
2211*4882a593Smuzhiyun
2212*4882a593Smuzhiyun.. _ref-classes-prexport:
2213*4882a593Smuzhiyun
2214*4882a593Smuzhiyun``prexport.bbclass``
2215*4882a593Smuzhiyun====================
2216*4882a593Smuzhiyun
2217*4882a593SmuzhiyunThe ``prexport`` class provides functionality for exporting
2218*4882a593Smuzhiyun:term:`PR` values.
2219*4882a593Smuzhiyun
2220*4882a593Smuzhiyun.. note::
2221*4882a593Smuzhiyun
2222*4882a593Smuzhiyun   This class is not intended to be used directly. Rather, it is enabled
2223*4882a593Smuzhiyun   when using "``bitbake-prserv-tool export``".
2224*4882a593Smuzhiyun
2225*4882a593Smuzhiyun.. _ref-classes-primport:
2226*4882a593Smuzhiyun
2227*4882a593Smuzhiyun``primport.bbclass``
2228*4882a593Smuzhiyun====================
2229*4882a593Smuzhiyun
2230*4882a593SmuzhiyunThe ``primport`` class provides functionality for importing
2231*4882a593Smuzhiyun:term:`PR` values.
2232*4882a593Smuzhiyun
2233*4882a593Smuzhiyun.. note::
2234*4882a593Smuzhiyun
2235*4882a593Smuzhiyun   This class is not intended to be used directly. Rather, it is enabled
2236*4882a593Smuzhiyun   when using "``bitbake-prserv-tool import``".
2237*4882a593Smuzhiyun
2238*4882a593Smuzhiyun.. _ref-classes-prserv:
2239*4882a593Smuzhiyun
2240*4882a593Smuzhiyun``prserv.bbclass``
2241*4882a593Smuzhiyun==================
2242*4882a593Smuzhiyun
2243*4882a593SmuzhiyunThe ``prserv`` class provides functionality for using a :ref:`PR
2244*4882a593Smuzhiyunservice <dev-manual/common-tasks:working with a pr service>` in order to
2245*4882a593Smuzhiyunautomatically manage the incrementing of the :term:`PR`
2246*4882a593Smuzhiyunvariable for each recipe.
2247*4882a593Smuzhiyun
2248*4882a593SmuzhiyunThis class is enabled by default because it is inherited by the
2249*4882a593Smuzhiyun:ref:`package <ref-classes-package>` class. However, the OpenEmbedded
2250*4882a593Smuzhiyunbuild system will not enable the functionality of this class unless
2251*4882a593Smuzhiyun:term:`PRSERV_HOST` has been set.
2252*4882a593Smuzhiyun
2253*4882a593Smuzhiyun.. _ref-classes-ptest:
2254*4882a593Smuzhiyun
2255*4882a593Smuzhiyun``ptest.bbclass``
2256*4882a593Smuzhiyun=================
2257*4882a593Smuzhiyun
2258*4882a593SmuzhiyunThe ``ptest`` class provides functionality for packaging and installing
2259*4882a593Smuzhiyunruntime tests for recipes that build software that provides these tests.
2260*4882a593Smuzhiyun
2261*4882a593SmuzhiyunThis class is intended to be inherited by individual recipes. However,
2262*4882a593Smuzhiyunthe class' functionality is largely disabled unless "ptest" appears in
2263*4882a593Smuzhiyun:term:`DISTRO_FEATURES`. See the
2264*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:testing packages with ptest`"
2265*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual for more information
2266*4882a593Smuzhiyunon ptest.
2267*4882a593Smuzhiyun
2268*4882a593Smuzhiyun.. _ref-classes-ptest-gnome:
2269*4882a593Smuzhiyun
2270*4882a593Smuzhiyun``ptest-gnome.bbclass``
2271*4882a593Smuzhiyun=======================
2272*4882a593Smuzhiyun
2273*4882a593SmuzhiyunEnables package tests (ptests) specifically for GNOME packages, which
2274*4882a593Smuzhiyunhave tests intended to be executed with ``gnome-desktop-testing``.
2275*4882a593Smuzhiyun
2276*4882a593SmuzhiyunFor information on setting up and running ptests, see the
2277*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:testing packages with ptest`"
2278*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
2279*4882a593Smuzhiyun
2280*4882a593Smuzhiyun.. _ref-classes-python3-dir:
2281*4882a593Smuzhiyun
2282*4882a593Smuzhiyun``python3-dir.bbclass``
2283*4882a593Smuzhiyun=======================
2284*4882a593Smuzhiyun
2285*4882a593SmuzhiyunThe ``python3-dir`` class provides the base version, location, and site
2286*4882a593Smuzhiyunpackage location for Python 3.
2287*4882a593Smuzhiyun
2288*4882a593Smuzhiyun.. _ref-classes-python3native:
2289*4882a593Smuzhiyun
2290*4882a593Smuzhiyun``python3native.bbclass``
2291*4882a593Smuzhiyun=========================
2292*4882a593Smuzhiyun
2293*4882a593SmuzhiyunThe ``python3native`` class supports using the native version of Python
2294*4882a593Smuzhiyun3 built by the build system rather than support of the version provided
2295*4882a593Smuzhiyunby the build host.
2296*4882a593Smuzhiyun
2297*4882a593Smuzhiyun.. _ref-classes-python3targetconfig:
2298*4882a593Smuzhiyun
2299*4882a593Smuzhiyun``python3targetconfig.bbclass``
2300*4882a593Smuzhiyun===============================
2301*4882a593Smuzhiyun
2302*4882a593SmuzhiyunThe ``python3targetconfig`` class supports using the native version of Python
2303*4882a593Smuzhiyun3 built by the build system rather than support of the version provided
2304*4882a593Smuzhiyunby the build host, except that the configuration for the target machine
2305*4882a593Smuzhiyunis accessible (such as correct installation directories). This also adds a
2306*4882a593Smuzhiyundependency on target ``python3``, so should only be used where appropriate
2307*4882a593Smuzhiyunin order to avoid unnecessarily lengthening builds.
2308*4882a593Smuzhiyun
2309*4882a593Smuzhiyun.. _ref-classes-qemu:
2310*4882a593Smuzhiyun
2311*4882a593Smuzhiyun``qemu.bbclass``
2312*4882a593Smuzhiyun================
2313*4882a593Smuzhiyun
2314*4882a593SmuzhiyunThe ``qemu`` class provides functionality for recipes that either need
2315*4882a593SmuzhiyunQEMU or test for the existence of QEMU. Typically, this class is used to
2316*4882a593Smuzhiyunrun programs for a target system on the build host using QEMU's
2317*4882a593Smuzhiyunapplication emulation mode.
2318*4882a593Smuzhiyun
2319*4882a593Smuzhiyun.. _ref-classes-recipe_sanity:
2320*4882a593Smuzhiyun
2321*4882a593Smuzhiyun``recipe_sanity.bbclass``
2322*4882a593Smuzhiyun=========================
2323*4882a593Smuzhiyun
2324*4882a593SmuzhiyunThe ``recipe_sanity`` class checks for the presence of any host system
2325*4882a593Smuzhiyunrecipe prerequisites that might affect the build (e.g. variables that
2326*4882a593Smuzhiyunare set or software that is present).
2327*4882a593Smuzhiyun
2328*4882a593Smuzhiyun.. _ref-classes-relocatable:
2329*4882a593Smuzhiyun
2330*4882a593Smuzhiyun``relocatable.bbclass``
2331*4882a593Smuzhiyun=======================
2332*4882a593Smuzhiyun
2333*4882a593SmuzhiyunThe ``relocatable`` class enables relocation of binaries when they are
2334*4882a593Smuzhiyuninstalled into the sysroot.
2335*4882a593Smuzhiyun
2336*4882a593SmuzhiyunThis class makes use of the :ref:`chrpath <ref-classes-chrpath>` class
2337*4882a593Smuzhiyunand is used by both the :ref:`cross <ref-classes-cross>` and
2338*4882a593Smuzhiyun:ref:`native <ref-classes-native>` classes.
2339*4882a593Smuzhiyun
2340*4882a593Smuzhiyun.. _ref-classes-remove-libtool:
2341*4882a593Smuzhiyun
2342*4882a593Smuzhiyun``remove-libtool.bbclass``
2343*4882a593Smuzhiyun==========================
2344*4882a593Smuzhiyun
2345*4882a593SmuzhiyunThe ``remove-libtool`` class adds a post function to the
2346*4882a593Smuzhiyun:ref:`ref-tasks-install` task to remove all ``.la`` files
2347*4882a593Smuzhiyuninstalled by ``libtool``. Removing these files results in them being
2348*4882a593Smuzhiyunabsent from both the sysroot and target packages.
2349*4882a593Smuzhiyun
2350*4882a593SmuzhiyunIf a recipe needs the ``.la`` files to be installed, then the recipe can
2351*4882a593Smuzhiyunoverride the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
2352*4882a593Smuzhiyun
2353*4882a593Smuzhiyun   REMOVE_LIBTOOL_LA = "0"
2354*4882a593Smuzhiyun
2355*4882a593Smuzhiyun.. note::
2356*4882a593Smuzhiyun
2357*4882a593Smuzhiyun   The ``remove-libtool`` class is not enabled by default.
2358*4882a593Smuzhiyun
2359*4882a593Smuzhiyun.. _ref-classes-report-error:
2360*4882a593Smuzhiyun
2361*4882a593Smuzhiyun``report-error.bbclass``
2362*4882a593Smuzhiyun========================
2363*4882a593Smuzhiyun
2364*4882a593SmuzhiyunThe ``report-error`` class supports enabling the :ref:`error reporting
2365*4882a593Smuzhiyuntool <dev-manual/common-tasks:using the error reporting tool>`",
2366*4882a593Smuzhiyunwhich allows you to submit build error information to a central database.
2367*4882a593Smuzhiyun
2368*4882a593SmuzhiyunThe class collects debug information for recipe, recipe version, task,
2369*4882a593Smuzhiyunmachine, distro, build system, target system, host distro, branch,
2370*4882a593Smuzhiyuncommit, and log. From the information, report files using a JSON format
2371*4882a593Smuzhiyunare created and stored in
2372*4882a593Smuzhiyun``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2373*4882a593Smuzhiyun
2374*4882a593Smuzhiyun.. _ref-classes-rm-work:
2375*4882a593Smuzhiyun
2376*4882a593Smuzhiyun``rm_work.bbclass``
2377*4882a593Smuzhiyun===================
2378*4882a593Smuzhiyun
2379*4882a593SmuzhiyunThe ``rm_work`` class supports deletion of temporary workspace, which
2380*4882a593Smuzhiyuncan ease your hard drive demands during builds.
2381*4882a593Smuzhiyun
2382*4882a593SmuzhiyunThe OpenEmbedded build system can use a substantial amount of disk space
2383*4882a593Smuzhiyunduring the build process. A portion of this space is the work files
2384*4882a593Smuzhiyununder the ``${TMPDIR}/work`` directory for each recipe. Once the build
2385*4882a593Smuzhiyunsystem generates the packages for a recipe, the work files for that
2386*4882a593Smuzhiyunrecipe are no longer needed. However, by default, the build system
2387*4882a593Smuzhiyunpreserves these files for inspection and possible debugging purposes. If
2388*4882a593Smuzhiyunyou would rather have these files deleted to save disk space as the
2389*4882a593Smuzhiyunbuild progresses, you can enable ``rm_work`` by adding the following to
2390*4882a593Smuzhiyunyour ``local.conf`` file, which is found in the :term:`Build Directory`.
2391*4882a593Smuzhiyun::
2392*4882a593Smuzhiyun
2393*4882a593Smuzhiyun   INHERIT += "rm_work"
2394*4882a593Smuzhiyun
2395*4882a593SmuzhiyunIf you are
2396*4882a593Smuzhiyunmodifying and building source code out of the work directory for a
2397*4882a593Smuzhiyunrecipe, enabling ``rm_work`` will potentially result in your changes to
2398*4882a593Smuzhiyunthe source being lost. To exclude some recipes from having their work
2399*4882a593Smuzhiyundirectories deleted by ``rm_work``, you can add the names of the recipe
2400*4882a593Smuzhiyunor recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which
2401*4882a593Smuzhiyuncan also be set in your ``local.conf`` file. Here is an example::
2402*4882a593Smuzhiyun
2403*4882a593Smuzhiyun   RM_WORK_EXCLUDE += "busybox glibc"
2404*4882a593Smuzhiyun
2405*4882a593Smuzhiyun.. _ref-classes-rootfs*:
2406*4882a593Smuzhiyun
2407*4882a593Smuzhiyun``rootfs*.bbclass``
2408*4882a593Smuzhiyun===================
2409*4882a593Smuzhiyun
2410*4882a593SmuzhiyunThe ``rootfs*`` classes support creating the root filesystem for an
2411*4882a593Smuzhiyunimage and consist of the following classes:
2412*4882a593Smuzhiyun
2413*4882a593Smuzhiyun-  The ``rootfs-postcommands`` class, which defines filesystem
2414*4882a593Smuzhiyun   post-processing functions for image recipes.
2415*4882a593Smuzhiyun
2416*4882a593Smuzhiyun-  The ``rootfs_deb`` class, which supports creation of root filesystems
2417*4882a593Smuzhiyun   for images built using ``.deb`` packages.
2418*4882a593Smuzhiyun
2419*4882a593Smuzhiyun-  The ``rootfs_rpm`` class, which supports creation of root filesystems
2420*4882a593Smuzhiyun   for images built using ``.rpm`` packages.
2421*4882a593Smuzhiyun
2422*4882a593Smuzhiyun-  The ``rootfs_ipk`` class, which supports creation of root filesystems
2423*4882a593Smuzhiyun   for images built using ``.ipk`` packages.
2424*4882a593Smuzhiyun
2425*4882a593Smuzhiyun-  The ``rootfsdebugfiles`` class, which installs additional files found
2426*4882a593Smuzhiyun   on the build host directly into the root filesystem.
2427*4882a593Smuzhiyun
2428*4882a593SmuzhiyunThe root filesystem is created from packages using one of the
2429*4882a593Smuzhiyun``rootfs*.bbclass`` files as determined by the
2430*4882a593Smuzhiyun:term:`PACKAGE_CLASSES` variable.
2431*4882a593Smuzhiyun
2432*4882a593SmuzhiyunFor information on how root filesystem images are created, see the
2433*4882a593Smuzhiyun":ref:`overview-manual/concepts:image generation`"
2434*4882a593Smuzhiyunsection in the Yocto Project Overview and Concepts Manual.
2435*4882a593Smuzhiyun
2436*4882a593Smuzhiyun.. _ref-classes-sanity:
2437*4882a593Smuzhiyun
2438*4882a593Smuzhiyun``sanity.bbclass``
2439*4882a593Smuzhiyun==================
2440*4882a593Smuzhiyun
2441*4882a593SmuzhiyunThe ``sanity`` class checks to see if prerequisite software is present
2442*4882a593Smuzhiyunon the host system so that users can be notified of potential problems
2443*4882a593Smuzhiyunthat might affect their build. The class also performs basic user
2444*4882a593Smuzhiyunconfiguration checks from the ``local.conf`` configuration file to
2445*4882a593Smuzhiyunprevent common mistakes that cause build failures. Distribution policy
2446*4882a593Smuzhiyunusually determines whether to include this class.
2447*4882a593Smuzhiyun
2448*4882a593Smuzhiyun.. _ref-classes-scons:
2449*4882a593Smuzhiyun
2450*4882a593Smuzhiyun``scons.bbclass``
2451*4882a593Smuzhiyun=================
2452*4882a593Smuzhiyun
2453*4882a593SmuzhiyunThe ``scons`` class supports recipes that need to build software that
2454*4882a593Smuzhiyunuses the SCons build system. You can use the
2455*4882a593Smuzhiyun:term:`EXTRA_OESCONS` variable to specify
2456*4882a593Smuzhiyunadditional configuration options you want to pass SCons command line.
2457*4882a593Smuzhiyun
2458*4882a593Smuzhiyun.. _ref-classes-sdl:
2459*4882a593Smuzhiyun
2460*4882a593Smuzhiyun``sdl.bbclass``
2461*4882a593Smuzhiyun===============
2462*4882a593Smuzhiyun
2463*4882a593SmuzhiyunThe ``sdl`` class supports recipes that need to build software that uses
2464*4882a593Smuzhiyunthe Simple DirectMedia Layer (SDL) library.
2465*4882a593Smuzhiyun
2466*4882a593Smuzhiyun.. _ref-classes-python_setuptools_build_meta:
2467*4882a593Smuzhiyun
2468*4882a593Smuzhiyun``python_setuptools_build_meta.bbclass``
2469*4882a593Smuzhiyun========================================
2470*4882a593Smuzhiyun
2471*4882a593SmuzhiyunThe ``python_setuptools_build_meta`` class enables building Python modules which
2472*4882a593Smuzhiyundeclare the
2473*4882a593Smuzhiyun`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2474*4882a593Smuzhiyun``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2475*4882a593Smuzhiyunsection of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2476*4882a593Smuzhiyun
2477*4882a593SmuzhiyunPython modules built with ``setuptools.build_meta`` can be pure Python or
2478*4882a593Smuzhiyuninclude ``C`` or ``Rust`` extensions).
2479*4882a593Smuzhiyun
2480*4882a593SmuzhiyunInternally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
2481*4882a593Smuzhiyun
2482*4882a593Smuzhiyun.. _ref-classes-setuptools3:
2483*4882a593Smuzhiyun
2484*4882a593Smuzhiyun``setuptools3.bbclass``
2485*4882a593Smuzhiyun=======================
2486*4882a593Smuzhiyun
2487*4882a593SmuzhiyunThe ``setuptools3`` class supports Python version 3.x extensions that
2488*4882a593Smuzhiyunuse build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and
2489*4882a593Smuzhiyunhave not migrated to the official ``pyproject.toml`` format). If your recipe
2490*4882a593Smuzhiyunuses these build systems, the recipe needs to inherit the ``setuptools3`` class.
2491*4882a593Smuzhiyun
2492*4882a593Smuzhiyun   .. note::
2493*4882a593Smuzhiyun
2494*4882a593Smuzhiyun      The ``setuptools3`` class ``do_compile()`` task now calls
2495*4882a593Smuzhiyun      ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2496*4882a593Smuzhiyun      (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2497*4882a593Smuzhiyun
2498*4882a593Smuzhiyun      A consequence of this is that legacy software still using deprecated
2499*4882a593Smuzhiyun      ``distutils`` from the Python standard library cannot be packaged as
2500*4882a593Smuzhiyun      ``wheels``. A common solution is the replace
2501*4882a593Smuzhiyun      ``from distutils.core import setup`` with ``from setuptools import setup``.
2502*4882a593Smuzhiyun
2503*4882a593Smuzhiyun   .. note::
2504*4882a593Smuzhiyun
2505*4882a593Smuzhiyun     The ``setuptools3`` class ``do_install()`` task now installs the ``wheel``
2506*4882a593Smuzhiyun     binary archive. In current versions of ``setuptools`` the legacy ``setup.py
2507*4882a593Smuzhiyun     install`` method is deprecated. If the ``setup.py`` cannot be used with
2508*4882a593Smuzhiyun     wheels, for example it creates files outside of the Python module or
2509*4882a593Smuzhiyun     standard entry points, then :ref:`setuptools3_legacy
2510*4882a593Smuzhiyun     <ref-classes-setuptools3_legacy>` should be used.
2511*4882a593Smuzhiyun
2512*4882a593Smuzhiyun.. _ref-classes-setuptools3_legacy:
2513*4882a593Smuzhiyun
2514*4882a593Smuzhiyun``setuptools3_legacy.bbclass``
2515*4882a593Smuzhiyun==============================
2516*4882a593Smuzhiyun
2517*4882a593SmuzhiyunThe ``setuptools3_legacy`` class supports Python version 3.x extensions that use
2518*4882a593Smuzhiyunbuild systems based on ``setuptools`` (e.g. only have a ``setup.py`` and have
2519*4882a593Smuzhiyunnot migrated to the official ``pyproject.toml`` format). Unlike
2520*4882a593Smuzhiyun``setuptools3.bbclass``, this uses the traditional ``setup.py`` ``build`` and
2521*4882a593Smuzhiyun``install`` commands and not wheels. This use of ``setuptools`` like this is
2522*4882a593Smuzhiyun`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`_
2523*4882a593Smuzhiyunbut still relatively common.
2524*4882a593Smuzhiyun
2525*4882a593Smuzhiyun.. _ref-classes-setuptools3-base:
2526*4882a593Smuzhiyun
2527*4882a593Smuzhiyun``setuptools3-base.bbclass``
2528*4882a593Smuzhiyun============================
2529*4882a593Smuzhiyun
2530*4882a593SmuzhiyunThe ``setuptools3-base`` class provides a reusable base for other classes
2531*4882a593Smuzhiyunthat support building Python version 3.x extensions. If you need
2532*4882a593Smuzhiyunfunctionality that is not provided by the :ref:`setuptools3 <ref-classes-setuptools3>` class, you may
2533*4882a593Smuzhiyunwant to ``inherit setuptools3-base``. Some recipes do not need the tasks
2534*4882a593Smuzhiyunin the :ref:`setuptools3 <ref-classes-setuptools3>` class and inherit this class instead.
2535*4882a593Smuzhiyun
2536*4882a593Smuzhiyun.. _ref-classes-sign_rpm:
2537*4882a593Smuzhiyun
2538*4882a593Smuzhiyun``sign_rpm.bbclass``
2539*4882a593Smuzhiyun====================
2540*4882a593Smuzhiyun
2541*4882a593SmuzhiyunThe ``sign_rpm`` class supports generating signed RPM packages.
2542*4882a593Smuzhiyun
2543*4882a593Smuzhiyun.. _ref-classes-sip:
2544*4882a593Smuzhiyun
2545*4882a593Smuzhiyun``sip.bbclass``
2546*4882a593Smuzhiyun===============
2547*4882a593Smuzhiyun
2548*4882a593SmuzhiyunThe ``sip`` class supports recipes that build or package SIP-based
2549*4882a593SmuzhiyunPython bindings.
2550*4882a593Smuzhiyun
2551*4882a593Smuzhiyun.. _ref-classes-siteconfig:
2552*4882a593Smuzhiyun
2553*4882a593Smuzhiyun``siteconfig.bbclass``
2554*4882a593Smuzhiyun======================
2555*4882a593Smuzhiyun
2556*4882a593SmuzhiyunThe ``siteconfig`` class provides functionality for handling site
2557*4882a593Smuzhiyunconfiguration. The class is used by the
2558*4882a593Smuzhiyun:ref:`autotools <ref-classes-autotools>` class to accelerate the
2559*4882a593Smuzhiyun:ref:`ref-tasks-configure` task.
2560*4882a593Smuzhiyun
2561*4882a593Smuzhiyun.. _ref-classes-siteinfo:
2562*4882a593Smuzhiyun
2563*4882a593Smuzhiyun``siteinfo.bbclass``
2564*4882a593Smuzhiyun====================
2565*4882a593Smuzhiyun
2566*4882a593SmuzhiyunThe ``siteinfo`` class provides information about the targets that might
2567*4882a593Smuzhiyunbe needed by other classes or recipes.
2568*4882a593Smuzhiyun
2569*4882a593SmuzhiyunAs an example, consider Autotools, which can require tests that must
2570*4882a593Smuzhiyunexecute on the target hardware. Since this is not possible in general
2571*4882a593Smuzhiyunwhen cross compiling, site information is used to provide cached test
2572*4882a593Smuzhiyunresults so these tests can be skipped over but still make the correct
2573*4882a593Smuzhiyunvalues available. The ``meta/site directory`` contains test results
2574*4882a593Smuzhiyunsorted into different categories such as architecture, endianness, and
2575*4882a593Smuzhiyunthe ``libc`` used. Site information provides a list of files containing
2576*4882a593Smuzhiyundata relevant to the current build in the :term:`CONFIG_SITE` variable that
2577*4882a593SmuzhiyunAutotools automatically picks up.
2578*4882a593Smuzhiyun
2579*4882a593SmuzhiyunThe class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2580*4882a593Smuzhiyun:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
2581*4882a593Smuzhiyun
2582*4882a593Smuzhiyun.. _ref-classes-sstate:
2583*4882a593Smuzhiyun
2584*4882a593Smuzhiyun``sstate.bbclass``
2585*4882a593Smuzhiyun==================
2586*4882a593Smuzhiyun
2587*4882a593SmuzhiyunThe ``sstate`` class provides support for Shared State (sstate). By
2588*4882a593Smuzhiyundefault, the class is enabled through the
2589*4882a593Smuzhiyun:term:`INHERIT_DISTRO` variable's default value.
2590*4882a593Smuzhiyun
2591*4882a593SmuzhiyunFor more information on sstate, see the
2592*4882a593Smuzhiyun":ref:`overview-manual/concepts:shared state cache`"
2593*4882a593Smuzhiyunsection in the Yocto Project Overview and Concepts Manual.
2594*4882a593Smuzhiyun
2595*4882a593Smuzhiyun.. _ref-classes-staging:
2596*4882a593Smuzhiyun
2597*4882a593Smuzhiyun``staging.bbclass``
2598*4882a593Smuzhiyun===================
2599*4882a593Smuzhiyun
2600*4882a593SmuzhiyunThe ``staging`` class installs files into individual recipe work
2601*4882a593Smuzhiyundirectories for sysroots. The class contains the following key tasks:
2602*4882a593Smuzhiyun
2603*4882a593Smuzhiyun-  The :ref:`ref-tasks-populate_sysroot` task,
2604*4882a593Smuzhiyun   which is responsible for handing the files that end up in the recipe
2605*4882a593Smuzhiyun   sysroots.
2606*4882a593Smuzhiyun
2607*4882a593Smuzhiyun-  The
2608*4882a593Smuzhiyun   :ref:`ref-tasks-prepare_recipe_sysroot`
2609*4882a593Smuzhiyun   task (a "partner" task to the ``populate_sysroot`` task), which
2610*4882a593Smuzhiyun   installs the files into the individual recipe work directories (i.e.
2611*4882a593Smuzhiyun   :term:`WORKDIR`).
2612*4882a593Smuzhiyun
2613*4882a593SmuzhiyunThe code in the ``staging`` class is complex and basically works in two
2614*4882a593Smuzhiyunstages:
2615*4882a593Smuzhiyun
2616*4882a593Smuzhiyun-  *Stage One:* The first stage addresses recipes that have files they
2617*4882a593Smuzhiyun   want to share with other recipes that have dependencies on the
2618*4882a593Smuzhiyun   originating recipe. Normally these dependencies are installed through
2619*4882a593Smuzhiyun   the :ref:`ref-tasks-install` task into
2620*4882a593Smuzhiyun   ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task
2621*4882a593Smuzhiyun   copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2622*4882a593Smuzhiyun   subset of files is controlled by the
2623*4882a593Smuzhiyun   :term:`SYSROOT_DIRS`,
2624*4882a593Smuzhiyun   :term:`SYSROOT_DIRS_NATIVE`, and
2625*4882a593Smuzhiyun   :term:`SYSROOT_DIRS_IGNORE`
2626*4882a593Smuzhiyun   variables.
2627*4882a593Smuzhiyun
2628*4882a593Smuzhiyun   .. note::
2629*4882a593Smuzhiyun
2630*4882a593Smuzhiyun      Additionally, a recipe can customize the files further by
2631*4882a593Smuzhiyun      declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
2632*4882a593Smuzhiyun      variable.
2633*4882a593Smuzhiyun
2634*4882a593Smuzhiyun   A shared state (sstate) object is built from these files and the
2635*4882a593Smuzhiyun   files are placed into a subdirectory of
2636*4882a593Smuzhiyun   :ref:`structure-build-tmp-sysroots-components`.
2637*4882a593Smuzhiyun   The files are scanned for hardcoded paths to the original
2638*4882a593Smuzhiyun   installation location. If the location is found in text files, the
2639*4882a593Smuzhiyun   hardcoded locations are replaced by tokens and a list of the files
2640*4882a593Smuzhiyun   needing such replacements is created. These adjustments are referred
2641*4882a593Smuzhiyun   to as "FIXMEs". The list of files that are scanned for paths is
2642*4882a593Smuzhiyun   controlled by the :term:`SSTATE_SCAN_FILES`
2643*4882a593Smuzhiyun   variable.
2644*4882a593Smuzhiyun
2645*4882a593Smuzhiyun-  *Stage Two:* The second stage addresses recipes that want to use
2646*4882a593Smuzhiyun   something from another recipe and declare a dependency on that recipe
2647*4882a593Smuzhiyun   through the :term:`DEPENDS` variable. The recipe will
2648*4882a593Smuzhiyun   have a
2649*4882a593Smuzhiyun   :ref:`ref-tasks-prepare_recipe_sysroot`
2650*4882a593Smuzhiyun   task and when this task executes, it creates the ``recipe-sysroot``
2651*4882a593Smuzhiyun   and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2652*4882a593Smuzhiyun   :term:`WORKDIR`). The OpenEmbedded build system
2653*4882a593Smuzhiyun   creates hard links to copies of the relevant files from
2654*4882a593Smuzhiyun   ``sysroots-components`` into the recipe work directory.
2655*4882a593Smuzhiyun
2656*4882a593Smuzhiyun   .. note::
2657*4882a593Smuzhiyun
2658*4882a593Smuzhiyun      If hard links are not possible, the build system uses actual
2659*4882a593Smuzhiyun      copies.
2660*4882a593Smuzhiyun
2661*4882a593Smuzhiyun   The build system then addresses any "FIXMEs" to paths as defined from
2662*4882a593Smuzhiyun   the list created in the first stage.
2663*4882a593Smuzhiyun
2664*4882a593Smuzhiyun   Finally, any files in ``${bindir}`` within the sysroot that have the
2665*4882a593Smuzhiyun   prefix "``postinst-``" are executed.
2666*4882a593Smuzhiyun
2667*4882a593Smuzhiyun   .. note::
2668*4882a593Smuzhiyun
2669*4882a593Smuzhiyun      Although such sysroot post installation scripts are not
2670*4882a593Smuzhiyun      recommended for general use, the files do allow some issues such
2671*4882a593Smuzhiyun      as user creation and module indexes to be addressed.
2672*4882a593Smuzhiyun
2673*4882a593Smuzhiyun   Because recipes can have other dependencies outside of :term:`DEPENDS`
2674*4882a593Smuzhiyun   (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2675*4882a593Smuzhiyun   the sysroot creation function ``extend_recipe_sysroot`` is also added
2676*4882a593Smuzhiyun   as a pre-function for those tasks whose dependencies are not through
2677*4882a593Smuzhiyun   :term:`DEPENDS` but operate similarly.
2678*4882a593Smuzhiyun
2679*4882a593Smuzhiyun   When installing dependencies into the sysroot, the code traverses the
2680*4882a593Smuzhiyun   dependency graph and processes dependencies in exactly the same way
2681*4882a593Smuzhiyun   as the dependencies would or would not be when installed from sstate.
2682*4882a593Smuzhiyun   This processing means, for example, a native tool would have its
2683*4882a593Smuzhiyun   native dependencies added but a target library would not have its
2684*4882a593Smuzhiyun   dependencies traversed or installed. The same sstate dependency code
2685*4882a593Smuzhiyun   is used so that builds should be identical regardless of whether
2686*4882a593Smuzhiyun   sstate was used or not. For a closer look, see the
2687*4882a593Smuzhiyun   ``setscene_depvalid()`` function in the
2688*4882a593Smuzhiyun   :ref:`sstate <ref-classes-sstate>` class.
2689*4882a593Smuzhiyun
2690*4882a593Smuzhiyun   The build system is careful to maintain manifests of the files it
2691*4882a593Smuzhiyun   installs so that any given dependency can be installed as needed. The
2692*4882a593Smuzhiyun   sstate hash of the installed item is also stored so that if it
2693*4882a593Smuzhiyun   changes, the build system can reinstall it.
2694*4882a593Smuzhiyun
2695*4882a593Smuzhiyun.. _ref-classes-syslinux:
2696*4882a593Smuzhiyun
2697*4882a593Smuzhiyun``syslinux.bbclass``
2698*4882a593Smuzhiyun====================
2699*4882a593Smuzhiyun
2700*4882a593SmuzhiyunThe ``syslinux`` class provides syslinux-specific functions for building
2701*4882a593Smuzhiyunbootable images.
2702*4882a593Smuzhiyun
2703*4882a593SmuzhiyunThe class supports the following variables:
2704*4882a593Smuzhiyun
2705*4882a593Smuzhiyun-  :term:`INITRD`: Indicates list of filesystem images to
2706*4882a593Smuzhiyun   concatenate and use as an initial RAM disk (initrd). This variable is
2707*4882a593Smuzhiyun   optional.
2708*4882a593Smuzhiyun
2709*4882a593Smuzhiyun-  :term:`ROOTFS`: Indicates a filesystem image to include
2710*4882a593Smuzhiyun   as the root filesystem. This variable is optional.
2711*4882a593Smuzhiyun
2712*4882a593Smuzhiyun-  :term:`AUTO_SYSLINUXMENU`: Enables creating
2713*4882a593Smuzhiyun   an automatic menu when set to "1".
2714*4882a593Smuzhiyun
2715*4882a593Smuzhiyun-  :term:`LABELS`: Lists targets for automatic
2716*4882a593Smuzhiyun   configuration.
2717*4882a593Smuzhiyun
2718*4882a593Smuzhiyun-  :term:`APPEND`: Lists append string overrides for each
2719*4882a593Smuzhiyun   label.
2720*4882a593Smuzhiyun
2721*4882a593Smuzhiyun-  :term:`SYSLINUX_OPTS`: Lists additional options
2722*4882a593Smuzhiyun   to add to the syslinux file. Semicolon characters separate multiple
2723*4882a593Smuzhiyun   options.
2724*4882a593Smuzhiyun
2725*4882a593Smuzhiyun-  :term:`SYSLINUX_SPLASH`: Lists a background
2726*4882a593Smuzhiyun   for the VGA boot menu when you are using the boot menu.
2727*4882a593Smuzhiyun
2728*4882a593Smuzhiyun-  :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2729*4882a593Smuzhiyun   to "console=ttyX" to change kernel boot default console.
2730*4882a593Smuzhiyun
2731*4882a593Smuzhiyun-  :term:`SYSLINUX_SERIAL`: Sets an alternate
2732*4882a593Smuzhiyun   serial port. Or, turns off serial when the variable is set with an
2733*4882a593Smuzhiyun   empty string.
2734*4882a593Smuzhiyun
2735*4882a593Smuzhiyun-  :term:`SYSLINUX_SERIAL_TTY`: Sets an
2736*4882a593Smuzhiyun   alternate "console=tty..." kernel boot argument.
2737*4882a593Smuzhiyun
2738*4882a593Smuzhiyun.. _ref-classes-systemd:
2739*4882a593Smuzhiyun
2740*4882a593Smuzhiyun``systemd.bbclass``
2741*4882a593Smuzhiyun===================
2742*4882a593Smuzhiyun
2743*4882a593SmuzhiyunThe ``systemd`` class provides support for recipes that install systemd
2744*4882a593Smuzhiyununit files.
2745*4882a593Smuzhiyun
2746*4882a593SmuzhiyunThe functionality for this class is disabled unless you have "systemd"
2747*4882a593Smuzhiyunin :term:`DISTRO_FEATURES`.
2748*4882a593Smuzhiyun
2749*4882a593SmuzhiyunUnder this class, the recipe or Makefile (i.e. whatever the recipe is
2750*4882a593Smuzhiyuncalling during the :ref:`ref-tasks-install` task)
2751*4882a593Smuzhiyuninstalls unit files into
2752*4882a593Smuzhiyun``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2753*4882a593Smuzhiyunfiles being installed go into packages other than the main package, you
2754*4882a593Smuzhiyunneed to set :term:`SYSTEMD_PACKAGES` in your
2755*4882a593Smuzhiyunrecipe to identify the packages in which the files will be installed.
2756*4882a593Smuzhiyun
2757*4882a593SmuzhiyunYou should set :term:`SYSTEMD_SERVICE` to the
2758*4882a593Smuzhiyunname of the service file. You should also use a package name override to
2759*4882a593Smuzhiyunindicate the package to which the value applies. If the value applies to
2760*4882a593Smuzhiyunthe recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
2761*4882a593Smuzhiyunis an example from the connman recipe::
2762*4882a593Smuzhiyun
2763*4882a593Smuzhiyun   SYSTEMD_SERVICE:${PN} = "connman.service"
2764*4882a593Smuzhiyun
2765*4882a593SmuzhiyunServices are set up to start on boot automatically
2766*4882a593Smuzhiyununless you have set
2767*4882a593Smuzhiyun:term:`SYSTEMD_AUTO_ENABLE` to "disable".
2768*4882a593Smuzhiyun
2769*4882a593SmuzhiyunFor more information on ``systemd``, see the
2770*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:selecting an initialization manager`"
2771*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
2772*4882a593Smuzhiyun
2773*4882a593Smuzhiyun.. _ref-classes-systemd-boot:
2774*4882a593Smuzhiyun
2775*4882a593Smuzhiyun``systemd-boot.bbclass``
2776*4882a593Smuzhiyun========================
2777*4882a593Smuzhiyun
2778*4882a593SmuzhiyunThe ``systemd-boot`` class provides functions specific to the
2779*4882a593Smuzhiyunsystemd-boot bootloader for building bootable images. This is an
2780*4882a593Smuzhiyuninternal class and is not intended to be used directly.
2781*4882a593Smuzhiyun
2782*4882a593Smuzhiyun.. note::
2783*4882a593Smuzhiyun
2784*4882a593Smuzhiyun   The ``systemd-boot`` class is a result from merging the ``gummiboot`` class
2785*4882a593Smuzhiyun   used in previous Yocto Project releases with the ``systemd`` project.
2786*4882a593Smuzhiyun
2787*4882a593SmuzhiyunSet the :term:`EFI_PROVIDER` variable to
2788*4882a593Smuzhiyun"systemd-boot" to use this class. Doing so creates a standalone EFI
2789*4882a593Smuzhiyunbootloader that is not dependent on systemd.
2790*4882a593Smuzhiyun
2791*4882a593SmuzhiyunFor information on more variables used and supported in this class, see
2792*4882a593Smuzhiyunthe :term:`SYSTEMD_BOOT_CFG`,
2793*4882a593Smuzhiyun:term:`SYSTEMD_BOOT_ENTRIES`, and
2794*4882a593Smuzhiyun:term:`SYSTEMD_BOOT_TIMEOUT` variables.
2795*4882a593Smuzhiyun
2796*4882a593SmuzhiyunYou can also see the `Systemd-boot
2797*4882a593Smuzhiyundocumentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
2798*4882a593Smuzhiyunfor more information.
2799*4882a593Smuzhiyun
2800*4882a593Smuzhiyun.. _ref-classes-terminal:
2801*4882a593Smuzhiyun
2802*4882a593Smuzhiyun``terminal.bbclass``
2803*4882a593Smuzhiyun====================
2804*4882a593Smuzhiyun
2805*4882a593SmuzhiyunThe ``terminal`` class provides support for starting a terminal session.
2806*4882a593SmuzhiyunThe :term:`OE_TERMINAL` variable controls which
2807*4882a593Smuzhiyunterminal emulator is used for the session.
2808*4882a593Smuzhiyun
2809*4882a593SmuzhiyunOther classes use the ``terminal`` class anywhere a separate terminal
2810*4882a593Smuzhiyunsession needs to be started. For example, the
2811*4882a593Smuzhiyun:ref:`patch <ref-classes-patch>` class assuming
2812*4882a593Smuzhiyun:term:`PATCHRESOLVE` is set to "user", the
2813*4882a593Smuzhiyun:ref:`cml1 <ref-classes-cml1>` class, and the
2814*4882a593Smuzhiyun:ref:`devshell <ref-classes-devshell>` class all use the ``terminal``
2815*4882a593Smuzhiyunclass.
2816*4882a593Smuzhiyun
2817*4882a593Smuzhiyun.. _ref-classes-testimage*:
2818*4882a593Smuzhiyun
2819*4882a593Smuzhiyun``testimage*.bbclass``
2820*4882a593Smuzhiyun======================
2821*4882a593Smuzhiyun
2822*4882a593SmuzhiyunThe ``testimage*`` classes support running automated tests against
2823*4882a593Smuzhiyunimages using QEMU and on actual hardware. The classes handle loading the
2824*4882a593Smuzhiyuntests and starting the image. To use the classes, you need to perform
2825*4882a593Smuzhiyunsteps to set up the environment.
2826*4882a593Smuzhiyun
2827*4882a593Smuzhiyun.. note::
2828*4882a593Smuzhiyun
2829*4882a593Smuzhiyun   Best practices include using :term:`IMAGE_CLASSES` rather than
2830*4882a593Smuzhiyun   :term:`INHERIT` to inherit the ``testimage`` class for automated image
2831*4882a593Smuzhiyun   testing.
2832*4882a593Smuzhiyun
2833*4882a593SmuzhiyunThe tests are commands that run on the target system over ``ssh``. Each
2834*4882a593Smuzhiyuntest is written in Python and makes use of the ``unittest`` module.
2835*4882a593Smuzhiyun
2836*4882a593SmuzhiyunThe ``testimage.bbclass`` runs tests on an image when called using the
2837*4882a593Smuzhiyunfollowing::
2838*4882a593Smuzhiyun
2839*4882a593Smuzhiyun   $ bitbake -c testimage image
2840*4882a593Smuzhiyun
2841*4882a593SmuzhiyunThe ``testimage-auto`` class
2842*4882a593Smuzhiyunruns tests on an image after the image is constructed (i.e.
2843*4882a593Smuzhiyun:term:`TESTIMAGE_AUTO` must be set to "1").
2844*4882a593Smuzhiyun
2845*4882a593SmuzhiyunFor information on how to enable, run, and create new tests, see the
2846*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:performing automated runtime testing`"
2847*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
2848*4882a593Smuzhiyun
2849*4882a593Smuzhiyun.. _ref-classes-testsdk:
2850*4882a593Smuzhiyun
2851*4882a593Smuzhiyun``testsdk.bbclass``
2852*4882a593Smuzhiyun===================
2853*4882a593Smuzhiyun
2854*4882a593SmuzhiyunThis class supports running automated tests against software development
2855*4882a593Smuzhiyunkits (SDKs). The ``testsdk`` class runs tests on an SDK when called
2856*4882a593Smuzhiyunusing the following::
2857*4882a593Smuzhiyun
2858*4882a593Smuzhiyun   $ bitbake -c testsdk image
2859*4882a593Smuzhiyun
2860*4882a593Smuzhiyun.. note::
2861*4882a593Smuzhiyun
2862*4882a593Smuzhiyun   Best practices include using :term:`IMAGE_CLASSES` rather than
2863*4882a593Smuzhiyun   :term:`INHERIT` to inherit the ``testsdk`` class for automated SDK
2864*4882a593Smuzhiyun   testing.
2865*4882a593Smuzhiyun
2866*4882a593Smuzhiyun.. _ref-classes-texinfo:
2867*4882a593Smuzhiyun
2868*4882a593Smuzhiyun``texinfo.bbclass``
2869*4882a593Smuzhiyun===================
2870*4882a593Smuzhiyun
2871*4882a593SmuzhiyunThis class should be inherited by recipes whose upstream packages invoke
2872*4882a593Smuzhiyunthe ``texinfo`` utilities at build-time. Native and cross recipes are
2873*4882a593Smuzhiyunmade to use the dummy scripts provided by ``texinfo-dummy-native``, for
2874*4882a593Smuzhiyunimproved performance. Target architecture recipes use the genuine
2875*4882a593SmuzhiyunTexinfo utilities. By default, they use the Texinfo utilities on the
2876*4882a593Smuzhiyunhost system.
2877*4882a593Smuzhiyun
2878*4882a593Smuzhiyun.. note::
2879*4882a593Smuzhiyun
2880*4882a593Smuzhiyun   If you want to use the Texinfo recipe shipped with the build system,
2881*4882a593Smuzhiyun   you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
2882*4882a593Smuzhiyun   from :term:`SANITY_REQUIRED_UTILITIES`.
2883*4882a593Smuzhiyun
2884*4882a593Smuzhiyun.. _ref-classes-toaster:
2885*4882a593Smuzhiyun
2886*4882a593Smuzhiyun``toaster.bbclass``
2887*4882a593Smuzhiyun===================
2888*4882a593Smuzhiyun
2889*4882a593SmuzhiyunThe ``toaster`` class collects information about packages and images and
2890*4882a593Smuzhiyunsends them as events that the BitBake user interface can receive. The
2891*4882a593Smuzhiyunclass is enabled when the Toaster user interface is running.
2892*4882a593Smuzhiyun
2893*4882a593SmuzhiyunThis class is not intended to be used directly.
2894*4882a593Smuzhiyun
2895*4882a593Smuzhiyun.. _ref-classes-toolchain-scripts:
2896*4882a593Smuzhiyun
2897*4882a593Smuzhiyun``toolchain-scripts.bbclass``
2898*4882a593Smuzhiyun=============================
2899*4882a593Smuzhiyun
2900*4882a593SmuzhiyunThe ``toolchain-scripts`` class provides the scripts used for setting up
2901*4882a593Smuzhiyunthe environment for installed SDKs.
2902*4882a593Smuzhiyun
2903*4882a593Smuzhiyun.. _ref-classes-typecheck:
2904*4882a593Smuzhiyun
2905*4882a593Smuzhiyun``typecheck.bbclass``
2906*4882a593Smuzhiyun=====================
2907*4882a593Smuzhiyun
2908*4882a593SmuzhiyunThe ``typecheck`` class provides support for validating the values of
2909*4882a593Smuzhiyunvariables set at the configuration level against their defined types.
2910*4882a593SmuzhiyunThe OpenEmbedded build system allows you to define the type of a
2911*4882a593Smuzhiyunvariable using the "type" varflag. Here is an example::
2912*4882a593Smuzhiyun
2913*4882a593Smuzhiyun   IMAGE_FEATURES[type] = "list"
2914*4882a593Smuzhiyun
2915*4882a593Smuzhiyun.. _ref-classes-uboot-config:
2916*4882a593Smuzhiyun
2917*4882a593Smuzhiyun``uboot-config.bbclass``
2918*4882a593Smuzhiyun========================
2919*4882a593Smuzhiyun
2920*4882a593SmuzhiyunThe ``uboot-config`` class provides support for U-Boot configuration for
2921*4882a593Smuzhiyuna machine. Specify the machine in your recipe as follows::
2922*4882a593Smuzhiyun
2923*4882a593Smuzhiyun   UBOOT_CONFIG ??= <default>
2924*4882a593Smuzhiyun   UBOOT_CONFIG[foo] = "config,images"
2925*4882a593Smuzhiyun
2926*4882a593SmuzhiyunYou can also specify the machine using this method::
2927*4882a593Smuzhiyun
2928*4882a593Smuzhiyun   UBOOT_MACHINE = "config"
2929*4882a593Smuzhiyun
2930*4882a593SmuzhiyunSee the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
2931*4882a593Smuzhiyuninformation.
2932*4882a593Smuzhiyun
2933*4882a593Smuzhiyun.. _ref-classes-uninative:
2934*4882a593Smuzhiyun
2935*4882a593Smuzhiyun``uninative.bbclass``
2936*4882a593Smuzhiyun=====================
2937*4882a593Smuzhiyun
2938*4882a593SmuzhiyunAttempts to isolate the build system from the host distribution's C
2939*4882a593Smuzhiyunlibrary in order to make re-use of native shared state artifacts across
2940*4882a593Smuzhiyundifferent host distributions practical. With this class enabled, a
2941*4882a593Smuzhiyuntarball containing a pre-built C library is downloaded at the start of
2942*4882a593Smuzhiyunthe build. In the Poky reference distribution this is enabled by default
2943*4882a593Smuzhiyunthrough ``meta/conf/distro/include/yocto-uninative.inc``. Other
2944*4882a593Smuzhiyundistributions that do not derive from poky can also
2945*4882a593Smuzhiyun"``require conf/distro/include/yocto-uninative.inc``" to use this.
2946*4882a593SmuzhiyunAlternatively if you prefer, you can build the uninative-tarball recipe
2947*4882a593Smuzhiyunyourself, publish the resulting tarball (e.g. via HTTP) and set
2948*4882a593Smuzhiyun``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
2949*4882a593Smuzhiyunexample, see the ``meta/conf/distro/include/yocto-uninative.inc``.
2950*4882a593Smuzhiyun
2951*4882a593SmuzhiyunThe ``uninative`` class is also used unconditionally by the extensible
2952*4882a593SmuzhiyunSDK. When building the extensible SDK, ``uninative-tarball`` is built
2953*4882a593Smuzhiyunand the resulting tarball is included within the SDK.
2954*4882a593Smuzhiyun
2955*4882a593Smuzhiyun.. _ref-classes-update-alternatives:
2956*4882a593Smuzhiyun
2957*4882a593Smuzhiyun``update-alternatives.bbclass``
2958*4882a593Smuzhiyun===============================
2959*4882a593Smuzhiyun
2960*4882a593SmuzhiyunThe ``update-alternatives`` class helps the alternatives system when
2961*4882a593Smuzhiyunmultiple sources provide the same command. This situation occurs when
2962*4882a593Smuzhiyunseveral programs that have the same or similar function are installed
2963*4882a593Smuzhiyunwith the same name. For example, the ``ar`` command is available from
2964*4882a593Smuzhiyunthe ``busybox``, ``binutils`` and ``elfutils`` packages. The
2965*4882a593Smuzhiyun``update-alternatives`` class handles renaming the binaries so that
2966*4882a593Smuzhiyunmultiple packages can be installed without conflicts. The ``ar`` command
2967*4882a593Smuzhiyunstill works regardless of which packages are installed or subsequently
2968*4882a593Smuzhiyunremoved. The class renames the conflicting binary in each package and
2969*4882a593Smuzhiyunsymlinks the highest priority binary during installation or removal of
2970*4882a593Smuzhiyunpackages.
2971*4882a593Smuzhiyun
2972*4882a593SmuzhiyunTo use this class, you need to define a number of variables:
2973*4882a593Smuzhiyun
2974*4882a593Smuzhiyun-  :term:`ALTERNATIVE`
2975*4882a593Smuzhiyun
2976*4882a593Smuzhiyun-  :term:`ALTERNATIVE_LINK_NAME`
2977*4882a593Smuzhiyun
2978*4882a593Smuzhiyun-  :term:`ALTERNATIVE_TARGET`
2979*4882a593Smuzhiyun
2980*4882a593Smuzhiyun-  :term:`ALTERNATIVE_PRIORITY`
2981*4882a593Smuzhiyun
2982*4882a593SmuzhiyunThese variables list alternative commands needed by a package, provide
2983*4882a593Smuzhiyunpathnames for links, default links for targets, and so forth. For
2984*4882a593Smuzhiyundetails on how to use this class, see the comments in the
2985*4882a593Smuzhiyun:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes/update-alternatives.bbclass>`
2986*4882a593Smuzhiyunfile.
2987*4882a593Smuzhiyun
2988*4882a593Smuzhiyun.. note::
2989*4882a593Smuzhiyun
2990*4882a593Smuzhiyun   You can use the ``update-alternatives`` command directly in your recipes.
2991*4882a593Smuzhiyun   However, this class simplifies things in most cases.
2992*4882a593Smuzhiyun
2993*4882a593Smuzhiyun.. _ref-classes-update-rc.d:
2994*4882a593Smuzhiyun
2995*4882a593Smuzhiyun``update-rc.d.bbclass``
2996*4882a593Smuzhiyun=======================
2997*4882a593Smuzhiyun
2998*4882a593SmuzhiyunThe ``update-rc.d`` class uses ``update-rc.d`` to safely install an
2999*4882a593Smuzhiyuninitialization script on behalf of the package. The OpenEmbedded build
3000*4882a593Smuzhiyunsystem takes care of details such as making sure the script is stopped
3001*4882a593Smuzhiyunbefore a package is removed and started when the package is installed.
3002*4882a593Smuzhiyun
3003*4882a593SmuzhiyunThree variables control this class: :term:`INITSCRIPT_PACKAGES`,
3004*4882a593Smuzhiyun:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
3005*4882a593Smuzhiyunfor details.
3006*4882a593Smuzhiyun
3007*4882a593Smuzhiyun.. _ref-classes-useradd:
3008*4882a593Smuzhiyun
3009*4882a593Smuzhiyun``useradd*.bbclass``
3010*4882a593Smuzhiyun====================
3011*4882a593Smuzhiyun
3012*4882a593SmuzhiyunThe ``useradd*`` classes support the addition of users or groups for
3013*4882a593Smuzhiyunusage by the package on the target. For example, if you have packages
3014*4882a593Smuzhiyunthat contain system services that should be run under their own user or
3015*4882a593Smuzhiyungroup, you can use these classes to enable creation of the user or
3016*4882a593Smuzhiyungroup. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3017*4882a593Smuzhiyun</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
3018*4882a593Smuzhiyunrecipe in the :term:`Source Directory` provides a simple
3019*4882a593Smuzhiyunexample that shows how to add three users and groups to two packages.
3020*4882a593Smuzhiyun
3021*4882a593SmuzhiyunThe ``useradd_base`` class provides basic functionality for user or
3022*4882a593Smuzhiyungroups settings.
3023*4882a593Smuzhiyun
3024*4882a593SmuzhiyunThe ``useradd*`` classes support the
3025*4882a593Smuzhiyun:term:`USERADD_PACKAGES`,
3026*4882a593Smuzhiyun:term:`USERADD_PARAM`,
3027*4882a593Smuzhiyun:term:`GROUPADD_PARAM`, and
3028*4882a593Smuzhiyun:term:`GROUPMEMS_PARAM` variables.
3029*4882a593Smuzhiyun
3030*4882a593SmuzhiyunThe ``useradd-staticids`` class supports the addition of users or groups
3031*4882a593Smuzhiyunthat have static user identification (``uid``) and group identification
3032*4882a593Smuzhiyun(``gid``) values.
3033*4882a593Smuzhiyun
3034*4882a593SmuzhiyunThe default behavior of the OpenEmbedded build system for assigning
3035*4882a593Smuzhiyun``uid`` and ``gid`` values when packages add users and groups during
3036*4882a593Smuzhiyunpackage install time is to add them dynamically. This works fine for
3037*4882a593Smuzhiyunprograms that do not care what the values of the resulting users and
3038*4882a593Smuzhiyungroups become. In these cases, the order of the installation determines
3039*4882a593Smuzhiyunthe final ``uid`` and ``gid`` values. However, if non-deterministic
3040*4882a593Smuzhiyun``uid`` and ``gid`` values are a problem, you can override the default,
3041*4882a593Smuzhiyundynamic application of these values by setting static values. When you
3042*4882a593Smuzhiyunset static values, the OpenEmbedded build system looks in
3043*4882a593Smuzhiyun:term:`BBPATH` for ``files/passwd`` and ``files/group``
3044*4882a593Smuzhiyunfiles for the values.
3045*4882a593Smuzhiyun
3046*4882a593SmuzhiyunTo use static ``uid`` and ``gid`` values, you need to set some
3047*4882a593Smuzhiyunvariables. See the :term:`USERADDEXTENSION`,
3048*4882a593Smuzhiyun:term:`USERADD_UID_TABLES`,
3049*4882a593Smuzhiyun:term:`USERADD_GID_TABLES`, and
3050*4882a593Smuzhiyun:term:`USERADD_ERROR_DYNAMIC` variables.
3051*4882a593SmuzhiyunYou can also see the :ref:`useradd <ref-classes-useradd>` class for
3052*4882a593Smuzhiyunadditional information.
3053*4882a593Smuzhiyun
3054*4882a593Smuzhiyun.. note::
3055*4882a593Smuzhiyun
3056*4882a593Smuzhiyun   You do not use the ``useradd-staticids`` class directly. You either enable
3057*4882a593Smuzhiyun   or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
3058*4882a593Smuzhiyun   enable or disable the class in a configured system, :term:`TMPDIR` might
3059*4882a593Smuzhiyun   contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
3060*4882a593Smuzhiyun   directory will correct this condition.
3061*4882a593Smuzhiyun
3062*4882a593Smuzhiyun.. _ref-classes-utility-tasks:
3063*4882a593Smuzhiyun
3064*4882a593Smuzhiyun``utility-tasks.bbclass``
3065*4882a593Smuzhiyun=========================
3066*4882a593Smuzhiyun
3067*4882a593SmuzhiyunThe ``utility-tasks`` class provides support for various "utility" type
3068*4882a593Smuzhiyuntasks that are applicable to all recipes, such as
3069*4882a593Smuzhiyun:ref:`ref-tasks-clean` and
3070*4882a593Smuzhiyun:ref:`ref-tasks-listtasks`.
3071*4882a593Smuzhiyun
3072*4882a593SmuzhiyunThis class is enabled by default because it is inherited by the
3073*4882a593Smuzhiyun:ref:`base <ref-classes-base>` class.
3074*4882a593Smuzhiyun
3075*4882a593Smuzhiyun.. _ref-classes-utils:
3076*4882a593Smuzhiyun
3077*4882a593Smuzhiyun``utils.bbclass``
3078*4882a593Smuzhiyun=================
3079*4882a593Smuzhiyun
3080*4882a593SmuzhiyunThe ``utils`` class provides some useful Python functions that are
3081*4882a593Smuzhiyuntypically used in inline Python expressions (e.g. ``${@...}``). One
3082*4882a593Smuzhiyunexample use is for ``bb.utils.contains()``.
3083*4882a593Smuzhiyun
3084*4882a593SmuzhiyunThis class is enabled by default because it is inherited by the
3085*4882a593Smuzhiyun:ref:`base <ref-classes-base>` class.
3086*4882a593Smuzhiyun
3087*4882a593Smuzhiyun.. _ref-classes-vala:
3088*4882a593Smuzhiyun
3089*4882a593Smuzhiyun``vala.bbclass``
3090*4882a593Smuzhiyun================
3091*4882a593Smuzhiyun
3092*4882a593SmuzhiyunThe ``vala`` class supports recipes that need to build software written
3093*4882a593Smuzhiyunusing the Vala programming language.
3094*4882a593Smuzhiyun
3095*4882a593Smuzhiyun.. _ref-classes-waf:
3096*4882a593Smuzhiyun
3097*4882a593Smuzhiyun``waf.bbclass``
3098*4882a593Smuzhiyun===============
3099*4882a593Smuzhiyun
3100*4882a593SmuzhiyunThe ``waf`` class supports recipes that need to build software that uses
3101*4882a593Smuzhiyunthe Waf build system. You can use the
3102*4882a593Smuzhiyun:term:`EXTRA_OECONF` or
3103*4882a593Smuzhiyun:term:`PACKAGECONFIG_CONFARGS` variables
3104*4882a593Smuzhiyunto specify additional configuration options to be passed on the Waf
3105*4882a593Smuzhiyuncommand line.
3106