classes.rst 130 KB

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