classes.rst 138 KB

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