classes.rst 130 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. *******
  3. Classes
  4. *******
  5. Class files are used to abstract common functionality and share it
  6. amongst multiple recipe (``.bb``) files. To use a class file, you simply
  7. make sure the recipe inherits the class. In most cases, when a recipe
  8. inherits a class it is enough to enable its features. There are cases,
  9. however, where in the recipe you might need to set variables or override
  10. some default behavior.
  11. Any :term:`Metadata` usually found in a recipe can also be
  12. placed in a class file. Class files are identified by the extension
  13. ``.bbclass`` and are usually placed in one of a set of subdirectories
  14. beneath the ``meta*/`` directory found in the :term:`Source Directory`:
  15. - ``classes-recipe/`` - classes intended to be inherited by recipes
  16. individually
  17. - ``classes-global/`` - classes intended to be inherited globally
  18. - ``classes/`` - classes whose usage context is not clearly defined
  19. Class files can also be pointed to by
  20. :term:`BUILDDIR` (e.g. ``build/``) in the same way as
  21. ``.conf`` files in the ``conf`` directory. Class files are searched for
  22. in :term:`BBPATH` using the same method by which ``.conf``
  23. files are searched.
  24. This chapter discusses only the most useful and important classes. Other
  25. classes do exist within the ``meta/classes*`` directories in the Source
  26. Directory. You can reference the ``.bbclass`` files directly for more
  27. information.
  28. .. _ref-classes-allarch:
  29. ``allarch``
  30. ===========
  31. The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce
  32. architecture-specific output. The class disables functionality that is
  33. normally needed for recipes that produce executable binaries (such as
  34. building the cross-compiler and a C library as pre-requisites, and
  35. splitting out of debug symbols during packaging).
  36. .. note::
  37. Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
  38. produce packages that depend on tunings through use of the
  39. :term:`RDEPENDS` and
  40. :term:`TUNE_PKGARCH` variables, should never be
  41. configured for all architectures using :ref:`ref-classes-allarch`. This is the case
  42. even if the recipes do not produce architecture-specific output.
  43. Configuring such recipes for all architectures causes the
  44. :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to
  45. have different signatures for the machines with different tunings.
  46. Additionally, unnecessary rebuilds occur every time an image for a
  47. different :term:`MACHINE` is built even when the recipe never changes.
  48. By default, all recipes inherit the :ref:`ref-classes-base` and
  49. :ref:`ref-classes-package` classes, which enable
  50. functionality needed for recipes that produce executable output. If your
  51. recipe, for example, only produces packages that contain configuration
  52. files, media files, or scripts (e.g. Python and Perl), then it should
  53. inherit the :ref:`ref-classes-allarch` class.
  54. .. _ref-classes-archiver:
  55. ``archiver``
  56. ============
  57. The :ref:`ref-classes-archiver` class supports releasing source code and other
  58. materials with the binaries.
  59. For more details on the source :ref:`ref-classes-archiver`, see the
  60. ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
  61. section in the Yocto Project Development Tasks Manual. You can also see
  62. the :term:`ARCHIVER_MODE` variable for information
  63. about the variable flags (varflags) that help control archive creation.
  64. .. _ref-classes-autotools:
  65. ``autotools*``
  66. ==============
  67. The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the
  68. :wikipedia:`GNU Autotools <GNU_Autotools>`.
  69. The ``autoconf``, ``automake``, and ``libtool`` packages bring
  70. standardization. This class defines a set of tasks (e.g. ``configure``,
  71. ``compile`` and so forth) that work for all Autotooled packages. It
  72. should usually be enough to define a few standard variables and then
  73. simply ``inherit autotools``. These classes can also work with software
  74. that emulates Autotools. For more information, see the
  75. ":ref:`dev-manual/new-recipe:building an autotooled package`" section
  76. in the Yocto Project Development Tasks Manual.
  77. By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e.
  78. ``autotools.bbclass`` building with ``B != S``).
  79. If the software being built by a recipe does not support using
  80. out-of-tree builds, you should have the recipe inherit the
  81. :ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves
  82. the same as the :ref:`ref-classes-autotools` class but builds with :term:`B`
  83. == :term:`S`. This method is useful when out-of-tree build
  84. support is either not present or is broken.
  85. .. note::
  86. It is recommended that out-of-tree support be fixed and used if at
  87. all possible.
  88. It's useful to have some idea of how the tasks defined by the
  89. :ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes.
  90. - :ref:`ref-tasks-configure` --- regenerates the
  91. configure script (using ``autoreconf``) and then launches it with a
  92. standard set of arguments used during cross-compilation. You can pass
  93. additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
  94. or :term:`PACKAGECONFIG_CONFARGS`
  95. variables.
  96. - :ref:`ref-tasks-compile` --- runs ``make`` with
  97. arguments that specify the compiler and linker. You can pass
  98. additional arguments through the :term:`EXTRA_OEMAKE` variable.
  99. - :ref:`ref-tasks-install` --- runs ``make install`` and
  100. passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
  101. .. _ref-classes-barebox:
  102. ``barebox``
  103. ===========
  104. The :ref:`ref-classes-barebox` class manages building the barebox bootloader.
  105. If a file named ``defconfig`` is included in the :term:`SRC_URI`, it will be
  106. copied to ``.config`` in the build directory and used as the barebox
  107. configuration.
  108. Instead of providing a ``defconfig`` file, you can set :term:`BAREBOX_CONFIG`
  109. to a defconfig provided by the barebox source tree.
  110. If neither ``defconfig`` nor :term:`BAREBOX_CONFIG` is specified, the class
  111. will raise an error.
  112. The :ref:`ref-classes-barebox` class supports config fragments and internally
  113. includes the :ref:`ref-classes-cml1` class to provide `Kconfig
  114. <https://docs.kernel.org/kbuild/kconfig-language.html>`__ support for
  115. barebox, enabling tasks such as :ref:`ref-tasks-menuconfig` and
  116. :ref:`ref-tasks-diffconfig`.
  117. The generated barebox binaries are deployed to
  118. :term:`DEPLOY_DIR_IMAGE` as well as installed to ``BAREBOX_INSTALL_PATH``
  119. (``/boot`` by default) making them part of the recipe’s base package.
  120. This setup supports both using the barebox binaries as independent artifacts
  121. and installing them into a rootfs.
  122. :term:`BAREBOX_BINARY` can be used to select a distinct binary to deploy and
  123. install.
  124. If ``barebox`` is set as the :term:`EFI_PROVIDER`, the class will leverage
  125. :oe_git:`conf/image-uefi.conf </openembedded-core/tree/meta/conf/image-uefi.conf>`
  126. to define the default installation paths and naming conventions.
  127. The compiled-in barebox environment can be extended by adding environment files
  128. to the ``BAREBOX_ENV_DIR``.
  129. The ``BAREBOX_FIRMWARE_DIR`` variable allows you to specify the firmware blob
  130. search directory, enabling loading of additional firmware like TF-A or OP-TEE.
  131. .. _ref-classes-base:
  132. ``base``
  133. ========
  134. The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly
  135. inherits the class. This class contains definitions for standard basic
  136. tasks such as fetching, unpacking, configuring (empty by default),
  137. compiling (runs any ``Makefile`` present), installing (empty by default)
  138. and packaging (empty by default). These tasks are often overridden or
  139. extended by other classes such as the :ref:`ref-classes-autotools` class or the
  140. :ref:`ref-classes-package` class.
  141. The class also contains some commonly used functions such as
  142. ``oe_runmake``, which runs ``make`` with the arguments specified in
  143. :term:`EXTRA_OEMAKE` variable as well as the
  144. arguments passed directly to ``oe_runmake``.
  145. .. _ref-classes-bash-completion:
  146. ``bash-completion``
  147. ===================
  148. Sets up packaging and dependencies appropriate for recipes that build
  149. software that includes bash-completion data.
  150. .. _ref-classes-bin-package:
  151. ``bin_package``
  152. ===============
  153. The :ref:`ref-classes-bin-package` class is a helper class for recipes, that
  154. disables the :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` tasks and
  155. copies the content of the :term:`S` directory into the :term:`D` directory. This
  156. is useful for installing binary packages (e.g. RPM packages) by passing the
  157. package in the :term:`SRC_URI` variable and inheriting this class.
  158. For RPMs and other packages that do not contain a subdirectory, you should set
  159. the :term:`SRC_URI` option ``subdir`` to :term:`BP` so that the contents are
  160. extracted to the directory expected by the default value of :term:`S`. For
  161. example::
  162. SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}"
  163. This class can also be used for tarballs. For example::
  164. SRC_URI = "file://somepackage.tar.xz;subdir=${BP}"
  165. The :ref:`ref-classes-bin-package` class will copy the extracted content of the
  166. tarball from :term:`S` to :term:`D`.
  167. This class assumes that the content of the package as installed in :term:`S`
  168. mirrors the expected layout once installed on the target, which is generally the
  169. case for binary packages. For example, an RPM package for a library would
  170. usually contain the ``usr/lib`` directory, and should be extracted to
  171. ``${S}/usr/lib/<library>.so.<version>`` to be installed in :term:`D` correctly.
  172. .. note::
  173. The extraction of the package passed in :term:`SRC_URI` is not handled by the
  174. :ref:`ref-classes-bin-package` class, but rather by the appropriate
  175. :ref:`fetcher <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
  176. depending on the file extension.
  177. .. _ref-classes-binconfig:
  178. ``binconfig``
  179. =============
  180. The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts.
  181. Before ``pkg-config`` had become widespread, libraries shipped shell
  182. scripts to give information about the libraries and include paths needed
  183. to build software (usually named ``LIBNAME-config``). This class assists
  184. any recipe using such scripts.
  185. During staging, the OpenEmbedded build system installs such scripts into
  186. the ``sysroots/`` directory. Inheriting this class results in all paths
  187. in these scripts being changed to point into the ``sysroots/`` directory
  188. so that all builds that use the script use the correct directories for
  189. the cross compiling layout. See the
  190. :term:`BINCONFIG_GLOB` variable for more
  191. information.
  192. .. _ref-classes-binconfig-disabled:
  193. ``binconfig-disabled``
  194. ======================
  195. An alternative version of the :ref:`ref-classes-binconfig`
  196. class, which disables binary configuration scripts by making them return
  197. an error in favor of using ``pkg-config`` to query the information. The
  198. scripts to be disabled should be specified using the :term:`BINCONFIG`
  199. variable within the recipe inheriting the class.
  200. .. _ref-classes-buildhistory:
  201. ``buildhistory``
  202. ================
  203. The :ref:`ref-classes-buildhistory` class records a history of build output metadata,
  204. which can be used to detect possible regressions as well as used for
  205. analysis of the build output. For more information on using Build
  206. History, see the
  207. ":ref:`dev-manual/build-quality:maintaining build output quality`"
  208. section in the Yocto Project Development Tasks Manual.
  209. .. _ref-classes-buildstats:
  210. ``buildstats``
  211. ==============
  212. The :ref:`ref-classes-buildstats` class records performance statistics about each task
  213. executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
  214. When you use this class, the output goes into the
  215. :term:`BUILDSTATS_BASE` directory, which defaults
  216. to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
  217. ``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
  218. chart of the entire build process and can be useful for highlighting
  219. bottlenecks.
  220. Collecting build statistics is enabled by default through the
  221. :term:`USER_CLASSES` variable from your
  222. ``local.conf`` file. Consequently, you do not have to do anything to
  223. enable the class. However, if you want to disable the class, simply
  224. remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list.
  225. .. _ref-classes-buildstats-summary:
  226. ``buildstats-summary``
  227. ======================
  228. When inherited globally, prints statistics at the end of the build on
  229. sstate re-use. In order to function, this class requires the
  230. :ref:`ref-classes-buildstats` class be enabled.
  231. .. _ref-classes-cargo:
  232. ``cargo``
  233. =========
  234. The :ref:`ref-classes-cargo` class allows to compile Rust language programs
  235. using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
  236. manager, allowing to fetch package dependencies and build your program.
  237. Using this class makes it very easy to build Rust programs. All you need
  238. is to use the :term:`SRC_URI` variable to point to a source repository
  239. which can be built by Cargo, typically one that was created by the
  240. ``cargo new`` command, containing a ``Cargo.toml`` file, a ``Cargo.lock`` file and a ``src``
  241. subdirectory.
  242. If you want to build and package tests of the program, inherit the
  243. :ref:`ref-classes-ptest-cargo` class instead of :ref:`ref-classes-cargo`.
  244. You will find an example (that show also how to handle possible git source dependencies) in the
  245. :oe_git:`zvariant_3.12.0.bb </openembedded-core/tree/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb>`
  246. recipe. Another example, with only crate dependencies, is the
  247. :oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
  248. recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
  249. tool.
  250. This class inherits the :ref:`ref-classes-cargo_common` class.
  251. .. _ref-classes-cargo_c:
  252. ``cargo_c``
  253. ===========
  254. The :ref:`ref-classes-cargo_c` class can be inherited by a recipe to generate
  255. a Rust library that can be called by C/C++ code. The recipe which inherits this
  256. class has to only replace ``inherit cargo`` by ``inherit cargo_c``.
  257. See the :yocto_git:`rust-c-lib-example_git.bb
  258. </poky/tree/meta-selftest/recipes-devtools/rust/rust-c-lib-example_git.bb>`
  259. example recipe.
  260. .. _ref-classes-cargo_common:
  261. ``cargo_common``
  262. ================
  263. The :ref:`ref-classes-cargo_common` class is an internal class
  264. that is not intended to be used directly.
  265. An exception is the "rust" recipe, to build the Rust compiler and runtime
  266. library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
  267. class. This is why this class was introduced.
  268. .. _ref-classes-cargo-update-recipe-crates:
  269. ``cargo-update-recipe-crates``
  270. ===============================
  271. The :ref:`ref-classes-cargo-update-recipe-crates` class allows
  272. recipe developers to update the list of Cargo crates in :term:`SRC_URI`
  273. by reading the ``Cargo.lock`` file in the source tree.
  274. To do so, create a recipe for your program, for example using
  275. :doc:`devtool </ref-manual/devtool-reference>`,
  276. make it inherit the :ref:`ref-classes-cargo` and
  277. :ref:`ref-classes-cargo-update-recipe-crates` and run::
  278. bitbake -c update_crates recipe
  279. This creates a ``recipe-crates.inc`` file that you can include in your
  280. recipe::
  281. require ${BPN}-crates.inc
  282. That's also something you can achieve by using the
  283. `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
  284. .. _ref-classes-ccache:
  285. ``ccache``
  286. ==========
  287. The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
  288. This class is used to give a minor performance boost during the build.
  289. See https://ccache.samba.org/ for information on the C/C++ Compiler
  290. Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
  291. file for details about how to enable this mechanism in your configuration
  292. file, how to disable it for specific recipes, and how to share ``ccache``
  293. files between builds.
  294. However, using the class can lead to unexpected side-effects. Thus, using
  295. this class is not recommended.
  296. .. _ref-classes-chrpath:
  297. ``chrpath``
  298. ===========
  299. The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
  300. is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
  301. :ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
  302. in order to make them relocatable.
  303. .. _ref-classes-cmake:
  304. ``cmake``
  305. =========
  306. The :ref:`ref-classes-cmake` class allows recipes to build software using the
  307. `CMake <https://cmake.org/overview/>`__ build system. You can use the
  308. :term:`EXTRA_OECMAKE` variable to specify additional configuration options to
  309. pass to the ``cmake`` command line.
  310. By default, the :ref:`ref-classes-cmake` class uses
  311. `Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
  312. offers better build performance. If a recipe is broken with Ninja, then the
  313. recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
  314. use GNU make instead.
  315. If you need to install custom CMake toolchain files supplied by the application
  316. being built, you should install them (during :ref:`ref-tasks-install`) to the
  317. preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
  318. .. _ref-classes-cmake-qemu:
  319. ``cmake-qemu``
  320. ==============
  321. The :ref:`ref-classes-cmake-qemu` class might be used instead of the
  322. :ref:`ref-classes-cmake` class. In addition to the features provided by the
  323. :ref:`ref-classes-cmake` class, the :ref:`ref-classes-cmake-qemu` class passes
  324. the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use
  325. QEMU user-mode emulation for the execution of cross-compiled binaries on the
  326. host machine. For more information about ``CMAKE_CROSSCOMPILING_EMULATOR``
  327. please refer to the `related section of the CMake documentation
  328. <https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__.
  329. Not all platforms are supported by QEMU. This class only works for machines with
  330. ``qemu-usermode`` in the :ref:`ref-features-machine`. Using QEMU user-mode therefore
  331. involves a certain risk, which is also the reason why this feature is not part of
  332. the main :ref:`ref-classes-cmake` class by default.
  333. One use case is the execution of cross-compiled unit tests with CTest on the build
  334. machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured::
  335. cmake --build --target test
  336. works transparently with QEMU user-mode.
  337. If the CMake project is developed with this use case in mind this works very nicely.
  338. This also applies to an IDE configured to use ``cmake-native`` for cross-compiling.
  339. .. _ref-classes-cml1:
  340. ``cml1``
  341. ========
  342. The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
  343. build configuration system. "cml" stands for "Configuration Menu Language", which
  344. originates from the Linux kernel but is also used in other projects such as U-Boot
  345. and BusyBox. It could have been called "kconfig" too.
  346. .. _ref-classes-compress_doc:
  347. ``compress_doc``
  348. ================
  349. Enables compression for manual and info pages. This class is intended
  350. to be inherited globally. The default compression mechanism is gz (gzip)
  351. but you can select an alternative mechanism by setting the
  352. :term:`DOC_COMPRESS` variable.
  353. .. _ref-classes-copyleft_compliance:
  354. ``copyleft_compliance``
  355. =======================
  356. The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
  357. of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
  358. class and is still used by some users even though it has been deprecated
  359. in favor of the :ref:`ref-classes-archiver` class.
  360. .. _ref-classes-copyleft_filter:
  361. ``copyleft_filter``
  362. ===================
  363. A class used by the :ref:`ref-classes-archiver` and
  364. :ref:`ref-classes-copyleft_compliance` classes
  365. for filtering licenses. The ``copyleft_filter`` class is an internal
  366. class and is not intended to be used directly.
  367. .. _ref-classes-core-image:
  368. ``core-image``
  369. ==============
  370. The :ref:`ref-classes-core-image` class provides common definitions for the
  371. ``core-image-*`` image recipes, such as support for additional
  372. :term:`IMAGE_FEATURES`.
  373. .. _ref-classes-cpan:
  374. ``cpan*``
  375. =========
  376. The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
  377. Recipes for Perl modules are simple. These recipes usually only need to
  378. point to the source's archive and then inherit the proper class file.
  379. Building is split into two methods depending on which method the module
  380. authors used.
  381. - Modules that use old ``Makefile.PL``-based build system require
  382. ``cpan.bbclass`` in their recipes.
  383. - Modules that use ``Build.PL``-based build system require using
  384. ``cpan_build.bbclass`` in their recipes.
  385. Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
  386. support.
  387. .. _ref-classes-create-spdx:
  388. ``create-spdx``
  389. ===============
  390. The :ref:`ref-classes-create-spdx` class provides support for
  391. automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
  392. and SDK contents.
  393. This class is meant to be inherited globally from a configuration file::
  394. INHERIT += "create-spdx"
  395. The toplevel :term:`SPDX` output file is generated in JSON format as a
  396. ``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
  397. :term:`Build Directory`. There are other related files in the same directory,
  398. as well as in ``tmp/deploy/spdx``.
  399. The exact behaviour of this class, and the amount of output can be controlled
  400. by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
  401. :term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
  402. See the description of these variables and the
  403. ":ref:`dev-manual/sbom:creating a software bill of materials`"
  404. section in the Yocto Project Development Manual for more details.
  405. .. _ref-classes-cross:
  406. ``cross``
  407. =========
  408. The :ref:`ref-classes-cross` class provides support for the recipes that build the
  409. cross-compilation tools.
  410. .. _ref-classes-cross-canadian:
  411. ``cross-canadian``
  412. ==================
  413. The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
  414. the Canadian Cross-compilation tools for SDKs. See the
  415. ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  416. section in the Yocto Project Overview and Concepts Manual for more
  417. discussion on these cross-compilation tools.
  418. .. _ref-classes-crosssdk:
  419. ``crosssdk``
  420. ============
  421. The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
  422. cross-compilation tools used for building SDKs. See the
  423. ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  424. section in the Yocto Project Overview and Concepts Manual for more
  425. discussion on these cross-compilation tools.
  426. .. _ref-classes-cve-check:
  427. ``cve-check``
  428. =============
  429. The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
  430. and Exposures) while building with BitBake. This class is meant to be
  431. inherited globally from a configuration file::
  432. INHERIT += "cve-check"
  433. To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
  434. add following line to the build configuration file::
  435. include cve-extra-exclusions.inc
  436. You can also look for vulnerabilities in specific packages by passing
  437. ``-c cve_check`` to BitBake.
  438. After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
  439. and image specific summaries in ``tmp/deploy/images/*.json`` files.
  440. When building, the CVE checker will emit build time warnings for any detected
  441. issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
  442. and version being compiled and no patches to address the issue are applied. Other states
  443. for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
  444. applied, and ``Ignored`` meaning that the issue can be ignored.
  445. The ``Patched`` state of a CVE issue is detected from patch files with the format
  446. ``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
  447. CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
  448. .. note::
  449. Commit message metadata (``CVE: CVE-ID`` in a patch header) will not be scanned
  450. in any patches that are remote, i.e. that are anything other than local files
  451. referenced via ``file://`` in SRC_URI. However, a ``CVE-ID`` in a remote patch
  452. file name itself will be registered.
  453. If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
  454. mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
  455. CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
  456. If CVE check reports that a recipe contains false positives or false negatives, these may be
  457. fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
  458. :term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
  459. database vendor and product pairs using the syntax::
  460. CVE_PRODUCT = "flex_project:flex"
  461. where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
  462. if the default recipe version :term:`PV` does not match the version numbers of the software component
  463. in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
  464. CVE database compatible version number, for example::
  465. CVE_VERSION = "2.39"
  466. Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
  467. via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
  468. Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
  469. patching and updating the software should be done as a regular process. The data and assumptions
  470. required for CVE checker to reliably detect issues are frequently broken in various ways.
  471. These can only be detected by reviewing the details of the issues and iterating over the generated reports,
  472. and following what happens in other Linux distributions and in the greater open source community.
  473. You will find some more details in the
  474. ":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
  475. section in the Development Tasks Manual.
  476. .. _ref-classes-cython:
  477. ``cython``
  478. ==========
  479. The :ref:`ref-classes-cython` class can be used by Python recipes that require
  480. `Cython <https://cython.org/>`__ as part of their build dependencies
  481. (:term:`DEPENDS`).
  482. .. _ref-classes-debian:
  483. ``debian``
  484. ==========
  485. The :ref:`ref-classes-debian` class renames output packages so that they follow the
  486. Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
  487. ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
  488. name and version as part of the package name.
  489. If a recipe creates packages for multiple libraries (shared object files
  490. of ``.so`` type), use the :term:`LEAD_SONAME`
  491. variable in the recipe to specify the library on which to apply the
  492. naming scheme.
  493. .. _ref-classes-deploy:
  494. ``deploy``
  495. ==========
  496. The :ref:`ref-classes-deploy` class handles deploying files to the
  497. :term:`DEPLOY_DIR_IMAGE` directory. The main
  498. function of this class is to allow the deploy step to be accelerated by
  499. shared state. Recipes that inherit this class should define their own
  500. :ref:`ref-tasks-deploy` function to copy the files to be
  501. deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
  502. add the task at the appropriate place, which is usually after
  503. :ref:`ref-tasks-compile` or
  504. :ref:`ref-tasks-install`. The class then takes care of
  505. staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
  506. .. _ref-classes-devicetree:
  507. ``devicetree``
  508. ==============
  509. The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
  510. device tree source files that are not in the kernel tree.
  511. The compilation of out-of-tree device tree sources is the same as the kernel
  512. in-tree device tree compilation process. This includes the ability to include
  513. sources from the kernel such as SoC ``dtsi`` files as well as C header files,
  514. such as ``gpio.h``.
  515. The :ref:`ref-tasks-compile` task will compile two kinds of files:
  516. - Regular device tree sources with a ``.dts`` extension.
  517. - Device tree overlays, detected from the presence of the ``/plugin/;``
  518. string in the file contents.
  519. This class deploys the generated device tree binaries into
  520. ``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
  521. what the :ref:`ref-classes-kernel-devicetree` class does, with the added
  522. ``devicetree`` subdirectory to avoid name clashes. Additionally, the device
  523. trees are populated into the sysroot for access via the sysroot from within
  524. other recipes.
  525. By default, all device tree sources located in :term:`DT_FILES_PATH` directory
  526. are compiled. To select only particular sources, set :term:`DT_FILES` to
  527. a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
  528. convenience, both ``.dts`` and ``.dtb`` extensions can be used.
  529. An extra padding is appended to non-overlay device trees binaries. This
  530. can typically be used as extra space for adding extra properties at boot time.
  531. The padding size can be modified by setting :term:`DT_PADDING_SIZE`
  532. to the desired size, in bytes.
  533. See :oe_git:`devicetree.bbclass sources
  534. </openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
  535. for further variables controlling this class.
  536. Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
  537. recipe inheriting this class::
  538. inherit devicetree
  539. COMPATIBLE_MACHINE = "^mymachine$"
  540. SRC_URI:mymachine = "file://mymachine.dts"
  541. .. _ref-classes-devshell:
  542. ``devshell``
  543. ============
  544. The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
  545. policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
  546. section in the Yocto Project Development Tasks Manual for more
  547. information about using :ref:`ref-classes-devshell`.
  548. .. _ref-classes-devupstream:
  549. ``devupstream``
  550. ===============
  551. The :ref:`ref-classes-devupstream` class uses
  552. :term:`BBCLASSEXTEND` to add a variant of the
  553. recipe that fetches from an alternative URI (e.g. Git) instead of a
  554. tarball. Here is an example::
  555. BBCLASSEXTEND = "devupstream:target"
  556. SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
  557. SRCREV:class-devupstream = "abcd1234"
  558. Adding the above statements to your recipe creates a variant that has
  559. :term:`DEFAULT_PREFERENCE` set to "-1".
  560. Consequently, you need to select the variant of the recipe to use it.
  561. Any development-specific adjustments can be done by using the
  562. ``class-devupstream`` override. Here is an example::
  563. DEPENDS:append:class-devupstream = " gperf-native"
  564. do_configure:prepend:class-devupstream() {
  565. touch ${S}/README
  566. }
  567. The class
  568. currently only supports creating a development variant of the target
  569. recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
  570. The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
  571. support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
  572. functionality can be added in a future release.
  573. Support for other version control systems such as Subversion is limited
  574. due to BitBake's automatic fetch dependencies (e.g.
  575. ``subversion-native``).
  576. .. _ref-classes-externalsrc:
  577. ``externalsrc``
  578. ===============
  579. The :ref:`ref-classes-externalsrc` class supports building software from source code
  580. that is external to the OpenEmbedded build system. Building software
  581. from an external source tree means that the build system's normal fetch,
  582. unpack, and patch process is not used.
  583. By default, the OpenEmbedded build system uses the :term:`S`
  584. and :term:`B` variables to locate unpacked recipe source code
  585. and to build it, respectively. When your recipe inherits the
  586. :ref:`ref-classes-externalsrc` class, you use the
  587. :term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
  588. ultimately define :term:`S` and :term:`B`.
  589. By default, this class expects the source code to support recipe builds
  590. that use the :term:`B` variable to point to the directory in
  591. which the OpenEmbedded build system places the generated objects built
  592. from the recipes. By default, the :term:`B` directory is set to the
  593. following, which is separate from the source directory (:term:`S`)::
  594. ${WORKDIR}/${BPN}-{PV}/
  595. See these variables for more information:
  596. :term:`WORKDIR`, :term:`BPN`, and
  597. :term:`PV`,
  598. For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
  599. ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
  600. For information on how to use the :ref:`ref-classes-externalsrc` class, see the
  601. ":ref:`dev-manual/building:building software from an external source`"
  602. section in the Yocto Project Development Tasks Manual.
  603. .. _ref-classes-extrausers:
  604. ``extrausers``
  605. ==============
  606. The :ref:`ref-classes-extrausers` class allows additional user and group configuration
  607. to be applied at the image level. Inheriting this class either globally
  608. or from an image recipe allows additional user and group operations to
  609. be performed using the
  610. :term:`EXTRA_USERS_PARAMS` variable.
  611. .. note::
  612. The user and group operations added using the :ref:`ref-classes-extrausers`
  613. class are not tied to a specific recipe outside of the recipe for the
  614. image. Thus, the operations can be performed across the image as a
  615. whole. Use the :ref:`ref-classes-useradd` class to add user and group
  616. configuration to a specific recipe.
  617. Here is an example that uses this class in an image recipe::
  618. inherit extrausers
  619. EXTRA_USERS_PARAMS = "\
  620. useradd -p '' tester; \
  621. groupadd developers; \
  622. userdel nobody; \
  623. groupdel -g video; \
  624. groupmod -g 1020 developers; \
  625. usermod -s /bin/sh tester; \
  626. "
  627. Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
  628. passwords. First on host, create the (escaped) password hash::
  629. printf "%q" $(mkpasswd -m sha256crypt tester01)
  630. The resulting hash is set to a variable and used in ``useradd`` command parameters::
  631. inherit extrausers
  632. PASSWD = "\$X\$ABC123\$A-Long-Hash"
  633. EXTRA_USERS_PARAMS = "\
  634. useradd -p '${PASSWD}' tester-jim; \
  635. useradd -p '${PASSWD}' tester-sue; \
  636. "
  637. Finally, here is an example that sets the root password::
  638. inherit extrausers
  639. EXTRA_USERS_PARAMS = "\
  640. usermod -p '${PASSWD}' root; \
  641. "
  642. .. note::
  643. From a security perspective, hardcoding a default password is not
  644. generally a good idea or even legal in some jurisdictions. It is
  645. recommended that you do not do this if you are building a production
  646. image.
  647. .. _ref-classes-features_check:
  648. ``features_check``
  649. ==================
  650. The :ref:`ref-classes-features_check` class allows individual recipes to check
  651. for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
  652. or :term:`COMBINED_FEATURES`.
  653. This class provides support for the following variables:
  654. - :term:`REQUIRED_DISTRO_FEATURES`
  655. - :term:`CONFLICT_DISTRO_FEATURES`
  656. - :term:`ANY_OF_DISTRO_FEATURES`
  657. - ``REQUIRED_MACHINE_FEATURES``
  658. - ``CONFLICT_MACHINE_FEATURES``
  659. - ``ANY_OF_MACHINE_FEATURES``
  660. - ``REQUIRED_COMBINED_FEATURES``
  661. - ``CONFLICT_COMBINED_FEATURES``
  662. - ``ANY_OF_COMBINED_FEATURES``
  663. If any conditions specified in the recipe using the above
  664. variables are not met, the recipe will be skipped, and if the
  665. build system attempts to build the recipe then an error will be
  666. triggered.
  667. .. _ref-classes-fontcache:
  668. ``fontcache``
  669. =============
  670. The :ref:`ref-classes-fontcache` class generates the proper post-install and
  671. post-remove (postinst and postrm) scriptlets for font packages. These
  672. scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
  673. to the font information cache. Since the cache files are
  674. architecture-specific, ``fc-cache`` runs using QEMU if the postinst
  675. scriptlets need to be run on the build host during image creation.
  676. If the fonts being installed are in packages other than the main
  677. package, set :term:`FONT_PACKAGES` to specify the
  678. packages containing the fonts.
  679. .. _ref-classes-fs-uuid:
  680. ``fs-uuid``
  681. ===========
  682. The :ref:`ref-classes-fs-uuid` class extracts UUID from
  683. ``${``\ :term:`ROOTFS`\ ``}``, which must have been built
  684. by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
  685. works on ``ext`` file systems and depends on ``tune2fs``.
  686. .. _ref-classes-gconf:
  687. ``gconf``
  688. =========
  689. The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
  690. to install GConf schemas. The schemas will be put into a separate
  691. package (``${``\ :term:`PN`\ ``}-gconf``) that is created
  692. automatically when this class is inherited. This package uses the
  693. appropriate post-install and post-remove (postinst/postrm) scriptlets to
  694. register and unregister the schemas in the target image.
  695. .. _ref-classes-gettext:
  696. ``gettext``
  697. ===========
  698. The :ref:`ref-classes-gettext` class provides support for building
  699. software that uses the GNU ``gettext`` internationalization and localization
  700. system. All recipes building software that use ``gettext`` should inherit this
  701. class.
  702. .. _ref-classes-github-releases:
  703. ``github-releases``
  704. ===================
  705. For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
  706. class sets up a standard way for checking available upstream versions
  707. (to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
  708. To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
  709. and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
  710. then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
  711. in the value you set for :term:`SRC_URI` within the recipe.
  712. .. _ref-classes-gnomebase:
  713. ``gnomebase``
  714. =============
  715. The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
  716. software from the GNOME stack. This class sets
  717. :term:`SRC_URI` to download the source from the GNOME
  718. mirrors as well as extending :term:`FILES` with the typical
  719. GNOME installation paths.
  720. .. _ref-classes-go:
  721. ``go``
  722. ======
  723. The :ref:`ref-classes-go` class supports building Go programs. The behavior of
  724. this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
  725. by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
  726. To build a Go program with the Yocto Project, you can use the
  727. :yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
  728. recipe as an example.
  729. .. _ref-classes-go-mod:
  730. ``go-mod``
  731. ==========
  732. The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
  733. :ref:`ref-classes-go` class.
  734. See the associated :term:`GO_WORKDIR` variable.
  735. .. _ref-classes-go-mod-update-modules:
  736. ``go-mod-update-modules``
  737. =========================
  738. The :ref:`ref-classes-go-mod-update-modules` class can be used in Go recipes and
  739. defines a ``do_update_modules`` task that can be run manually to update two
  740. files ("BPN" below corresponds to :term:`BPN`):
  741. - ``BPN-go-mods.inc``: list of Go modules the recipe depends on.
  742. - ``BPN-licenses.inc``: list of licenses for each Go modules the recipe depends
  743. on.
  744. These files can then updated automatically with the ``do_update_modules`` task.
  745. .. _ref-classes-go-vendor:
  746. ``go-vendor``
  747. =============
  748. The :ref:`ref-classes-go-vendor` class implements support for offline builds,
  749. also known as Go vendoring. In such a scenario, the module dependencias are
  750. downloaded during the :ref:`ref-tasks-fetch` task rather than when modules are
  751. imported, thus being coherent with Yocto's concept of fetching every source
  752. beforehand.
  753. The dependencies are unpacked into the modules' ``vendor`` directory, where a
  754. manifest file is generated.
  755. .. _ref-classes-gobject-introspection:
  756. ``gobject-introspection``
  757. =========================
  758. Provides support for recipes building software that supports GObject
  759. introspection. This functionality is only enabled if the
  760. "gobject-introspection-data" feature is in
  761. :term:`DISTRO_FEATURES` as well as
  762. "qemu-usermode" being in
  763. :term:`MACHINE_FEATURES`.
  764. .. note::
  765. This functionality is :ref:`backfilled <ref-features-backfill>` by default
  766. and, if not applicable, should be disabled through
  767. :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
  768. :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
  769. .. _ref-classes-grub-efi:
  770. ``grub-efi``
  771. ============
  772. The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
  773. building bootable images.
  774. This class supports several variables:
  775. - :term:`INITRD`: Indicates list of filesystem images to
  776. concatenate and use as an initial RAM disk (initrd) (optional).
  777. Can be specified for each ``LABEL``.
  778. - :term:`ROOTFS`: Indicates a filesystem image to include
  779. as the root filesystem (optional).
  780. - :term:`GRUB_GFXSERIAL`: Set this to "1" to have
  781. graphics and serial in the boot menu.
  782. - :term:`LABELS`: A list of targets for the automatic
  783. configuration.
  784. - :term:`APPEND`: An override list of append strings for
  785. each ``LABEL``.
  786. - :term:`GRUB_TITLE`: A custom title for each ``LABEL``. If a label does not
  787. have a custom title, the label is used as title for the GRUB menu entry.
  788. - :term:`GRUB_OPTS`: Additional options to add to the
  789. configuration (optional). Options are delimited using semi-colon
  790. characters (``;``).
  791. - :term:`GRUB_TIMEOUT`: Timeout before executing
  792. the default ``LABEL`` (optional).
  793. Each ``LABEL`` defined in the :term:`LABELS` variable creates a GRUB boot
  794. entry, and some variables can be defined individually per ``LABEL``. The label
  795. specific override names are defined as ``grub_LABEL``.
  796. For example, for a label ``factory``, the override name would be
  797. ``grub_factory``. A custom GRUB menu entry titled "Factory Install" with the
  798. additional parameter ``factory=yes`` can be achieved as follows::
  799. LABELS:append = " factory"
  800. APPEND:grub_factory = "factory=yes"
  801. GRUB_TITLE:grub_factory = "Factory Install"
  802. .. _ref-classes-gsettings:
  803. ``gsettings``
  804. =============
  805. The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
  806. need to install GSettings (glib) schemas. The schemas are assumed to be
  807. part of the main package. Appropriate post-install and post-remove
  808. (postinst/postrm) scriptlets are added to register and unregister the
  809. schemas in the target image.
  810. .. _ref-classes-gtk-doc:
  811. ``gtk-doc``
  812. ===========
  813. The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
  814. ``gtk-doc`` dependencies and disable ``gtk-doc``.
  815. .. _ref-classes-gtk-icon-cache:
  816. ``gtk-icon-cache``
  817. ==================
  818. The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
  819. post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
  820. install icons. These scriptlets call ``gtk-update-icon-cache`` to add
  821. the fonts to GTK+'s icon cache. Since the cache files are
  822. architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
  823. the postinst scriptlets need to be run on the build host during image
  824. creation.
  825. .. _ref-classes-gtk-immodules-cache:
  826. ``gtk-immodules-cache``
  827. =======================
  828. The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
  829. post-remove (postinst/postrm) scriptlets for packages that install GTK+
  830. input method modules for virtual keyboards. These scriptlets call
  831. ``gtk-update-icon-cache`` to add the input method modules to the cache.
  832. Since the cache files are architecture-specific,
  833. ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
  834. need to be run on the build host during image creation.
  835. If the input method modules being installed are in packages other than
  836. the main package, set
  837. :term:`GTKIMMODULES_PACKAGES` to specify
  838. the packages containing the modules.
  839. .. _ref-classes-gzipnative:
  840. ``gzipnative``
  841. ==============
  842. The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
  843. ``gzip`` and ``pigz`` rather than the versions of these tools from the
  844. build host.
  845. .. _ref-classes-image:
  846. ``image``
  847. =========
  848. The :ref:`ref-classes-image` class helps support creating images in different formats.
  849. First, the root filesystem is created from packages using one of the
  850. ``rootfs*.bbclass`` files (depending on the package format used) and
  851. then one or more image files are created.
  852. - The :term:`IMAGE_FSTYPES` variable controls the types of images to
  853. generate.
  854. - The :term:`IMAGE_INSTALL` variable controls the list of packages to
  855. install into the image.
  856. For information on customizing images, see the
  857. ":ref:`dev-manual/customizing-images:customizing images`" section
  858. in the Yocto Project Development Tasks Manual. For information on how
  859. images are created, see the
  860. ":ref:`overview-manual/concepts:images`" section in the
  861. Yocto Project Overview and Concepts Manual.
  862. .. _ref-classes-image-buildinfo:
  863. ``image-buildinfo``
  864. ===================
  865. The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
  866. build information to the target filesystem at ``${sysconfdir}/buildinfo``
  867. by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
  868. This can be useful for manually determining the origin of any given
  869. image. It writes out two sections:
  870. #. `Build Configuration`: a list of variables and their values (specified
  871. by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
  872. :term:`DISTRO_VERSION`)
  873. #. `Layer Revisions`: the revisions of all of the layers used in the
  874. build.
  875. Additionally, when building an SDK it will write the same contents
  876. to ``/buildinfo`` by default (as specified by
  877. :term:`SDK_BUILDINFO_FILE`).
  878. .. _ref-classes-image_types:
  879. ``image_types``
  880. ===============
  881. The :ref:`ref-classes-image_types` class defines all of the standard image output types
  882. that you can enable through the
  883. :term:`IMAGE_FSTYPES` variable. You can use this
  884. class as a reference on how to add support for custom image output
  885. types.
  886. By default, the :ref:`ref-classes-image` class automatically
  887. enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
  888. ``IMGCLASSES`` variable as follows::
  889. IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
  890. # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
  891. # in the non-Linux SDK_OS case, such as mingw32
  892. inherit populate_sdk_base
  893. IMGCLASSES += "${@['', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
  894. IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
  895. IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
  896. IMGCLASSES += "image_types_wic"
  897. IMGCLASSES += "rootfs-postcommands"
  898. IMGCLASSES += "image-postinst-intercepts"
  899. IMGCLASSES += "overlayfs-etc"
  900. inherit_defer ${IMGCLASSES}
  901. The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
  902. .. note::
  903. To build a VMware VMDK image, you need to add "wic.vmdk" to
  904. :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
  905. Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
  906. .. _ref-classes-image-live:
  907. ``image-live``
  908. ==============
  909. This class controls building "live" (i.e. HDDIMG and ISO) images. Live
  910. images contain syslinux for legacy booting, as well as the bootloader
  911. specified by :term:`EFI_PROVIDER` if
  912. :term:`MACHINE_FEATURES` contains "efi".
  913. Normally, you do not use this class directly. Instead, you add "live" to
  914. :term:`IMAGE_FSTYPES`.
  915. .. _ref-classes-insane:
  916. ``insane``
  917. ==========
  918. The :ref:`ref-classes-insane` class adds a step to the package generation process so
  919. that output quality assurance checks are generated by the OpenEmbedded
  920. build system. A range of checks are performed that check the build's
  921. output for common problems that show up during runtime. Distribution
  922. policy usually dictates whether to include this class.
  923. You can configure the sanity checks so that specific test failures
  924. either raise a warning or an error message. Typically, failures for new
  925. tests generate a warning. Subsequent failures for the same test would
  926. then generate an error message once the metadata is in a known and good
  927. condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
  928. and error messages you might encounter using a default configuration.
  929. Use the :term:`WARN_QA` and
  930. :term:`ERROR_QA` variables to control the behavior of
  931. these checks at the global level (i.e. in your custom distro
  932. configuration). However, to skip one or more checks in recipes, you
  933. should use :term:`INSANE_SKIP`. For example, to skip
  934. the check for symbolic link ``.so`` files in the main package of a
  935. recipe, add the following to the recipe. You need to realize that the
  936. package name override, in this example ``${PN}``, must be used::
  937. INSANE_SKIP:${PN} += "dev-so"
  938. Please keep in mind that the QA checks
  939. are meant to detect real or potential problems in the packaged
  940. output. So exercise caution when disabling these checks.
  941. The tests you can list with the :term:`WARN_QA` and
  942. :term:`ERROR_QA` variables are documented in the :doc:`/ref-manual/qa-checks`
  943. document of the Yocto Project Reference Manual.
  944. .. _ref-classes-kernel:
  945. ``kernel``
  946. ==========
  947. The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
  948. code to build all kernel trees. All needed headers are staged into the
  949. :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
  950. using the :ref:`ref-classes-module` class.
  951. If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
  952. :ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
  953. so it is automatically used as the kernel configuration for the build. This
  954. copy is not performed in case ``.config`` already exists there: this allows
  955. recipes to produce a configuration by other means in
  956. ``do_configure:prepend``.
  957. Each built kernel module is packaged separately and inter-module
  958. dependencies are created by parsing the ``modinfo`` output. If all modules
  959. are required, then installing the ``kernel-modules`` package installs all
  960. packages with modules and various other kernel packages such as
  961. ``kernel-vmlinux``.
  962. The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
  963. RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
  964. information on how to build an :term:`Initramfs`, see the
  965. ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
  966. the Yocto Project Development Tasks Manual.
  967. Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
  968. internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
  969. :ref:`ref-classes-linux-kernel-base` classes.
  970. .. _ref-classes-kernel-arch:
  971. ``kernel-arch``
  972. ===============
  973. The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
  974. Linux kernel compilation (including modules).
  975. .. _ref-classes-kernel-devicetree:
  976. ``kernel-devicetree``
  977. =====================
  978. The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
  979. :ref:`ref-classes-kernel` class, supports device tree generation.
  980. Its behavior is mainly controlled by the following variables:
  981. - :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
  982. - :term:`KERNEL_DTBDEST`: directory where to install DTB files
  983. - :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
  984. - :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
  985. - :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
  986. .. _ref-classes-kernel-fit-image:
  987. ``kernel-fit-image``
  988. ====================
  989. The :ref:`ref-classes-kernel-fit-image` class provides support to pack a kernel image,
  990. device trees, a U-boot script, and an :term:`Initramfs` into a single FIT image.
  991. In theory, a FIT image can support any number of kernels, U-boot scripts,
  992. :term:`Initramfs`, and device trees.
  993. However, :ref:`ref-classes-kernel-fit-image` currently only supports
  994. limited usecases: just one kernel image, an optional U-boot script,
  995. an optional :term:`Initramfs`, and any number of device trees.
  996. The FIT image is created by a recipe which inherits the
  997. :ref:`ref-classes-kernel-fit-image` class.
  998. One such example is the ``linux-yocto-fitimage`` recipe which creates a FIT
  999. image for the Linux Yocto kernel.
  1000. Additionally, it is required that :term:`KERNEL_CLASSES` is set to include
  1001. :ref:`ref-classes-kernel-fit-extra-artifacts`.
  1002. The :ref:`ref-classes-kernel-fit-extra-artifacts` class exposes the required kernel
  1003. artifacts to the :term:`DEPLOY_DIR_IMAGE` which are used by the
  1004. :ref:`ref-classes-kernel-fit-image` class to create the FIT image.
  1005. The simplest example for building a FIT image is to add::
  1006. KERNEL_CLASSES += "kernel-fit-extra-artifacts"
  1007. to the machine :term:`configuration file` and to execute::
  1008. bitbake linux-yocto-fitimage
  1009. This results in a ``fitImage`` file deployed to the :term:`DEPLOY_DIR_IMAGE`
  1010. directory and a ``linux-yocto-fitimage`` package which can be installed.
  1011. The same approach works for all variants of the ``linux-yocto`` kernel.
  1012. For example, if the ``linux-yocto-rt`` kernel should be used, add the following
  1013. lines to the machine configuration file::
  1014. KERNEL_CLASSES += "kernel-fit-extra-artifacts"
  1015. PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt"
  1016. The FIT image, this time including the RT kernel, is built again by calling::
  1017. bitbake linux-yocto-fitimage
  1018. For other kernels provided by other layers, the same approach would work.
  1019. However, it is usually more intuitive to add a custom FIT image recipe next to
  1020. the custom kernel recipe.
  1021. For example, if a layer provides a ``linux-vanilla`` recipe, a
  1022. ``linux-vanilla-fitimage`` recipe may be added as well.
  1023. The ``linux-vanilla-fitimage`` recipe can be created as a customized copy of
  1024. the ``linux-yocto-fitimage`` recipe.
  1025. Usually the kernel is built as a dependency of an image.
  1026. If the FIT image should be used as a replacement for the kernel image which
  1027. is installed in the root filesystem, then the following variables can be set
  1028. e.g. in the machine configuration file::
  1029. # Create and deploy the vmlinux artifact which gets included into the FIT image
  1030. KERNEL_CLASSES += "kernel-fit-extra-artifacts"
  1031. # Do not install the kernel image package
  1032. RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""
  1033. # Install the FIT image package
  1034. MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "linux-yocto-fitimage"
  1035. # Configure the image.bbclass to depend on the FIT image instead of only
  1036. # the kernel to ensure the FIT image is built and deployed with the image
  1037. KERNEL_DEPLOY_DEPEND = "linux-yocto-fitimage:do_deploy"
  1038. The :ref:`ref-classes-kernel-fit-image` class processes several variables that
  1039. allow configuration:
  1040. - The options for the device tree compiler passed to ``mkimage -D``
  1041. when creating the FIT image are specified using the
  1042. :term:`UBOOT_MKIMAGE_DTCOPTS` variable.
  1043. - Only a single kernel can be added to the FIT image created by
  1044. :ref:`ref-classes-kernel-fit-image` and it is a mandatory component of the
  1045. FIT image.
  1046. The address where the kernel image is to be loaded by U-Boot is
  1047. specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
  1048. :term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
  1049. is necessary if such addresses are 64 bit ones.
  1050. - Multiple device trees can be added to the FIT image created by
  1051. :ref:`ref-classes-kernel-fit-image` and the device tree is optional.
  1052. The address where the device tree is to be loaded by U-Boot is
  1053. specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
  1054. and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
  1055. - Only a single :term:`Initramfs` can be added to the FIT image created by
  1056. :ref:`ref-classes-kernel-fit-image`. The :term:`Initramfs` in FIT is optional.
  1057. The address where the RAM disk image is to be loaded by U-Boot
  1058. is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
  1059. :term:`UBOOT_RD_ENTRYPOINT`. The :term:`Initramfs` is added to the FIT image
  1060. when :term:`INITRAMFS_IMAGE` is specified.
  1061. - It's recommended to add the :term:`Initramfs` and the kernel image as
  1062. independent image nodes to the FIT image.
  1063. Bundling a RAM disk image with the kernel image and including the bundle
  1064. (:term:`INITRAMFS_IMAGE_BUNDLE` set to "1") in the FIT image is possible.
  1065. However, this approach has the disadvantage that any change to the RAM
  1066. disk image necessitates rebuilding the kernel image.
  1067. This process requires the full kernel build directory, which is kind of
  1068. incompatible with the :term:`SSTATE_DIR` and, consequently, with SDKs.
  1069. - Only a single U-Boot boot script can be added to the FIT image created by
  1070. :ref:`ref-classes-kernel-fit-image`. The boot script is optional.
  1071. The boot script is specified in the ITS file as a text file containing
  1072. U-Boot commands. When using a boot script the recipe which inherits the
  1073. :ref:`ref-classes-kernel-fit-image` class should add the script to
  1074. :term:`SRC_URI` and set the :term:`FIT_UBOOT_ENV` variable to the name of the
  1075. file like the following::
  1076. FIT_UBOOT_ENV = "boot.txt"
  1077. SRC_URI += "file://${FIT_UBOOT_ENV}"
  1078. At run-time, U-boot's boot command can be configured to load the boot script
  1079. from the FIT image and source it.
  1080. - The FIT image generated by the :ref:`ref-classes-kernel-fit-image` class is signed when the
  1081. variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
  1082. :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
  1083. appropriately. The default values used for :term:`FIT_HASH_ALG` and
  1084. :term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fit-image` are "sha256" and
  1085. "rsa2048" respectively. The keys for signing the FIT image can be generated using
  1086. the :ref:`ref-classes-kernel-fit-image` class when both :term:`FIT_GENERATE_KEYS` and
  1087. :term:`UBOOT_SIGN_ENABLE` are set to "1".
  1088. .. _ref-classes-kernel-fit-extra-artifacts:
  1089. ``kernel-fit-extra-artifacts``
  1090. ==============================
  1091. The :ref:`ref-classes-kernel-fit-extra-artifacts` class exposes the required
  1092. kernel artifacts to the :term:`DEPLOY_DIR_IMAGE` directory.
  1093. These artifacts are used by the :ref:`ref-classes-kernel-fit-image` class to
  1094. create a FIT image that can include the kernel, device trees, an optional
  1095. U-Boot script, and an optional Initramfs.
  1096. This class is typically included by adding it to the :term:`KERNEL_CLASSES`
  1097. variable in your kernel recipe or machine configuration when building FIT images.
  1098. It ensures that all necessary files are available for packaging into the FIT image,
  1099. such as the kernel binary, device tree blobs (DTBs), and other related files.
  1100. For example, to enable this class, set::
  1101. KERNEL_CLASSES += "kernel-fit-extra-artifacts"
  1102. This is required when using the :ref:`ref-classes-kernel-fit-image` class to
  1103. generate FIT images for your kernel.
  1104. .. _ref-classes-kernel-grub:
  1105. ``kernel-grub``
  1106. ===============
  1107. The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
  1108. the kernel as the priority boot mechanism while installing a RPM to
  1109. update the kernel on a deployed target.
  1110. .. _ref-classes-kernel-module-split:
  1111. ``kernel-module-split``
  1112. =======================
  1113. The :ref:`ref-classes-kernel-module-split` class provides common functionality for
  1114. splitting Linux kernel modules into separate packages.
  1115. .. _ref-classes-kernel-uboot:
  1116. ``kernel-uboot``
  1117. ================
  1118. The :ref:`ref-classes-kernel-uboot` class provides support for building from
  1119. vmlinux-style kernel sources.
  1120. .. _ref-classes-kernel-uimage:
  1121. ``kernel-uimage``
  1122. =================
  1123. The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
  1124. .. _ref-classes-kernel-yocto:
  1125. ``kernel-yocto``
  1126. ================
  1127. The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
  1128. from linux-yocto style kernel source repositories.
  1129. .. _ref-classes-kernelsrc:
  1130. ``kernelsrc``
  1131. =============
  1132. The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
  1133. .. _ref-classes-lib_package:
  1134. ``lib_package``
  1135. ===============
  1136. The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
  1137. produce executable binaries, where those binaries should not be
  1138. installed by default along with the library. Instead, the binaries are
  1139. added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
  1140. make their installation optional.
  1141. .. _ref-classes-libc*:
  1142. ``libc*``
  1143. =========
  1144. The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
  1145. - The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
  1146. ``libc``.
  1147. - The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
  1148. ``eglibc``.
  1149. .. _ref-classes-license:
  1150. ``license``
  1151. ===========
  1152. The :ref:`ref-classes-license` class provides license manifest creation and license
  1153. exclusion. This class is enabled by default using the default value for
  1154. the :term:`INHERIT_DISTRO` variable.
  1155. .. _ref-classes-linux-kernel-base:
  1156. ``linux-kernel-base``
  1157. =====================
  1158. The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
  1159. recipes that build out of the Linux kernel source tree. These builds
  1160. goes beyond the kernel itself. For example, the Perf recipe also
  1161. inherits this class.
  1162. .. _ref-classes-linuxloader:
  1163. ``linuxloader``
  1164. ===============
  1165. Provides the function ``linuxloader()``, which gives the value of the
  1166. dynamic loader/linker provided on the platform. This value is used by a
  1167. number of other classes.
  1168. .. _ref-classes-logging:
  1169. ``logging``
  1170. ===========
  1171. The :ref:`ref-classes-logging` class provides the standard shell functions used to log
  1172. messages for various BitBake severity levels (i.e. ``bbplain``,
  1173. ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
  1174. This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
  1175. class.
  1176. .. _ref-classes-meson:
  1177. ``meson``
  1178. =========
  1179. The :ref:`ref-classes-meson` class allows to create recipes that build software
  1180. using the `Meson <https://mesonbuild.com/>`__ build system. You can use the
  1181. :term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON`
  1182. variables to specify additional configuration options to be passed using the
  1183. ``meson`` command line.
  1184. .. _ref-classes-metadata_scm:
  1185. ``metadata_scm``
  1186. ================
  1187. The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
  1188. branch and revision of a Source Code Manager (SCM) repository.
  1189. The :ref:`ref-classes-base` class uses this class to print the revisions of
  1190. each layer before starting every build. The :ref:`ref-classes-metadata_scm`
  1191. class is enabled by default because it is inherited by the
  1192. :ref:`ref-classes-base` class.
  1193. .. _ref-classes-mime:
  1194. ``mime``
  1195. ========
  1196. The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
  1197. (postinst/postrm) scriptlets for packages that install MIME type files.
  1198. These scriptlets call ``update-mime-database`` to add the MIME types to
  1199. the shared database.
  1200. .. _ref-classes-mime-xdg:
  1201. ``mime-xdg``
  1202. ============
  1203. The :ref:`ref-classes-mime-xdg` class generates the proper
  1204. post-install and post-remove (postinst/postrm) scriptlets for packages
  1205. that install ``.desktop`` files containing ``MimeType`` entries.
  1206. These scriptlets call ``update-desktop-database`` to add the MIME types
  1207. to the database of MIME types handled by desktop files.
  1208. Thanks to this class, when users open a file through a file browser
  1209. on recently created images, they don't have to choose the application
  1210. to open the file from the pool of all known applications, even the ones
  1211. that cannot open the selected file.
  1212. If you have recipes installing their ``.desktop`` files as absolute
  1213. symbolic links, the detection of such files cannot be done by the current
  1214. implementation of this class. In this case, you have to add the corresponding
  1215. package names to the :term:`MIME_XDG_PACKAGES` variable.
  1216. .. _ref-classes-mirrors:
  1217. ``mirrors``
  1218. ===========
  1219. The :ref:`ref-classes-mirrors` class sets up some standard
  1220. :term:`MIRRORS` entries for source code mirrors. These
  1221. mirrors provide a fall-back path in case the upstream source specified
  1222. in :term:`SRC_URI` within recipes is unavailable.
  1223. This class is enabled by default since it is inherited by the
  1224. :ref:`ref-classes-base` class.
  1225. .. _ref-classes-module:
  1226. ``module``
  1227. ==========
  1228. The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
  1229. kernel modules. The class inherits the :ref:`ref-classes-module-base` and
  1230. :ref:`ref-classes-kernel-module-split` classes, and implements the
  1231. :ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
  1232. everything needed to build and package a kernel module.
  1233. For general information on out-of-tree Linux kernel modules, see the
  1234. ":ref:`kernel-dev/common:incorporating out-of-tree modules`"
  1235. section in the Yocto Project Linux Kernel Development Manual.
  1236. .. _ref-classes-module-base:
  1237. ``module-base``
  1238. ===============
  1239. The :ref:`ref-classes-module-base` class provides the base functionality for
  1240. building Linux kernel modules. Typically, a recipe that builds software that
  1241. includes one or more kernel modules and has its own means of building the module
  1242. inherits this class as opposed to inheriting the :ref:`ref-classes-module`
  1243. class.
  1244. .. _ref-classes-multilib*:
  1245. ``multilib*``
  1246. =============
  1247. The :ref:`ref-classes-multilib*` classes provide support for building libraries with
  1248. different target optimizations or target architectures and installing
  1249. them side-by-side in the same image.
  1250. For more information on using the Multilib feature, see the
  1251. ":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
  1252. section in the Yocto Project Development Tasks Manual.
  1253. .. _ref-classes-native:
  1254. ``native``
  1255. ==========
  1256. The :ref:`ref-classes-native` class provides common functionality for recipes that
  1257. build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
  1258. or other tools from the build host).
  1259. You can create a recipe that builds tools that run natively on the host
  1260. a couple different ways:
  1261. - Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
  1262. class. If you use this method, you must order the inherit statement
  1263. in the recipe after all other inherit statements so that the
  1264. :ref:`ref-classes-native` class is inherited last.
  1265. .. note::
  1266. When creating a recipe this way, the recipe name must follow this
  1267. naming convention::
  1268. myrecipe-native.bb
  1269. Not using this naming convention can lead to subtle problems
  1270. caused by existing code that depends on that naming convention.
  1271. - Or, create a :ref:`ref-classes-native` variant of any target recipe (e.g.
  1272. ``myrecipe.bb``) by adding the following to the recipe::
  1273. BBCLASSEXTEND = "native"
  1274. Inside the
  1275. recipe, use ``:class-native`` and ``:class-target`` overrides to
  1276. specify any functionality specific to the respective native or target
  1277. case.
  1278. Although applied differently, the :ref:`ref-classes-native` class is used with both
  1279. methods. The advantage of the second method is that you do not need to
  1280. have two separate recipes (assuming you need both) for native and
  1281. target. All common parts of the recipe are automatically shared.
  1282. .. _ref-classes-nativesdk:
  1283. ``nativesdk``
  1284. =============
  1285. The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
  1286. wish to build tools to run as part of an SDK (i.e. tools that run on
  1287. :term:`SDKMACHINE`).
  1288. You can create a recipe that builds tools that run on the SDK machine a
  1289. couple different ways:
  1290. - Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
  1291. :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
  1292. inherit statement in the recipe after all other inherit statements so
  1293. that the :ref:`ref-classes-nativesdk` class is inherited last.
  1294. .. note::
  1295. When creating a recipe, you must follow this naming convention::
  1296. nativesdk-myrecipe.bb
  1297. Not doing so can lead to subtle problems because there is code that
  1298. depends on the naming convention.
  1299. - Or, create a :ref:`ref-classes-nativesdk` variant of any target recipe (e.g.
  1300. ``myrecipe.bb``) by adding the following to the recipe::
  1301. BBCLASSEXTEND = "nativesdk"
  1302. Inside the
  1303. recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
  1304. specify any functionality specific to the respective SDK machine or
  1305. target case.
  1306. Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
  1307. methods. The advantage of the second method is that you do not need to
  1308. have two separate recipes (assuming you need both) for the SDK machine
  1309. and the target. All common parts of the recipe are automatically shared.
  1310. .. _ref-classes-nopackages:
  1311. ``nopackages``
  1312. ==============
  1313. Disables packaging tasks for those recipes and classes where packaging
  1314. is not needed.
  1315. .. _ref-classes-nospdx:
  1316. ``nospdx``
  1317. ==========
  1318. The :ref:`ref-classes-nospdx` allows a recipe to opt out of SPDX
  1319. generation provided by :ref:`ref-classes-create-spdx`.
  1320. .. _ref-classes-npm:
  1321. ``npm``
  1322. =======
  1323. Provides support for building Node.js software fetched using the
  1324. :wikipedia:`node package manager (NPM) <Npm_(software)>`.
  1325. .. note::
  1326. Currently, recipes inheriting this class must use the ``npm://``
  1327. fetcher to have dependencies fetched and packaged automatically.
  1328. For information on how to create NPM packages, see the
  1329. ":ref:`dev-manual/packages:creating node package manager (npm) packages`"
  1330. section in the Yocto Project Development Tasks Manual.
  1331. .. _ref-classes-oelint:
  1332. ``oelint``
  1333. ==========
  1334. The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
  1335. ``meta/classes`` in the :term:`Source Directory`.
  1336. There are some classes that could be generally useful in OE-Core but
  1337. are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
  1338. one such example. However, being aware of this class can reduce the
  1339. proliferation of different versions of similar classes across multiple
  1340. layers.
  1341. .. _ref-classes-overlayfs:
  1342. ``overlayfs``
  1343. =============
  1344. It's often desired in Embedded System design to have a read-only root filesystem.
  1345. But a lot of different applications might want to have read-write access to
  1346. some parts of a filesystem. It can be especially useful when your update mechanism
  1347. overwrites the whole root filesystem, but you may want your application data to be preserved
  1348. between updates. The :ref:`ref-classes-overlayfs` class provides a way
  1349. to achieve that by means of ``overlayfs`` and at the same time keeping the base
  1350. root filesystem read-only.
  1351. To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
  1352. layer in your machine configuration. The underlying file system can be anything that
  1353. is supported by ``overlayfs``. This has to be done in your machine configuration::
  1354. OVERLAYFS_MOUNT_POINT[data] = "/data"
  1355. .. note::
  1356. * QA checks fail to catch file existence if you redefine this variable in your recipe!
  1357. * Only the existence of the systemd mount unit file is checked, not its contents.
  1358. * To get more details on ``overlayfs``, its internals and supported operations, please refer
  1359. to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__.
  1360. The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
  1361. (e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
  1362. Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
  1363. OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
  1364. To support several mount points you can use a different variable flag. Assuming we
  1365. want to have a writable location on the file system, but do not need that the data
  1366. survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
  1367. file system.
  1368. In your machine configuration::
  1369. OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
  1370. and then in your recipe::
  1371. OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
  1372. On a practical note, your application recipe might require multiple
  1373. overlays to be mounted before running to avoid writing to the underlying
  1374. file system (which can be forbidden in case of read-only file system)
  1375. To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
  1376. helper service for mounting overlays. This helper service is named
  1377. ``${PN}-overlays.service`` and can be depended on in your application recipe
  1378. (named ``application`` in the following example) ``systemd`` unit by adding
  1379. to the unit the following::
  1380. [Unit]
  1381. After=application-overlays.service
  1382. Requires=application-overlays.service
  1383. .. note::
  1384. The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
  1385. In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
  1386. .. _ref-classes-overlayfs-etc:
  1387. ``overlayfs-etc``
  1388. =================
  1389. In order to have the ``/etc`` directory in overlayfs a special handling at early
  1390. boot stage is required. The idea is to supply a custom init script that mounts
  1391. ``/etc`` before launching the actual init program, because the latter already
  1392. requires ``/etc`` to be mounted.
  1393. Example usage in image recipe::
  1394. IMAGE_FEATURES += "overlayfs-etc"
  1395. .. note::
  1396. This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
  1397. Your machine configuration should define at least the device, mount point, and file system type
  1398. you are going to use for ``overlayfs``::
  1399. OVERLAYFS_ETC_MOUNT_POINT = "/data"
  1400. OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
  1401. OVERLAYFS_ETC_FSTYPE ?= "ext4"
  1402. To control more mount options you should consider setting mount options
  1403. (``defaults`` is used by default)::
  1404. OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
  1405. The class provides two options for ``/sbin/init`` generation:
  1406. - The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
  1407. and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
  1408. that you won't need to change any kernel parameters in order to make it work,
  1409. but it poses a restriction that package-management can't be used, because updating
  1410. the init manager would remove the generated script.
  1411. - If you wish to keep original init as is, you can set::
  1412. OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
  1413. Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
  1414. kernel parameters manually in your bootloader configuration.
  1415. .. _ref-classes-own-mirrors:
  1416. ``own-mirrors``
  1417. ===============
  1418. The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
  1419. :term:`PREMIRRORS` from which to first fetch source
  1420. before attempting to fetch it from the upstream specified in
  1421. :term:`SRC_URI` within each recipe.
  1422. To use this class, inherit it globally and specify
  1423. :term:`SOURCE_MIRROR_URL`. Here is an example::
  1424. INHERIT += "own-mirrors"
  1425. SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
  1426. You can specify only a single URL
  1427. in :term:`SOURCE_MIRROR_URL`.
  1428. .. _ref-classes-package:
  1429. ``package``
  1430. ===========
  1431. The :ref:`ref-classes-package` class supports generating packages from a build's
  1432. output. The core generic functionality is in ``package.bbclass``. The
  1433. code specific to particular package types resides in these
  1434. package-specific classes: :ref:`ref-classes-package_deb`,
  1435. :ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
  1436. You can control the list of resulting package formats by using the
  1437. :term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
  1438. configuration file, which is located in the :term:`Build Directory`.
  1439. When defining the variable, you can specify one or more package types.
  1440. Since images are generated from packages, a packaging class is needed
  1441. to enable image generation. The first class listed in this variable is
  1442. used for image generation.
  1443. If you take the optional step to set up a repository (package feed) on
  1444. the development host that can be used by DNF, you can install packages
  1445. from the feed while you are running the image on the target (i.e.
  1446. runtime installation of packages). For more information, see the
  1447. ":ref:`dev-manual/packages:using runtime package management`"
  1448. section in the Yocto Project Development Tasks Manual.
  1449. The package-specific class you choose can affect build-time performance
  1450. and has space ramifications. In general, building a package with IPK
  1451. takes about thirty percent less time as compared to using RPM to build
  1452. the same or similar package. This comparison takes into account a
  1453. complete build of the package with all dependencies previously built.
  1454. The reason for this discrepancy is because the RPM package manager
  1455. creates and processes more :term:`Metadata` than the IPK package
  1456. manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
  1457. ":ref:`ref-classes-package_ipk`" if you are building smaller systems.
  1458. Before making your package manager decision, however, you should
  1459. consider some further things about using RPM:
  1460. - RPM starts to provide more abilities than IPK due to the fact that it
  1461. processes more Metadata. For example, this information includes
  1462. individual file types, file checksum generation and evaluation on
  1463. install, sparse file support, conflict detection and resolution for
  1464. Multilib systems, ACID style upgrade, and repackaging abilities for
  1465. rollbacks.
  1466. - For smaller systems, the extra space used for the Berkeley Database
  1467. and the amount of metadata when using RPM can affect your ability to
  1468. perform on-device upgrades.
  1469. You can find additional information on the effects of the package class
  1470. at these two Yocto Project mailing list links:
  1471. - :yocto_lists:`/pipermail/poky/2011-May/006362.html`
  1472. - :yocto_lists:`/pipermail/poky/2011-May/006363.html`
  1473. .. _ref-classes-package_deb:
  1474. ``package_deb``
  1475. ===============
  1476. The :ref:`ref-classes-package_deb` class provides support for creating packages that
  1477. use the Debian (i.e. ``.deb``) file format. The class ensures the
  1478. packages are written out in a ``.deb`` file format to the
  1479. ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
  1480. This class inherits the :ref:`ref-classes-package` class and
  1481. is enabled through the :term:`PACKAGE_CLASSES`
  1482. variable in the ``local.conf`` file.
  1483. .. _ref-classes-package_ipk:
  1484. ``package_ipk``
  1485. ===============
  1486. The :ref:`ref-classes-package_ipk` class provides support for creating packages that
  1487. use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
  1488. are written out in a ``.ipk`` file format to the
  1489. ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
  1490. This class inherits the :ref:`ref-classes-package` class and
  1491. is enabled through the :term:`PACKAGE_CLASSES`
  1492. variable in the ``local.conf`` file.
  1493. .. _ref-classes-package_rpm:
  1494. ``package_rpm``
  1495. ===============
  1496. The :ref:`ref-classes-package_rpm` class provides support for creating packages that
  1497. use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
  1498. are written out in a ``.rpm`` file format to the
  1499. ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
  1500. This class inherits the :ref:`ref-classes-package` class and
  1501. is enabled through the :term:`PACKAGE_CLASSES`
  1502. variable in the ``local.conf`` file.
  1503. .. _ref-classes-packagedata:
  1504. ``packagedata``
  1505. ===============
  1506. The :ref:`ref-classes-packagedata` class provides common functionality for reading
  1507. ``pkgdata`` files found in :term:`PKGDATA_DIR`. These
  1508. files contain information about each output package produced by the
  1509. OpenEmbedded build system.
  1510. This class is enabled by default because it is inherited by the
  1511. :ref:`ref-classes-package` class.
  1512. .. _ref-classes-packagegroup:
  1513. ``packagegroup``
  1514. ================
  1515. The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
  1516. group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
  1517. so forth). It is highly recommended that all package group recipes
  1518. inherit this class.
  1519. For information on how to use this class, see the
  1520. ":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
  1521. section in the Yocto Project Development Tasks Manual.
  1522. Previously, this class was called the ``task`` class.
  1523. .. _ref-classes-patch:
  1524. ``patch``
  1525. =========
  1526. The :ref:`ref-classes-patch` class provides all functionality for applying patches
  1527. during the :ref:`ref-tasks-patch` task.
  1528. This class is enabled by default because it is inherited by the
  1529. :ref:`ref-classes-base` class.
  1530. .. _ref-classes-perlnative:
  1531. ``perlnative``
  1532. ==============
  1533. When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
  1534. native version of Perl built by the build system rather than using the
  1535. version provided by the build host.
  1536. .. _ref-classes-pypi:
  1537. ``pypi``
  1538. ========
  1539. The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
  1540. Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
  1541. By default it determines the PyPI package name based upon :term:`BPN`
  1542. (stripping the "python-" or "python3-" prefix off if present), however in
  1543. some cases you may need to set it manually in the recipe by setting
  1544. :term:`PYPI_PACKAGE`.
  1545. Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
  1546. :term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
  1547. and :term:`CVE_PRODUCT`.
  1548. .. _ref-classes-python_flit_core:
  1549. ``python_flit_core``
  1550. ====================
  1551. The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
  1552. the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
  1553. ``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
  1554. section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
  1555. Python modules built with ``flit_core.buildapi`` are pure Python (no
  1556. ``C`` or ``Rust`` extensions).
  1557. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1558. .. _ref-classes-python_maturin:
  1559. ``python_maturin``
  1560. ==================
  1561. The :ref:`ref-classes-python_maturin` class provides support for python-maturin, a replacement
  1562. for setuptools_rust and another "backend" for building Python Wheels.
  1563. .. _ref-classes-python_mesonpy:
  1564. ``python_mesonpy``
  1565. ==================
  1566. The :ref:`ref-classes-python_mesonpy` class enables building Python modules which use the
  1567. meson-python build system.
  1568. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1569. .. _ref-classes-python_pep517:
  1570. ``python_pep517``
  1571. =================
  1572. The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
  1573. archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
  1574. Recipes wouldn't inherit this directly, instead typically another class will
  1575. inherit this and add the relevant native dependencies.
  1576. Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
  1577. :ref:`ref-classes-python_setuptools_build_meta`, and
  1578. :ref:`ref-classes-python_poetry_core`.
  1579. .. _ref-classes-python_poetry_core:
  1580. ``python_poetry_core``
  1581. ======================
  1582. The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
  1583. `Poetry Core <https://python-poetry.org>`__ build system.
  1584. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1585. .. _ref-classes-python_pyo3:
  1586. ``python_pyo3``
  1587. ===============
  1588. The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
  1589. written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
  1590. environment for cross compilation.
  1591. This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
  1592. and is not meant to be used directly in recipes.
  1593. .. _ref-classes-python-setuptools3_rust:
  1594. ``python-setuptools3_rust``
  1595. ===========================
  1596. The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
  1597. extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
  1598. to compile and distribute Python extensions written in Rust as easily
  1599. as if they were written in C.
  1600. This class inherits the :ref:`ref-classes-setuptools3` and
  1601. :ref:`ref-classes-python_pyo3` classes.
  1602. .. _ref-classes-pixbufcache:
  1603. ``pixbufcache``
  1604. ===============
  1605. The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
  1606. post-remove (postinst/postrm) scriptlets for packages that install
  1607. pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
  1608. call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
  1609. Since the cache files are architecture-specific, ``update_pixbuf_cache``
  1610. is run using QEMU if the postinst scriptlets need to be run on the build
  1611. host during image creation.
  1612. If the pixbuf loaders being installed are in packages other than the
  1613. recipe's main package, set
  1614. :term:`PIXBUF_PACKAGES` to specify the packages
  1615. containing the loaders.
  1616. .. _ref-classes-pkgconfig:
  1617. ``pkgconfig``
  1618. =============
  1619. The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
  1620. library information by using ``pkg-config``. This class aims to smooth
  1621. integration of ``pkg-config`` into libraries that use it.
  1622. During staging, BitBake installs ``pkg-config`` data into the
  1623. ``sysroots/`` directory. By making use of sysroot functionality within
  1624. ``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
  1625. files.
  1626. .. _ref-classes-populate-sdk:
  1627. ``populate_sdk``
  1628. ================
  1629. The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
  1630. information on advantages gained when building a cross-development
  1631. toolchain using the :ref:`ref-tasks-populate_sdk`
  1632. task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1633. section in the Yocto Project Application Development and the Extensible
  1634. Software Development Kit (eSDK) manual.
  1635. .. _ref-classes-populate-sdk-*:
  1636. ``populate_sdk_*``
  1637. ==================
  1638. The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
  1639. following classes:
  1640. - :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
  1641. all package managers (i.e. DEB, RPM, and opkg).
  1642. - :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
  1643. package manager.
  1644. - :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
  1645. package manager.
  1646. - :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
  1647. (IPK format) package manager.
  1648. - :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
  1649. package managers.
  1650. The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
  1651. ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
  1652. :term:`IMAGE_PKGTYPE`.
  1653. The base class ensures all source and destination directories are
  1654. established and then populates the SDK. After populating the SDK, the
  1655. :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
  1656. ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
  1657. contains the cross-compiler and associated tooling, and the target,
  1658. which contains a target root filesystem that is configured for the SDK
  1659. usage. These two images reside in :term:`SDK_OUTPUT`,
  1660. which consists of the following::
  1661. ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
  1662. ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
  1663. Finally, the base populate SDK class creates the toolchain environment
  1664. setup script, the tarball of the SDK, and the installer.
  1665. The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
  1666. :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
  1667. These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
  1668. class.
  1669. For more information on the cross-development toolchain generation, see
  1670. the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  1671. section in the Yocto Project Overview and Concepts Manual. For
  1672. information on advantages gained when building a cross-development
  1673. toolchain using the :ref:`ref-tasks-populate_sdk`
  1674. task, see the
  1675. ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1676. section in the Yocto Project Application Development and the Extensible
  1677. Software Development Kit (eSDK) manual.
  1678. .. _ref-classes-prexport:
  1679. ``prexport``
  1680. ============
  1681. The :ref:`ref-classes-prexport` class provides functionality for exporting
  1682. :term:`PR` values.
  1683. .. note::
  1684. This class is not intended to be used directly. Rather, it is enabled
  1685. when using "``bitbake-prserv-tool export``".
  1686. .. _ref-classes-primport:
  1687. ``primport``
  1688. ============
  1689. The :ref:`ref-classes-primport` class provides functionality for importing
  1690. :term:`PR` values.
  1691. .. note::
  1692. This class is not intended to be used directly. Rather, it is enabled
  1693. when using "``bitbake-prserv-tool import``".
  1694. .. _ref-classes-prserv:
  1695. ``prserv``
  1696. ==========
  1697. The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
  1698. service <dev-manual/packages:working with a pr service>` in order to
  1699. automatically manage the incrementing of the :term:`PR`
  1700. variable for each recipe.
  1701. This class is enabled by default because it is inherited by the
  1702. :ref:`ref-classes-package` class. However, the OpenEmbedded
  1703. build system will not enable the functionality of this class unless
  1704. :term:`PRSERV_HOST` has been set.
  1705. .. _ref-classes-ptest:
  1706. ``ptest``
  1707. =========
  1708. The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
  1709. runtime tests for recipes that build software that provides these tests.
  1710. This class is intended to be inherited by individual recipes. However,
  1711. the class' functionality is largely disabled unless "ptest" appears in
  1712. :term:`DISTRO_FEATURES`. See the
  1713. ":ref:`test-manual/ptest:testing packages with ptest`"
  1714. section in the Yocto Project Development Tasks Manual for more information
  1715. on ptest.
  1716. .. _ref-classes-ptest-cargo:
  1717. ``ptest-cargo``
  1718. ===============
  1719. The :ref:`ref-classes-ptest-cargo` class is a class which extends the
  1720. :ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
  1721. ``install_ptest_cargo`` steps to respectively build and install
  1722. test suites defined in the ``Cargo.toml`` file, into a dedicated
  1723. ``-ptest`` package.
  1724. .. _ref-classes-ptest-gnome:
  1725. ``ptest-gnome``
  1726. ===============
  1727. Enables package tests (ptests) specifically for GNOME packages, which
  1728. have tests intended to be executed with ``gnome-desktop-testing``.
  1729. For information on setting up and running ptests, see the
  1730. ":ref:`test-manual/ptest:testing packages with ptest`"
  1731. section in the Yocto Project Development Tasks Manual.
  1732. .. _ref-classes-ptest-python-pytest:
  1733. ``ptest-python-pytest``
  1734. =======================
  1735. The :ref:`ref-classes-ptest-python-pytest` class can be inherited in Python-based
  1736. recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
  1737. packages leveraging the `pytest <https://docs.pytest.org>`__ unit test framework.
  1738. Within the recipe, the :term:`PTEST_PYTEST_DIR` variable specifies the path to
  1739. the directory containing the tests that will be installed in :term:`D` by the
  1740. :ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
  1741. script for this task.
  1742. .. _ref-classes-python3-dir:
  1743. ``python3-dir``
  1744. ===============
  1745. The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
  1746. package location for Python 3.
  1747. .. _ref-classes-python3native:
  1748. ``python3native``
  1749. =================
  1750. The :ref:`ref-classes-python3native` class supports using the native version of Python
  1751. 3 built by the build system rather than support of the version provided
  1752. by the build host.
  1753. .. _ref-classes-python3targetconfig:
  1754. ``python3targetconfig``
  1755. =======================
  1756. The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
  1757. 3 built by the build system rather than support of the version provided
  1758. by the build host, except that the configuration for the target machine
  1759. is accessible (such as correct installation directories). This also adds a
  1760. dependency on target ``python3``, so should only be used where appropriate
  1761. in order to avoid unnecessarily lengthening builds.
  1762. .. _ref-classes-qemu:
  1763. ``qemu``
  1764. ========
  1765. The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
  1766. QEMU or test for the existence of QEMU. Typically, this class is used to
  1767. run programs for a target system on the build host using QEMU's
  1768. application emulation mode.
  1769. .. _ref-classes-recipe_sanity:
  1770. ``recipe_sanity``
  1771. =================
  1772. The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
  1773. recipe prerequisites that might affect the build (e.g. variables that
  1774. are set or software that is present).
  1775. .. _ref-classes-relocatable:
  1776. ``relocatable``
  1777. ===============
  1778. The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
  1779. installed into the sysroot.
  1780. This class makes use of the :ref:`ref-classes-chrpath` class and is used by
  1781. both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
  1782. .. _ref-classes-remove-libtool:
  1783. ``remove-libtool``
  1784. ==================
  1785. The :ref:`ref-classes-remove-libtool` class adds a post function to the
  1786. :ref:`ref-tasks-install` task to remove all ``.la`` files
  1787. installed by ``libtool``. Removing these files results in them being
  1788. absent from both the sysroot and target packages.
  1789. If a recipe needs the ``.la`` files to be installed, then the recipe can
  1790. override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
  1791. REMOVE_LIBTOOL_LA = "0"
  1792. .. note::
  1793. The :ref:`ref-classes-remove-libtool` class is not enabled by default.
  1794. .. _ref-classes-report-error:
  1795. ``report-error``
  1796. ================
  1797. The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
  1798. tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
  1799. which allows you to submit build error information to a central database.
  1800. The class collects debug information for recipe, recipe version, task,
  1801. machine, distro, build system, target system, host distro, branch,
  1802. commit, and log. From the information, report files using a JSON format
  1803. are created and stored in
  1804. ``${``\ :term:`LOG_DIR`\ ``}/error-report``.
  1805. .. _ref-classes-retain:
  1806. ``retain``
  1807. ==========
  1808. The :ref:`ref-classes-retain` class can be used to create a tarball of the work
  1809. directory for a recipe when one of its tasks fails, or any other nominated
  1810. directories. It is useful in cases where the environment in which builds are run
  1811. is ephemeral or otherwise inaccessible for examination during debugging.
  1812. To enable, add the following to your configuration::
  1813. INHERIT += "retain"
  1814. The class can be disabled for specific recipes using the :term:`RETAIN_ENABLED`
  1815. variable.
  1816. .. _ref-classes-rm-work:
  1817. ``rm_work``
  1818. ===========
  1819. The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
  1820. can ease your hard drive demands during builds.
  1821. The OpenEmbedded build system can use a substantial amount of disk space
  1822. during the build process. A portion of this space is the work files
  1823. under the ``${TMPDIR}/work`` directory for each recipe. Once the build
  1824. system generates the packages for a recipe, the work files for that
  1825. recipe are no longer needed. However, by default, the build system
  1826. preserves these files for inspection and possible debugging purposes. If
  1827. you would rather have these files deleted to save disk space as the build
  1828. progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
  1829. your ``local.conf`` file, which is found in the :term:`Build Directory`::
  1830. INHERIT += "rm_work"
  1831. If you are modifying and building source code out of the work directory for a
  1832. recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
  1833. changes to the source being lost. To exclude some recipes from having their work
  1834. directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
  1835. recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
  1836. which can also be set in your ``local.conf`` file. Here is an example::
  1837. RM_WORK_EXCLUDE += "busybox glibc"
  1838. .. _ref-classes-rootfs*:
  1839. ``rootfs*``
  1840. ===========
  1841. The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
  1842. image and consist of the following classes:
  1843. - The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
  1844. post-processing functions for image recipes.
  1845. - The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
  1846. for images built using ``.deb`` packages.
  1847. - The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
  1848. for images built using ``.rpm`` packages.
  1849. - The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
  1850. for images built using ``.ipk`` packages.
  1851. - The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
  1852. on the build host directly into the root filesystem.
  1853. The root filesystem is created from packages using one of the
  1854. :ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
  1855. variable.
  1856. For information on how root filesystem images are created, see the
  1857. ":ref:`overview-manual/concepts:image generation`"
  1858. section in the Yocto Project Overview and Concepts Manual.
  1859. .. _ref-classes-rust:
  1860. ``rust``
  1861. ========
  1862. The :ref:`ref-classes-rust` class is an internal class which is just used
  1863. in the "rust" recipe, to build the Rust compiler and runtime
  1864. library. Except for this recipe, it is not intended to be used directly.
  1865. .. _ref-classes-rust-common:
  1866. ``rust-common``
  1867. ===============
  1868. The :ref:`ref-classes-rust-common` class is an internal class to the
  1869. :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
  1870. intended to be used directly.
  1871. .. _ref-classes-sanity:
  1872. ``sanity``
  1873. ==========
  1874. The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
  1875. on the host system so that users can be notified of potential problems
  1876. that might affect their build. The class also performs basic user
  1877. configuration checks from the ``local.conf`` configuration file to
  1878. prevent common mistakes that cause build failures. Distribution policy
  1879. usually determines whether to include this class.
  1880. .. _ref-classes-scons:
  1881. ``scons``
  1882. =========
  1883. The :ref:`ref-classes-scons` class supports recipes that need to build software
  1884. that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
  1885. variable to specify additional configuration options you want to pass SCons
  1886. command line.
  1887. .. _ref-classes-sdl:
  1888. ``sdl``
  1889. =======
  1890. The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
  1891. the Simple DirectMedia Layer (SDL) library.
  1892. .. _ref-classes-python_setuptools_build_meta:
  1893. ``python_setuptools_build_meta``
  1894. ================================
  1895. The :ref:`ref-classes-python_setuptools_build_meta` class enables building
  1896. Python modules which declare the
  1897. `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
  1898. ``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
  1899. section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
  1900. Python modules built with ``setuptools.build_meta`` can be pure Python or
  1901. include ``C`` or ``Rust`` extensions).
  1902. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1903. .. _ref-classes-setuptools3:
  1904. ``setuptools3``
  1905. ===============
  1906. The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
  1907. that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
  1908. and have not migrated to the official ``pyproject.toml`` format). If your recipe
  1909. uses these build systems, the recipe needs to inherit the
  1910. :ref:`ref-classes-setuptools3` class.
  1911. .. note::
  1912. The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
  1913. ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
  1914. (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
  1915. A consequence of this is that legacy software still using deprecated
  1916. ``distutils`` from the Python standard library cannot be packaged as
  1917. ``wheels``. A common solution is the replace
  1918. ``from distutils.core import setup`` with ``from setuptools import setup``.
  1919. .. note::
  1920. The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
  1921. installs the ``wheel`` binary archive. In current versions of
  1922. ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
  1923. the ``setup.py`` cannot be used with wheels, for example it creates files
  1924. outside of the Python module or standard entry points, then
  1925. :ref:`ref-classes-setuptools3_legacy` should be used.
  1926. .. _ref-classes-setuptools3_legacy:
  1927. ``setuptools3_legacy``
  1928. ======================
  1929. The :ref:`ref-classes-setuptools3_legacy` class supports
  1930. Python version 3.x extensions that use build systems based on ``setuptools``
  1931. (e.g. only have a ``setup.py`` and have not migrated to the official
  1932. ``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
  1933. this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
  1934. not wheels. This use of ``setuptools`` like this is
  1935. `deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
  1936. but still relatively common.
  1937. .. _ref-classes-setuptools3-base:
  1938. ``setuptools3-base``
  1939. ====================
  1940. The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
  1941. other classes that support building Python version 3.x extensions. If you need
  1942. functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
  1943. you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
  1944. in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
  1945. .. _ref-classes-sign_rpm:
  1946. ``sign_rpm``
  1947. ============
  1948. The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
  1949. .. _ref-classes-siteinfo:
  1950. ``siteinfo``
  1951. ============
  1952. The :ref:`ref-classes-siteinfo` class provides information about the targets
  1953. that might be needed by other classes or recipes.
  1954. As an example, consider Autotools, which can require tests that must
  1955. execute on the target hardware. Since this is not possible in general
  1956. when cross compiling, site information is used to provide cached test
  1957. results so these tests can be skipped over but still make the correct
  1958. values available. The ``meta/site directory`` contains test results
  1959. sorted into different categories such as architecture, endianness, and
  1960. the ``libc`` used. Site information provides a list of files containing
  1961. data relevant to the current build in the :term:`CONFIG_SITE` variable that
  1962. Autotools automatically picks up.
  1963. The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
  1964. :term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
  1965. .. _ref-classes-sstate:
  1966. ``sstate``
  1967. ==========
  1968. The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
  1969. By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
  1970. default value.
  1971. For more information on sstate, see the
  1972. ":ref:`overview-manual/concepts:shared state cache`"
  1973. section in the Yocto Project Overview and Concepts Manual.
  1974. .. _ref-classes-staging:
  1975. ``staging``
  1976. ===========
  1977. The :ref:`ref-classes-staging` class installs files into individual recipe work
  1978. directories for sysroots. The class contains the following key tasks:
  1979. - The :ref:`ref-tasks-populate_sysroot` task,
  1980. which is responsible for handing the files that end up in the recipe
  1981. sysroots.
  1982. - The
  1983. :ref:`ref-tasks-prepare_recipe_sysroot`
  1984. task (a "partner" task to the ``populate_sysroot`` task), which
  1985. installs the files into the individual recipe work directories (i.e.
  1986. :term:`WORKDIR`).
  1987. The code in the :ref:`ref-classes-staging` class is complex and basically works
  1988. in two stages:
  1989. - *Stage One:* The first stage addresses recipes that have files they
  1990. want to share with other recipes that have dependencies on the
  1991. originating recipe. Normally these dependencies are installed through
  1992. the :ref:`ref-tasks-install` task into
  1993. ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
  1994. copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
  1995. subset of files is controlled by the
  1996. :term:`SYSROOT_DIRS`,
  1997. :term:`SYSROOT_DIRS_NATIVE`, and
  1998. :term:`SYSROOT_DIRS_IGNORE`
  1999. variables.
  2000. .. note::
  2001. Additionally, a recipe can customize the files further by
  2002. declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
  2003. variable.
  2004. A shared state (sstate) object is built from these files and the
  2005. files are placed into a subdirectory of
  2006. :ref:`structure-build-tmp-sysroots-components`.
  2007. The files are scanned for hardcoded paths to the original
  2008. installation location. If the location is found in text files, the
  2009. hardcoded locations are replaced by tokens and a list of the files
  2010. needing such replacements is created. These adjustments are referred
  2011. to as "FIXMEs". The list of files that are scanned for paths is
  2012. controlled by the :term:`SSTATE_SCAN_FILES`
  2013. variable.
  2014. - *Stage Two:* The second stage addresses recipes that want to use
  2015. something from another recipe and declare a dependency on that recipe
  2016. through the :term:`DEPENDS` variable. The recipe will
  2017. have a
  2018. :ref:`ref-tasks-prepare_recipe_sysroot`
  2019. task and when this task executes, it creates the ``recipe-sysroot``
  2020. and ``recipe-sysroot-native`` in the recipe work directory (i.e.
  2021. :term:`WORKDIR`). The OpenEmbedded build system
  2022. creates hard links to copies of the relevant files from
  2023. ``sysroots-components`` into the recipe work directory.
  2024. .. note::
  2025. If hard links are not possible, the build system uses actual
  2026. copies.
  2027. The build system then addresses any "FIXMEs" to paths as defined from
  2028. the list created in the first stage.
  2029. Finally, any files in ``${bindir}`` within the sysroot that have the
  2030. prefix "``postinst-``" are executed.
  2031. .. note::
  2032. Although such sysroot post installation scripts are not
  2033. recommended for general use, the files do allow some issues such
  2034. as user creation and module indexes to be addressed.
  2035. Because recipes can have other dependencies outside of :term:`DEPENDS`
  2036. (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
  2037. the sysroot creation function ``extend_recipe_sysroot`` is also added
  2038. as a pre-function for those tasks whose dependencies are not through
  2039. :term:`DEPENDS` but operate similarly.
  2040. When installing dependencies into the sysroot, the code traverses the
  2041. dependency graph and processes dependencies in exactly the same way
  2042. as the dependencies would or would not be when installed from sstate.
  2043. This processing means, for example, a native tool would have its
  2044. native dependencies added but a target library would not have its
  2045. dependencies traversed or installed. The same sstate dependency code
  2046. is used so that builds should be identical regardless of whether
  2047. sstate was used or not. For a closer look, see the
  2048. ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
  2049. The build system is careful to maintain manifests of the files it
  2050. installs so that any given dependency can be installed as needed. The
  2051. sstate hash of the installed item is also stored so that if it
  2052. changes, the build system can reinstall it.
  2053. .. _ref-classes-syslinux:
  2054. ``syslinux``
  2055. ============
  2056. The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
  2057. building bootable images.
  2058. The class supports the following variables:
  2059. - :term:`INITRD`: Indicates list of filesystem images to
  2060. concatenate and use as an initial RAM disk (initrd). This variable is
  2061. optional.
  2062. - :term:`ROOTFS`: Indicates a filesystem image to include
  2063. as the root filesystem. This variable is optional.
  2064. - :term:`AUTO_SYSLINUXMENU`: Enables creating
  2065. an automatic menu when set to "1".
  2066. - :term:`LABELS`: Lists targets for automatic
  2067. configuration.
  2068. - :term:`APPEND`: Lists append string overrides for each
  2069. label.
  2070. - :term:`SYSLINUX_OPTS`: Lists additional options
  2071. to add to the syslinux file. Semicolon characters separate multiple
  2072. options.
  2073. - :term:`SYSLINUX_SPLASH`: Lists a background
  2074. for the VGA boot menu when you are using the boot menu.
  2075. - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
  2076. to "console=ttyX" to change kernel boot default console.
  2077. - :term:`SYSLINUX_SERIAL`: Sets an alternate
  2078. serial port. Or, turns off serial when the variable is set with an
  2079. empty string.
  2080. - :term:`SYSLINUX_SERIAL_TTY`: Sets an
  2081. alternate "console=tty..." kernel boot argument.
  2082. .. _ref-classes-systemd:
  2083. ``systemd``
  2084. ===========
  2085. The :ref:`ref-classes-systemd` class provides support for recipes that install
  2086. systemd unit files.
  2087. The functionality for this class is disabled unless you have "systemd"
  2088. in :term:`DISTRO_FEATURES`.
  2089. Under this class, the recipe or Makefile (i.e. whatever the recipe is
  2090. calling during the :ref:`ref-tasks-install` task)
  2091. installs unit files into
  2092. ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
  2093. files being installed go into packages other than the main package, you
  2094. need to set :term:`SYSTEMD_PACKAGES` in your
  2095. recipe to identify the packages in which the files will be installed.
  2096. You should set :term:`SYSTEMD_SERVICE` to the
  2097. name of the service file. You should also use a package name override to
  2098. indicate the package to which the value applies. If the value applies to
  2099. the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
  2100. is an example from the connman recipe::
  2101. SYSTEMD_SERVICE:${PN} = "connman.service"
  2102. Services are set up to start on boot automatically
  2103. unless you have set
  2104. :term:`SYSTEMD_AUTO_ENABLE` to "disable".
  2105. For more information on :ref:`ref-classes-systemd`, see the
  2106. ":ref:`dev-manual/init-manager:selecting an initialization manager`"
  2107. section in the Yocto Project Development Tasks Manual.
  2108. .. _ref-classes-systemd-boot:
  2109. ``systemd-boot``
  2110. ================
  2111. The :ref:`ref-classes-systemd-boot` class provides functions specific to the
  2112. systemd-boot bootloader for building bootable images. This is an
  2113. internal class and is not intended to be used directly.
  2114. .. note::
  2115. The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
  2116. used in previous Yocto Project releases with the ``systemd`` project.
  2117. Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
  2118. use this class. Doing so creates a standalone EFI bootloader that is not
  2119. dependent on systemd.
  2120. For information on more variables used and supported in this class, see
  2121. the :term:`SYSTEMD_BOOT_CFG`,
  2122. :term:`SYSTEMD_BOOT_ENTRIES`, and
  2123. :term:`SYSTEMD_BOOT_TIMEOUT` variables.
  2124. You can also see the `Systemd-boot
  2125. documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
  2126. for more information.
  2127. .. _ref-classes-terminal:
  2128. ``terminal``
  2129. ============
  2130. The :ref:`ref-classes-terminal` class provides support for starting a terminal
  2131. session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
  2132. used for the session.
  2133. Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
  2134. terminal session needs to be started. For example, the :ref:`ref-classes-patch`
  2135. class assuming :term:`PATCHRESOLVE` is set to "user", the
  2136. :ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
  2137. use the :ref:`ref-classes-terminal` class.
  2138. .. _ref-classes-testexport:
  2139. ``testexport``
  2140. ==============
  2141. Based on the :ref:`ref-classes-testimage` class, the
  2142. :ref:`ref-classes-testexport` class can be used to export the test environment
  2143. outside of the :term:`OpenEmbedded Build System`. This will generate the
  2144. directory structure to execute the runtime tests using the
  2145. :oe_git:`runexported.py </openembedded-core/tree/meta/lib/oeqa/runexported.py>`
  2146. Python script.
  2147. For more details on how to use :ref:`ref-classes-testexport`, see
  2148. the :ref:`test-manual/runtime-testing:Exporting Tests` section in the Yocto
  2149. Project Test Environment Manual.
  2150. .. _ref-classes-testimage:
  2151. ``testimage``
  2152. =============
  2153. The :ref:`ref-classes-testimage` class supports running automated tests against
  2154. images using QEMU and on actual hardware. The classes handle loading the
  2155. tests and starting the image. To use the classes, you need to perform
  2156. steps to set up the environment.
  2157. To enable this class, add the following to your configuration::
  2158. IMAGE_CLASSES += "testimage"
  2159. The tests are commands that run on the target system over ``ssh``. Each
  2160. test is written in Python and makes use of the ``unittest`` module.
  2161. The :ref:`ref-classes-testimage` class runs tests on an image when called using the
  2162. following::
  2163. $ bitbake -c testimage image
  2164. Alternatively, if you wish to have tests automatically run for each image
  2165. after it is built, you can set :term:`TESTIMAGE_AUTO`::
  2166. TESTIMAGE_AUTO = "1"
  2167. For information on how to enable, run, and create new tests, see the
  2168. ":ref:`test-manual/runtime-testing:performing automated runtime testing`"
  2169. section in the Yocto Project Test Environment Manual.
  2170. .. _ref-classes-testsdk:
  2171. ``testsdk``
  2172. ===========
  2173. This class supports running automated tests against software development
  2174. kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
  2175. using the following::
  2176. $ bitbake -c testsdk image
  2177. The list of test modules that are run can be controlled with the
  2178. :term:`TESTSDK_SUITES` variable.
  2179. .. note::
  2180. Best practices include using :term:`IMAGE_CLASSES` rather than
  2181. :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
  2182. testing.
  2183. .. _ref-classes-texinfo:
  2184. ``texinfo``
  2185. ===========
  2186. This class should be inherited by recipes whose upstream packages invoke
  2187. the ``texinfo`` utilities at build-time. Native and cross recipes are
  2188. made to use the dummy scripts provided by ``texinfo-dummy-native``, for
  2189. improved performance. Target architecture recipes use the genuine
  2190. Texinfo utilities. By default, they use the Texinfo utilities on the
  2191. host system.
  2192. .. note::
  2193. If you want to use the Texinfo recipe shipped with the build system,
  2194. you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
  2195. from :term:`SANITY_REQUIRED_UTILITIES`.
  2196. .. _ref-classes-toaster:
  2197. ``toaster``
  2198. ===========
  2199. The :ref:`ref-classes-toaster` class collects information about packages and images and
  2200. sends them as events that the BitBake user interface can receive. The
  2201. class is enabled when the Toaster user interface is running.
  2202. This class is not intended to be used directly.
  2203. .. _ref-classes-toolchain-scripts:
  2204. ``toolchain-scripts``
  2205. =====================
  2206. The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
  2207. the environment for installed SDKs.
  2208. .. _ref-classes-toolchain-clang:
  2209. ``toolchain/clang``
  2210. ===================
  2211. The :ref:`ref-classes-toolchain-clang` class defines commands for building
  2212. recipes with Clang/LLVM compiler and utilities.
  2213. This class is not meant to be inherited directly. Instead, you should either:
  2214. - set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE`
  2215. or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "clang" from a
  2216. :term:`Configuration File`. This will make the :ref:`ref-classes-base` class
  2217. use the :ref:`ref-classes-toolchain-clang` accordingly. All recipes will
  2218. be built with the Clang/LLVM toolchain, exception be made for recipes that
  2219. override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to
  2220. another value.
  2221. - set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "clang" from a recipe
  2222. when the recipe needs to override the default toolchain set by
  2223. :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or
  2224. :term:`PREFERRED_TOOLCHAIN_SDK`.
  2225. .. _ref-classes-toolchain-clang-native:
  2226. ``toolchain/clang-native``
  2227. ==========================
  2228. The :ref:`ref-classes-toolchain-clang-native` class defines commands for
  2229. building :ref:`ref-classes-native` recipes with Clang/LLVM compiler and
  2230. utilities independently of the build context.
  2231. The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`,
  2232. :term:`BUILD_CXX` and other such variables which are rarely used in recipes.
  2233. Exception be made for target recipes that need to use the compiler from the
  2234. build host at some point during the build.
  2235. This class should not be inherited directly. It is inherited by the
  2236. :ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "clang".
  2237. .. _ref-classes-toolchain-gcc:
  2238. ``toolchain/gcc``
  2239. =================
  2240. The :ref:`ref-classes-toolchain-gcc` class defines commands for building
  2241. recipes with GCC/Binutils compiler and utilities.
  2242. This class is not meant to be inherited directly. Instead, you should either:
  2243. - set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE`
  2244. or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "gcc" from a
  2245. :term:`Configuration File`. This will make the :ref:`ref-classes-base` class
  2246. use the :ref:`ref-classes-toolchain-gcc` accordingly. All recipes will
  2247. be built with the GCC/Binutils toolchain, exception be made for recipes that
  2248. override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to
  2249. another value.
  2250. - set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "gcc" from a recipe
  2251. when the recipe needs to override the default toolchain set by
  2252. :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or
  2253. :term:`PREFERRED_TOOLCHAIN_SDK`.
  2254. .. _ref-classes-toolchain-gcc-native:
  2255. ``toolchain/gcc-native``
  2256. ========================
  2257. The :ref:`ref-classes-toolchain-gcc-native` class defines commands for building
  2258. :ref:`ref-classes-native` recipes with GCC/Binutils compiler and utilities
  2259. independently of the build context.
  2260. The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`,
  2261. :term:`BUILD_CXX` and other such variables which are rarely used in recipes.
  2262. Exception be made for target recipes that need to use the compiler from the build
  2263. host at some point during the build.
  2264. This class should not be inherited directly. It is inherited by the
  2265. :ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "gcc".
  2266. .. _ref-classes-typecheck:
  2267. ``typecheck``
  2268. =============
  2269. The :ref:`ref-classes-typecheck` class provides support for validating the values of
  2270. variables set at the configuration level against their defined types.
  2271. The OpenEmbedded build system allows you to define the type of a
  2272. variable using the "type" varflag. Here is an example::
  2273. IMAGE_FEATURES[type] = "list"
  2274. .. _ref-classes-uboot-config:
  2275. ``uboot-config``
  2276. ================
  2277. The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
  2278. a machine. Specify the machine in your recipe as follows::
  2279. UBOOT_CONFIG ??= <default>
  2280. UBOOT_CONFIG[foo] = "config,images,binary"
  2281. You can also specify the machine using this method::
  2282. UBOOT_MACHINE = "config"
  2283. See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
  2284. information.
  2285. .. _ref-classes-uboot-sign:
  2286. ``uboot-sign``
  2287. ==============
  2288. The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
  2289. It is intended to be inherited from U-Boot recipes.
  2290. The variables used by this class are:
  2291. - :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
  2292. building the FIT image.
  2293. - :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
  2294. - :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
  2295. - :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
  2296. - :term:`SPL_DTB_BINARY`: Name of the SPL device tree binary. Can be set to an
  2297. empty string to indicate that no SPL should be created and added to the FIT
  2298. image.
  2299. - :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
  2300. - :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
  2301. - :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
  2302. - :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
  2303. - :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
  2304. - :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
  2305. - :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
  2306. - :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
  2307. signing.
  2308. - :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
  2309. for FIT image signing.
  2310. - :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
  2311. - :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
  2312. rebuilding the FIT image containing the kernel.
  2313. - :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE`: include the Trusted Firmware-A
  2314. (TF-A) binary in the U-Boot FIT image.
  2315. - :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE`: specifies the path to the
  2316. Trusted Firmware-A (TF-A) binary.
  2317. - :term:`UBOOT_FIT_TEE`: include the Trusted Execution Environment (TEE)
  2318. binary in the U-Boot FIT image.
  2319. - :term:`UBOOT_FIT_TEE_IMAGE`: specifies the path to the Trusted Execution
  2320. Environment (TEE) binary.
  2321. - :term:`UBOOT_FIT_USER_SETTINGS`: adds a user-specific snippet to the U-Boot
  2322. Image Tree Source (ITS). Users can include their custom U-Boot Image Tree
  2323. Source (ITS) snippet in this variable.
  2324. - :term:`UBOOT_FIT_CONF_FIRMWARE`: adds one image to the ``firmware`` property
  2325. of the configuration node.
  2326. - :term:`UBOOT_FIT_CONF_USER_LOADABLES`: adds one or more user-defined images
  2327. to the ``loadables`` property of the configuration node.
  2328. See U-Boot's documentation for details about `verified boot
  2329. <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
  2330. and the `signature process
  2331. <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
  2332. See also the description of :ref:`ref-classes-kernel-fit-image` class, which this class
  2333. imitates.
  2334. .. _ref-classes-uki:
  2335. ``uki``
  2336. =======
  2337. The :ref:`ref-classes-uki` class provides support for `Unified Kernel Image
  2338. (UKI) <https://uapi-group.org/specifications/specs/unified_kernel_image/>`__
  2339. format. UKIs combine kernel, :term:`Initramfs`, signatures, metadata etc to a
  2340. single UEFI firmware compatible binary. The class is intended to be inherited
  2341. by rootfs image recipes. The build configuration should also use an
  2342. :term:`Initramfs`, ``systemd-boot`` as boot menu provider and have UEFI support
  2343. on target hardware. Using ``systemd`` as init is recommended. Image builds
  2344. should create an ESP partition for UEFI firmware and copy ``systemd-boot`` and
  2345. UKI files there. Sample configuration for Wic images is provided in
  2346. :oe_git:`scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in
  2347. </openembedded-core/tree/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in>`.
  2348. UKIs are generated using ``systemd`` reference implementation `ukify
  2349. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__.
  2350. This class uses a number of variables but tries to find sensible defaults for
  2351. them.
  2352. The variables used by this class are:
  2353. - :term:`EFI_ARCH`: architecture name within EFI standard, set in
  2354. :oe_git:`meta/conf/image-uefi.conf
  2355. </openembedded-core/tree/meta/conf/image-uefi.conf>`
  2356. - :term:`IMAGE_EFI_BOOT_FILES`: files to install to EFI boot partition
  2357. created by the ``bootimg_efi`` Wic plugin
  2358. - :term:`INITRAMFS_IMAGE`: initramfs recipe name
  2359. - :term:`KERNEL_DEVICETREE`: optional devicetree files to embed into UKI
  2360. - :term:`UKIFY_CMD`: `ukify
  2361. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
  2362. command to build the UKI image
  2363. - :term:`UKI_CMDLINE`: kernel command line to use with UKI
  2364. - :term:`UKI_CONFIG_FILE`: optional config file for `ukify
  2365. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
  2366. - :term:`UKI_FILENAME`: output file name for the UKI image
  2367. - :term:`UKI_KERNEL_FILENAME`: kernel image file name
  2368. - :term:`UKI_SB_CERT`: optional UEFI secureboot certificate matching the
  2369. private key
  2370. - :term:`UKI_SB_KEY`: optional UEFI secureboot private key to sign UKI with
  2371. For examples on how to use this class see oeqa selftest
  2372. :oe_git:`meta/lib/oeqa/selftest/cases/uki.py
  2373. </openembedded-core/tree/meta/lib/oeqa/selftest/cases/uki.py>`.
  2374. Also an oeqa runtime test :oe_git:`meta/lib/oeqa/runtime/cases/uki.py
  2375. </openembedded-core/tree/meta/lib/oeqa/runtime/cases/uki.py>` is provided which
  2376. verifies that the target system booted the same UKI binary as was set at
  2377. buildtime via :term:`UKI_FILENAME`.
  2378. .. _ref-classes-uninative:
  2379. ``uninative``
  2380. =============
  2381. Attempts to isolate the build system from the host distribution's C
  2382. library in order to make re-use of native shared state artifacts across
  2383. different host distributions practical. With this class enabled, a
  2384. tarball containing a pre-built C library is downloaded at the start of
  2385. the build. In the Poky reference distribution this is enabled by default
  2386. through ``meta/conf/distro/include/yocto-uninative.inc``. Other
  2387. distributions that do not derive from poky can also
  2388. "``require conf/distro/include/yocto-uninative.inc``" to use this.
  2389. Alternatively if you prefer, you can build the uninative-tarball recipe
  2390. yourself, publish the resulting tarball (e.g. via HTTP) and set
  2391. ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
  2392. example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
  2393. The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
  2394. SDK. When building the extensible SDK, ``uninative-tarball`` is built
  2395. and the resulting tarball is included within the SDK.
  2396. .. _ref-classes-update-alternatives:
  2397. ``update-alternatives``
  2398. =======================
  2399. The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
  2400. multiple sources provide the same command. This situation occurs when
  2401. several programs that have the same or similar function are installed
  2402. with the same name. For example, the ``ar`` command is available from
  2403. the ``busybox``, ``binutils`` and ``elfutils`` packages. The
  2404. :ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
  2405. multiple packages can be installed without conflicts. The ``ar`` command
  2406. still works regardless of which packages are installed or subsequently
  2407. removed. The class renames the conflicting binary in each package and
  2408. symlinks the highest priority binary during installation or removal of
  2409. packages.
  2410. To use this class, you need to define a number of variables:
  2411. - :term:`ALTERNATIVE`
  2412. - :term:`ALTERNATIVE_LINK_NAME`
  2413. - :term:`ALTERNATIVE_TARGET`
  2414. - :term:`ALTERNATIVE_PRIORITY`
  2415. These variables list alternative commands needed by a package, provide
  2416. pathnames for links, default links for targets, and so forth. For
  2417. details on how to use this class, see the comments in the
  2418. :yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
  2419. file.
  2420. .. note::
  2421. You can use the ``update-alternatives`` command directly in your recipes.
  2422. However, this class simplifies things in most cases.
  2423. .. _ref-classes-update-rc.d:
  2424. ``update-rc.d``
  2425. ===============
  2426. The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
  2427. initialization script on behalf of the package. The OpenEmbedded build
  2428. system takes care of details such as making sure the script is stopped
  2429. before a package is removed and started when the package is installed.
  2430. Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
  2431. :term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
  2432. for details.
  2433. .. _ref-classes-useradd:
  2434. ``useradd*``
  2435. ============
  2436. The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
  2437. usage by the package on the target. For example, if you have packages
  2438. that contain system services that should be run under their own user or
  2439. group, you can use these classes to enable creation of the user or
  2440. group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
  2441. </openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
  2442. recipe in the :term:`Source Directory` provides a simple
  2443. example that shows how to add three users and groups to two packages.
  2444. The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
  2445. groups settings.
  2446. The :ref:`useradd* <ref-classes-useradd>` classes support the
  2447. :term:`USERADD_PACKAGES`,
  2448. :term:`USERADD_PARAM`,
  2449. :term:`GROUPADD_PARAM`, and
  2450. :term:`GROUPMEMS_PARAM` variables.
  2451. The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
  2452. that have static user identification (``uid``) and group identification
  2453. (``gid``) values.
  2454. The default behavior of the OpenEmbedded build system for assigning
  2455. ``uid`` and ``gid`` values when packages add users and groups during
  2456. package install time is to add them dynamically. This works fine for
  2457. programs that do not care what the values of the resulting users and
  2458. groups become. In these cases, the order of the installation determines
  2459. the final ``uid`` and ``gid`` values. However, if non-deterministic
  2460. ``uid`` and ``gid`` values are a problem, you can override the default,
  2461. dynamic application of these values by setting static values. When you
  2462. set static values, the OpenEmbedded build system looks in
  2463. :term:`BBPATH` for ``files/passwd`` and ``files/group``
  2464. files for the values.
  2465. To use static ``uid`` and ``gid`` values, you need to set some variables. See
  2466. the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
  2467. :term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
  2468. You can also see the :ref:`ref-classes-useradd` class for additional
  2469. information.
  2470. .. note::
  2471. You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
  2472. or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
  2473. enable or disable the class in a configured system, :term:`TMPDIR` might
  2474. contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
  2475. directory will correct this condition.
  2476. .. _ref-classes-utility-tasks:
  2477. ``utility-tasks``
  2478. =================
  2479. The :ref:`ref-classes-utility-tasks` class provides support for various
  2480. "utility" type tasks that are applicable to all recipes, such as
  2481. :ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
  2482. This class is enabled by default because it is inherited by the
  2483. :ref:`ref-classes-base` class.
  2484. .. _ref-classes-utils:
  2485. ``utils``
  2486. =========
  2487. The :ref:`ref-classes-utils` class provides some useful Python functions that are
  2488. typically used in inline Python expressions (e.g. ``${@...}``). One
  2489. example use is for ``bb.utils.contains()``.
  2490. This class is enabled by default because it is inherited by the
  2491. :ref:`ref-classes-base` class.
  2492. .. _ref-classes-vala:
  2493. ``vala``
  2494. ========
  2495. The :ref:`ref-classes-vala` class supports recipes that need to build software written
  2496. using the Vala programming language.
  2497. .. _ref-classes-vex:
  2498. ``vex``
  2499. ========
  2500. The :ref:`ref-classes-vex` class is used to generate metadata needed by external
  2501. tools to check for vulnerabilities, for example CVEs. It can be used as a
  2502. replacement for :ref:`ref-classes-cve-check`.
  2503. In order to use this class, inherit the class in the ``local.conf`` file and it
  2504. will add the ``generate_vex`` task for every recipe::
  2505. INHERIT += "vex"
  2506. If an image is built it will generate a report in :term:`DEPLOY_DIR_IMAGE` for
  2507. all the packages used, it will also generate a file for all recipes used in the
  2508. build.
  2509. Variables use the ``CVE_CHECK`` prefix to keep compatibility with the
  2510. :ref:`ref-classes-cve-check` class.
  2511. Example usage::
  2512. bitbake -c generate_vex openssl
  2513. .. _ref-classes-waf:
  2514. ``waf``
  2515. =======
  2516. The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
  2517. the Waf build system. You can use the
  2518. :term:`EXTRA_OECONF` or
  2519. :term:`PACKAGECONFIG_CONFARGS` variables
  2520. to specify additional configuration options to be passed on the Waf
  2521. command line.
  2522. .. _ref-classes-yocto-check-layer:
  2523. ``yocto-check-layer``
  2524. =====================
  2525. The :ref:`ref-classes-yocto-check-layer` class is used by the
  2526. :oe_git:`yocto-check-layer </openembedded-core/tree/scripts/yocto-check-layer>`
  2527. script to ensure that packages from Yocto Project Compatible layers don't skip
  2528. required QA checks listed in :term:`CHECKLAYER_REQUIRED_TESTS` defined by the
  2529. :ref:`ref-classes-insane` class.
  2530. It adds an anonymous python function with extra processing to all recipes,
  2531. and globally inheriting this class with :term:`INHERIT` is not advised. Instead
  2532. the ``yocto-check-layer`` script should be used as it handles usage of this
  2533. class.
  2534. For more information on the Yocto Project
  2535. Compatible layers, see the :ref:`dev-manual/layers:Making Sure Your Layer is
  2536. Compatible With Yocto Project` section of the Yocto Project Development Manual.