classes.rst 140 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706
  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-vendor:
  736. ``go-vendor``
  737. =============
  738. The :ref:`ref-classes-go-vendor` class implements support for offline builds,
  739. also known as Go vendoring. In such a scenario, the module dependencias are
  740. downloaded during the :ref:`ref-tasks-fetch` task rather than when modules are
  741. imported, thus being coherent with Yocto's concept of fetching every source
  742. beforehand.
  743. The dependencies are unpacked into the modules' ``vendor`` directory, where a
  744. manifest file is generated.
  745. .. _ref-classes-gobject-introspection:
  746. ``gobject-introspection``
  747. =========================
  748. Provides support for recipes building software that supports GObject
  749. introspection. This functionality is only enabled if the
  750. "gobject-introspection-data" feature is in
  751. :term:`DISTRO_FEATURES` as well as
  752. "qemu-usermode" being in
  753. :term:`MACHINE_FEATURES`.
  754. .. note::
  755. This functionality is :ref:`backfilled <ref-features-backfill>` by default
  756. and, if not applicable, should be disabled through
  757. :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
  758. :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
  759. .. _ref-classes-grub-efi:
  760. ``grub-efi``
  761. ============
  762. The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
  763. building bootable images.
  764. This class supports several variables:
  765. - :term:`INITRD`: Indicates list of filesystem images to
  766. concatenate and use as an initial RAM disk (initrd) (optional).
  767. Can be specified for each ``LABEL``.
  768. - :term:`ROOTFS`: Indicates a filesystem image to include
  769. as the root filesystem (optional).
  770. - :term:`GRUB_GFXSERIAL`: Set this to "1" to have
  771. graphics and serial in the boot menu.
  772. - :term:`LABELS`: A list of targets for the automatic
  773. configuration.
  774. - :term:`APPEND`: An override list of append strings for
  775. each ``LABEL``.
  776. - :term:`GRUB_TITLE`: A custom title for each ``LABEL``. If a label does not
  777. have a custom title, the label is used as title for the GRUB menu entry.
  778. - :term:`GRUB_OPTS`: Additional options to add to the
  779. configuration (optional). Options are delimited using semi-colon
  780. characters (``;``).
  781. - :term:`GRUB_TIMEOUT`: Timeout before executing
  782. the default ``LABEL`` (optional).
  783. Each ``LABEL`` defined in the :term:`LABELS` variable creates a GRUB boot
  784. entry, and some variables can be defined individually per ``LABEL``. The label
  785. specific override names are defined as ``grub_LABEL``.
  786. For example, for a label ``factory``, the override name would be
  787. ``grub_factory``. A custom GRUB menu entry titled "Factory Install" with the
  788. additional parameter ``factory=yes`` can be achieved as follows::
  789. LABELS:append = " factory"
  790. APPEND:grub_factory = "factory=yes"
  791. GRUB_TITLE:grub_factory = "Factory Install"
  792. .. _ref-classes-gsettings:
  793. ``gsettings``
  794. =============
  795. The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
  796. need to install GSettings (glib) schemas. The schemas are assumed to be
  797. part of the main package. Appropriate post-install and post-remove
  798. (postinst/postrm) scriptlets are added to register and unregister the
  799. schemas in the target image.
  800. .. _ref-classes-gtk-doc:
  801. ``gtk-doc``
  802. ===========
  803. The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
  804. ``gtk-doc`` dependencies and disable ``gtk-doc``.
  805. .. _ref-classes-gtk-icon-cache:
  806. ``gtk-icon-cache``
  807. ==================
  808. The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
  809. post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
  810. install icons. These scriptlets call ``gtk-update-icon-cache`` to add
  811. the fonts to GTK+'s icon cache. Since the cache files are
  812. architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
  813. the postinst scriptlets need to be run on the build host during image
  814. creation.
  815. .. _ref-classes-gtk-immodules-cache:
  816. ``gtk-immodules-cache``
  817. =======================
  818. The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
  819. post-remove (postinst/postrm) scriptlets for packages that install GTK+
  820. input method modules for virtual keyboards. These scriptlets call
  821. ``gtk-update-icon-cache`` to add the input method modules to the cache.
  822. Since the cache files are architecture-specific,
  823. ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
  824. need to be run on the build host during image creation.
  825. If the input method modules being installed are in packages other than
  826. the main package, set
  827. :term:`GTKIMMODULES_PACKAGES` to specify
  828. the packages containing the modules.
  829. .. _ref-classes-gzipnative:
  830. ``gzipnative``
  831. ==============
  832. The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
  833. ``gzip`` and ``pigz`` rather than the versions of these tools from the
  834. build host.
  835. .. _ref-classes-icecc:
  836. ``icecc``
  837. =========
  838. The :ref:`ref-classes-icecc` class supports
  839. `Icecream <https://github.com/icecc/icecream>`__, which facilitates
  840. taking compile jobs and distributing them among remote machines.
  841. The class stages directories with symlinks from ``gcc`` and ``g++`` to
  842. ``icecc``, for both native and cross compilers. Depending on each
  843. configure or compile, the OpenEmbedded build system adds the directories
  844. at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
  845. ``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
  846. compilers, respectively.
  847. For the cross compiler, the class creates a ``tar.gz`` file that
  848. contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
  849. is the version of the cross-compiler used in the cross-development
  850. toolchain, accordingly.
  851. The class handles all three different compile stages (i.e native,
  852. cross-kernel and target) and creates the necessary environment
  853. ``tar.gz`` file to be used by the remote machines. The class also
  854. supports SDK generation.
  855. If :term:`ICECC_PATH` is not set in your
  856. ``local.conf`` file, then the class tries to locate the ``icecc`` binary
  857. using ``which``. If :term:`ICECC_ENV_EXEC` is set
  858. in your ``local.conf`` file, the variable should point to the
  859. ``icecc-create-env`` script provided by the user. If you do not point to
  860. a user-provided script, the build system uses the default script
  861. provided by the recipe :oe_git:`icecc-create-env_0.1.bb
  862. </openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
  863. .. note::
  864. This script is a modified version and not the one that comes with
  865. ``icecream``.
  866. If you do not want the Icecream distributed compile support to apply to
  867. specific recipes or classes, you can ask them to be ignored by Icecream
  868. by listing the recipes and classes using the
  869. :term:`ICECC_RECIPE_DISABLE` and
  870. :term:`ICECC_CLASS_DISABLE` variables,
  871. respectively, in your ``local.conf`` file. Doing so causes the
  872. OpenEmbedded build system to handle these compilations locally.
  873. Additionally, you can list recipes using the
  874. :term:`ICECC_RECIPE_ENABLE` variable in
  875. your ``local.conf`` file to force ``icecc`` to be enabled for recipes
  876. using an empty :term:`PARALLEL_MAKE` variable.
  877. Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
  878. Consequently, if a development team has a dedicated build system that
  879. populates :term:`SSTATE_MIRRORS` and they want to
  880. reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
  881. system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
  882. At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
  883. sure that all builders start with the same sstate signatures. After
  884. inheriting the class, you can then disable the feature by setting the
  885. :term:`ICECC_DISABLED` variable to "1" as follows::
  886. INHERIT_DISTRO:append = " icecc"
  887. ICECC_DISABLED ??= "1"
  888. This practice
  889. makes sure everyone is using the same signatures but also requires
  890. individuals that do want to use Icecream to enable the feature
  891. individually as follows in your ``local.conf`` file::
  892. ICECC_DISABLED = ""
  893. .. _ref-classes-image:
  894. ``image``
  895. =========
  896. The :ref:`ref-classes-image` class helps support creating images in different formats.
  897. First, the root filesystem is created from packages using one of the
  898. ``rootfs*.bbclass`` files (depending on the package format used) and
  899. then one or more image files are created.
  900. - The :term:`IMAGE_FSTYPES` variable controls the types of images to
  901. generate.
  902. - The :term:`IMAGE_INSTALL` variable controls the list of packages to
  903. install into the image.
  904. For information on customizing images, see the
  905. ":ref:`dev-manual/customizing-images:customizing images`" section
  906. in the Yocto Project Development Tasks Manual. For information on how
  907. images are created, see the
  908. ":ref:`overview-manual/concepts:images`" section in the
  909. Yocto Project Overview and Concepts Manual.
  910. .. _ref-classes-image-buildinfo:
  911. ``image-buildinfo``
  912. ===================
  913. The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
  914. build information to the target filesystem at ``${sysconfdir}/buildinfo``
  915. by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
  916. This can be useful for manually determining the origin of any given
  917. image. It writes out two sections:
  918. #. `Build Configuration`: a list of variables and their values (specified
  919. by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
  920. :term:`DISTRO_VERSION`)
  921. #. `Layer Revisions`: the revisions of all of the layers used in the
  922. build.
  923. Additionally, when building an SDK it will write the same contents
  924. to ``/buildinfo`` by default (as specified by
  925. :term:`SDK_BUILDINFO_FILE`).
  926. .. _ref-classes-image_types:
  927. ``image_types``
  928. ===============
  929. The :ref:`ref-classes-image_types` class defines all of the standard image output types
  930. that you can enable through the
  931. :term:`IMAGE_FSTYPES` variable. You can use this
  932. class as a reference on how to add support for custom image output
  933. types.
  934. By default, the :ref:`ref-classes-image` class automatically
  935. enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
  936. ``IMGCLASSES`` variable as follows::
  937. IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
  938. # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
  939. # in the non-Linux SDK_OS case, such as mingw32
  940. inherit populate_sdk_base
  941. IMGCLASSES += "${@['', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
  942. IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
  943. IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
  944. IMGCLASSES += "image_types_wic"
  945. IMGCLASSES += "rootfs-postcommands"
  946. IMGCLASSES += "image-postinst-intercepts"
  947. IMGCLASSES += "overlayfs-etc"
  948. inherit_defer ${IMGCLASSES}
  949. The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
  950. .. note::
  951. To build a VMware VMDK image, you need to add "wic.vmdk" to
  952. :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
  953. Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
  954. .. _ref-classes-image-live:
  955. ``image-live``
  956. ==============
  957. This class controls building "live" (i.e. HDDIMG and ISO) images. Live
  958. images contain syslinux for legacy booting, as well as the bootloader
  959. specified by :term:`EFI_PROVIDER` if
  960. :term:`MACHINE_FEATURES` contains "efi".
  961. Normally, you do not use this class directly. Instead, you add "live" to
  962. :term:`IMAGE_FSTYPES`.
  963. .. _ref-classes-insane:
  964. ``insane``
  965. ==========
  966. The :ref:`ref-classes-insane` class adds a step to the package generation process so
  967. that output quality assurance checks are generated by the OpenEmbedded
  968. build system. A range of checks are performed that check the build's
  969. output for common problems that show up during runtime. Distribution
  970. policy usually dictates whether to include this class.
  971. You can configure the sanity checks so that specific test failures
  972. either raise a warning or an error message. Typically, failures for new
  973. tests generate a warning. Subsequent failures for the same test would
  974. then generate an error message once the metadata is in a known and good
  975. condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
  976. and error messages you might encounter using a default configuration.
  977. Use the :term:`WARN_QA` and
  978. :term:`ERROR_QA` variables to control the behavior of
  979. these checks at the global level (i.e. in your custom distro
  980. configuration). However, to skip one or more checks in recipes, you
  981. should use :term:`INSANE_SKIP`. For example, to skip
  982. the check for symbolic link ``.so`` files in the main package of a
  983. recipe, add the following to the recipe. You need to realize that the
  984. package name override, in this example ``${PN}``, must be used::
  985. INSANE_SKIP:${PN} += "dev-so"
  986. Please keep in mind that the QA checks
  987. are meant to detect real or potential problems in the packaged
  988. output. So exercise caution when disabling these checks.
  989. The tests you can list with the :term:`WARN_QA` and
  990. :term:`ERROR_QA` variables are:
  991. - ``already-stripped:`` Checks that produced binaries have not
  992. already been stripped prior to the build system extracting debug
  993. symbols. It is common for upstream software projects to default to
  994. stripping debug symbols for output binaries. In order for debugging
  995. to work on the target using ``-dbg`` packages, this stripping must be
  996. disabled.
  997. - ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
  998. size, and endianness of any binaries to ensure they match the target
  999. architecture. This test fails if any binaries do not match the type
  1000. since there would be an incompatibility. The test could indicate that
  1001. the wrong compiler or compiler options have been used. Sometimes
  1002. software, like bootloaders, might need to bypass this check.
  1003. - ``buildpaths:`` Checks for paths to locations on the build host
  1004. inside the output files. Not only can these leak information about
  1005. the build environment, they also hinder binary reproducibility.
  1006. - ``build-deps:`` Determines if a build-time dependency that is
  1007. specified through :term:`DEPENDS`, explicit
  1008. :term:`RDEPENDS`, or task-level dependencies exists
  1009. to match any runtime dependency. This determination is particularly
  1010. useful to discover where runtime dependencies are detected and added
  1011. during packaging. If no explicit dependency has been specified within
  1012. the metadata, at the packaging stage it is too late to ensure that
  1013. the dependency is built, and thus you can end up with an error when
  1014. the package is installed into the image during the
  1015. :ref:`ref-tasks-rootfs` task because the auto-detected
  1016. dependency was not satisfied. An example of this would be where the
  1017. :ref:`ref-classes-update-rc.d` class automatically
  1018. adds a dependency on the ``initscripts-functions`` package to
  1019. packages that install an initscript that refers to
  1020. ``/etc/init.d/functions``. The recipe should really have an explicit
  1021. :term:`RDEPENDS` for the package in question on ``initscripts-functions``
  1022. so that the OpenEmbedded build system is able to ensure that the
  1023. ``initscripts`` recipe is actually built and thus the
  1024. ``initscripts-functions`` package is made available.
  1025. - ``configure-gettext:`` Checks that if a recipe is building something
  1026. that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
  1027. directive, that the recipe also inherits the :ref:`ref-classes-gettext`
  1028. class to ensure that gettext is available during the build.
  1029. - ``compile-host-path:`` Checks the
  1030. :ref:`ref-tasks-compile` log for indications that
  1031. paths to locations on the build host were used. Using such paths
  1032. might result in host contamination of the build output.
  1033. - ``cve_status_not_in_db:`` Checks for each component if CVEs that are ignored
  1034. via :term:`CVE_STATUS`, that those are (still) reported for this component
  1035. in the NIST database. If not, a warning is printed. This check is disabled
  1036. by default.
  1037. - ``debug-deps:`` Checks that all packages except ``-dbg`` packages
  1038. do not depend on ``-dbg`` packages, which would cause a packaging
  1039. bug.
  1040. - ``debug-files:`` Checks for ``.debug`` directories in anything but
  1041. the ``-dbg`` package. The debug files should all be in the ``-dbg``
  1042. package. Thus, anything packaged elsewhere is incorrect packaging.
  1043. - ``dep-cmp:`` Checks for invalid version comparison statements in
  1044. runtime dependency relationships between packages (i.e. in
  1045. :term:`RDEPENDS`,
  1046. :term:`RRECOMMENDS`,
  1047. :term:`RSUGGESTS`,
  1048. :term:`RPROVIDES`,
  1049. :term:`RREPLACES`, and
  1050. :term:`RCONFLICTS` variable values). Any invalid
  1051. comparisons might trigger failures or undesirable behavior when
  1052. passed to the package manager.
  1053. - ``desktop:`` Runs the ``desktop-file-validate`` program against any
  1054. ``.desktop`` files to validate their contents against the
  1055. specification for ``.desktop`` files.
  1056. - ``dev-deps:`` Checks that all packages except ``-dev`` or
  1057. ``-staticdev`` packages do not depend on ``-dev`` packages, which
  1058. would be a packaging bug.
  1059. - ``dev-so:`` Checks that the ``.so`` symbolic links are in the
  1060. ``-dev`` package and not in any of the other packages. In general,
  1061. these symlinks are only useful for development purposes. Thus, the
  1062. ``-dev`` package is the correct location for them. In very rare
  1063. cases, such as dynamically loaded modules, these symlinks
  1064. are needed instead in the main package.
  1065. - ``empty-dirs:`` Checks that packages are not installing files to
  1066. directories that are normally expected to be empty (such as ``/tmp``)
  1067. The list of directories that are checked is specified by the
  1068. :term:`QA_EMPTY_DIRS` variable.
  1069. - ``file-rdeps:`` Checks that file-level dependencies identified by
  1070. the OpenEmbedded build system at packaging time are satisfied. For
  1071. example, a shell script might start with the line ``#!/bin/bash``.
  1072. This line would translate to a file dependency on ``/bin/bash``. Of
  1073. the three package managers that the OpenEmbedded build system
  1074. supports, only RPM directly handles file-level dependencies,
  1075. resolving them automatically to packages providing the files.
  1076. However, the lack of that functionality in the other two package
  1077. managers does not mean the dependencies do not still need resolving.
  1078. This QA check attempts to ensure that explicitly declared
  1079. :term:`RDEPENDS` exist to handle any file-level
  1080. dependency detected in packaged files.
  1081. - ``files-invalid:`` Checks for :term:`FILES` variable
  1082. values that contain "//", which is invalid.
  1083. - ``host-user-contaminated:`` Checks that no package produced by the
  1084. recipe contains any files outside of ``/home`` with a user or group
  1085. ID that matches the user running BitBake. A match usually indicates
  1086. that the files are being installed with an incorrect UID/GID, since
  1087. target IDs are independent from host IDs. For additional information,
  1088. see the section describing the
  1089. :ref:`ref-tasks-install` task.
  1090. - ``incompatible-license:`` Report when packages are excluded from
  1091. being created due to being marked with a license that is in
  1092. :term:`INCOMPATIBLE_LICENSE`.
  1093. - ``install-host-path:`` Checks the
  1094. :ref:`ref-tasks-install` log for indications that
  1095. paths to locations on the build host were used. Using such paths
  1096. might result in host contamination of the build output.
  1097. - ``installed-vs-shipped:`` Reports when files have been installed
  1098. within :ref:`ref-tasks-install` but have not been included in any package by
  1099. way of the :term:`FILES` variable. Files that do not
  1100. appear in any package cannot be present in an image later on in the
  1101. build process. Ideally, all installed files should be packaged or not
  1102. installed at all. These files can be deleted at the end of
  1103. :ref:`ref-tasks-install` if the files are not needed in any package.
  1104. - ``invalid-chars:`` Checks that the recipe metadata variables
  1105. :term:`DESCRIPTION`,
  1106. :term:`SUMMARY`, :term:`LICENSE`, and
  1107. :term:`SECTION` do not contain non-UTF-8 characters.
  1108. Some package managers do not support such characters.
  1109. - ``invalid-packageconfig:`` Checks that no undefined features are
  1110. being added to :term:`PACKAGECONFIG`. For
  1111. example, any name "foo" for which the following form does not exist::
  1112. PACKAGECONFIG[foo] = "..."
  1113. - ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
  1114. file containing these paths is incorrect since ``libtool`` adds the
  1115. correct sysroot prefix when using the files automatically itself.
  1116. - ``ldflags:`` Ensures that the binaries were linked with the
  1117. :term:`LDFLAGS` options provided by the build system.
  1118. If this test fails, check that the :term:`LDFLAGS` variable is being
  1119. passed to the linker command.
  1120. - ``libdir:`` Checks for libraries being installed into incorrect
  1121. (possibly hardcoded) installation paths. For example, this test will
  1122. catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
  1123. "lib32". Another example is when recipes install
  1124. ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
  1125. - ``libexec:`` Checks if a package contains files in
  1126. ``/usr/libexec``. This check is not performed if the ``libexecdir``
  1127. variable has been set explicitly to ``/usr/libexec``.
  1128. - ``mime:`` Check that if a package contains mime type files (``.xml``
  1129. files in ``${datadir}/mime/packages``) that the recipe also inherits
  1130. the :ref:`ref-classes-mime` class in order to ensure that these get
  1131. properly installed.
  1132. - ``mime-xdg:`` Checks that if a package contains a .desktop file with a
  1133. 'MimeType' key present, that the recipe inherits the
  1134. :ref:`ref-classes-mime-xdg` class that is required in order for that
  1135. to be activated.
  1136. - ``missing-update-alternatives:`` Check that if a recipe sets the
  1137. :term:`ALTERNATIVE` variable that the recipe also inherits
  1138. :ref:`ref-classes-update-alternatives` such that the alternative will
  1139. be correctly set up.
  1140. - ``packages-list:`` Checks for the same package being listed
  1141. multiple times through the :term:`PACKAGES` variable
  1142. value. Installing the package in this manner can cause errors during
  1143. packaging.
  1144. - ``patch-fuzz:`` Checks for fuzz in patch files that may allow
  1145. them to apply incorrectly if the underlying code changes.
  1146. - ``patch-status:`` Checks that the ``Upstream-Status`` is specified and valid
  1147. in the headers of patches for recipes.
  1148. - ``pep517-backend:`` checks that a recipe inheriting
  1149. :ref:`ref-classes-setuptools3` has a PEP517-compliant backend.
  1150. - ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
  1151. installed and packaged by a recipe.
  1152. - ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
  1153. invalid format.
  1154. - ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
  1155. invalid format.
  1156. - ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
  1157. 'link' where the specified target already exists.
  1158. - ``perms:`` Currently, this check is unused but reserved.
  1159. - ``pkgconfig:`` Checks ``.pc`` files for any
  1160. :term:`TMPDIR`/:term:`WORKDIR` paths.
  1161. Any ``.pc`` file containing these paths is incorrect since
  1162. ``pkg-config`` itself adds the correct sysroot prefix when the files
  1163. are accessed.
  1164. - ``pkgname:`` Checks that all packages in
  1165. :term:`PACKAGES` have names that do not contain
  1166. invalid characters (i.e. characters other than 0-9, a-z, ., +, and
  1167. -).
  1168. - ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
  1169. undefined during :ref:`ref-tasks-package`.
  1170. - ``pkgvarcheck:`` Checks through the variables
  1171. :term:`RDEPENDS`,
  1172. :term:`RRECOMMENDS`,
  1173. :term:`RSUGGESTS`,
  1174. :term:`RCONFLICTS`,
  1175. :term:`RPROVIDES`,
  1176. :term:`RREPLACES`, :term:`FILES`,
  1177. :term:`ALLOW_EMPTY`, ``pkg_preinst``,
  1178. ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
  1179. there are variable sets that are not package-specific. Using these
  1180. variables without a package suffix is bad practice, and might
  1181. unnecessarily complicate dependencies of other packages within the
  1182. same recipe or have other unintended consequences.
  1183. - ``pn-overrides:`` Checks that a recipe does not have a name
  1184. (:term:`PN`) value that appears in
  1185. :term:`OVERRIDES`. If a recipe is named such that
  1186. its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
  1187. :term:`PN` happens to be the same as :term:`MACHINE` or
  1188. :term:`DISTRO`), it can have unexpected consequences.
  1189. For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
  1190. turn into ``FILES = "xyz"``.
  1191. - ``rpaths:`` Checks for rpaths in the binaries that contain build
  1192. system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
  1193. options are being passed to the linker commands and your binaries
  1194. have potential security issues.
  1195. - ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
  1196. in a packaged script is not longer than 128 characters, which can cause
  1197. an error at runtime depending on the operating system.
  1198. - ``split-strip:`` Reports that splitting or stripping debug symbols
  1199. from binaries has failed.
  1200. - ``staticdev:`` Checks for static library files (``*.a``) in
  1201. non-``staticdev`` packages.
  1202. - ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
  1203. does not contain a reference to ``${PN}`` (instead of the correct
  1204. ``${BPN}``) nor refers to unstable Github archive tarballs.
  1205. - ``symlink-to-sysroot:`` Checks for symlinks in packages that point
  1206. into :term:`TMPDIR` on the host. Such symlinks will
  1207. work on the host, but are clearly invalid when running on the target.
  1208. - ``textrel:`` Checks for ELF binaries that contain relocations in
  1209. their ``.text`` sections, which can result in a performance impact at
  1210. runtime. See the explanation for the ``ELF binary`` message in
  1211. ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
  1212. issues.
  1213. - ``unhandled-features-check:`` check that if one of the variables that
  1214. the :ref:`ref-classes-features_check` class supports (e.g.
  1215. :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
  1216. also inherits :ref:`ref-classes-features_check` in order for the
  1217. requirement to actually work.
  1218. - ``unimplemented-ptest:`` Checks that ptests are implemented for upstream
  1219. tests.
  1220. - ``unlisted-pkg-lics:`` Checks that all declared licenses applying
  1221. for a package are also declared on the recipe level (i.e. any license
  1222. in ``LICENSE:*`` should appear in :term:`LICENSE`).
  1223. - ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
  1224. in the binaries that by default on a standard system are searched by
  1225. the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
  1226. not cause any breakage, they do waste space and are unnecessary.
  1227. - ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
  1228. check will ensure that no package installs files to root (``/bin``,
  1229. ``/sbin``, ``/lib``, ``/lib64``) directories.
  1230. - ``var-undefined:`` Reports when variables fundamental to packaging
  1231. (i.e. :term:`WORKDIR`,
  1232. :term:`DEPLOY_DIR`, :term:`D`,
  1233. :term:`PN`, and :term:`PKGD`) are undefined
  1234. during :ref:`ref-tasks-package`.
  1235. - ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
  1236. class is enabled, reports when a package being written out has a lower
  1237. version than the previously written package under the same name. If
  1238. you are placing output packages into a feed and upgrading packages on
  1239. a target system using that feed, the version of a package going
  1240. backwards can result in the target system not correctly upgrading to
  1241. the "new" version of the package.
  1242. .. note::
  1243. This is only relevant when you are using runtime package management
  1244. on your target system.
  1245. - ``virtual-slash:`` Checks to see if ``virtual/`` is being used in
  1246. :term:`RDEPENDS` or :term:`RPROVIDES`, which is not good practice ---
  1247. ``virtual/`` is a convention intended for use in the build context
  1248. (i.e. :term:`PROVIDES` and :term:`DEPENDS`) rather than the runtime
  1249. context.
  1250. - ``xorg-driver-abi:`` Checks that all packages containing Xorg
  1251. drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
  1252. driver ABI names. All drivers should depend on the ABI versions that
  1253. they have been built against. Driver recipes that include
  1254. ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
  1255. automatically get these versions. Consequently, you should only need
  1256. to explicitly add dependencies to binary driver recipes.
  1257. .. _ref-classes-kernel:
  1258. ``kernel``
  1259. ==========
  1260. The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
  1261. code to build all kernel trees. All needed headers are staged into the
  1262. :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
  1263. using the :ref:`ref-classes-module` class.
  1264. If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
  1265. :ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
  1266. so it is automatically used as the kernel configuration for the build. This
  1267. copy is not performed in case ``.config`` already exists there: this allows
  1268. recipes to produce a configuration by other means in
  1269. ``do_configure:prepend``.
  1270. Each built kernel module is packaged separately and inter-module
  1271. dependencies are created by parsing the ``modinfo`` output. If all modules
  1272. are required, then installing the ``kernel-modules`` package installs all
  1273. packages with modules and various other kernel packages such as
  1274. ``kernel-vmlinux``.
  1275. The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
  1276. RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
  1277. information on how to build an :term:`Initramfs`, see the
  1278. ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
  1279. the Yocto Project Development Tasks Manual.
  1280. Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
  1281. internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
  1282. :ref:`ref-classes-linux-kernel-base` classes.
  1283. .. _ref-classes-kernel-arch:
  1284. ``kernel-arch``
  1285. ===============
  1286. The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
  1287. Linux kernel compilation (including modules).
  1288. .. _ref-classes-kernel-devicetree:
  1289. ``kernel-devicetree``
  1290. =====================
  1291. The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
  1292. :ref:`ref-classes-kernel` class, supports device tree generation.
  1293. Its behavior is mainly controlled by the following variables:
  1294. - :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
  1295. - :term:`KERNEL_DTBDEST`: directory where to install DTB files
  1296. - :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
  1297. - :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
  1298. - :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
  1299. .. _ref-classes-kernel-fitimage:
  1300. ``kernel-fitimage``
  1301. ===================
  1302. The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
  1303. device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
  1304. into a single FIT image. In theory, a FIT image can support any number
  1305. of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
  1306. However, :ref:`ref-classes-kernel-fitimage` currently only supports
  1307. limited usecases: just one kernel image, an optional U-boot script,
  1308. an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
  1309. device trees.
  1310. To create a FIT image, it is required that :term:`KERNEL_CLASSES`
  1311. is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
  1312. :term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
  1313. The options for the device tree compiler passed to ``mkimage -D``
  1314. when creating the FIT image are specified using the
  1315. :term:`UBOOT_MKIMAGE_DTCOPTS` variable.
  1316. Only a single kernel can be added to the FIT image created by
  1317. :ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
  1318. address where the kernel image is to be loaded by U-Boot is
  1319. specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
  1320. :term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
  1321. is necessary if such addresses are 64 bit ones.
  1322. Multiple device trees can be added to the FIT image created by
  1323. :ref:`ref-classes-kernel-fitimage` and the device tree is optional.
  1324. The address where the device tree is to be loaded by U-Boot is
  1325. specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
  1326. and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
  1327. Only a single RAM disk can be added to the FIT image created by
  1328. :ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
  1329. The address where the RAM disk image is to be loaded by U-Boot
  1330. is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
  1331. :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
  1332. :term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
  1333. is not set to 1.
  1334. Only a single :term:`Initramfs` bundle can be added to the FIT image created by
  1335. :ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
  1336. In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
  1337. in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
  1338. When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
  1339. The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
  1340. is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
  1341. The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
  1342. by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
  1343. Only a single U-boot boot script can be added to the FIT image created by
  1344. :ref:`ref-classes-kernel-fitimage` and the boot script is optional.
  1345. The boot script is specified in the ITS file as a text file containing
  1346. U-boot commands. When using a boot script the user should configure the
  1347. U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
  1348. So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
  1349. class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
  1350. load the boot script from the FIT image and execute it.
  1351. The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
  1352. variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
  1353. :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
  1354. appropriately. The default values used for :term:`FIT_HASH_ALG` and
  1355. :term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
  1356. "rsa2048" respectively. The keys for signing the FIT image can be generated using
  1357. the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
  1358. :term:`UBOOT_SIGN_ENABLE` are set to "1".
  1359. .. _ref-classes-kernel-grub:
  1360. ``kernel-grub``
  1361. ===============
  1362. The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
  1363. the kernel as the priority boot mechanism while installing a RPM to
  1364. update the kernel on a deployed target.
  1365. .. _ref-classes-kernel-module-split:
  1366. ``kernel-module-split``
  1367. =======================
  1368. The :ref:`ref-classes-kernel-module-split` class provides common functionality for
  1369. splitting Linux kernel modules into separate packages.
  1370. .. _ref-classes-kernel-uboot:
  1371. ``kernel-uboot``
  1372. ================
  1373. The :ref:`ref-classes-kernel-uboot` class provides support for building from
  1374. vmlinux-style kernel sources.
  1375. .. _ref-classes-kernel-uimage:
  1376. ``kernel-uimage``
  1377. =================
  1378. The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
  1379. .. _ref-classes-kernel-yocto:
  1380. ``kernel-yocto``
  1381. ================
  1382. The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
  1383. from linux-yocto style kernel source repositories.
  1384. .. _ref-classes-kernelsrc:
  1385. ``kernelsrc``
  1386. =============
  1387. The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
  1388. .. _ref-classes-lib_package:
  1389. ``lib_package``
  1390. ===============
  1391. The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
  1392. produce executable binaries, where those binaries should not be
  1393. installed by default along with the library. Instead, the binaries are
  1394. added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
  1395. make their installation optional.
  1396. .. _ref-classes-libc*:
  1397. ``libc*``
  1398. =========
  1399. The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
  1400. - The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
  1401. ``libc``.
  1402. - The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
  1403. ``eglibc``.
  1404. .. _ref-classes-license:
  1405. ``license``
  1406. ===========
  1407. The :ref:`ref-classes-license` class provides license manifest creation and license
  1408. exclusion. This class is enabled by default using the default value for
  1409. the :term:`INHERIT_DISTRO` variable.
  1410. .. _ref-classes-linux-kernel-base:
  1411. ``linux-kernel-base``
  1412. =====================
  1413. The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
  1414. recipes that build out of the Linux kernel source tree. These builds
  1415. goes beyond the kernel itself. For example, the Perf recipe also
  1416. inherits this class.
  1417. .. _ref-classes-linuxloader:
  1418. ``linuxloader``
  1419. ===============
  1420. Provides the function ``linuxloader()``, which gives the value of the
  1421. dynamic loader/linker provided on the platform. This value is used by a
  1422. number of other classes.
  1423. .. _ref-classes-logging:
  1424. ``logging``
  1425. ===========
  1426. The :ref:`ref-classes-logging` class provides the standard shell functions used to log
  1427. messages for various BitBake severity levels (i.e. ``bbplain``,
  1428. ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
  1429. This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
  1430. class.
  1431. .. _ref-classes-meson:
  1432. ``meson``
  1433. =========
  1434. The :ref:`ref-classes-meson` class allows to create recipes that build software
  1435. using the `Meson <https://mesonbuild.com/>`__ build system. You can use the
  1436. :term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON`
  1437. variables to specify additional configuration options to be passed using the
  1438. ``meson`` command line.
  1439. .. _ref-classes-metadata_scm:
  1440. ``metadata_scm``
  1441. ================
  1442. The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
  1443. branch and revision of a Source Code Manager (SCM) repository.
  1444. The :ref:`ref-classes-base` class uses this class to print the revisions of
  1445. each layer before starting every build. The :ref:`ref-classes-metadata_scm`
  1446. class is enabled by default because it is inherited by the
  1447. :ref:`ref-classes-base` class.
  1448. .. _ref-classes-mime:
  1449. ``mime``
  1450. ========
  1451. The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
  1452. (postinst/postrm) scriptlets for packages that install MIME type files.
  1453. These scriptlets call ``update-mime-database`` to add the MIME types to
  1454. the shared database.
  1455. .. _ref-classes-mime-xdg:
  1456. ``mime-xdg``
  1457. ============
  1458. The :ref:`ref-classes-mime-xdg` class generates the proper
  1459. post-install and post-remove (postinst/postrm) scriptlets for packages
  1460. that install ``.desktop`` files containing ``MimeType`` entries.
  1461. These scriptlets call ``update-desktop-database`` to add the MIME types
  1462. to the database of MIME types handled by desktop files.
  1463. Thanks to this class, when users open a file through a file browser
  1464. on recently created images, they don't have to choose the application
  1465. to open the file from the pool of all known applications, even the ones
  1466. that cannot open the selected file.
  1467. If you have recipes installing their ``.desktop`` files as absolute
  1468. symbolic links, the detection of such files cannot be done by the current
  1469. implementation of this class. In this case, you have to add the corresponding
  1470. package names to the :term:`MIME_XDG_PACKAGES` variable.
  1471. .. _ref-classes-mirrors:
  1472. ``mirrors``
  1473. ===========
  1474. The :ref:`ref-classes-mirrors` class sets up some standard
  1475. :term:`MIRRORS` entries for source code mirrors. These
  1476. mirrors provide a fall-back path in case the upstream source specified
  1477. in :term:`SRC_URI` within recipes is unavailable.
  1478. This class is enabled by default since it is inherited by the
  1479. :ref:`ref-classes-base` class.
  1480. .. _ref-classes-module:
  1481. ``module``
  1482. ==========
  1483. The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
  1484. kernel modules. The class inherits the :ref:`ref-classes-module-base` and
  1485. :ref:`ref-classes-kernel-module-split` classes, and implements the
  1486. :ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
  1487. everything needed to build and package a kernel module.
  1488. For general information on out-of-tree Linux kernel modules, see the
  1489. ":ref:`kernel-dev/common:incorporating out-of-tree modules`"
  1490. section in the Yocto Project Linux Kernel Development Manual.
  1491. .. _ref-classes-module-base:
  1492. ``module-base``
  1493. ===============
  1494. The :ref:`ref-classes-module-base` class provides the base functionality for
  1495. building Linux kernel modules. Typically, a recipe that builds software that
  1496. includes one or more kernel modules and has its own means of building the module
  1497. inherits this class as opposed to inheriting the :ref:`ref-classes-module`
  1498. class.
  1499. .. _ref-classes-multilib*:
  1500. ``multilib*``
  1501. =============
  1502. The :ref:`ref-classes-multilib*` classes provide support for building libraries with
  1503. different target optimizations or target architectures and installing
  1504. them side-by-side in the same image.
  1505. For more information on using the Multilib feature, see the
  1506. ":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
  1507. section in the Yocto Project Development Tasks Manual.
  1508. .. _ref-classes-native:
  1509. ``native``
  1510. ==========
  1511. The :ref:`ref-classes-native` class provides common functionality for recipes that
  1512. build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
  1513. or other tools from the build host).
  1514. You can create a recipe that builds tools that run natively on the host
  1515. a couple different ways:
  1516. - Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
  1517. class. If you use this method, you must order the inherit statement
  1518. in the recipe after all other inherit statements so that the
  1519. :ref:`ref-classes-native` class is inherited last.
  1520. .. note::
  1521. When creating a recipe this way, the recipe name must follow this
  1522. naming convention::
  1523. myrecipe-native.bb
  1524. Not using this naming convention can lead to subtle problems
  1525. caused by existing code that depends on that naming convention.
  1526. - Create or modify a target recipe that contains the following::
  1527. BBCLASSEXTEND = "native"
  1528. Inside the
  1529. recipe, use ``:class-native`` and ``:class-target`` overrides to
  1530. specify any functionality specific to the respective native or target
  1531. case.
  1532. Although applied differently, the :ref:`ref-classes-native` class is used with both
  1533. methods. The advantage of the second method is that you do not need to
  1534. have two separate recipes (assuming you need both) for native and
  1535. target. All common parts of the recipe are automatically shared.
  1536. .. _ref-classes-nativesdk:
  1537. ``nativesdk``
  1538. =============
  1539. The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
  1540. wish to build tools to run as part of an SDK (i.e. tools that run on
  1541. :term:`SDKMACHINE`).
  1542. You can create a recipe that builds tools that run on the SDK machine a
  1543. couple different ways:
  1544. - Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
  1545. :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
  1546. inherit statement in the recipe after all other inherit statements so
  1547. that the :ref:`ref-classes-nativesdk` class is inherited last.
  1548. - Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
  1549. BBCLASSEXTEND = "nativesdk"
  1550. Inside the
  1551. recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
  1552. specify any functionality specific to the respective SDK machine or
  1553. target case.
  1554. .. note::
  1555. When creating a recipe, you must follow this naming convention::
  1556. nativesdk-myrecipe.bb
  1557. Not doing so can lead to subtle problems because there is code that
  1558. depends on the naming convention.
  1559. Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
  1560. methods. The advantage of the second method is that you do not need to
  1561. have two separate recipes (assuming you need both) for the SDK machine
  1562. and the target. All common parts of the recipe are automatically shared.
  1563. .. _ref-classes-nopackages:
  1564. ``nopackages``
  1565. ==============
  1566. Disables packaging tasks for those recipes and classes where packaging
  1567. is not needed.
  1568. .. _ref-classes-nospdx:
  1569. ``nospdx``
  1570. ==========
  1571. The :ref:`ref-classes-nospdx` allows a recipe to opt out of SPDX
  1572. generation provided by :ref:`ref-classes-create-spdx`.
  1573. .. _ref-classes-npm:
  1574. ``npm``
  1575. =======
  1576. Provides support for building Node.js software fetched using the
  1577. :wikipedia:`node package manager (NPM) <Npm_(software)>`.
  1578. .. note::
  1579. Currently, recipes inheriting this class must use the ``npm://``
  1580. fetcher to have dependencies fetched and packaged automatically.
  1581. For information on how to create NPM packages, see the
  1582. ":ref:`dev-manual/packages:creating node package manager (npm) packages`"
  1583. section in the Yocto Project Development Tasks Manual.
  1584. .. _ref-classes-oelint:
  1585. ``oelint``
  1586. ==========
  1587. The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
  1588. ``meta/classes`` in the :term:`Source Directory`.
  1589. There are some classes that could be generally useful in OE-Core but
  1590. are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
  1591. one such example. However, being aware of this class can reduce the
  1592. proliferation of different versions of similar classes across multiple
  1593. layers.
  1594. .. _ref-classes-overlayfs:
  1595. ``overlayfs``
  1596. =============
  1597. It's often desired in Embedded System design to have a read-only root filesystem.
  1598. But a lot of different applications might want to have read-write access to
  1599. some parts of a filesystem. It can be especially useful when your update mechanism
  1600. overwrites the whole root filesystem, but you may want your application data to be preserved
  1601. between updates. The :ref:`ref-classes-overlayfs` class provides a way
  1602. to achieve that by means of ``overlayfs`` and at the same time keeping the base
  1603. root filesystem read-only.
  1604. To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
  1605. layer in your machine configuration. The underlying file system can be anything that
  1606. is supported by ``overlayfs``. This has to be done in your machine configuration::
  1607. OVERLAYFS_MOUNT_POINT[data] = "/data"
  1608. .. note::
  1609. * QA checks fail to catch file existence if you redefine this variable in your recipe!
  1610. * Only the existence of the systemd mount unit file is checked, not its contents.
  1611. * To get more details on ``overlayfs``, its internals and supported operations, please refer
  1612. to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__.
  1613. The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
  1614. (e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
  1615. Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
  1616. OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
  1617. To support several mount points you can use a different variable flag. Assuming we
  1618. want to have a writable location on the file system, but do not need that the data
  1619. survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
  1620. file system.
  1621. In your machine configuration::
  1622. OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
  1623. and then in your recipe::
  1624. OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
  1625. On a practical note, your application recipe might require multiple
  1626. overlays to be mounted before running to avoid writing to the underlying
  1627. file system (which can be forbidden in case of read-only file system)
  1628. To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
  1629. helper service for mounting overlays. This helper service is named
  1630. ``${PN}-overlays.service`` and can be depended on in your application recipe
  1631. (named ``application`` in the following example) ``systemd`` unit by adding
  1632. to the unit the following::
  1633. [Unit]
  1634. After=application-overlays.service
  1635. Requires=application-overlays.service
  1636. .. note::
  1637. The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
  1638. In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
  1639. .. _ref-classes-overlayfs-etc:
  1640. ``overlayfs-etc``
  1641. =================
  1642. In order to have the ``/etc`` directory in overlayfs a special handling at early
  1643. boot stage is required. The idea is to supply a custom init script that mounts
  1644. ``/etc`` before launching the actual init program, because the latter already
  1645. requires ``/etc`` to be mounted.
  1646. Example usage in image recipe::
  1647. IMAGE_FEATURES += "overlayfs-etc"
  1648. .. note::
  1649. This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
  1650. Your machine configuration should define at least the device, mount point, and file system type
  1651. you are going to use for ``overlayfs``::
  1652. OVERLAYFS_ETC_MOUNT_POINT = "/data"
  1653. OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
  1654. OVERLAYFS_ETC_FSTYPE ?= "ext4"
  1655. To control more mount options you should consider setting mount options
  1656. (``defaults`` is used by default)::
  1657. OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
  1658. The class provides two options for ``/sbin/init`` generation:
  1659. - The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
  1660. and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
  1661. that you won't need to change any kernel parameters in order to make it work,
  1662. but it poses a restriction that package-management can't be used, because updating
  1663. the init manager would remove the generated script.
  1664. - If you wish to keep original init as is, you can set::
  1665. OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
  1666. Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
  1667. kernel parameters manually in your bootloader configuration.
  1668. .. _ref-classes-own-mirrors:
  1669. ``own-mirrors``
  1670. ===============
  1671. The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
  1672. :term:`PREMIRRORS` from which to first fetch source
  1673. before attempting to fetch it from the upstream specified in
  1674. :term:`SRC_URI` within each recipe.
  1675. To use this class, inherit it globally and specify
  1676. :term:`SOURCE_MIRROR_URL`. Here is an example::
  1677. INHERIT += "own-mirrors"
  1678. SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
  1679. You can specify only a single URL
  1680. in :term:`SOURCE_MIRROR_URL`.
  1681. .. _ref-classes-package:
  1682. ``package``
  1683. ===========
  1684. The :ref:`ref-classes-package` class supports generating packages from a build's
  1685. output. The core generic functionality is in ``package.bbclass``. The
  1686. code specific to particular package types resides in these
  1687. package-specific classes: :ref:`ref-classes-package_deb`,
  1688. :ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
  1689. You can control the list of resulting package formats by using the
  1690. :term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
  1691. configuration file, which is located in the :term:`Build Directory`.
  1692. When defining the variable, you can specify one or more package types.
  1693. Since images are generated from packages, a packaging class is needed
  1694. to enable image generation. The first class listed in this variable is
  1695. used for image generation.
  1696. If you take the optional step to set up a repository (package feed) on
  1697. the development host that can be used by DNF, you can install packages
  1698. from the feed while you are running the image on the target (i.e.
  1699. runtime installation of packages). For more information, see the
  1700. ":ref:`dev-manual/packages:using runtime package management`"
  1701. section in the Yocto Project Development Tasks Manual.
  1702. The package-specific class you choose can affect build-time performance
  1703. and has space ramifications. In general, building a package with IPK
  1704. takes about thirty percent less time as compared to using RPM to build
  1705. the same or similar package. This comparison takes into account a
  1706. complete build of the package with all dependencies previously built.
  1707. The reason for this discrepancy is because the RPM package manager
  1708. creates and processes more :term:`Metadata` than the IPK package
  1709. manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
  1710. ":ref:`ref-classes-package_ipk`" if you are building smaller systems.
  1711. Before making your package manager decision, however, you should
  1712. consider some further things about using RPM:
  1713. - RPM starts to provide more abilities than IPK due to the fact that it
  1714. processes more Metadata. For example, this information includes
  1715. individual file types, file checksum generation and evaluation on
  1716. install, sparse file support, conflict detection and resolution for
  1717. Multilib systems, ACID style upgrade, and repackaging abilities for
  1718. rollbacks.
  1719. - For smaller systems, the extra space used for the Berkeley Database
  1720. and the amount of metadata when using RPM can affect your ability to
  1721. perform on-device upgrades.
  1722. You can find additional information on the effects of the package class
  1723. at these two Yocto Project mailing list links:
  1724. - :yocto_lists:`/pipermail/poky/2011-May/006362.html`
  1725. - :yocto_lists:`/pipermail/poky/2011-May/006363.html`
  1726. .. _ref-classes-package_deb:
  1727. ``package_deb``
  1728. ===============
  1729. The :ref:`ref-classes-package_deb` class provides support for creating packages that
  1730. use the Debian (i.e. ``.deb``) file format. The class ensures the
  1731. packages are written out in a ``.deb`` file format to the
  1732. ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
  1733. This class inherits the :ref:`ref-classes-package` class and
  1734. is enabled through the :term:`PACKAGE_CLASSES`
  1735. variable in the ``local.conf`` file.
  1736. .. _ref-classes-package_ipk:
  1737. ``package_ipk``
  1738. ===============
  1739. The :ref:`ref-classes-package_ipk` class provides support for creating packages that
  1740. use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
  1741. are written out in a ``.ipk`` file format to the
  1742. ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
  1743. This class inherits the :ref:`ref-classes-package` class and
  1744. is enabled through the :term:`PACKAGE_CLASSES`
  1745. variable in the ``local.conf`` file.
  1746. .. _ref-classes-package_rpm:
  1747. ``package_rpm``
  1748. ===============
  1749. The :ref:`ref-classes-package_rpm` class provides support for creating packages that
  1750. use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
  1751. are written out in a ``.rpm`` file format to the
  1752. ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
  1753. This class inherits the :ref:`ref-classes-package` class and
  1754. is enabled through the :term:`PACKAGE_CLASSES`
  1755. variable in the ``local.conf`` file.
  1756. .. _ref-classes-packagedata:
  1757. ``packagedata``
  1758. ===============
  1759. The :ref:`ref-classes-packagedata` class provides common functionality for reading
  1760. ``pkgdata`` files found in :term:`PKGDATA_DIR`. These
  1761. files contain information about each output package produced by the
  1762. OpenEmbedded build system.
  1763. This class is enabled by default because it is inherited by the
  1764. :ref:`ref-classes-package` class.
  1765. .. _ref-classes-packagegroup:
  1766. ``packagegroup``
  1767. ================
  1768. The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
  1769. group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
  1770. so forth). It is highly recommended that all package group recipes
  1771. inherit this class.
  1772. For information on how to use this class, see the
  1773. ":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
  1774. section in the Yocto Project Development Tasks Manual.
  1775. Previously, this class was called the ``task`` class.
  1776. .. _ref-classes-patch:
  1777. ``patch``
  1778. =========
  1779. The :ref:`ref-classes-patch` class provides all functionality for applying patches
  1780. during the :ref:`ref-tasks-patch` task.
  1781. This class is enabled by default because it is inherited by the
  1782. :ref:`ref-classes-base` class.
  1783. .. _ref-classes-perlnative:
  1784. ``perlnative``
  1785. ==============
  1786. When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
  1787. native version of Perl built by the build system rather than using the
  1788. version provided by the build host.
  1789. .. _ref-classes-pypi:
  1790. ``pypi``
  1791. ========
  1792. The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
  1793. Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
  1794. By default it determines the PyPI package name based upon :term:`BPN`
  1795. (stripping the "python-" or "python3-" prefix off if present), however in
  1796. some cases you may need to set it manually in the recipe by setting
  1797. :term:`PYPI_PACKAGE`.
  1798. Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
  1799. :term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
  1800. and :term:`CVE_PRODUCT`.
  1801. .. _ref-classes-python_flit_core:
  1802. ``python_flit_core``
  1803. ====================
  1804. The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
  1805. the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
  1806. ``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
  1807. section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
  1808. Python modules built with ``flit_core.buildapi`` are pure Python (no
  1809. ``C`` or ``Rust`` extensions).
  1810. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1811. .. _ref-classes-python_maturin:
  1812. ``python_maturin``
  1813. ==================
  1814. The :ref:`ref-classes-python_maturin` class provides support for python-maturin, a replacement
  1815. for setuptools_rust and another "backend" for building Python Wheels.
  1816. .. _ref-classes-python_mesonpy:
  1817. ``python_mesonpy``
  1818. ==================
  1819. The :ref:`ref-classes-python_mesonpy` class enables building Python modules which use the
  1820. meson-python build system.
  1821. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1822. .. _ref-classes-python_pep517:
  1823. ``python_pep517``
  1824. =================
  1825. The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
  1826. archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
  1827. Recipes wouldn't inherit this directly, instead typically another class will
  1828. inherit this and add the relevant native dependencies.
  1829. Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
  1830. :ref:`ref-classes-python_setuptools_build_meta`, and
  1831. :ref:`ref-classes-python_poetry_core`.
  1832. .. _ref-classes-python_poetry_core:
  1833. ``python_poetry_core``
  1834. ======================
  1835. The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
  1836. `Poetry Core <https://python-poetry.org>`__ build system.
  1837. Internally this uses the :ref:`ref-classes-python_pep517` class.
  1838. .. _ref-classes-python_pyo3:
  1839. ``python_pyo3``
  1840. ===============
  1841. The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
  1842. written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
  1843. environment for cross compilation.
  1844. This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
  1845. and is not meant to be used directly in recipes.
  1846. .. _ref-classes-python-setuptools3_rust:
  1847. ``python-setuptools3_rust``
  1848. ===========================
  1849. The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
  1850. extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
  1851. to compile and distribute Python extensions written in Rust as easily
  1852. as if they were written in C.
  1853. This class inherits the :ref:`ref-classes-setuptools3` and
  1854. :ref:`ref-classes-python_pyo3` classes.
  1855. .. _ref-classes-pixbufcache:
  1856. ``pixbufcache``
  1857. ===============
  1858. The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
  1859. post-remove (postinst/postrm) scriptlets for packages that install
  1860. pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
  1861. call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
  1862. Since the cache files are architecture-specific, ``update_pixbuf_cache``
  1863. is run using QEMU if the postinst scriptlets need to be run on the build
  1864. host during image creation.
  1865. If the pixbuf loaders being installed are in packages other than the
  1866. recipe's main package, set
  1867. :term:`PIXBUF_PACKAGES` to specify the packages
  1868. containing the loaders.
  1869. .. _ref-classes-pkgconfig:
  1870. ``pkgconfig``
  1871. =============
  1872. The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
  1873. library information by using ``pkg-config``. This class aims to smooth
  1874. integration of ``pkg-config`` into libraries that use it.
  1875. During staging, BitBake installs ``pkg-config`` data into the
  1876. ``sysroots/`` directory. By making use of sysroot functionality within
  1877. ``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
  1878. files.
  1879. .. _ref-classes-populate-sdk:
  1880. ``populate_sdk``
  1881. ================
  1882. The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
  1883. information on advantages gained when building a cross-development
  1884. toolchain using the :ref:`ref-tasks-populate_sdk`
  1885. task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1886. section in the Yocto Project Application Development and the Extensible
  1887. Software Development Kit (eSDK) manual.
  1888. .. _ref-classes-populate-sdk-*:
  1889. ``populate_sdk_*``
  1890. ==================
  1891. The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
  1892. following classes:
  1893. - :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
  1894. all package managers (i.e. DEB, RPM, and opkg).
  1895. - :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
  1896. package manager.
  1897. - :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
  1898. package manager.
  1899. - :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
  1900. (IPK format) package manager.
  1901. - :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
  1902. package managers.
  1903. The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
  1904. ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
  1905. :term:`IMAGE_PKGTYPE`.
  1906. The base class ensures all source and destination directories are
  1907. established and then populates the SDK. After populating the SDK, the
  1908. :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
  1909. ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
  1910. contains the cross-compiler and associated tooling, and the target,
  1911. which contains a target root filesystem that is configured for the SDK
  1912. usage. These two images reside in :term:`SDK_OUTPUT`,
  1913. which consists of the following::
  1914. ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
  1915. ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
  1916. Finally, the base populate SDK class creates the toolchain environment
  1917. setup script, the tarball of the SDK, and the installer.
  1918. The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
  1919. :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
  1920. These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
  1921. class.
  1922. For more information on the cross-development toolchain generation, see
  1923. the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  1924. section in the Yocto Project Overview and Concepts Manual. For
  1925. information on advantages gained when building a cross-development
  1926. toolchain using the :ref:`ref-tasks-populate_sdk`
  1927. task, see the
  1928. ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1929. section in the Yocto Project Application Development and the Extensible
  1930. Software Development Kit (eSDK) manual.
  1931. .. _ref-classes-prexport:
  1932. ``prexport``
  1933. ============
  1934. The :ref:`ref-classes-prexport` class provides functionality for exporting
  1935. :term:`PR` values.
  1936. .. note::
  1937. This class is not intended to be used directly. Rather, it is enabled
  1938. when using "``bitbake-prserv-tool export``".
  1939. .. _ref-classes-primport:
  1940. ``primport``
  1941. ============
  1942. The :ref:`ref-classes-primport` class provides functionality for importing
  1943. :term:`PR` values.
  1944. .. note::
  1945. This class is not intended to be used directly. Rather, it is enabled
  1946. when using "``bitbake-prserv-tool import``".
  1947. .. _ref-classes-prserv:
  1948. ``prserv``
  1949. ==========
  1950. The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
  1951. service <dev-manual/packages:working with a pr service>` in order to
  1952. automatically manage the incrementing of the :term:`PR`
  1953. variable for each recipe.
  1954. This class is enabled by default because it is inherited by the
  1955. :ref:`ref-classes-package` class. However, the OpenEmbedded
  1956. build system will not enable the functionality of this class unless
  1957. :term:`PRSERV_HOST` has been set.
  1958. .. _ref-classes-ptest:
  1959. ``ptest``
  1960. =========
  1961. The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
  1962. runtime tests for recipes that build software that provides these tests.
  1963. This class is intended to be inherited by individual recipes. However,
  1964. the class' functionality is largely disabled unless "ptest" appears in
  1965. :term:`DISTRO_FEATURES`. See the
  1966. ":ref:`test-manual/ptest:testing packages with ptest`"
  1967. section in the Yocto Project Development Tasks Manual for more information
  1968. on ptest.
  1969. .. _ref-classes-ptest-cargo:
  1970. ``ptest-cargo``
  1971. ===============
  1972. The :ref:`ref-classes-ptest-cargo` class is a class which extends the
  1973. :ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
  1974. ``install_ptest_cargo`` steps to respectively build and install
  1975. test suites defined in the ``Cargo.toml`` file, into a dedicated
  1976. ``-ptest`` package.
  1977. .. _ref-classes-ptest-gnome:
  1978. ``ptest-gnome``
  1979. ===============
  1980. Enables package tests (ptests) specifically for GNOME packages, which
  1981. have tests intended to be executed with ``gnome-desktop-testing``.
  1982. For information on setting up and running ptests, see the
  1983. ":ref:`test-manual/ptest:testing packages with ptest`"
  1984. section in the Yocto Project Development Tasks Manual.
  1985. .. _ref-classes-ptest-python-pytest:
  1986. ``ptest-python-pytest``
  1987. =======================
  1988. The :ref:`ref-classes-ptest-python-pytest` class can be inherited in Python-based
  1989. recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
  1990. packages leveraging the `pytest <https://docs.pytest.org>`__ unit test framework.
  1991. Within the recipe, the :term:`PTEST_PYTEST_DIR` variable specifies the path to
  1992. the directory containing the tests that will be installed in :term:`D` by the
  1993. :ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
  1994. script for this task.
  1995. .. _ref-classes-python3-dir:
  1996. ``python3-dir``
  1997. ===============
  1998. The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
  1999. package location for Python 3.
  2000. .. _ref-classes-python3native:
  2001. ``python3native``
  2002. =================
  2003. The :ref:`ref-classes-python3native` class supports using the native version of Python
  2004. 3 built by the build system rather than support of the version provided
  2005. by the build host.
  2006. .. _ref-classes-python3targetconfig:
  2007. ``python3targetconfig``
  2008. =======================
  2009. The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
  2010. 3 built by the build system rather than support of the version provided
  2011. by the build host, except that the configuration for the target machine
  2012. is accessible (such as correct installation directories). This also adds a
  2013. dependency on target ``python3``, so should only be used where appropriate
  2014. in order to avoid unnecessarily lengthening builds.
  2015. .. _ref-classes-qemu:
  2016. ``qemu``
  2017. ========
  2018. The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
  2019. QEMU or test for the existence of QEMU. Typically, this class is used to
  2020. run programs for a target system on the build host using QEMU's
  2021. application emulation mode.
  2022. .. _ref-classes-recipe_sanity:
  2023. ``recipe_sanity``
  2024. =================
  2025. The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
  2026. recipe prerequisites that might affect the build (e.g. variables that
  2027. are set or software that is present).
  2028. .. _ref-classes-relocatable:
  2029. ``relocatable``
  2030. ===============
  2031. The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
  2032. installed into the sysroot.
  2033. This class makes use of the :ref:`ref-classes-chrpath` class and is used by
  2034. both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
  2035. .. _ref-classes-remove-libtool:
  2036. ``remove-libtool``
  2037. ==================
  2038. The :ref:`ref-classes-remove-libtool` class adds a post function to the
  2039. :ref:`ref-tasks-install` task to remove all ``.la`` files
  2040. installed by ``libtool``. Removing these files results in them being
  2041. absent from both the sysroot and target packages.
  2042. If a recipe needs the ``.la`` files to be installed, then the recipe can
  2043. override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
  2044. REMOVE_LIBTOOL_LA = "0"
  2045. .. note::
  2046. The :ref:`ref-classes-remove-libtool` class is not enabled by default.
  2047. .. _ref-classes-report-error:
  2048. ``report-error``
  2049. ================
  2050. The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
  2051. tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
  2052. which allows you to submit build error information to a central database.
  2053. The class collects debug information for recipe, recipe version, task,
  2054. machine, distro, build system, target system, host distro, branch,
  2055. commit, and log. From the information, report files using a JSON format
  2056. are created and stored in
  2057. ``${``\ :term:`LOG_DIR`\ ``}/error-report``.
  2058. .. _ref-classes-retain:
  2059. ``retain``
  2060. ==========
  2061. The :ref:`ref-classes-retain` class can be used to create a tarball of the work
  2062. directory for a recipe when one of its tasks fails, or any other nominated
  2063. directories. It is useful in cases where the environment in which builds are run
  2064. is ephemeral or otherwise inaccessible for examination during debugging.
  2065. To enable, add the following to your configuration::
  2066. INHERIT += "retain"
  2067. The class can be disabled for specific recipes using the :term:`RETAIN_ENABLED`
  2068. variable.
  2069. .. _ref-classes-rm-work:
  2070. ``rm_work``
  2071. ===========
  2072. The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
  2073. can ease your hard drive demands during builds.
  2074. The OpenEmbedded build system can use a substantial amount of disk space
  2075. during the build process. A portion of this space is the work files
  2076. under the ``${TMPDIR}/work`` directory for each recipe. Once the build
  2077. system generates the packages for a recipe, the work files for that
  2078. recipe are no longer needed. However, by default, the build system
  2079. preserves these files for inspection and possible debugging purposes. If
  2080. you would rather have these files deleted to save disk space as the build
  2081. progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
  2082. your ``local.conf`` file, which is found in the :term:`Build Directory`::
  2083. INHERIT += "rm_work"
  2084. If you are modifying and building source code out of the work directory for a
  2085. recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
  2086. changes to the source being lost. To exclude some recipes from having their work
  2087. directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
  2088. recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
  2089. which can also be set in your ``local.conf`` file. Here is an example::
  2090. RM_WORK_EXCLUDE += "busybox glibc"
  2091. .. _ref-classes-rootfs*:
  2092. ``rootfs*``
  2093. ===========
  2094. The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
  2095. image and consist of the following classes:
  2096. - The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
  2097. post-processing functions for image recipes.
  2098. - The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
  2099. for images built using ``.deb`` packages.
  2100. - The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
  2101. for images built using ``.rpm`` packages.
  2102. - The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
  2103. for images built using ``.ipk`` packages.
  2104. - The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
  2105. on the build host directly into the root filesystem.
  2106. The root filesystem is created from packages using one of the
  2107. :ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
  2108. variable.
  2109. For information on how root filesystem images are created, see the
  2110. ":ref:`overview-manual/concepts:image generation`"
  2111. section in the Yocto Project Overview and Concepts Manual.
  2112. .. _ref-classes-rust:
  2113. ``rust``
  2114. ========
  2115. The :ref:`ref-classes-rust` class is an internal class which is just used
  2116. in the "rust" recipe, to build the Rust compiler and runtime
  2117. library. Except for this recipe, it is not intended to be used directly.
  2118. .. _ref-classes-rust-common:
  2119. ``rust-common``
  2120. ===============
  2121. The :ref:`ref-classes-rust-common` class is an internal class to the
  2122. :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
  2123. intended to be used directly.
  2124. .. _ref-classes-sanity:
  2125. ``sanity``
  2126. ==========
  2127. The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
  2128. on the host system so that users can be notified of potential problems
  2129. that might affect their build. The class also performs basic user
  2130. configuration checks from the ``local.conf`` configuration file to
  2131. prevent common mistakes that cause build failures. Distribution policy
  2132. usually determines whether to include this class.
  2133. .. _ref-classes-scons:
  2134. ``scons``
  2135. =========
  2136. The :ref:`ref-classes-scons` class supports recipes that need to build software
  2137. that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
  2138. variable to specify additional configuration options you want to pass SCons
  2139. command line.
  2140. .. _ref-classes-sdl:
  2141. ``sdl``
  2142. =======
  2143. The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
  2144. the Simple DirectMedia Layer (SDL) library.
  2145. .. _ref-classes-python_setuptools_build_meta:
  2146. ``python_setuptools_build_meta``
  2147. ================================
  2148. The :ref:`ref-classes-python_setuptools_build_meta` class enables building
  2149. Python modules which declare the
  2150. `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
  2151. ``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
  2152. section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
  2153. Python modules built with ``setuptools.build_meta`` can be pure Python or
  2154. include ``C`` or ``Rust`` extensions).
  2155. Internally this uses the :ref:`ref-classes-python_pep517` class.
  2156. .. _ref-classes-setuptools3:
  2157. ``setuptools3``
  2158. ===============
  2159. The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
  2160. that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
  2161. and have not migrated to the official ``pyproject.toml`` format). If your recipe
  2162. uses these build systems, the recipe needs to inherit the
  2163. :ref:`ref-classes-setuptools3` class.
  2164. .. note::
  2165. The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
  2166. ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
  2167. (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
  2168. A consequence of this is that legacy software still using deprecated
  2169. ``distutils`` from the Python standard library cannot be packaged as
  2170. ``wheels``. A common solution is the replace
  2171. ``from distutils.core import setup`` with ``from setuptools import setup``.
  2172. .. note::
  2173. The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
  2174. installs the ``wheel`` binary archive. In current versions of
  2175. ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
  2176. the ``setup.py`` cannot be used with wheels, for example it creates files
  2177. outside of the Python module or standard entry points, then
  2178. :ref:`ref-classes-setuptools3_legacy` should be used.
  2179. .. _ref-classes-setuptools3_legacy:
  2180. ``setuptools3_legacy``
  2181. ======================
  2182. The :ref:`ref-classes-setuptools3_legacy` class supports
  2183. Python version 3.x extensions that use build systems based on ``setuptools``
  2184. (e.g. only have a ``setup.py`` and have not migrated to the official
  2185. ``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
  2186. this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
  2187. not wheels. This use of ``setuptools`` like this is
  2188. `deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
  2189. but still relatively common.
  2190. .. _ref-classes-setuptools3-base:
  2191. ``setuptools3-base``
  2192. ====================
  2193. The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
  2194. other classes that support building Python version 3.x extensions. If you need
  2195. functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
  2196. you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
  2197. in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
  2198. .. _ref-classes-sign_rpm:
  2199. ``sign_rpm``
  2200. ============
  2201. The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
  2202. .. _ref-classes-siteinfo:
  2203. ``siteinfo``
  2204. ============
  2205. The :ref:`ref-classes-siteinfo` class provides information about the targets
  2206. that might be needed by other classes or recipes.
  2207. As an example, consider Autotools, which can require tests that must
  2208. execute on the target hardware. Since this is not possible in general
  2209. when cross compiling, site information is used to provide cached test
  2210. results so these tests can be skipped over but still make the correct
  2211. values available. The ``meta/site directory`` contains test results
  2212. sorted into different categories such as architecture, endianness, and
  2213. the ``libc`` used. Site information provides a list of files containing
  2214. data relevant to the current build in the :term:`CONFIG_SITE` variable that
  2215. Autotools automatically picks up.
  2216. The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
  2217. :term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
  2218. .. _ref-classes-sstate:
  2219. ``sstate``
  2220. ==========
  2221. The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
  2222. By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
  2223. default value.
  2224. For more information on sstate, see the
  2225. ":ref:`overview-manual/concepts:shared state cache`"
  2226. section in the Yocto Project Overview and Concepts Manual.
  2227. .. _ref-classes-staging:
  2228. ``staging``
  2229. ===========
  2230. The :ref:`ref-classes-staging` class installs files into individual recipe work
  2231. directories for sysroots. The class contains the following key tasks:
  2232. - The :ref:`ref-tasks-populate_sysroot` task,
  2233. which is responsible for handing the files that end up in the recipe
  2234. sysroots.
  2235. - The
  2236. :ref:`ref-tasks-prepare_recipe_sysroot`
  2237. task (a "partner" task to the ``populate_sysroot`` task), which
  2238. installs the files into the individual recipe work directories (i.e.
  2239. :term:`WORKDIR`).
  2240. The code in the :ref:`ref-classes-staging` class is complex and basically works
  2241. in two stages:
  2242. - *Stage One:* The first stage addresses recipes that have files they
  2243. want to share with other recipes that have dependencies on the
  2244. originating recipe. Normally these dependencies are installed through
  2245. the :ref:`ref-tasks-install` task into
  2246. ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
  2247. copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
  2248. subset of files is controlled by the
  2249. :term:`SYSROOT_DIRS`,
  2250. :term:`SYSROOT_DIRS_NATIVE`, and
  2251. :term:`SYSROOT_DIRS_IGNORE`
  2252. variables.
  2253. .. note::
  2254. Additionally, a recipe can customize the files further by
  2255. declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
  2256. variable.
  2257. A shared state (sstate) object is built from these files and the
  2258. files are placed into a subdirectory of
  2259. :ref:`structure-build-tmp-sysroots-components`.
  2260. The files are scanned for hardcoded paths to the original
  2261. installation location. If the location is found in text files, the
  2262. hardcoded locations are replaced by tokens and a list of the files
  2263. needing such replacements is created. These adjustments are referred
  2264. to as "FIXMEs". The list of files that are scanned for paths is
  2265. controlled by the :term:`SSTATE_SCAN_FILES`
  2266. variable.
  2267. - *Stage Two:* The second stage addresses recipes that want to use
  2268. something from another recipe and declare a dependency on that recipe
  2269. through the :term:`DEPENDS` variable. The recipe will
  2270. have a
  2271. :ref:`ref-tasks-prepare_recipe_sysroot`
  2272. task and when this task executes, it creates the ``recipe-sysroot``
  2273. and ``recipe-sysroot-native`` in the recipe work directory (i.e.
  2274. :term:`WORKDIR`). The OpenEmbedded build system
  2275. creates hard links to copies of the relevant files from
  2276. ``sysroots-components`` into the recipe work directory.
  2277. .. note::
  2278. If hard links are not possible, the build system uses actual
  2279. copies.
  2280. The build system then addresses any "FIXMEs" to paths as defined from
  2281. the list created in the first stage.
  2282. Finally, any files in ``${bindir}`` within the sysroot that have the
  2283. prefix "``postinst-``" are executed.
  2284. .. note::
  2285. Although such sysroot post installation scripts are not
  2286. recommended for general use, the files do allow some issues such
  2287. as user creation and module indexes to be addressed.
  2288. Because recipes can have other dependencies outside of :term:`DEPENDS`
  2289. (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
  2290. the sysroot creation function ``extend_recipe_sysroot`` is also added
  2291. as a pre-function for those tasks whose dependencies are not through
  2292. :term:`DEPENDS` but operate similarly.
  2293. When installing dependencies into the sysroot, the code traverses the
  2294. dependency graph and processes dependencies in exactly the same way
  2295. as the dependencies would or would not be when installed from sstate.
  2296. This processing means, for example, a native tool would have its
  2297. native dependencies added but a target library would not have its
  2298. dependencies traversed or installed. The same sstate dependency code
  2299. is used so that builds should be identical regardless of whether
  2300. sstate was used or not. For a closer look, see the
  2301. ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
  2302. The build system is careful to maintain manifests of the files it
  2303. installs so that any given dependency can be installed as needed. The
  2304. sstate hash of the installed item is also stored so that if it
  2305. changes, the build system can reinstall it.
  2306. .. _ref-classes-syslinux:
  2307. ``syslinux``
  2308. ============
  2309. The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
  2310. building bootable images.
  2311. The class supports the following variables:
  2312. - :term:`INITRD`: Indicates list of filesystem images to
  2313. concatenate and use as an initial RAM disk (initrd). This variable is
  2314. optional.
  2315. - :term:`ROOTFS`: Indicates a filesystem image to include
  2316. as the root filesystem. This variable is optional.
  2317. - :term:`AUTO_SYSLINUXMENU`: Enables creating
  2318. an automatic menu when set to "1".
  2319. - :term:`LABELS`: Lists targets for automatic
  2320. configuration.
  2321. - :term:`APPEND`: Lists append string overrides for each
  2322. label.
  2323. - :term:`SYSLINUX_OPTS`: Lists additional options
  2324. to add to the syslinux file. Semicolon characters separate multiple
  2325. options.
  2326. - :term:`SYSLINUX_SPLASH`: Lists a background
  2327. for the VGA boot menu when you are using the boot menu.
  2328. - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
  2329. to "console=ttyX" to change kernel boot default console.
  2330. - :term:`SYSLINUX_SERIAL`: Sets an alternate
  2331. serial port. Or, turns off serial when the variable is set with an
  2332. empty string.
  2333. - :term:`SYSLINUX_SERIAL_TTY`: Sets an
  2334. alternate "console=tty..." kernel boot argument.
  2335. .. _ref-classes-systemd:
  2336. ``systemd``
  2337. ===========
  2338. The :ref:`ref-classes-systemd` class provides support for recipes that install
  2339. systemd unit files.
  2340. The functionality for this class is disabled unless you have "systemd"
  2341. in :term:`DISTRO_FEATURES`.
  2342. Under this class, the recipe or Makefile (i.e. whatever the recipe is
  2343. calling during the :ref:`ref-tasks-install` task)
  2344. installs unit files into
  2345. ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
  2346. files being installed go into packages other than the main package, you
  2347. need to set :term:`SYSTEMD_PACKAGES` in your
  2348. recipe to identify the packages in which the files will be installed.
  2349. You should set :term:`SYSTEMD_SERVICE` to the
  2350. name of the service file. You should also use a package name override to
  2351. indicate the package to which the value applies. If the value applies to
  2352. the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
  2353. is an example from the connman recipe::
  2354. SYSTEMD_SERVICE:${PN} = "connman.service"
  2355. Services are set up to start on boot automatically
  2356. unless you have set
  2357. :term:`SYSTEMD_AUTO_ENABLE` to "disable".
  2358. For more information on :ref:`ref-classes-systemd`, see the
  2359. ":ref:`dev-manual/init-manager:selecting an initialization manager`"
  2360. section in the Yocto Project Development Tasks Manual.
  2361. .. _ref-classes-systemd-boot:
  2362. ``systemd-boot``
  2363. ================
  2364. The :ref:`ref-classes-systemd-boot` class provides functions specific to the
  2365. systemd-boot bootloader for building bootable images. This is an
  2366. internal class and is not intended to be used directly.
  2367. .. note::
  2368. The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
  2369. used in previous Yocto Project releases with the ``systemd`` project.
  2370. Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
  2371. use this class. Doing so creates a standalone EFI bootloader that is not
  2372. dependent on systemd.
  2373. For information on more variables used and supported in this class, see
  2374. the :term:`SYSTEMD_BOOT_CFG`,
  2375. :term:`SYSTEMD_BOOT_ENTRIES`, and
  2376. :term:`SYSTEMD_BOOT_TIMEOUT` variables.
  2377. You can also see the `Systemd-boot
  2378. documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
  2379. for more information.
  2380. .. _ref-classes-terminal:
  2381. ``terminal``
  2382. ============
  2383. The :ref:`ref-classes-terminal` class provides support for starting a terminal
  2384. session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
  2385. used for the session.
  2386. Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
  2387. terminal session needs to be started. For example, the :ref:`ref-classes-patch`
  2388. class assuming :term:`PATCHRESOLVE` is set to "user", the
  2389. :ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
  2390. use the :ref:`ref-classes-terminal` class.
  2391. .. _ref-classes-testimage:
  2392. ``testimage``
  2393. =============
  2394. The :ref:`ref-classes-testimage` class supports running automated tests against
  2395. images using QEMU and on actual hardware. The classes handle loading the
  2396. tests and starting the image. To use the classes, you need to perform
  2397. steps to set up the environment.
  2398. To enable this class, add the following to your configuration::
  2399. IMAGE_CLASSES += "testimage"
  2400. The tests are commands that run on the target system over ``ssh``. Each
  2401. test is written in Python and makes use of the ``unittest`` module.
  2402. The :ref:`ref-classes-testimage` class runs tests on an image when called using the
  2403. following::
  2404. $ bitbake -c testimage image
  2405. Alternatively, if you wish to have tests automatically run for each image
  2406. after it is built, you can set :term:`TESTIMAGE_AUTO`::
  2407. TESTIMAGE_AUTO = "1"
  2408. For information on how to enable, run, and create new tests, see the
  2409. ":ref:`test-manual/runtime-testing:performing automated runtime testing`"
  2410. section in the Yocto Project Test Environment Manual.
  2411. .. _ref-classes-testsdk:
  2412. ``testsdk``
  2413. ===========
  2414. This class supports running automated tests against software development
  2415. kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
  2416. using the following::
  2417. $ bitbake -c testsdk image
  2418. .. note::
  2419. Best practices include using :term:`IMAGE_CLASSES` rather than
  2420. :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
  2421. testing.
  2422. .. _ref-classes-texinfo:
  2423. ``texinfo``
  2424. ===========
  2425. This class should be inherited by recipes whose upstream packages invoke
  2426. the ``texinfo`` utilities at build-time. Native and cross recipes are
  2427. made to use the dummy scripts provided by ``texinfo-dummy-native``, for
  2428. improved performance. Target architecture recipes use the genuine
  2429. Texinfo utilities. By default, they use the Texinfo utilities on the
  2430. host system.
  2431. .. note::
  2432. If you want to use the Texinfo recipe shipped with the build system,
  2433. you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
  2434. from :term:`SANITY_REQUIRED_UTILITIES`.
  2435. .. _ref-classes-toaster:
  2436. ``toaster``
  2437. ===========
  2438. The :ref:`ref-classes-toaster` class collects information about packages and images and
  2439. sends them as events that the BitBake user interface can receive. The
  2440. class is enabled when the Toaster user interface is running.
  2441. This class is not intended to be used directly.
  2442. .. _ref-classes-toolchain-scripts:
  2443. ``toolchain-scripts``
  2444. =====================
  2445. The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
  2446. the environment for installed SDKs.
  2447. .. _ref-classes-typecheck:
  2448. ``typecheck``
  2449. =============
  2450. The :ref:`ref-classes-typecheck` class provides support for validating the values of
  2451. variables set at the configuration level against their defined types.
  2452. The OpenEmbedded build system allows you to define the type of a
  2453. variable using the "type" varflag. Here is an example::
  2454. IMAGE_FEATURES[type] = "list"
  2455. .. _ref-classes-uboot-config:
  2456. ``uboot-config``
  2457. ================
  2458. The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
  2459. a machine. Specify the machine in your recipe as follows::
  2460. UBOOT_CONFIG ??= <default>
  2461. UBOOT_CONFIG[foo] = "config,images,binary"
  2462. You can also specify the machine using this method::
  2463. UBOOT_MACHINE = "config"
  2464. See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
  2465. information.
  2466. .. _ref-classes-uboot-sign:
  2467. ``uboot-sign``
  2468. ==============
  2469. The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
  2470. It is intended to be inherited from U-Boot recipes.
  2471. The variables used by this class are:
  2472. - :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
  2473. building the FIT image.
  2474. - :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
  2475. - :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
  2476. - :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
  2477. - :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
  2478. - :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
  2479. - :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
  2480. - :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
  2481. - :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
  2482. - :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
  2483. - :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
  2484. - :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
  2485. signing.
  2486. - :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
  2487. for FIT image signing.
  2488. - :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
  2489. - :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
  2490. rebuilding the FIT image containing the kernel.
  2491. - :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE`: include the Trusted Firmware-A
  2492. (TF-A) binary in the U-Boot FIT image.
  2493. - :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE`: specifies the path to the
  2494. Trusted Firmware-A (TF-A) binary.
  2495. - :term:`UBOOT_FIT_TEE`: include the Trusted Execution Environment (TEE)
  2496. binary in the U-Boot FIT image.
  2497. - :term:`UBOOT_FIT_TEE_IMAGE`: specifies the path to the Trusted Execution
  2498. Environment (TEE) binary.
  2499. - :term:`UBOOT_FIT_USER_SETTINGS`: adds a user-specific snippet to the U-Boot
  2500. Image Tree Source (ITS). Users can include their custom U-Boot Image Tree
  2501. Source (ITS) snippet in this variable.
  2502. - :term:`UBOOT_FIT_CONF_FIRMWARE`: adds one image to the ``firmware`` property
  2503. of the configuration node.
  2504. - :term:`UBOOT_FIT_CONF_USER_LOADABLES`: adds one or more user-defined images
  2505. to the ``loadables`` property of the configuration node.
  2506. See U-Boot's documentation for details about `verified boot
  2507. <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
  2508. and the `signature process
  2509. <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
  2510. See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
  2511. imitates.
  2512. .. _ref-classes-uki:
  2513. ``uki``
  2514. =======
  2515. The :ref:`ref-classes-uki` class provides support for `Unified Kernel Image
  2516. (UKI) <https://uapi-group.org/specifications/specs/unified_kernel_image/>`__
  2517. format. UKIs combine kernel, :term:`Initramfs`, signatures, metadata etc to a
  2518. single UEFI firmware compatible binary. The class is intended to be inherited
  2519. by rootfs image recipes. The build configuration should also use an
  2520. :term:`Initramfs`, ``systemd-boot`` as boot menu provider and have UEFI support
  2521. on target hardware. Using ``systemd`` as init is recommended. Image builds
  2522. should create an ESP partition for UEFI firmware and copy ``systemd-boot`` and
  2523. UKI files there. Sample configuration for Wic images is provided in
  2524. :oe_git:`scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in
  2525. </openembedded-core/tree/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in>`.
  2526. UKIs are generated using ``systemd`` reference implementation `ukify
  2527. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__.
  2528. This class uses a number of variables but tries to find sensible defaults for
  2529. them.
  2530. The variables used by this class are:
  2531. - :term:`EFI_ARCH`: architecture name within EFI standard, set in
  2532. :oe_git:`meta/conf/image-uefi.conf
  2533. </openembedded-core/tree/meta/conf/image-uefi.conf>`
  2534. - :term:`IMAGE_EFI_BOOT_FILES`: files to install to EFI boot partition
  2535. created by the ``bootimg-efi`` Wic plugin
  2536. - :term:`INITRAMFS_IMAGE`: initramfs recipe name
  2537. - :term:`KERNEL_DEVICETREE`: optional devicetree files to embed into UKI
  2538. - :term:`UKIFY_CMD`: `ukify
  2539. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
  2540. command to build the UKI image
  2541. - :term:`UKI_CMDLINE`: kernel command line to use with UKI
  2542. - :term:`UKI_CONFIG_FILE`: optional config file for `ukify
  2543. <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
  2544. - :term:`UKI_FILENAME`: output file name for the UKI image
  2545. - :term:`UKI_KERNEL_FILENAME`: kernel image file name
  2546. - :term:`UKI_SB_CERT`: optional UEFI secureboot certificate matching the
  2547. private key
  2548. - :term:`UKI_SB_KEY`: optional UEFI secureboot private key to sign UKI with
  2549. For examples on how to use this class see oeqa selftest
  2550. :oe_git:`meta/lib/oeqa/selftest/cases/uki.py
  2551. </openembedded-core/tree/meta/lib/oeqa/selftest/cases/uki.py>`.
  2552. Also an oeqa runtime test :oe_git:`meta/lib/oeqa/runtime/cases/uki.py
  2553. </openembedded-core/tree/meta/lib/oeqa/runtime/cases/uki.py>` is provided which
  2554. verifies that the target system booted the same UKI binary as was set at
  2555. buildtime via :term:`UKI_FILENAME`.
  2556. .. _ref-classes-uninative:
  2557. ``uninative``
  2558. =============
  2559. Attempts to isolate the build system from the host distribution's C
  2560. library in order to make re-use of native shared state artifacts across
  2561. different host distributions practical. With this class enabled, a
  2562. tarball containing a pre-built C library is downloaded at the start of
  2563. the build. In the Poky reference distribution this is enabled by default
  2564. through ``meta/conf/distro/include/yocto-uninative.inc``. Other
  2565. distributions that do not derive from poky can also
  2566. "``require conf/distro/include/yocto-uninative.inc``" to use this.
  2567. Alternatively if you prefer, you can build the uninative-tarball recipe
  2568. yourself, publish the resulting tarball (e.g. via HTTP) and set
  2569. ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
  2570. example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
  2571. The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
  2572. SDK. When building the extensible SDK, ``uninative-tarball`` is built
  2573. and the resulting tarball is included within the SDK.
  2574. .. _ref-classes-update-alternatives:
  2575. ``update-alternatives``
  2576. =======================
  2577. The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
  2578. multiple sources provide the same command. This situation occurs when
  2579. several programs that have the same or similar function are installed
  2580. with the same name. For example, the ``ar`` command is available from
  2581. the ``busybox``, ``binutils`` and ``elfutils`` packages. The
  2582. :ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
  2583. multiple packages can be installed without conflicts. The ``ar`` command
  2584. still works regardless of which packages are installed or subsequently
  2585. removed. The class renames the conflicting binary in each package and
  2586. symlinks the highest priority binary during installation or removal of
  2587. packages.
  2588. To use this class, you need to define a number of variables:
  2589. - :term:`ALTERNATIVE`
  2590. - :term:`ALTERNATIVE_LINK_NAME`
  2591. - :term:`ALTERNATIVE_TARGET`
  2592. - :term:`ALTERNATIVE_PRIORITY`
  2593. These variables list alternative commands needed by a package, provide
  2594. pathnames for links, default links for targets, and so forth. For
  2595. details on how to use this class, see the comments in the
  2596. :yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
  2597. file.
  2598. .. note::
  2599. You can use the ``update-alternatives`` command directly in your recipes.
  2600. However, this class simplifies things in most cases.
  2601. .. _ref-classes-update-rc.d:
  2602. ``update-rc.d``
  2603. ===============
  2604. The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
  2605. initialization script on behalf of the package. The OpenEmbedded build
  2606. system takes care of details such as making sure the script is stopped
  2607. before a package is removed and started when the package is installed.
  2608. Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
  2609. :term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
  2610. for details.
  2611. .. _ref-classes-useradd:
  2612. ``useradd*``
  2613. ============
  2614. The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
  2615. usage by the package on the target. For example, if you have packages
  2616. that contain system services that should be run under their own user or
  2617. group, you can use these classes to enable creation of the user or
  2618. group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
  2619. </openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
  2620. recipe in the :term:`Source Directory` provides a simple
  2621. example that shows how to add three users and groups to two packages.
  2622. The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
  2623. groups settings.
  2624. The :ref:`useradd* <ref-classes-useradd>` classes support the
  2625. :term:`USERADD_PACKAGES`,
  2626. :term:`USERADD_PARAM`,
  2627. :term:`GROUPADD_PARAM`, and
  2628. :term:`GROUPMEMS_PARAM` variables.
  2629. The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
  2630. that have static user identification (``uid``) and group identification
  2631. (``gid``) values.
  2632. The default behavior of the OpenEmbedded build system for assigning
  2633. ``uid`` and ``gid`` values when packages add users and groups during
  2634. package install time is to add them dynamically. This works fine for
  2635. programs that do not care what the values of the resulting users and
  2636. groups become. In these cases, the order of the installation determines
  2637. the final ``uid`` and ``gid`` values. However, if non-deterministic
  2638. ``uid`` and ``gid`` values are a problem, you can override the default,
  2639. dynamic application of these values by setting static values. When you
  2640. set static values, the OpenEmbedded build system looks in
  2641. :term:`BBPATH` for ``files/passwd`` and ``files/group``
  2642. files for the values.
  2643. To use static ``uid`` and ``gid`` values, you need to set some variables. See
  2644. the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
  2645. :term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
  2646. You can also see the :ref:`ref-classes-useradd` class for additional
  2647. information.
  2648. .. note::
  2649. You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
  2650. or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
  2651. enable or disable the class in a configured system, :term:`TMPDIR` might
  2652. contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
  2653. directory will correct this condition.
  2654. .. _ref-classes-utility-tasks:
  2655. ``utility-tasks``
  2656. =================
  2657. The :ref:`ref-classes-utility-tasks` class provides support for various
  2658. "utility" type tasks that are applicable to all recipes, such as
  2659. :ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
  2660. This class is enabled by default because it is inherited by the
  2661. :ref:`ref-classes-base` class.
  2662. .. _ref-classes-utils:
  2663. ``utils``
  2664. =========
  2665. The :ref:`ref-classes-utils` class provides some useful Python functions that are
  2666. typically used in inline Python expressions (e.g. ``${@...}``). One
  2667. example use is for ``bb.utils.contains()``.
  2668. This class is enabled by default because it is inherited by the
  2669. :ref:`ref-classes-base` class.
  2670. .. _ref-classes-vala:
  2671. ``vala``
  2672. ========
  2673. The :ref:`ref-classes-vala` class supports recipes that need to build software written
  2674. using the Vala programming language.
  2675. .. _ref-classes-vex:
  2676. ``vex``
  2677. ========
  2678. The :ref:`ref-classes-vex` class is used to generate metadata needed by external
  2679. tools to check for vulnerabilities, for example CVEs. It can be used as a
  2680. replacement for :ref:`ref-classes-cve-check`.
  2681. In order to use this class, inherit the class in the ``local.conf`` file and it
  2682. will add the ``generate_vex`` task for every recipe::
  2683. INHERIT += "vex"
  2684. If an image is built it will generate a report in :term:`DEPLOY_DIR_IMAGE` for
  2685. all the packages used, it will also generate a file for all recipes used in the
  2686. build.
  2687. Variables use the ``CVE_CHECK`` prefix to keep compatibility with the
  2688. :ref:`ref-classes-cve-check` class.
  2689. Example usage::
  2690. bitbake -c generate_vex openssl
  2691. .. _ref-classes-waf:
  2692. ``waf``
  2693. =======
  2694. The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
  2695. the Waf build system. You can use the
  2696. :term:`EXTRA_OECONF` or
  2697. :term:`PACKAGECONFIG_CONFARGS` variables
  2698. to specify additional configuration options to be passed on the Waf
  2699. command line.
  2700. .. _ref-classes-yocto-check-layer:
  2701. ``yocto-check-layer``
  2702. =====================
  2703. The :ref:`ref-classes-yocto-check-layer` class is used by the
  2704. :oe_git:`yocto-check-layer </openembedded-core/tree/scripts/yocto-check-layer>`
  2705. script to ensure that packages from Yocto Project Compatible layers don't skip
  2706. required QA checks listed in :term:`CHECKLAYER_REQUIRED_TESTS` defined by the
  2707. :ref:`ref-classes-insane` class.
  2708. It adds an anonymous python function with extra processing to all recipes,
  2709. and globally inheriting this class with :term:`INHERIT` is not advised. Instead
  2710. the ``yocto-check-layer`` script should be used as it handles usage of this
  2711. class.
  2712. For more information on the Yocto Project
  2713. Compatible layers, see the :ref:`dev-manual/layers:Making Sure Your Layer is
  2714. Compatible With Yocto Project` section of the Yocto Project Development Manual.