classes.rst 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827
  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 a ``classes/`` directory beneath
  14. the ``meta*/`` directory found in the :term:`Source Directory`.
  15. Class files can also be pointed to by
  16. :term:`BUILDDIR` (e.g. ``build/``) in the same way as
  17. ``.conf`` files in the ``conf`` directory. Class files are searched for
  18. in :term:`BBPATH` using the same method by which ``.conf``
  19. files are searched.
  20. This chapter discusses only the most useful and important classes. Other
  21. classes do exist within the ``meta/classes`` directory in the Source
  22. Directory. You can reference the ``.bbclass`` files directly for more
  23. information.
  24. .. _ref-classes-allarch:
  25. ``allarch.bbclass``
  26. ===================
  27. The ``allarch`` class is inherited by recipes that do not produce
  28. architecture-specific output. The class disables functionality that is
  29. normally needed for recipes that produce executable binaries (such as
  30. building the cross-compiler and a C library as pre-requisites, and
  31. splitting out of debug symbols during packaging).
  32. .. note::
  33. Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
  34. produce packages that depend on tunings through use of the
  35. :term:`RDEPENDS` and
  36. :term:`TUNE_PKGARCH` variables, should never be
  37. configured for all architectures using ``allarch``. This is the case
  38. even if the recipes do not produce architecture-specific output.
  39. Configuring such recipes for all architectures causes the
  40. ``do_package_write_*`` tasks to
  41. have different signatures for the machines with different tunings.
  42. Additionally, unnecessary rebuilds occur every time an image for a
  43. different :term:`MACHINE` is built even when the recipe never changes.
  44. By default, all recipes inherit the :ref:`base <ref-classes-base>` and
  45. :ref:`package <ref-classes-package>` classes, which enable
  46. functionality needed for recipes that produce executable output. If your
  47. recipe, for example, only produces packages that contain configuration
  48. files, media files, or scripts (e.g. Python and Perl), then it should
  49. inherit the ``allarch`` class.
  50. .. _ref-classes-archiver:
  51. ``archiver.bbclass``
  52. ====================
  53. The ``archiver`` class supports releasing source code and other
  54. materials with the binaries.
  55. For more details on the source archiver, see the
  56. ":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
  57. section in the Yocto Project Development Tasks Manual. You can also see
  58. the :term:`ARCHIVER_MODE` variable for information
  59. about the variable flags (varflags) that help control archive creation.
  60. .. _ref-classes-autotools:
  61. ``autotools*.bbclass``
  62. ======================
  63. The ``autotools*`` classes support Autotooled packages.
  64. The ``autoconf``, ``automake``, and ``libtool`` packages bring
  65. standardization. This class defines a set of tasks (e.g. ``configure``,
  66. ``compile`` and so forth) that work for all Autotooled packages. It
  67. should usually be enough to define a few standard variables and then
  68. simply ``inherit autotools``. These classes can also work with software
  69. that emulates Autotools. For more information, see the
  70. ":ref:`dev-manual/common-tasks:autotooled package`" section
  71. in the Yocto Project Development Tasks Manual.
  72. By default, the ``autotools*`` classes use out-of-tree builds (i.e.
  73. ``autotools.bbclass`` building with ``B != S``).
  74. If the software being built by a recipe does not support using
  75. out-of-tree builds, you should have the recipe inherit the
  76. ``autotools-brokensep`` class. The ``autotools-brokensep`` class behaves
  77. the same as the ``autotools`` class but builds with :term:`B`
  78. == :term:`S`. This method is useful when out-of-tree build
  79. support is either not present or is broken.
  80. .. note::
  81. It is recommended that out-of-tree support be fixed and used if at
  82. all possible.
  83. It's useful to have some idea of how the tasks defined by the
  84. ``autotools*`` classes work and what they do behind the scenes.
  85. - :ref:`ref-tasks-configure` - Regenerates the
  86. configure script (using ``autoreconf``) and then launches it with a
  87. standard set of arguments used during cross-compilation. You can pass
  88. additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
  89. or :term:`PACKAGECONFIG_CONFARGS`
  90. variables.
  91. - :ref:`ref-tasks-compile` - Runs ``make`` with
  92. arguments that specify the compiler and linker. You can pass
  93. additional arguments through the :term:`EXTRA_OEMAKE` variable.
  94. - :ref:`ref-tasks-install` - Runs ``make install`` and
  95. passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
  96. .. _ref-classes-base:
  97. ``base.bbclass``
  98. ================
  99. The ``base`` class is special in that every ``.bb`` file implicitly
  100. inherits the class. This class contains definitions for standard basic
  101. tasks such as fetching, unpacking, configuring (empty by default),
  102. compiling (runs any ``Makefile`` present), installing (empty by default)
  103. and packaging (empty by default). These classes are often overridden or
  104. extended by other classes such as the
  105. :ref:`autotools <ref-classes-autotools>` class or the
  106. :ref:`package <ref-classes-package>` class.
  107. The class also contains some commonly used functions such as
  108. ``oe_runmake``, which runs ``make`` with the arguments specified in
  109. :term:`EXTRA_OEMAKE` variable as well as the
  110. arguments passed directly to ``oe_runmake``.
  111. .. _ref-classes-bash-completion:
  112. ``bash-completion.bbclass``
  113. ===========================
  114. Sets up packaging and dependencies appropriate for recipes that build
  115. software that includes bash-completion data.
  116. .. _ref-classes-bin-package:
  117. ``bin_package.bbclass``
  118. =======================
  119. The ``bin_package`` class is a helper class for recipes that extract the
  120. contents of a binary package (e.g. an RPM) and install those contents
  121. rather than building the binary from source. The binary package is
  122. extracted and new packages in the configured output package format are
  123. created. Extraction and installation of proprietary binaries is a good
  124. example use for this class.
  125. .. note::
  126. For RPMs and other packages that do not contain a subdirectory, you
  127. should specify an appropriate fetcher parameter to point to the
  128. subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
  129. the "subpath" parameter limits the checkout to a specific subpath
  130. of the tree. Here is an example where ``${BP}`` is used so that the files
  131. are extracted into the subdirectory expected by the default value of
  132. :term:`S`::
  133. SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
  134. See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
  135. more information on supported BitBake Fetchers.
  136. .. _ref-classes-binconfig:
  137. ``binconfig.bbclass``
  138. =====================
  139. The ``binconfig`` class helps to correct paths in shell scripts.
  140. Before ``pkg-config`` had become widespread, libraries shipped shell
  141. scripts to give information about the libraries and include paths needed
  142. to build software (usually named ``LIBNAME-config``). This class assists
  143. any recipe using such scripts.
  144. During staging, the OpenEmbedded build system installs such scripts into
  145. the ``sysroots/`` directory. Inheriting this class results in all paths
  146. in these scripts being changed to point into the ``sysroots/`` directory
  147. so that all builds that use the script use the correct directories for
  148. the cross compiling layout. See the
  149. :term:`BINCONFIG_GLOB` variable for more
  150. information.
  151. .. _ref-classes-binconfig-disabled:
  152. ``binconfig-disabled.bbclass``
  153. ==============================
  154. An alternative version of the :ref:`binconfig <ref-classes-binconfig>`
  155. class, which disables binary configuration scripts by making them return
  156. an error in favor of using ``pkg-config`` to query the information. The
  157. scripts to be disabled should be specified using the
  158. :term:`BINCONFIG` variable within the recipe inheriting
  159. the class.
  160. .. _ref-classes-blacklist:
  161. ``blacklist.bbclass``
  162. =====================
  163. The ``blacklist`` class prevents the OpenEmbedded build system from
  164. building specific recipes (blacklists them). To use this class, inherit
  165. the class globally and set :term:`PNBLACKLIST` for
  166. each recipe you wish to blacklist. Specify the :term:`PN`
  167. value as a variable flag (varflag) and provide a reason, which is
  168. reported, if the package is requested to be built as the value. For
  169. example, if you want to blacklist a recipe called "exoticware", you add
  170. the following to your ``local.conf`` or distribution configuration::
  171. INHERIT += "blacklist"
  172. PNBLACKLIST[exoticware] = "Not supported by our organization."
  173. .. _ref-classes-buildhistory:
  174. ``buildhistory.bbclass``
  175. ========================
  176. The ``buildhistory`` class records a history of build output metadata,
  177. which can be used to detect possible regressions as well as used for
  178. analysis of the build output. For more information on using Build
  179. History, see the
  180. ":ref:`dev-manual/common-tasks:maintaining build output quality`"
  181. section in the Yocto Project Development Tasks Manual.
  182. .. _ref-classes-buildstats:
  183. ``buildstats.bbclass``
  184. ======================
  185. The ``buildstats`` class records performance statistics about each task
  186. executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
  187. When you use this class, the output goes into the
  188. :term:`BUILDSTATS_BASE` directory, which defaults
  189. to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
  190. ``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
  191. chart of the entire build process and can be useful for highlighting
  192. bottlenecks.
  193. Collecting build statistics is enabled by default through the
  194. :term:`USER_CLASSES` variable from your
  195. ``local.conf`` file. Consequently, you do not have to do anything to
  196. enable the class. However, if you want to disable the class, simply
  197. remove "buildstats" from the :term:`USER_CLASSES` list.
  198. .. _ref-classes-buildstats-summary:
  199. ``buildstats-summary.bbclass``
  200. ==============================
  201. When inherited globally, prints statistics at the end of the build on
  202. sstate re-use. In order to function, this class requires the
  203. :ref:`buildstats <ref-classes-buildstats>` class be enabled.
  204. .. _ref-classes-ccache:
  205. ``ccache.bbclass``
  206. ==================
  207. The ``ccache`` class enables the C/C++ Compiler Cache for the build.
  208. This class is used to give a minor performance boost during the build.
  209. However, using the class can lead to unexpected side-effects. Thus, it
  210. is recommended that you do not use this class. See
  211. https://ccache.samba.org/ for information on the C/C++ Compiler
  212. Cache.
  213. .. _ref-classes-chrpath:
  214. ``chrpath.bbclass``
  215. ===================
  216. The ``chrpath`` class is a wrapper around the "chrpath" utility, which
  217. is used during the build process for ``nativesdk``, ``cross``, and
  218. ``cross-canadian`` recipes to change ``RPATH`` records within binaries
  219. in order to make them relocatable.
  220. .. _ref-classes-cmake:
  221. ``cmake.bbclass``
  222. =================
  223. The ``cmake`` class allows for recipes that need to build software using
  224. the `CMake <https://cmake.org/overview/>`__ build system. You can use
  225. the :term:`EXTRA_OECMAKE` variable to specify
  226. additional configuration options to be passed using the ``cmake``
  227. command line.
  228. On the occasion that you would be installing custom CMake toolchain
  229. files supplied by the application being built, you should install them
  230. to the preferred CMake Module directory: ``${D}${datadir}/cmake/``
  231. Modules during
  232. :ref:`ref-tasks-install`.
  233. .. _ref-classes-cml1:
  234. ``cml1.bbclass``
  235. ================
  236. The ``cml1`` class provides basic support for the Linux kernel style
  237. build configuration system.
  238. .. _ref-classes-compress_doc:
  239. ``compress_doc.bbclass``
  240. ========================
  241. Enables compression for man pages and info pages. This class is intended
  242. to be inherited globally. The default compression mechanism is gz (gzip)
  243. but you can select an alternative mechanism by setting the
  244. :term:`DOC_COMPRESS` variable.
  245. .. _ref-classes-copyleft_compliance:
  246. ``copyleft_compliance.bbclass``
  247. ===============================
  248. The ``copyleft_compliance`` class preserves source code for the purposes
  249. of license compliance. This class is an alternative to the ``archiver``
  250. class and is still used by some users even though it has been deprecated
  251. in favor of the :ref:`archiver <ref-classes-archiver>` class.
  252. .. _ref-classes-copyleft_filter:
  253. ``copyleft_filter.bbclass``
  254. ===========================
  255. A class used by the :ref:`archiver <ref-classes-archiver>` and
  256. :ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes
  257. for filtering licenses. The ``copyleft_filter`` class is an internal
  258. class and is not intended to be used directly.
  259. .. _ref-classes-core-image:
  260. ``core-image.bbclass``
  261. ======================
  262. The ``core-image`` class provides common definitions for the
  263. ``core-image-*`` image recipes, such as support for additional
  264. :term:`IMAGE_FEATURES`.
  265. .. _ref-classes-cpan:
  266. ``cpan*.bbclass``
  267. =================
  268. The ``cpan*`` classes support Perl modules.
  269. Recipes for Perl modules are simple. These recipes usually only need to
  270. point to the source's archive and then inherit the proper class file.
  271. Building is split into two methods depending on which method the module
  272. authors used.
  273. - Modules that use old ``Makefile.PL``-based build system require
  274. ``cpan.bbclass`` in their recipes.
  275. - Modules that use ``Build.PL``-based build system require using
  276. ``cpan_build.bbclass`` in their recipes.
  277. Both build methods inherit the ``cpan-base`` class for basic Perl
  278. support.
  279. .. _ref-classes-cross:
  280. ``cross.bbclass``
  281. =================
  282. The ``cross`` class provides support for the recipes that build the
  283. cross-compilation tools.
  284. .. _ref-classes-cross-canadian:
  285. ``cross-canadian.bbclass``
  286. ==========================
  287. The ``cross-canadian`` class provides support for the recipes that build
  288. the Canadian Cross-compilation tools for SDKs. See the
  289. ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  290. section in the Yocto Project Overview and Concepts Manual for more
  291. discussion on these cross-compilation tools.
  292. .. _ref-classes-crosssdk:
  293. ``crosssdk.bbclass``
  294. ====================
  295. The ``crosssdk`` class provides support for the recipes that build the
  296. cross-compilation tools used for building SDKs. See the
  297. ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  298. section in the Yocto Project Overview and Concepts Manual for more
  299. discussion on these cross-compilation tools.
  300. .. _ref-classes-debian:
  301. ``debian.bbclass``
  302. ==================
  303. The ``debian`` class renames output packages so that they follow the
  304. Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
  305. ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
  306. name and version as part of the package name.
  307. If a recipe creates packages for multiple libraries (shared object files
  308. of ``.so`` type), use the :term:`LEAD_SONAME`
  309. variable in the recipe to specify the library on which to apply the
  310. naming scheme.
  311. .. _ref-classes-deploy:
  312. ``deploy.bbclass``
  313. ==================
  314. The ``deploy`` class handles deploying files to the
  315. :term:`DEPLOY_DIR_IMAGE` directory. The main
  316. function of this class is to allow the deploy step to be accelerated by
  317. shared state. Recipes that inherit this class should define their own
  318. :ref:`ref-tasks-deploy` function to copy the files to be
  319. deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
  320. add the task at the appropriate place, which is usually after
  321. :ref:`ref-tasks-compile` or
  322. :ref:`ref-tasks-install`. The class then takes care of
  323. staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
  324. .. _ref-classes-devshell:
  325. ``devshell.bbclass``
  326. ====================
  327. The ``devshell`` class adds the ``do_devshell`` task. Distribution
  328. policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
  329. section in the Yocto Project Development Tasks Manual for more
  330. information about using ``devshell``.
  331. .. _ref-classes-devupstream:
  332. ``devupstream.bbclass``
  333. =======================
  334. The ``devupstream`` class uses
  335. :term:`BBCLASSEXTEND` to add a variant of the
  336. recipe that fetches from an alternative URI (e.g. Git) instead of a
  337. tarball. Following is an example::
  338. BBCLASSEXTEND = "devupstream:target"
  339. SRC_URI_class-devupstream = "git://git.example.com/example"
  340. SRCREV_class-devupstream = "abcd1234"
  341. Adding the above statements to your recipe creates a variant that has
  342. :term:`DEFAULT_PREFERENCE` set to "-1".
  343. Consequently, you need to select the variant of the recipe to use it.
  344. Any development-specific adjustments can be done by using the
  345. ``class-devupstream`` override. Here is an example::
  346. DEPENDS_append_class-devupstream = " gperf-native"
  347. do_configure_prepend_class-devupstream() {
  348. touch ${S}/README
  349. }
  350. The class
  351. currently only supports creating a development variant of the target
  352. recipe, not ``native`` or ``nativesdk`` variants.
  353. The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
  354. support for ``native`` and ``nativesdk`` variants. Consequently, this
  355. functionality can be added in a future release.
  356. Support for other version control systems such as Subversion is limited
  357. due to BitBake's automatic fetch dependencies (e.g.
  358. ``subversion-native``).
  359. .. _ref-classes-distutils3:
  360. ``distutils3*.bbclass``
  361. =======================
  362. The ``distutils3*`` classes support recipes for Python version 3.x
  363. extensions, which are simple. These recipes usually only need to point
  364. to the source's archive and then inherit the proper class. Building is
  365. split into three methods depending on which method the module authors
  366. used.
  367. - Extensions that use an Autotools-based build system require Autotools
  368. and ``distutils``-based classes in their recipes.
  369. - Extensions that use ``distutils``-based build systems require the
  370. ``distutils`` class in their recipes.
  371. - Extensions that use build systems based on ``setuptools3`` require
  372. the :ref:`setuptools3 <ref-classes-setuptools3>` class in their
  373. recipes.
  374. .. _ref-classes-externalsrc:
  375. ``externalsrc.bbclass``
  376. =======================
  377. The ``externalsrc`` class supports building software from source code
  378. that is external to the OpenEmbedded build system. Building software
  379. from an external source tree means that the build system's normal fetch,
  380. unpack, and patch process is not used.
  381. By default, the OpenEmbedded build system uses the :term:`S`
  382. and :term:`B` variables to locate unpacked recipe source code
  383. and to build it, respectively. When your recipe inherits the
  384. ``externalsrc`` class, you use the
  385. :term:`EXTERNALSRC` and
  386. :term:`EXTERNALSRC_BUILD` variables to
  387. ultimately define :term:`S` and :term:`B`.
  388. By default, this class expects the source code to support recipe builds
  389. that use the :term:`B` variable to point to the directory in
  390. which the OpenEmbedded build system places the generated objects built
  391. from the recipes. By default, the :term:`B` directory is set to the
  392. following, which is separate from the source directory (:term:`S`)::
  393. ${WORKDIR}/${BPN}/{PV}/
  394. See these variables for more information:
  395. :term:`WORKDIR`, :term:`BPN`, and
  396. :term:`PV`,
  397. For more information on the ``externalsrc`` class, see the comments in
  398. ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
  399. For information on how to use the
  400. ``externalsrc`` class, see the
  401. ":ref:`dev-manual/common-tasks:building software from an external source`"
  402. section in the Yocto Project Development Tasks Manual.
  403. .. _ref-classes-extrausers:
  404. ``extrausers.bbclass``
  405. ======================
  406. The ``extrausers`` class allows additional user and group configuration
  407. to be applied at the image level. Inheriting this class either globally
  408. or from an image recipe allows additional user and group operations to
  409. be performed using the
  410. :term:`EXTRA_USERS_PARAMS` variable.
  411. .. note::
  412. The user and group operations added using the
  413. extrausers
  414. class are not tied to a specific recipe outside of the recipe for the
  415. image. Thus, the operations can be performed across the image as a
  416. whole. Use the
  417. useradd
  418. class to add user and group configuration to a specific recipe.
  419. Here is an example that uses this class in an image recipe::
  420. inherit extrausers
  421. EXTRA_USERS_PARAMS = "\
  422. useradd -p '' tester; \
  423. groupadd developers; \
  424. userdel nobody; \
  425. groupdel -g video; \
  426. groupmod -g 1020 developers; \
  427. usermod -s /bin/sh tester; \
  428. "
  429. Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
  430. passwords::
  431. inherit extrausers
  432. EXTRA_USERS_PARAMS = "\
  433. useradd -P tester01 tester-jim; \
  434. useradd -P tester01 tester-sue; \
  435. "
  436. Finally, here is an example that sets the root password to "1876*18"::
  437. inherit extrausers
  438. EXTRA_USERS_PARAMS = "\
  439. usermod -P 1876*18 root; \
  440. "
  441. .. _ref-classes-features_check:
  442. ``features_check.bbclass``
  443. =================================
  444. The ``features_check`` class allows individual recipes to check
  445. for required and conflicting
  446. :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`.
  447. This class provides support for the following variables:
  448. - :term:`REQUIRED_DISTRO_FEATURES`
  449. - :term:`CONFLICT_DISTRO_FEATURES`
  450. - :term:`ANY_OF_DISTRO_FEATURES`
  451. - ``REQUIRED_MACHINE_FEATURES``
  452. - ``CONFLICT_MACHINE_FEATURES``
  453. - ``ANY_OF_MACHINE_FEATURES``
  454. - ``REQUIRED_COMBINED_FEATURES``
  455. - ``CONFLICT_COMBINED_FEATURES``
  456. - ``ANY_OF_COMBINED_FEATURES``
  457. If any conditions specified in the recipe using the above
  458. variables are not met, the recipe will be skipped, and if the
  459. build system attempts to build the recipe then an error will be
  460. triggered.
  461. .. _ref-classes-fontcache:
  462. ``fontcache.bbclass``
  463. =====================
  464. The ``fontcache`` class generates the proper post-install and
  465. post-remove (postinst and postrm) scriptlets for font packages. These
  466. scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
  467. to the font information cache. Since the cache files are
  468. architecture-specific, ``fc-cache`` runs using QEMU if the postinst
  469. scriptlets need to be run on the build host during image creation.
  470. If the fonts being installed are in packages other than the main
  471. package, set :term:`FONT_PACKAGES` to specify the
  472. packages containing the fonts.
  473. .. _ref-classes-fs-uuid:
  474. ``fs-uuid.bbclass``
  475. ===================
  476. The ``fs-uuid`` class extracts UUID from
  477. ``${``\ :term:`ROOTFS`\ ``}``, which must have been built
  478. by the time that this function gets called. The ``fs-uuid`` class only
  479. works on ``ext`` file systems and depends on ``tune2fs``.
  480. .. _ref-classes-gconf:
  481. ``gconf.bbclass``
  482. =================
  483. The ``gconf`` class provides common functionality for recipes that need
  484. to install GConf schemas. The schemas will be put into a separate
  485. package (``${``\ :term:`PN`\ ``}-gconf``) that is created
  486. automatically when this class is inherited. This package uses the
  487. appropriate post-install and post-remove (postinst/postrm) scriptlets to
  488. register and unregister the schemas in the target image.
  489. .. _ref-classes-gettext:
  490. ``gettext.bbclass``
  491. ===================
  492. The ``gettext`` class provides support for building software that uses
  493. the GNU ``gettext`` internationalization and localization system. All
  494. recipes building software that use ``gettext`` should inherit this
  495. class.
  496. .. _ref-classes-gnomebase:
  497. ``gnomebase.bbclass``
  498. =====================
  499. The ``gnomebase`` class is the base class for recipes that build
  500. software from the GNOME stack. This class sets
  501. :term:`SRC_URI` to download the source from the GNOME
  502. mirrors as well as extending :term:`FILES` with the typical
  503. GNOME installation paths.
  504. .. _ref-classes-gobject-introspection:
  505. ``gobject-introspection.bbclass``
  506. =================================
  507. Provides support for recipes building software that supports GObject
  508. introspection. This functionality is only enabled if the
  509. "gobject-introspection-data" feature is in
  510. :term:`DISTRO_FEATURES` as well as
  511. "qemu-usermode" being in
  512. :term:`MACHINE_FEATURES`.
  513. .. note::
  514. This functionality is backfilled by default and, if not applicable,
  515. should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
  516. :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
  517. .. _ref-classes-grub-efi:
  518. ``grub-efi.bbclass``
  519. ====================
  520. The ``grub-efi`` class provides ``grub-efi``-specific functions for
  521. building bootable images.
  522. This class supports several variables:
  523. - :term:`INITRD`: Indicates list of filesystem images to
  524. concatenate and use as an initial RAM disk (initrd) (optional).
  525. - :term:`ROOTFS`: Indicates a filesystem image to include
  526. as the root filesystem (optional).
  527. - :term:`GRUB_GFXSERIAL`: Set this to "1" to have
  528. graphics and serial in the boot menu.
  529. - :term:`LABELS`: A list of targets for the automatic
  530. configuration.
  531. - :term:`APPEND`: An override list of append strings for
  532. each ``LABEL``.
  533. - :term:`GRUB_OPTS`: Additional options to add to the
  534. configuration (optional). Options are delimited using semi-colon
  535. characters (``;``).
  536. - :term:`GRUB_TIMEOUT`: Timeout before executing
  537. the default ``LABEL`` (optional).
  538. .. _ref-classes-gsettings:
  539. ``gsettings.bbclass``
  540. =====================
  541. The ``gsettings`` class provides common functionality for recipes that
  542. need to install GSettings (glib) schemas. The schemas are assumed to be
  543. part of the main package. Appropriate post-install and post-remove
  544. (postinst/postrm) scriptlets are added to register and unregister the
  545. schemas in the target image.
  546. .. _ref-classes-gtk-doc:
  547. ``gtk-doc.bbclass``
  548. ===================
  549. The ``gtk-doc`` class is a helper class to pull in the appropriate
  550. ``gtk-doc`` dependencies and disable ``gtk-doc``.
  551. .. _ref-classes-gtk-icon-cache:
  552. ``gtk-icon-cache.bbclass``
  553. ==========================
  554. The ``gtk-icon-cache`` class generates the proper post-install and
  555. post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
  556. install icons. These scriptlets call ``gtk-update-icon-cache`` to add
  557. the fonts to GTK+'s icon cache. Since the cache files are
  558. architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
  559. the postinst scriptlets need to be run on the build host during image
  560. creation.
  561. .. _ref-classes-gtk-immodules-cache:
  562. ``gtk-immodules-cache.bbclass``
  563. ===============================
  564. The ``gtk-immodules-cache`` class generates the proper post-install and
  565. post-remove (postinst/postrm) scriptlets for packages that install GTK+
  566. input method modules for virtual keyboards. These scriptlets call
  567. ``gtk-update-icon-cache`` to add the input method modules to the cache.
  568. Since the cache files are architecture-specific,
  569. ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
  570. need to be run on the build host during image creation.
  571. If the input method modules being installed are in packages other than
  572. the main package, set
  573. :term:`GTKIMMODULES_PACKAGES` to specify
  574. the packages containing the modules.
  575. .. _ref-classes-gzipnative:
  576. ``gzipnative.bbclass``
  577. ======================
  578. The ``gzipnative`` class enables the use of different native versions of
  579. ``gzip`` and ``pigz`` rather than the versions of these tools from the
  580. build host.
  581. .. _ref-classes-icecc:
  582. ``icecc.bbclass``
  583. =================
  584. The ``icecc`` class supports
  585. `Icecream <https://github.com/icecc/icecream>`__, which facilitates
  586. taking compile jobs and distributing them among remote machines.
  587. The class stages directories with symlinks from ``gcc`` and ``g++`` to
  588. ``icecc``, for both native and cross compilers. Depending on each
  589. configure or compile, the OpenEmbedded build system adds the directories
  590. at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
  591. ``ICEC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
  592. compilers, respectively.
  593. For the cross compiler, the class creates a ``tar.gz`` file that
  594. contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
  595. is the version of the cross-compiler used in the cross-development
  596. toolchain, accordingly.
  597. The class handles all three different compile stages (i.e native
  598. ,cross-kernel and target) and creates the necessary environment
  599. ``tar.gz`` file to be used by the remote machines. The class also
  600. supports SDK generation.
  601. If :term:`ICECC_PATH` is not set in your
  602. ``local.conf`` file, then the class tries to locate the ``icecc`` binary
  603. using ``which``. If :term:`ICECC_ENV_EXEC` is set
  604. in your ``local.conf`` file, the variable should point to the
  605. ``icecc-create-env`` script provided by the user. If you do not point to
  606. a user-provided script, the build system uses the default script
  607. provided by the recipe ``icecc-create-env-native.bb``.
  608. .. note::
  609. This script is a modified version and not the one that comes with
  610. icecc.
  611. If you do not want the Icecream distributed compile support to apply to
  612. specific recipes or classes, you can effectively "blacklist" them by
  613. listing the recipes and classes using the
  614. :term:`ICECC_USER_PACKAGE_BL` and
  615. :term:`ICECC_USER_CLASS_BL`, variables,
  616. respectively, in your ``local.conf`` file. Doing so causes the
  617. OpenEmbedded build system to handle these compilations locally.
  618. Additionally, you can list recipes using the
  619. :term:`ICECC_USER_PACKAGE_WL` variable in
  620. your ``local.conf`` file to force ``icecc`` to be enabled for recipes
  621. using an empty :term:`PARALLEL_MAKE` variable.
  622. Inheriting the ``icecc`` class changes all sstate signatures.
  623. Consequently, if a development team has a dedicated build system that
  624. populates :term:`SSTATE_MIRRORS` and they want to
  625. reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
  626. system need to either inherit the ``icecc`` class or nobody should.
  627. At the distribution level, you can inherit the ``icecc`` class to be
  628. sure that all builders start with the same sstate signatures. After
  629. inheriting the class, you can then disable the feature by setting the
  630. :term:`ICECC_DISABLED` variable to "1" as follows::
  631. INHERIT_DISTRO_append = " icecc"
  632. ICECC_DISABLED ??= "1"
  633. This practice
  634. makes sure everyone is using the same signatures but also requires
  635. individuals that do want to use Icecream to enable the feature
  636. individually as follows in your ``local.conf`` file::
  637. ICECC_DISABLED = ""
  638. .. _ref-classes-image:
  639. ``image.bbclass``
  640. =================
  641. The ``image`` class helps support creating images in different formats.
  642. First, the root filesystem is created from packages using one of the
  643. ``rootfs*.bbclass`` files (depending on the package format used) and
  644. then one or more image files are created.
  645. - The :term:`IMAGE_FSTYPES` variable controls the types of images to
  646. generate.
  647. - The :term:`IMAGE_INSTALL` variable controls the list of packages to
  648. install into the image.
  649. For information on customizing images, see the
  650. ":ref:`dev-manual/common-tasks:customizing images`" section
  651. in the Yocto Project Development Tasks Manual. For information on how
  652. images are created, see the
  653. ":ref:`overview-manual/concepts:images`" section in the
  654. Yocto Project Overview and Concepts Manual.
  655. .. _ref-classes-image-buildinfo:
  656. ``image-buildinfo.bbclass``
  657. ===========================
  658. The ``image-buildinfo`` class writes information to the target
  659. filesystem on ``/etc/build``.
  660. .. _ref-classes-image_types:
  661. ``image_types.bbclass``
  662. =======================
  663. The ``image_types`` class defines all of the standard image output types
  664. that you can enable through the
  665. :term:`IMAGE_FSTYPES` variable. You can use this
  666. class as a reference on how to add support for custom image output
  667. types.
  668. By default, the :ref:`image <ref-classes-image>` class automatically
  669. enables the ``image_types`` class. The ``image`` class uses the
  670. ``IMGCLASSES`` variable as follows::
  671. IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
  672. IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
  673. IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
  674. IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
  675. IMGCLASSES += "image_types_wic"
  676. IMGCLASSES += "rootfs-postcommands"
  677. IMGCLASSES += "image-postinst-intercepts"
  678. inherit ${IMGCLASSES}
  679. The ``image_types`` class also handles conversion and compression of images.
  680. .. note::
  681. To build a VMware VMDK image, you need to add "wic.vmdk" to
  682. :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
  683. Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
  684. .. _ref-classes-image-live:
  685. ``image-live.bbclass``
  686. ======================
  687. This class controls building "live" (i.e. HDDIMG and ISO) images. Live
  688. images contain syslinux for legacy booting, as well as the bootloader
  689. specified by :term:`EFI_PROVIDER` if
  690. :term:`MACHINE_FEATURES` contains "efi".
  691. Normally, you do not use this class directly. Instead, you add "live" to
  692. :term:`IMAGE_FSTYPES`.
  693. .. _ref-classes-image-prelink:
  694. ``image-prelink.bbclass``
  695. =========================
  696. The ``image-prelink`` class enables the use of the ``prelink`` utility
  697. during the :ref:`ref-tasks-rootfs` task, which optimizes
  698. the dynamic linking of shared libraries to reduce executable startup
  699. time.
  700. By default, the class is enabled in the ``local.conf.template`` using
  701. the :term:`USER_CLASSES` variable as follows::
  702. USER_CLASSES ?= "buildstats image-prelink"
  703. .. _ref-classes-insane:
  704. ``insane.bbclass``
  705. ==================
  706. The ``insane`` class adds a step to the package generation process so
  707. that output quality assurance checks are generated by the OpenEmbedded
  708. build system. A range of checks are performed that check the build's
  709. output for common problems that show up during runtime. Distribution
  710. policy usually dictates whether to include this class.
  711. You can configure the sanity checks so that specific test failures
  712. either raise a warning or an error message. Typically, failures for new
  713. tests generate a warning. Subsequent failures for the same test would
  714. then generate an error message once the metadata is in a known and good
  715. condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
  716. and error messages you might encounter using a default configuration.
  717. Use the :term:`WARN_QA` and
  718. :term:`ERROR_QA` variables to control the behavior of
  719. these checks at the global level (i.e. in your custom distro
  720. configuration). However, to skip one or more checks in recipes, you
  721. should use :term:`INSANE_SKIP`. For example, to skip
  722. the check for symbolic link ``.so`` files in the main package of a
  723. recipe, add the following to the recipe. You need to realize that the
  724. package name override, in this example ``${PN}``, must be used::
  725. INSANE_SKIP_${PN} += "dev-so"
  726. Please keep in mind that the QA checks
  727. are meant to detect real or potential problems in the packaged
  728. output. So exercise caution when disabling these checks.
  729. Here are the tests you can list with the :term:`WARN_QA` and
  730. :term:`ERROR_QA` variables:
  731. - ``already-stripped:`` Checks that produced binaries have not
  732. already been stripped prior to the build system extracting debug
  733. symbols. It is common for upstream software projects to default to
  734. stripping debug symbols for output binaries. In order for debugging
  735. to work on the target using ``-dbg`` packages, this stripping must be
  736. disabled.
  737. - ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
  738. size, and endianness of any binaries to ensure they match the target
  739. architecture. This test fails if any binaries do not match the type
  740. since there would be an incompatibility. The test could indicate that
  741. the wrong compiler or compiler options have been used. Sometimes
  742. software, like bootloaders, might need to bypass this check.
  743. - ``buildpaths:`` Checks for paths to locations on the build host
  744. inside the output files. Currently, this test triggers too many false
  745. positives and thus is not normally enabled.
  746. - ``build-deps:`` Determines if a build-time dependency that is
  747. specified through :term:`DEPENDS`, explicit
  748. :term:`RDEPENDS`, or task-level dependencies exists
  749. to match any runtime dependency. This determination is particularly
  750. useful to discover where runtime dependencies are detected and added
  751. during packaging. If no explicit dependency has been specified within
  752. the metadata, at the packaging stage it is too late to ensure that
  753. the dependency is built, and thus you can end up with an error when
  754. the package is installed into the image during the
  755. :ref:`ref-tasks-rootfs` task because the auto-detected
  756. dependency was not satisfied. An example of this would be where the
  757. :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically
  758. adds a dependency on the ``initscripts-functions`` package to
  759. packages that install an initscript that refers to
  760. ``/etc/init.d/functions``. The recipe should really have an explicit
  761. :term:`RDEPENDS` for the package in question on ``initscripts-functions``
  762. so that the OpenEmbedded build system is able to ensure that the
  763. ``initscripts`` recipe is actually built and thus the
  764. ``initscripts-functions`` package is made available.
  765. - ``compile-host-path:`` Checks the
  766. :ref:`ref-tasks-compile` log for indications that
  767. paths to locations on the build host were used. Using such paths
  768. might result in host contamination of the build output.
  769. - ``debug-deps:`` Checks that all packages except ``-dbg`` packages
  770. do not depend on ``-dbg`` packages, which would cause a packaging
  771. bug.
  772. - ``debug-files:`` Checks for ``.debug`` directories in anything but
  773. the ``-dbg`` package. The debug files should all be in the ``-dbg``
  774. package. Thus, anything packaged elsewhere is incorrect packaging.
  775. - ``dep-cmp:`` Checks for invalid version comparison statements in
  776. runtime dependency relationships between packages (i.e. in
  777. :term:`RDEPENDS`,
  778. :term:`RRECOMMENDS`,
  779. :term:`RSUGGESTS`,
  780. :term:`RPROVIDES`,
  781. :term:`RREPLACES`, and
  782. :term:`RCONFLICTS` variable values). Any invalid
  783. comparisons might trigger failures or undesirable behavior when
  784. passed to the package manager.
  785. - ``desktop:`` Runs the ``desktop-file-validate`` program against any
  786. ``.desktop`` files to validate their contents against the
  787. specification for ``.desktop`` files.
  788. - ``dev-deps:`` Checks that all packages except ``-dev`` or
  789. ``-staticdev`` packages do not depend on ``-dev`` packages, which
  790. would be a packaging bug.
  791. - ``dev-so:`` Checks that the ``.so`` symbolic links are in the
  792. ``-dev`` package and not in any of the other packages. In general,
  793. these symlinks are only useful for development purposes. Thus, the
  794. ``-dev`` package is the correct location for them. In very rare
  795. cases, such as dynamically loaded modules, these symlinks
  796. are needed instead in the main package.
  797. - ``file-rdeps:`` Checks that file-level dependencies identified by
  798. the OpenEmbedded build system at packaging time are satisfied. For
  799. example, a shell script might start with the line ``#!/bin/bash``.
  800. This line would translate to a file dependency on ``/bin/bash``. Of
  801. the three package managers that the OpenEmbedded build system
  802. supports, only RPM directly handles file-level dependencies,
  803. resolving them automatically to packages providing the files.
  804. However, the lack of that functionality in the other two package
  805. managers does not mean the dependencies do not still need resolving.
  806. This QA check attempts to ensure that explicitly declared
  807. :term:`RDEPENDS` exist to handle any file-level
  808. dependency detected in packaged files.
  809. - ``files-invalid:`` Checks for :term:`FILES` variable
  810. values that contain "//", which is invalid.
  811. - ``host-user-contaminated:`` Checks that no package produced by the
  812. recipe contains any files outside of ``/home`` with a user or group
  813. ID that matches the user running BitBake. A match usually indicates
  814. that the files are being installed with an incorrect UID/GID, since
  815. target IDs are independent from host IDs. For additional information,
  816. see the section describing the
  817. :ref:`ref-tasks-install` task.
  818. - ``incompatible-license:`` Report when packages are excluded from
  819. being created due to being marked with a license that is in
  820. :term:`INCOMPATIBLE_LICENSE`.
  821. - ``install-host-path:`` Checks the
  822. :ref:`ref-tasks-install` log for indications that
  823. paths to locations on the build host were used. Using such paths
  824. might result in host contamination of the build output.
  825. - ``installed-vs-shipped:`` Reports when files have been installed
  826. within ``do_install`` but have not been included in any package by
  827. way of the :term:`FILES` variable. Files that do not
  828. appear in any package cannot be present in an image later on in the
  829. build process. Ideally, all installed files should be packaged or not
  830. installed at all. These files can be deleted at the end of
  831. ``do_install`` if the files are not needed in any package.
  832. - ``invalid-chars:`` Checks that the recipe metadata variables
  833. :term:`DESCRIPTION`,
  834. :term:`SUMMARY`, :term:`LICENSE`, and
  835. :term:`SECTION` do not contain non-UTF-8 characters.
  836. Some package managers do not support such characters.
  837. - ``invalid-packageconfig:`` Checks that no undefined features are
  838. being added to :term:`PACKAGECONFIG`. For
  839. example, any name "foo" for which the following form does not exist::
  840. PACKAGECONFIG[foo] = "..."
  841. - ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
  842. file containing these paths is incorrect since ``libtool`` adds the
  843. correct sysroot prefix when using the files automatically itself.
  844. - ``ldflags:`` Ensures that the binaries were linked with the
  845. :term:`LDFLAGS` options provided by the build system.
  846. If this test fails, check that the :term:`LDFLAGS` variable is being
  847. passed to the linker command.
  848. - ``libdir:`` Checks for libraries being installed into incorrect
  849. (possibly hardcoded) installation paths. For example, this test will
  850. catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
  851. "lib32". Another example is when recipes install
  852. ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
  853. - ``libexec:`` Checks if a package contains files in
  854. ``/usr/libexec``. This check is not performed if the ``libexecdir``
  855. variable has been set explicitly to ``/usr/libexec``.
  856. - ``packages-list:`` Checks for the same package being listed
  857. multiple times through the :term:`PACKAGES` variable
  858. value. Installing the package in this manner can cause errors during
  859. packaging.
  860. - ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
  861. invalid format.
  862. - ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
  863. invalid format.
  864. - ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
  865. 'link' where the specified target already exists.
  866. - ``perms:`` Currently, this check is unused but reserved.
  867. - ``pkgconfig:`` Checks ``.pc`` files for any
  868. :term:`TMPDIR`/:term:`WORKDIR` paths.
  869. Any ``.pc`` file containing these paths is incorrect since
  870. ``pkg-config`` itself adds the correct sysroot prefix when the files
  871. are accessed.
  872. - ``pkgname:`` Checks that all packages in
  873. :term:`PACKAGES` have names that do not contain
  874. invalid characters (i.e. characters other than 0-9, a-z, ., +, and
  875. -).
  876. - ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
  877. undefined during :ref:`ref-tasks-package`.
  878. - ``pkgvarcheck:`` Checks through the variables
  879. :term:`RDEPENDS`,
  880. :term:`RRECOMMENDS`,
  881. :term:`RSUGGESTS`,
  882. :term:`RCONFLICTS`,
  883. :term:`RPROVIDES`,
  884. :term:`RREPLACES`, :term:`FILES`,
  885. :term:`ALLOW_EMPTY`, ``pkg_preinst``,
  886. ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
  887. there are variable sets that are not package-specific. Using these
  888. variables without a package suffix is bad practice, and might
  889. unnecessarily complicate dependencies of other packages within the
  890. same recipe or have other unintended consequences.
  891. - ``pn-overrides:`` Checks that a recipe does not have a name
  892. (:term:`PN`) value that appears in
  893. :term:`OVERRIDES`. If a recipe is named such that
  894. its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
  895. :term:`PN` happens to be the same as :term:`MACHINE` or
  896. :term:`DISTRO`), it can have unexpected consequences.
  897. For example, assignments such as ``FILES_${PN} = "xyz"`` effectively
  898. turn into ``FILES = "xyz"``.
  899. - ``rpaths:`` Checks for rpaths in the binaries that contain build
  900. system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
  901. options are being passed to the linker commands and your binaries
  902. have potential security issues.
  903. - ``split-strip:`` Reports that splitting or stripping debug symbols
  904. from binaries has failed.
  905. - ``staticdev:`` Checks for static library files (``*.a``) in
  906. non-``staticdev`` packages.
  907. - ``symlink-to-sysroot:`` Checks for symlinks in packages that point
  908. into :term:`TMPDIR` on the host. Such symlinks will
  909. work on the host, but are clearly invalid when running on the target.
  910. - ``textrel:`` Checks for ELF binaries that contain relocations in
  911. their ``.text`` sections, which can result in a performance impact at
  912. runtime. See the explanation for the ``ELF binary`` message in
  913. ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
  914. issues.
  915. - ``unlisted-pkg-lics:`` Checks that all declared licenses applying
  916. for a package are also declared on the recipe level (i.e. any license
  917. in ``LICENSE_*`` should appear in :term:`LICENSE`).
  918. - ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
  919. in the binaries that by default on a standard system are searched by
  920. the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
  921. not cause any breakage, they do waste space and are unnecessary.
  922. - ``var-undefined:`` Reports when variables fundamental to packaging
  923. (i.e. :term:`WORKDIR`,
  924. :term:`DEPLOY_DIR`, :term:`D`,
  925. :term:`PN`, and :term:`PKGD`) are undefined
  926. during :ref:`ref-tasks-package`.
  927. - ``version-going-backwards:`` If Build History is enabled, reports
  928. when a package being written out has a lower version than the
  929. previously written package under the same name. If you are placing
  930. output packages into a feed and upgrading packages on a target system
  931. using that feed, the version of a package going backwards can result
  932. in the target system not correctly upgrading to the "new" version of
  933. the package.
  934. .. note::
  935. This is only relevant when you are using runtime package management
  936. on your target system.
  937. - ``xorg-driver-abi:`` Checks that all packages containing Xorg
  938. drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
  939. driver ABI names. All drivers should depend on the ABI versions that
  940. they have been built against. Driver recipes that include
  941. ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
  942. automatically get these versions. Consequently, you should only need
  943. to explicitly add dependencies to binary driver recipes.
  944. .. _ref-classes-insserv:
  945. ``insserv.bbclass``
  946. ===================
  947. The ``insserv`` class uses the ``insserv`` utility to update the order
  948. of symbolic links in ``/etc/rc?.d/`` within an image based on
  949. dependencies specified by LSB headers in the ``init.d`` scripts
  950. themselves.
  951. .. _ref-classes-kernel:
  952. ``kernel.bbclass``
  953. ==================
  954. The ``kernel`` class handles building Linux kernels. The class contains
  955. code to build all kernel trees. All needed headers are staged into the
  956. :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
  957. using the :ref:`module <ref-classes-module>` class.
  958. This means that each built kernel module is packaged separately and
  959. inter-module dependencies are created by parsing the ``modinfo`` output.
  960. If all modules are required, then installing the ``kernel-modules``
  961. package installs all packages with modules and various other kernel
  962. packages such as ``kernel-vmlinux``.
  963. The ``kernel`` class contains logic that allows you to embed an initial
  964. RAM filesystem (initramfs) image when you build the kernel image. For
  965. information on how to build an initramfs, see the
  966. ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section in
  967. the Yocto Project Development Tasks Manual.
  968. Various other classes are used by the ``kernel`` and ``module`` classes
  969. internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`,
  970. :ref:`module-base <ref-classes-module-base>`, and
  971. :ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes.
  972. .. _ref-classes-kernel-arch:
  973. ``kernel-arch.bbclass``
  974. =======================
  975. The ``kernel-arch`` class sets the ``ARCH`` environment variable for
  976. Linux kernel compilation (including modules).
  977. .. _ref-classes-kernel-devicetree:
  978. ``kernel-devicetree.bbclass``
  979. =============================
  980. The ``kernel-devicetree`` class, which is inherited by the
  981. :ref:`kernel <ref-classes-kernel>` class, supports device tree
  982. generation.
  983. .. _ref-classes-kernel-fitimage:
  984. ``kernel-fitimage.bbclass``
  985. ===========================
  986. The ``kernel-fitimage`` class provides support to pack a kernel image,
  987. device trees, a U-boot script, a Initramfs bundle and a RAM disk
  988. into a single FIT image. In theory, a FIT image can support any number
  989. of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
  990. However, ``kernel-fitimage`` currently only supports
  991. limited usescases: just one kernel image, an optional U-boot script,
  992. an optional Initramfs bundle, an optional RAM disk, and any number of
  993. device tree.
  994. To create a FIT image, it is required that :term:`KERNEL_CLASSES`
  995. is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE`
  996. is set to "fitImage".
  997. The options for the device tree compiler passed to ``mkimage -D``
  998. when creating the FIT image are specified using the
  999. :term:`UBOOT_MKIMAGE_DTCOPTS` variable.
  1000. Only a single kernel can be added to the FIT image created by
  1001. ``kernel-fitimage`` and the kernel image in FIT is mandatory. The
  1002. address where the kernel image is to be loaded by U-Boot is
  1003. specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
  1004. :term:`UBOOT_ENTRYPOINT`.
  1005. Multiple device trees can be added to the FIT image created by
  1006. ``kernel-fitimage`` and the device tree is optional.
  1007. The address where the device tree is to be loaded by U-Boot is
  1008. specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
  1009. and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
  1010. Only a single RAM disk can be added to the FIT image created by
  1011. ``kernel-fitimage`` and the RAM disk in FIT is optional.
  1012. The address where the RAM disk image is to be loaded by U-Boot
  1013. is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
  1014. :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
  1015. :term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
  1016. is set to 0.
  1017. Only a single Initramfs bundle can be added to the FIT image created by
  1018. ``kernel-fitimage`` and the Initramfs bundle in FIT is optional.
  1019. In case of Initramfs, the kernel is configured to be bundled with the rootfs
  1020. in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
  1021. When the kernel is copied to RAM and executed, it unpacks the Initramfs rootfs.
  1022. The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE`
  1023. is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
  1024. The address where the Initramfs bundle is to be loaded by U-boot is specified
  1025. by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
  1026. Only a single U-boot boot script can be added to the FIT image created by
  1027. ``kernel-fitimage`` and the boot script is optional.
  1028. The boot script is specified in the ITS file as a text file containing
  1029. U-boot commands. When using a boot script the user should configure the
  1030. U-boot ``do_install`` task to copy the script to sysroot.
  1031. So the script can be included in the FIT image by the ``kernel-fitimage``
  1032. class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
  1033. load the boot script from the FIT image and executes it.
  1034. The FIT image generated by ``kernel-fitimage`` class is signed when the
  1035. variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
  1036. :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
  1037. appropriately. The default values used for :term:`FIT_HASH_ALG` and
  1038. :term:`FIT_SIGN_ALG` in ``kernel-fitimage`` are "sha256" and
  1039. "rsa2048" respectively. The keys for signing fitImage can be generated using
  1040. the ``kernel-fitimage`` class when both :term:`FIT_GENERATE_KEYS` and
  1041. :term:`UBOOT_SIGN_ENABLE` are set to "1".
  1042. .. _ref-classes-kernel-grub:
  1043. ``kernel-grub.bbclass``
  1044. =======================
  1045. The ``kernel-grub`` class updates the boot area and the boot menu with
  1046. the kernel as the priority boot mechanism while installing a RPM to
  1047. update the kernel on a deployed target.
  1048. .. _ref-classes-kernel-module-split:
  1049. ``kernel-module-split.bbclass``
  1050. ===============================
  1051. The ``kernel-module-split`` class provides common functionality for
  1052. splitting Linux kernel modules into separate packages.
  1053. .. _ref-classes-kernel-uboot:
  1054. ``kernel-uboot.bbclass``
  1055. ========================
  1056. The ``kernel-uboot`` class provides support for building from
  1057. vmlinux-style kernel sources.
  1058. .. _ref-classes-kernel-uimage:
  1059. ``kernel-uimage.bbclass``
  1060. =========================
  1061. The ``kernel-uimage`` class provides support to pack uImage.
  1062. .. _ref-classes-kernel-yocto:
  1063. ``kernel-yocto.bbclass``
  1064. ========================
  1065. The ``kernel-yocto`` class provides common functionality for building
  1066. from linux-yocto style kernel source repositories.
  1067. .. _ref-classes-kernelsrc:
  1068. ``kernelsrc.bbclass``
  1069. =====================
  1070. The ``kernelsrc`` class sets the Linux kernel source and version.
  1071. .. _ref-classes-lib_package:
  1072. ``lib_package.bbclass``
  1073. =======================
  1074. The ``lib_package`` class supports recipes that build libraries and
  1075. produce executable binaries, where those binaries should not be
  1076. installed by default along with the library. Instead, the binaries are
  1077. added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
  1078. make their installation optional.
  1079. .. _ref-classes-libc*:
  1080. ``libc*.bbclass``
  1081. =================
  1082. The ``libc*`` classes support recipes that build packages with ``libc``:
  1083. - The ``libc-common`` class provides common support for building with
  1084. ``libc``.
  1085. - The ``libc-package`` class supports packaging up ``glibc`` and
  1086. ``eglibc``.
  1087. .. _ref-classes-license:
  1088. ``license.bbclass``
  1089. ===================
  1090. The ``license`` class provides license manifest creation and license
  1091. exclusion. This class is enabled by default using the default value for
  1092. the :term:`INHERIT_DISTRO` variable.
  1093. .. _ref-classes-linux-kernel-base:
  1094. ``linux-kernel-base.bbclass``
  1095. =============================
  1096. The ``linux-kernel-base`` class provides common functionality for
  1097. recipes that build out of the Linux kernel source tree. These builds
  1098. goes beyond the kernel itself. For example, the Perf recipe also
  1099. inherits this class.
  1100. .. _ref-classes-linuxloader:
  1101. ``linuxloader.bbclass``
  1102. =======================
  1103. Provides the function ``linuxloader()``, which gives the value of the
  1104. dynamic loader/linker provided on the platform. This value is used by a
  1105. number of other classes.
  1106. .. _ref-classes-logging:
  1107. ``logging.bbclass``
  1108. ===================
  1109. The ``logging`` class provides the standard shell functions used to log
  1110. messages for various BitBake severity levels (i.e. ``bbplain``,
  1111. ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
  1112. This class is enabled by default since it is inherited by the ``base``
  1113. class.
  1114. .. _ref-classes-meta:
  1115. ``meta.bbclass``
  1116. ================
  1117. The ``meta`` class is inherited by recipes that do not build any output
  1118. packages themselves, but act as a "meta" target for building other
  1119. recipes.
  1120. .. _ref-classes-metadata_scm:
  1121. ``metadata_scm.bbclass``
  1122. ========================
  1123. The ``metadata_scm`` class provides functionality for querying the
  1124. branch and revision of a Source Code Manager (SCM) repository.
  1125. The :ref:`base <ref-classes-base>` class uses this class to print the
  1126. revisions of each layer before starting every build. The
  1127. ``metadata_scm`` class is enabled by default because it is inherited by
  1128. the ``base`` class.
  1129. .. _ref-classes-migrate_localcount:
  1130. ``migrate_localcount.bbclass``
  1131. ==============================
  1132. The ``migrate_localcount`` class verifies a recipe's localcount data and
  1133. increments it appropriately.
  1134. .. _ref-classes-mime:
  1135. ``mime.bbclass``
  1136. ================
  1137. The ``mime`` class generates the proper post-install and post-remove
  1138. (postinst/postrm) scriptlets for packages that install MIME type files.
  1139. These scriptlets call ``update-mime-database`` to add the MIME types to
  1140. the shared database.
  1141. .. _ref-classes-mirrors:
  1142. ``mirrors.bbclass``
  1143. ===================
  1144. The ``mirrors`` class sets up some standard
  1145. :term:`MIRRORS` entries for source code mirrors. These
  1146. mirrors provide a fall-back path in case the upstream source specified
  1147. in :term:`SRC_URI` within recipes is unavailable.
  1148. This class is enabled by default since it is inherited by the
  1149. :ref:`base <ref-classes-base>` class.
  1150. .. _ref-classes-module:
  1151. ``module.bbclass``
  1152. ==================
  1153. The ``module`` class provides support for building out-of-tree Linux
  1154. kernel modules. The class inherits the
  1155. :ref:`module-base <ref-classes-module-base>` and
  1156. :ref:`kernel-module-split <ref-classes-kernel-module-split>` classes,
  1157. and implements the :ref:`ref-tasks-compile` and
  1158. :ref:`ref-tasks-install` tasks. The class provides
  1159. everything needed to build and package a kernel module.
  1160. For general information on out-of-tree Linux kernel modules, see the
  1161. ":ref:`kernel-dev/common:incorporating out-of-tree modules`"
  1162. section in the Yocto Project Linux Kernel Development Manual.
  1163. .. _ref-classes-module-base:
  1164. ``module-base.bbclass``
  1165. =======================
  1166. The ``module-base`` class provides the base functionality for building
  1167. Linux kernel modules. Typically, a recipe that builds software that
  1168. includes one or more kernel modules and has its own means of building
  1169. the module inherits this class as opposed to inheriting the
  1170. :ref:`module <ref-classes-module>` class.
  1171. .. _ref-classes-multilib*:
  1172. ``multilib*.bbclass``
  1173. =====================
  1174. The ``multilib*`` classes provide support for building libraries with
  1175. different target optimizations or target architectures and installing
  1176. them side-by-side in the same image.
  1177. For more information on using the Multilib feature, see the
  1178. ":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`"
  1179. section in the Yocto Project Development Tasks Manual.
  1180. .. _ref-classes-native:
  1181. ``native.bbclass``
  1182. ==================
  1183. The ``native`` class provides common functionality for recipes that
  1184. build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
  1185. or other tools from the build host).
  1186. You can create a recipe that builds tools that run natively on the host
  1187. a couple different ways:
  1188. - Create a myrecipe\ ``-native.bb`` recipe that inherits the ``native``
  1189. class. If you use this method, you must order the inherit statement
  1190. in the recipe after all other inherit statements so that the
  1191. ``native`` class is inherited last.
  1192. .. note::
  1193. When creating a recipe this way, the recipe name must follow this
  1194. naming convention::
  1195. myrecipe-native.bb
  1196. Not using this naming convention can lead to subtle problems
  1197. caused by existing code that depends on that naming convention.
  1198. - Create or modify a target recipe that contains the following::
  1199. BBCLASSEXTEND = "native"
  1200. Inside the
  1201. recipe, use ``_class-native`` and ``_class-target`` overrides to
  1202. specify any functionality specific to the respective native or target
  1203. case.
  1204. Although applied differently, the ``native`` class is used with both
  1205. methods. The advantage of the second method is that you do not need to
  1206. have two separate recipes (assuming you need both) for native and
  1207. target. All common parts of the recipe are automatically shared.
  1208. .. _ref-classes-nativesdk:
  1209. ``nativesdk.bbclass``
  1210. =====================
  1211. The ``nativesdk`` class provides common functionality for recipes that
  1212. wish to build tools to run as part of an SDK (i.e. tools that run on
  1213. :term:`SDKMACHINE`).
  1214. You can create a recipe that builds tools that run on the SDK machine a
  1215. couple different ways:
  1216. - Create a ``nativesdk-``\ myrecipe\ ``.bb`` recipe that inherits the
  1217. ``nativesdk`` class. If you use this method, you must order the
  1218. inherit statement in the recipe after all other inherit statements so
  1219. that the ``nativesdk`` class is inherited last.
  1220. - Create a ``nativesdk`` variant of any recipe by adding the following::
  1221. BBCLASSEXTEND = "nativesdk"
  1222. Inside the
  1223. recipe, use ``_class-nativesdk`` and ``_class-target`` overrides to
  1224. specify any functionality specific to the respective SDK machine or
  1225. target case.
  1226. .. note::
  1227. When creating a recipe, you must follow this naming convention::
  1228. nativesdk-myrecipe.bb
  1229. Not doing so can lead to subtle problems because there is code that
  1230. depends on the naming convention.
  1231. Although applied differently, the ``nativesdk`` class is used with both
  1232. methods. The advantage of the second method is that you do not need to
  1233. have two separate recipes (assuming you need both) for the SDK machine
  1234. and the target. All common parts of the recipe are automatically shared.
  1235. .. _ref-classes-nopackages:
  1236. ``nopackages.bbclass``
  1237. ======================
  1238. Disables packaging tasks for those recipes and classes where packaging
  1239. is not needed.
  1240. .. _ref-classes-npm:
  1241. ``npm.bbclass``
  1242. ===============
  1243. Provides support for building Node.js software fetched using the `node
  1244. package manager (NPM) <https://en.wikipedia.org/wiki/Npm_(software)>`__.
  1245. .. note::
  1246. Currently, recipes inheriting this class must use the ``npm://``
  1247. fetcher to have dependencies fetched and packaged automatically.
  1248. For information on how to create NPM packages, see the
  1249. ":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`"
  1250. section in the Yocto Project Development Tasks Manual.
  1251. .. _ref-classes-oelint:
  1252. ``oelint.bbclass``
  1253. ==================
  1254. The ``oelint`` class is an obsolete lint checking tool available in
  1255. ``meta/classes`` in the :term:`Source Directory`.
  1256. There are some classes that could be generally useful in OE-Core but
  1257. are never actually used within OE-Core itself. The ``oelint`` class is
  1258. one such example. However, being aware of this class can reduce the
  1259. proliferation of different versions of similar classes across multiple
  1260. layers.
  1261. .. _ref-classes-own-mirrors:
  1262. ``own-mirrors.bbclass``
  1263. =======================
  1264. The ``own-mirrors`` class makes it easier to set up your own
  1265. :term:`PREMIRRORS` from which to first fetch source
  1266. before attempting to fetch it from the upstream specified in
  1267. :term:`SRC_URI` within each recipe.
  1268. To use this class, inherit it globally and specify
  1269. :term:`SOURCE_MIRROR_URL`. Here is an example::
  1270. INHERIT += "own-mirrors"
  1271. SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
  1272. You can specify only a single URL
  1273. in :term:`SOURCE_MIRROR_URL`.
  1274. .. _ref-classes-package:
  1275. ``package.bbclass``
  1276. ===================
  1277. The ``package`` class supports generating packages from a build's
  1278. output. The core generic functionality is in ``package.bbclass``. The
  1279. code specific to particular package types resides in these
  1280. package-specific classes:
  1281. :ref:`package_deb <ref-classes-package_deb>`,
  1282. :ref:`package_rpm <ref-classes-package_rpm>`,
  1283. :ref:`package_ipk <ref-classes-package_ipk>`, and
  1284. :ref:`package_tar <ref-classes-package_tar>`.
  1285. .. note::
  1286. The
  1287. package_tar
  1288. class is broken and not supported. It is recommended that you do not
  1289. use this class.
  1290. You can control the list of resulting package formats by using the
  1291. :term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
  1292. configuration file, which is located in the :term:`Build Directory`.
  1293. When defining the variable, you can
  1294. specify one or more package types. Since images are generated from
  1295. packages, a packaging class is needed to enable image generation. The
  1296. first class listed in this variable is used for image generation.
  1297. If you take the optional step to set up a repository (package feed) on
  1298. the development host that can be used by DNF, you can install packages
  1299. from the feed while you are running the image on the target (i.e.
  1300. runtime installation of packages). For more information, see the
  1301. ":ref:`dev-manual/common-tasks:using runtime package management`"
  1302. section in the Yocto Project Development Tasks Manual.
  1303. The package-specific class you choose can affect build-time performance
  1304. and has space ramifications. In general, building a package with IPK
  1305. takes about thirty percent less time as compared to using RPM to build
  1306. the same or similar package. This comparison takes into account a
  1307. complete build of the package with all dependencies previously built.
  1308. The reason for this discrepancy is because the RPM package manager
  1309. creates and processes more :term:`Metadata` than the IPK package
  1310. manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
  1311. "package_ipk" if you are building smaller systems.
  1312. Before making your package manager decision, however, you should
  1313. consider some further things about using RPM:
  1314. - RPM starts to provide more abilities than IPK due to the fact that it
  1315. processes more Metadata. For example, this information includes
  1316. individual file types, file checksum generation and evaluation on
  1317. install, sparse file support, conflict detection and resolution for
  1318. Multilib systems, ACID style upgrade, and repackaging abilities for
  1319. rollbacks.
  1320. - For smaller systems, the extra space used for the Berkeley Database
  1321. and the amount of metadata when using RPM can affect your ability to
  1322. perform on-device upgrades.
  1323. You can find additional information on the effects of the package class
  1324. at these two Yocto Project mailing list links:
  1325. - :yocto_lists:`/pipermail/poky/2011-May/006362.html`
  1326. - :yocto_lists:`/pipermail/poky/2011-May/006363.html`
  1327. .. _ref-classes-package_deb:
  1328. ``package_deb.bbclass``
  1329. =======================
  1330. The ``package_deb`` class provides support for creating packages that
  1331. use the Debian (i.e. ``.deb``) file format. The class ensures the
  1332. packages are written out in a ``.deb`` file format to the
  1333. ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
  1334. This class inherits the :ref:`package <ref-classes-package>` class and
  1335. is enabled through the :term:`PACKAGE_CLASSES`
  1336. variable in the ``local.conf`` file.
  1337. .. _ref-classes-package_ipk:
  1338. ``package_ipk.bbclass``
  1339. =======================
  1340. The ``package_ipk`` class provides support for creating packages that
  1341. use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
  1342. are written out in a ``.ipk`` file format to the
  1343. ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
  1344. This class inherits the :ref:`package <ref-classes-package>` class and
  1345. is enabled through the :term:`PACKAGE_CLASSES`
  1346. variable in the ``local.conf`` file.
  1347. .. _ref-classes-package_rpm:
  1348. ``package_rpm.bbclass``
  1349. =======================
  1350. The ``package_rpm`` class provides support for creating packages that
  1351. use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
  1352. are written out in a ``.rpm`` file format to the
  1353. ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
  1354. This class inherits the :ref:`package <ref-classes-package>` class and
  1355. is enabled through the :term:`PACKAGE_CLASSES`
  1356. variable in the ``local.conf`` file.
  1357. .. _ref-classes-package_tar:
  1358. ``package_tar.bbclass``
  1359. =======================
  1360. The ``package_tar`` class provides support for creating tarballs. The
  1361. class ensures the packages are written out in a tarball format to the
  1362. ``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory.
  1363. This class inherits the :ref:`package <ref-classes-package>` class and
  1364. is enabled through the :term:`PACKAGE_CLASSES`
  1365. variable in the ``local.conf`` file.
  1366. .. note::
  1367. You cannot specify the ``package_tar`` class first using the
  1368. :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
  1369. file formats for your image or SDK.
  1370. .. _ref-classes-packagedata:
  1371. ``packagedata.bbclass``
  1372. =======================
  1373. The ``packagedata`` class provides common functionality for reading
  1374. ``pkgdata`` files found in :term:`PKGDATA_DIR`. These
  1375. files contain information about each output package produced by the
  1376. OpenEmbedded build system.
  1377. This class is enabled by default because it is inherited by the
  1378. :ref:`package <ref-classes-package>` class.
  1379. .. _ref-classes-packagegroup:
  1380. ``packagegroup.bbclass``
  1381. ========================
  1382. The ``packagegroup`` class sets default values appropriate for package
  1383. group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
  1384. so forth). It is highly recommended that all package group recipes
  1385. inherit this class.
  1386. For information on how to use this class, see the
  1387. ":ref:`dev-manual/common-tasks:customizing images using custom package groups`"
  1388. section in the Yocto Project Development Tasks Manual.
  1389. Previously, this class was called the ``task`` class.
  1390. .. _ref-classes-patch:
  1391. ``patch.bbclass``
  1392. =================
  1393. The ``patch`` class provides all functionality for applying patches
  1394. during the :ref:`ref-tasks-patch` task.
  1395. This class is enabled by default because it is inherited by the
  1396. :ref:`base <ref-classes-base>` class.
  1397. .. _ref-classes-perlnative:
  1398. ``perlnative.bbclass``
  1399. ======================
  1400. When inherited by a recipe, the ``perlnative`` class supports using the
  1401. native version of Perl built by the build system rather than using the
  1402. version provided by the build host.
  1403. .. _ref-classes-pixbufcache:
  1404. ``pixbufcache.bbclass``
  1405. =======================
  1406. The ``pixbufcache`` class generates the proper post-install and
  1407. post-remove (postinst/postrm) scriptlets for packages that install
  1408. pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
  1409. call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
  1410. Since the cache files are architecture-specific, ``update_pixbuf_cache``
  1411. is run using QEMU if the postinst scriptlets need to be run on the build
  1412. host during image creation.
  1413. If the pixbuf loaders being installed are in packages other than the
  1414. recipe's main package, set
  1415. :term:`PIXBUF_PACKAGES` to specify the packages
  1416. containing the loaders.
  1417. .. _ref-classes-pkgconfig:
  1418. ``pkgconfig.bbclass``
  1419. =====================
  1420. The ``pkgconfig`` class provides a standard way to get header and
  1421. library information by using ``pkg-config``. This class aims to smooth
  1422. integration of ``pkg-config`` into libraries that use it.
  1423. During staging, BitBake installs ``pkg-config`` data into the
  1424. ``sysroots/`` directory. By making use of sysroot functionality within
  1425. ``pkg-config``, the ``pkgconfig`` class no longer has to manipulate the
  1426. files.
  1427. .. _ref-classes-populate-sdk:
  1428. ``populate_sdk.bbclass``
  1429. ========================
  1430. The ``populate_sdk`` class provides support for SDK-only recipes. For
  1431. information on advantages gained when building a cross-development
  1432. toolchain using the :ref:`ref-tasks-populate_sdk`
  1433. task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1434. section in the Yocto Project Application Development and the Extensible
  1435. Software Development Kit (eSDK) manual.
  1436. .. _ref-classes-populate-sdk-*:
  1437. ``populate_sdk_*.bbclass``
  1438. ==========================
  1439. The ``populate_sdk_*`` classes support SDK creation and consist of the
  1440. following classes:
  1441. - ``populate_sdk_base``: The base class supporting SDK creation under
  1442. all package managers (i.e. DEB, RPM, and opkg).
  1443. - ``populate_sdk_deb``: Supports creation of the SDK given the Debian
  1444. package manager.
  1445. - ``populate_sdk_rpm``: Supports creation of the SDK given the RPM
  1446. package manager.
  1447. - ``populate_sdk_ipk``: Supports creation of the SDK given the opkg
  1448. (IPK format) package manager.
  1449. - ``populate_sdk_ext``: Supports extensible SDK creation under all
  1450. package managers.
  1451. The ``populate_sdk_base`` class inherits the appropriate
  1452. ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
  1453. :term:`IMAGE_PKGTYPE`.
  1454. The base class ensures all source and destination directories are
  1455. established and then populates the SDK. After populating the SDK, the
  1456. ``populate_sdk_base`` class constructs two sysroots:
  1457. ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
  1458. contains the cross-compiler and associated tooling, and the target,
  1459. which contains a target root filesystem that is configured for the SDK
  1460. usage. These two images reside in :term:`SDK_OUTPUT`,
  1461. which consists of the following::
  1462. ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
  1463. ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
  1464. Finally, the base populate SDK class creates the toolchain environment
  1465. setup script, the tarball of the SDK, and the installer.
  1466. The respective ``populate_sdk_deb``, ``populate_sdk_rpm``, and
  1467. ``populate_sdk_ipk`` classes each support the specific type of SDK.
  1468. These classes are inherited by and used with the ``populate_sdk_base``
  1469. class.
  1470. For more information on the cross-development toolchain generation, see
  1471. the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
  1472. section in the Yocto Project Overview and Concepts Manual. For
  1473. information on advantages gained when building a cross-development
  1474. toolchain using the :ref:`ref-tasks-populate_sdk`
  1475. task, see the
  1476. ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  1477. section in the Yocto Project Application Development and the Extensible
  1478. Software Development Kit (eSDK) manual.
  1479. .. _ref-classes-prexport:
  1480. ``prexport.bbclass``
  1481. ====================
  1482. The ``prexport`` class provides functionality for exporting
  1483. :term:`PR` values.
  1484. .. note::
  1485. This class is not intended to be used directly. Rather, it is enabled
  1486. when using "``bitbake-prserv-tool export``".
  1487. .. _ref-classes-primport:
  1488. ``primport.bbclass``
  1489. ====================
  1490. The ``primport`` class provides functionality for importing
  1491. :term:`PR` values.
  1492. .. note::
  1493. This class is not intended to be used directly. Rather, it is enabled
  1494. when using "``bitbake-prserv-tool import``".
  1495. .. _ref-classes-prserv:
  1496. ``prserv.bbclass``
  1497. ==================
  1498. The ``prserv`` class provides functionality for using a :ref:`PR
  1499. service <dev-manual/common-tasks:working with a pr service>` in order to
  1500. automatically manage the incrementing of the :term:`PR`
  1501. variable for each recipe.
  1502. This class is enabled by default because it is inherited by the
  1503. :ref:`package <ref-classes-package>` class. However, the OpenEmbedded
  1504. build system will not enable the functionality of this class unless
  1505. :term:`PRSERV_HOST` has been set.
  1506. .. _ref-classes-ptest:
  1507. ``ptest.bbclass``
  1508. =================
  1509. The ``ptest`` class provides functionality for packaging and installing
  1510. runtime tests for recipes that build software that provides these tests.
  1511. This class is intended to be inherited by individual recipes. However,
  1512. the class' functionality is largely disabled unless "ptest" appears in
  1513. :term:`DISTRO_FEATURES`. See the
  1514. ":ref:`dev-manual/common-tasks:testing packages with ptest`"
  1515. section in the Yocto Project Development Tasks Manual for more information
  1516. on ptest.
  1517. .. _ref-classes-ptest-gnome:
  1518. ``ptest-gnome.bbclass``
  1519. =======================
  1520. Enables package tests (ptests) specifically for GNOME packages, which
  1521. have tests intended to be executed with ``gnome-desktop-testing``.
  1522. For information on setting up and running ptests, see the
  1523. ":ref:`dev-manual/common-tasks:testing packages with ptest`"
  1524. section in the Yocto Project Development Tasks Manual.
  1525. .. _ref-classes-python3-dir:
  1526. ``python3-dir.bbclass``
  1527. =======================
  1528. The ``python3-dir`` class provides the base version, location, and site
  1529. package location for Python 3.
  1530. .. _ref-classes-python3native:
  1531. ``python3native.bbclass``
  1532. =========================
  1533. The ``python3native`` class supports using the native version of Python
  1534. 3 built by the build system rather than support of the version provided
  1535. by the build host.
  1536. .. _ref-classes-python3targetconfig:
  1537. ``python3targetconfig.bbclass``
  1538. ===============================
  1539. The ``python3targetconfig`` class supports using the native version of Python
  1540. 3 built by the build system rather than support of the version provided
  1541. by the build host, except that the configuration for the target machine
  1542. is accessible (such as correct installation directories). This also adds a
  1543. dependency on target ``python3``, so should only be used where appropriate
  1544. in order to avoid unnecessarily lengthening builds.
  1545. .. _ref-classes-qemu:
  1546. ``qemu.bbclass``
  1547. ================
  1548. The ``qemu`` class provides functionality for recipes that either need
  1549. QEMU or test for the existence of QEMU. Typically, this class is used to
  1550. run programs for a target system on the build host using QEMU's
  1551. application emulation mode.
  1552. .. _ref-classes-recipe_sanity:
  1553. ``recipe_sanity.bbclass``
  1554. =========================
  1555. The ``recipe_sanity`` class checks for the presence of any host system
  1556. recipe prerequisites that might affect the build (e.g. variables that
  1557. are set or software that is present).
  1558. .. _ref-classes-relocatable:
  1559. ``relocatable.bbclass``
  1560. =======================
  1561. The ``relocatable`` class enables relocation of binaries when they are
  1562. installed into the sysroot.
  1563. This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class
  1564. and is used by both the :ref:`cross <ref-classes-cross>` and
  1565. :ref:`native <ref-classes-native>` classes.
  1566. .. _ref-classes-remove-libtool:
  1567. ``remove-libtool.bbclass``
  1568. ==========================
  1569. The ``remove-libtool`` class adds a post function to the
  1570. :ref:`ref-tasks-install` task to remove all ``.la`` files
  1571. installed by ``libtool``. Removing these files results in them being
  1572. absent from both the sysroot and target packages.
  1573. If a recipe needs the ``.la`` files to be installed, then the recipe can
  1574. override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
  1575. REMOVE_LIBTOOL_LA = "0"
  1576. .. note::
  1577. The ``remove-libtool`` class is not enabled by default.
  1578. .. _ref-classes-report-error:
  1579. ``report-error.bbclass``
  1580. ========================
  1581. The ``report-error`` class supports enabling the :ref:`error reporting
  1582. tool <dev-manual/common-tasks:using the error reporting tool>`",
  1583. which allows you to submit build error information to a central database.
  1584. The class collects debug information for recipe, recipe version, task,
  1585. machine, distro, build system, target system, host distro, branch,
  1586. commit, and log. From the information, report files using a JSON format
  1587. are created and stored in
  1588. ``${``\ :term:`LOG_DIR`\ ``}/error-report``.
  1589. .. _ref-classes-rm-work:
  1590. ``rm_work.bbclass``
  1591. ===================
  1592. The ``rm_work`` class supports deletion of temporary workspace, which
  1593. can ease your hard drive demands during builds.
  1594. The OpenEmbedded build system can use a substantial amount of disk space
  1595. during the build process. A portion of this space is the work files
  1596. under the ``${TMPDIR}/work`` directory for each recipe. Once the build
  1597. system generates the packages for a recipe, the work files for that
  1598. recipe are no longer needed. However, by default, the build system
  1599. preserves these files for inspection and possible debugging purposes. If
  1600. you would rather have these files deleted to save disk space as the
  1601. build progresses, you can enable ``rm_work`` by adding the following to
  1602. your ``local.conf`` file, which is found in the :term:`Build Directory`.
  1603. ::
  1604. INHERIT += "rm_work"
  1605. If you are
  1606. modifying and building source code out of the work directory for a
  1607. recipe, enabling ``rm_work`` will potentially result in your changes to
  1608. the source being lost. To exclude some recipes from having their work
  1609. directories deleted by ``rm_work``, you can add the names of the recipe
  1610. or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which
  1611. can also be set in your ``local.conf`` file. Here is an example::
  1612. RM_WORK_EXCLUDE += "busybox glibc"
  1613. .. _ref-classes-rootfs*:
  1614. ``rootfs*.bbclass``
  1615. ===================
  1616. The ``rootfs*`` classes support creating the root filesystem for an
  1617. image and consist of the following classes:
  1618. - The ``rootfs-postcommands`` class, which defines filesystem
  1619. post-processing functions for image recipes.
  1620. - The ``rootfs_deb`` class, which supports creation of root filesystems
  1621. for images built using ``.deb`` packages.
  1622. - The ``rootfs_rpm`` class, which supports creation of root filesystems
  1623. for images built using ``.rpm`` packages.
  1624. - The ``rootfs_ipk`` class, which supports creation of root filesystems
  1625. for images built using ``.ipk`` packages.
  1626. - The ``rootfsdebugfiles`` class, which installs additional files found
  1627. on the build host directly into the root filesystem.
  1628. The root filesystem is created from packages using one of the
  1629. ``rootfs*.bbclass`` files as determined by the
  1630. :term:`PACKAGE_CLASSES` variable.
  1631. For information on how root filesystem images are created, see the
  1632. ":ref:`overview-manual/concepts:image generation`"
  1633. section in the Yocto Project Overview and Concepts Manual.
  1634. .. _ref-classes-sanity:
  1635. ``sanity.bbclass``
  1636. ==================
  1637. The ``sanity`` class checks to see if prerequisite software is present
  1638. on the host system so that users can be notified of potential problems
  1639. that might affect their build. The class also performs basic user
  1640. configuration checks from the ``local.conf`` configuration file to
  1641. prevent common mistakes that cause build failures. Distribution policy
  1642. usually determines whether to include this class.
  1643. .. _ref-classes-scons:
  1644. ``scons.bbclass``
  1645. =================
  1646. The ``scons`` class supports recipes that need to build software that
  1647. uses the SCons build system. You can use the
  1648. :term:`EXTRA_OESCONS` variable to specify
  1649. additional configuration options you want to pass SCons command line.
  1650. .. _ref-classes-sdl:
  1651. ``sdl.bbclass``
  1652. ===============
  1653. The ``sdl`` class supports recipes that need to build software that uses
  1654. the Simple DirectMedia Layer (SDL) library.
  1655. .. _ref-classes-setuptools3:
  1656. ``setuptools3.bbclass``
  1657. =======================
  1658. The ``setuptools3`` class supports Python version 3.x extensions that
  1659. use build systems based on ``setuptools``. If your recipe uses these
  1660. build systems, the recipe needs to inherit the ``setuptools3`` class.
  1661. .. _ref-classes-sign_rpm:
  1662. ``sign_rpm.bbclass``
  1663. ====================
  1664. The ``sign_rpm`` class supports generating signed RPM packages.
  1665. .. _ref-classes-sip:
  1666. ``sip.bbclass``
  1667. ===============
  1668. The ``sip`` class supports recipes that build or package SIP-based
  1669. Python bindings.
  1670. .. _ref-classes-siteconfig:
  1671. ``siteconfig.bbclass``
  1672. ======================
  1673. The ``siteconfig`` class provides functionality for handling site
  1674. configuration. The class is used by the
  1675. :ref:`autotools <ref-classes-autotools>` class to accelerate the
  1676. :ref:`ref-tasks-configure` task.
  1677. .. _ref-classes-siteinfo:
  1678. ``siteinfo.bbclass``
  1679. ====================
  1680. The ``siteinfo`` class provides information about the targets that might
  1681. be needed by other classes or recipes.
  1682. As an example, consider Autotools, which can require tests that must
  1683. execute on the target hardware. Since this is not possible in general
  1684. when cross compiling, site information is used to provide cached test
  1685. results so these tests can be skipped over but still make the correct
  1686. values available. The ``meta/site directory`` contains test results
  1687. sorted into different categories such as architecture, endianness, and
  1688. the ``libc`` used. Site information provides a list of files containing
  1689. data relevant to the current build in the :term:`CONFIG_SITE` variable that
  1690. Autotools automatically picks up.
  1691. The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
  1692. :term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
  1693. .. _ref-classes-sstate:
  1694. ``sstate.bbclass``
  1695. ==================
  1696. The ``sstate`` class provides support for Shared State (sstate). By
  1697. default, the class is enabled through the
  1698. :term:`INHERIT_DISTRO` variable's default value.
  1699. For more information on sstate, see the
  1700. ":ref:`overview-manual/concepts:shared state cache`"
  1701. section in the Yocto Project Overview and Concepts Manual.
  1702. .. _ref-classes-staging:
  1703. ``staging.bbclass``
  1704. ===================
  1705. The ``staging`` class installs files into individual recipe work
  1706. directories for sysroots. The class contains the following key tasks:
  1707. - The :ref:`ref-tasks-populate_sysroot` task,
  1708. which is responsible for handing the files that end up in the recipe
  1709. sysroots.
  1710. - The
  1711. :ref:`ref-tasks-prepare_recipe_sysroot`
  1712. task (a "partner" task to the ``populate_sysroot`` task), which
  1713. installs the files into the individual recipe work directories (i.e.
  1714. :term:`WORKDIR`).
  1715. The code in the ``staging`` class is complex and basically works in two
  1716. stages:
  1717. - *Stage One:* The first stage addresses recipes that have files they
  1718. want to share with other recipes that have dependencies on the
  1719. originating recipe. Normally these dependencies are installed through
  1720. the :ref:`ref-tasks-install` task into
  1721. ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task
  1722. copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
  1723. subset of files is controlled by the
  1724. :term:`SYSROOT_DIRS`,
  1725. :term:`SYSROOT_DIRS_NATIVE`, and
  1726. :term:`SYSROOT_DIRS_BLACKLIST`
  1727. variables.
  1728. .. note::
  1729. Additionally, a recipe can customize the files further by
  1730. declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
  1731. variable.
  1732. A shared state (sstate) object is built from these files and the
  1733. files are placed into a subdirectory of
  1734. :ref:`structure-build-tmp-sysroots-components`.
  1735. The files are scanned for hardcoded paths to the original
  1736. installation location. If the location is found in text files, the
  1737. hardcoded locations are replaced by tokens and a list of the files
  1738. needing such replacements is created. These adjustments are referred
  1739. to as "FIXMEs". The list of files that are scanned for paths is
  1740. controlled by the :term:`SSTATE_SCAN_FILES`
  1741. variable.
  1742. - *Stage Two:* The second stage addresses recipes that want to use
  1743. something from another recipe and declare a dependency on that recipe
  1744. through the :term:`DEPENDS` variable. The recipe will
  1745. have a
  1746. :ref:`ref-tasks-prepare_recipe_sysroot`
  1747. task and when this task executes, it creates the ``recipe-sysroot``
  1748. and ``recipe-sysroot-native`` in the recipe work directory (i.e.
  1749. :term:`WORKDIR`). The OpenEmbedded build system
  1750. creates hard links to copies of the relevant files from
  1751. ``sysroots-components`` into the recipe work directory.
  1752. .. note::
  1753. If hard links are not possible, the build system uses actual
  1754. copies.
  1755. The build system then addresses any "FIXMEs" to paths as defined from
  1756. the list created in the first stage.
  1757. Finally, any files in ``${bindir}`` within the sysroot that have the
  1758. prefix "``postinst-``" are executed.
  1759. .. note::
  1760. Although such sysroot post installation scripts are not
  1761. recommended for general use, the files do allow some issues such
  1762. as user creation and module indexes to be addressed.
  1763. Because recipes can have other dependencies outside of :term:`DEPENDS`
  1764. (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
  1765. the sysroot creation function ``extend_recipe_sysroot`` is also added
  1766. as a pre-function for those tasks whose dependencies are not through
  1767. :term:`DEPENDS` but operate similarly.
  1768. When installing dependencies into the sysroot, the code traverses the
  1769. dependency graph and processes dependencies in exactly the same way
  1770. as the dependencies would or would not be when installed from sstate.
  1771. This processing means, for example, a native tool would have its
  1772. native dependencies added but a target library would not have its
  1773. dependencies traversed or installed. The same sstate dependency code
  1774. is used so that builds should be identical regardless of whether
  1775. sstate was used or not. For a closer look, see the
  1776. ``setscene_depvalid()`` function in the
  1777. :ref:`sstate <ref-classes-sstate>` class.
  1778. The build system is careful to maintain manifests of the files it
  1779. installs so that any given dependency can be installed as needed. The
  1780. sstate hash of the installed item is also stored so that if it
  1781. changes, the build system can reinstall it.
  1782. .. _ref-classes-syslinux:
  1783. ``syslinux.bbclass``
  1784. ====================
  1785. The ``syslinux`` class provides syslinux-specific functions for building
  1786. bootable images.
  1787. The class supports the following variables:
  1788. - :term:`INITRD`: Indicates list of filesystem images to
  1789. concatenate and use as an initial RAM disk (initrd). This variable is
  1790. optional.
  1791. - :term:`ROOTFS`: Indicates a filesystem image to include
  1792. as the root filesystem. This variable is optional.
  1793. - :term:`AUTO_SYSLINUXMENU`: Enables creating
  1794. an automatic menu when set to "1".
  1795. - :term:`LABELS`: Lists targets for automatic
  1796. configuration.
  1797. - :term:`APPEND`: Lists append string overrides for each
  1798. label.
  1799. - :term:`SYSLINUX_OPTS`: Lists additional options
  1800. to add to the syslinux file. Semicolon characters separate multiple
  1801. options.
  1802. - :term:`SYSLINUX_SPLASH`: Lists a background
  1803. for the VGA boot menu when you are using the boot menu.
  1804. - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
  1805. to "console=ttyX" to change kernel boot default console.
  1806. - :term:`SYSLINUX_SERIAL`: Sets an alternate
  1807. serial port. Or, turns off serial when the variable is set with an
  1808. empty string.
  1809. - :term:`SYSLINUX_SERIAL_TTY`: Sets an
  1810. alternate "console=tty..." kernel boot argument.
  1811. .. _ref-classes-systemd:
  1812. ``systemd.bbclass``
  1813. ===================
  1814. The ``systemd`` class provides support for recipes that install systemd
  1815. unit files.
  1816. The functionality for this class is disabled unless you have "systemd"
  1817. in :term:`DISTRO_FEATURES`.
  1818. Under this class, the recipe or Makefile (i.e. whatever the recipe is
  1819. calling during the :ref:`ref-tasks-install` task)
  1820. installs unit files into
  1821. ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
  1822. files being installed go into packages other than the main package, you
  1823. need to set :term:`SYSTEMD_PACKAGES` in your
  1824. recipe to identify the packages in which the files will be installed.
  1825. You should set :term:`SYSTEMD_SERVICE` to the
  1826. name of the service file. You should also use a package name override to
  1827. indicate the package to which the value applies. If the value applies to
  1828. the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
  1829. is an example from the connman recipe::
  1830. SYSTEMD_SERVICE_${PN} = "connman.service"
  1831. Services are set up to start on boot automatically
  1832. unless you have set
  1833. :term:`SYSTEMD_AUTO_ENABLE` to "disable".
  1834. For more information on ``systemd``, see the
  1835. ":ref:`dev-manual/common-tasks:selecting an initialization manager`"
  1836. section in the Yocto Project Development Tasks Manual.
  1837. .. _ref-classes-systemd-boot:
  1838. ``systemd-boot.bbclass``
  1839. ========================
  1840. The ``systemd-boot`` class provides functions specific to the
  1841. systemd-boot bootloader for building bootable images. This is an
  1842. internal class and is not intended to be used directly.
  1843. .. note::
  1844. The ``systemd-boot`` class is a result from merging the ``gummiboot`` class
  1845. used in previous Yocto Project releases with the ``systemd`` project.
  1846. Set the :term:`EFI_PROVIDER` variable to
  1847. "systemd-boot" to use this class. Doing so creates a standalone EFI
  1848. bootloader that is not dependent on systemd.
  1849. For information on more variables used and supported in this class, see
  1850. the :term:`SYSTEMD_BOOT_CFG`,
  1851. :term:`SYSTEMD_BOOT_ENTRIES`, and
  1852. :term:`SYSTEMD_BOOT_TIMEOUT` variables.
  1853. You can also see the `Systemd-boot
  1854. documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
  1855. for more information.
  1856. .. _ref-classes-terminal:
  1857. ``terminal.bbclass``
  1858. ====================
  1859. The ``terminal`` class provides support for starting a terminal session.
  1860. The :term:`OE_TERMINAL` variable controls which
  1861. terminal emulator is used for the session.
  1862. Other classes use the ``terminal`` class anywhere a separate terminal
  1863. session needs to be started. For example, the
  1864. :ref:`patch <ref-classes-patch>` class assuming
  1865. :term:`PATCHRESOLVE` is set to "user", the
  1866. :ref:`cml1 <ref-classes-cml1>` class, and the
  1867. :ref:`devshell <ref-classes-devshell>` class all use the ``terminal``
  1868. class.
  1869. .. _ref-classes-testimage*:
  1870. ``testimage*.bbclass``
  1871. ======================
  1872. The ``testimage*`` classes support running automated tests against
  1873. images using QEMU and on actual hardware. The classes handle loading the
  1874. tests and starting the image. To use the classes, you need to perform
  1875. steps to set up the environment.
  1876. .. note::
  1877. Best practices include using :term:`IMAGE_CLASSES` rather than
  1878. :term:`INHERIT` to inherit the ``testimage`` class for automated image
  1879. testing.
  1880. The tests are commands that run on the target system over ``ssh``. Each
  1881. test is written in Python and makes use of the ``unittest`` module.
  1882. The ``testimage.bbclass`` runs tests on an image when called using the
  1883. following::
  1884. $ bitbake -c testimage image
  1885. The ``testimage-auto`` class
  1886. runs tests on an image after the image is constructed (i.e.
  1887. :term:`TESTIMAGE_AUTO` must be set to "1").
  1888. For information on how to enable, run, and create new tests, see the
  1889. ":ref:`dev-manual/common-tasks:performing automated runtime testing`"
  1890. section in the Yocto Project Development Tasks Manual.
  1891. .. _ref-classes-testsdk:
  1892. ``testsdk.bbclass``
  1893. ===================
  1894. This class supports running automated tests against software development
  1895. kits (SDKs). The ``testsdk`` class runs tests on an SDK when called
  1896. using the following::
  1897. $ bitbake -c testsdk image
  1898. .. note::
  1899. Best practices include using :term:`IMAGE_CLASSES` rather than
  1900. :term:`INHERIT` to inherit the ``testsdk`` class for automated SDK
  1901. testing.
  1902. .. _ref-classes-texinfo:
  1903. ``texinfo.bbclass``
  1904. ===================
  1905. This class should be inherited by recipes whose upstream packages invoke
  1906. the ``texinfo`` utilities at build-time. Native and cross recipes are
  1907. made to use the dummy scripts provided by ``texinfo-dummy-native``, for
  1908. improved performance. Target architecture recipes use the genuine
  1909. Texinfo utilities. By default, they use the Texinfo utilities on the
  1910. host system.
  1911. .. note::
  1912. If you want to use the Texinfo recipe shipped with the build system,
  1913. you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
  1914. from :term:`SANITY_REQUIRED_UTILITIES`.
  1915. .. _ref-classes-toaster:
  1916. ``toaster.bbclass``
  1917. ===================
  1918. The ``toaster`` class collects information about packages and images and
  1919. sends them as events that the BitBake user interface can receive. The
  1920. class is enabled when the Toaster user interface is running.
  1921. This class is not intended to be used directly.
  1922. .. _ref-classes-toolchain-scripts:
  1923. ``toolchain-scripts.bbclass``
  1924. =============================
  1925. The ``toolchain-scripts`` class provides the scripts used for setting up
  1926. the environment for installed SDKs.
  1927. .. _ref-classes-typecheck:
  1928. ``typecheck.bbclass``
  1929. =====================
  1930. The ``typecheck`` class provides support for validating the values of
  1931. variables set at the configuration level against their defined types.
  1932. The OpenEmbedded build system allows you to define the type of a
  1933. variable using the "type" varflag. Here is an example::
  1934. IMAGE_FEATURES[type] = "list"
  1935. .. _ref-classes-uboot-config:
  1936. ``uboot-config.bbclass``
  1937. ========================
  1938. The ``uboot-config`` class provides support for U-Boot configuration for
  1939. a machine. Specify the machine in your recipe as follows::
  1940. UBOOT_CONFIG ??= <default>
  1941. UBOOT_CONFIG[foo] = "config,images"
  1942. You can also specify the machine using this method::
  1943. UBOOT_MACHINE = "config"
  1944. See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
  1945. information.
  1946. .. _ref-classes-uninative:
  1947. ``uninative.bbclass``
  1948. =====================
  1949. Attempts to isolate the build system from the host distribution's C
  1950. library in order to make re-use of native shared state artifacts across
  1951. different host distributions practical. With this class enabled, a
  1952. tarball containing a pre-built C library is downloaded at the start of
  1953. the build. In the Poky reference distribution this is enabled by default
  1954. through ``meta/conf/distro/include/yocto-uninative.inc``. Other
  1955. distributions that do not derive from poky can also
  1956. "``require conf/distro/include/yocto-uninative.inc``" to use this.
  1957. Alternatively if you prefer, you can build the uninative-tarball recipe
  1958. yourself, publish the resulting tarball (e.g. via HTTP) and set
  1959. ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
  1960. example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
  1961. The ``uninative`` class is also used unconditionally by the extensible
  1962. SDK. When building the extensible SDK, ``uninative-tarball`` is built
  1963. and the resulting tarball is included within the SDK.
  1964. .. _ref-classes-update-alternatives:
  1965. ``update-alternatives.bbclass``
  1966. ===============================
  1967. The ``update-alternatives`` class helps the alternatives system when
  1968. multiple sources provide the same command. This situation occurs when
  1969. several programs that have the same or similar function are installed
  1970. with the same name. For example, the ``ar`` command is available from
  1971. the ``busybox``, ``binutils`` and ``elfutils`` packages. The
  1972. ``update-alternatives`` class handles renaming the binaries so that
  1973. multiple packages can be installed without conflicts. The ``ar`` command
  1974. still works regardless of which packages are installed or subsequently
  1975. removed. The class renames the conflicting binary in each package and
  1976. symlinks the highest priority binary during installation or removal of
  1977. packages.
  1978. To use this class, you need to define a number of variables:
  1979. - :term:`ALTERNATIVE`
  1980. - :term:`ALTERNATIVE_LINK_NAME`
  1981. - :term:`ALTERNATIVE_TARGET`
  1982. - :term:`ALTERNATIVE_PRIORITY`
  1983. These variables list alternative commands needed by a package, provide
  1984. pathnames for links, default links for targets, and so forth. For
  1985. details on how to use this class, see the comments in the
  1986. :yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes/update-alternatives.bbclass>`
  1987. file.
  1988. .. note::
  1989. You can use the ``update-alternatives`` command directly in your recipes.
  1990. However, this class simplifies things in most cases.
  1991. .. _ref-classes-update-rc.d:
  1992. ``update-rc.d.bbclass``
  1993. =======================
  1994. The ``update-rc.d`` class uses ``update-rc.d`` to safely install an
  1995. initialization script on behalf of the package. The OpenEmbedded build
  1996. system takes care of details such as making sure the script is stopped
  1997. before a package is removed and started when the package is installed.
  1998. Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
  1999. :term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
  2000. for details.
  2001. .. _ref-classes-useradd:
  2002. ``useradd*.bbclass``
  2003. ====================
  2004. The ``useradd*`` classes support the addition of users or groups for
  2005. usage by the package on the target. For example, if you have packages
  2006. that contain system services that should be run under their own user or
  2007. group, you can use these classes to enable creation of the user or
  2008. group. The ``meta-skeleton/recipes-skeleton/useradd/useradd-example.bb``
  2009. recipe in the :term:`Source Directory` provides a simple
  2010. example that shows how to add three users and groups to two packages.
  2011. See the ``useradd-example.bb`` recipe for more information on how to use
  2012. these classes.
  2013. The ``useradd_base`` class provides basic functionality for user or
  2014. groups settings.
  2015. The ``useradd*`` classes support the
  2016. :term:`USERADD_PACKAGES`,
  2017. :term:`USERADD_PARAM`,
  2018. :term:`GROUPADD_PARAM`, and
  2019. :term:`GROUPMEMS_PARAM` variables.
  2020. The ``useradd-staticids`` class supports the addition of users or groups
  2021. that have static user identification (``uid``) and group identification
  2022. (``gid``) values.
  2023. The default behavior of the OpenEmbedded build system for assigning
  2024. ``uid`` and ``gid`` values when packages add users and groups during
  2025. package install time is to add them dynamically. This works fine for
  2026. programs that do not care what the values of the resulting users and
  2027. groups become. In these cases, the order of the installation determines
  2028. the final ``uid`` and ``gid`` values. However, if non-deterministic
  2029. ``uid`` and ``gid`` values are a problem, you can override the default,
  2030. dynamic application of these values by setting static values. When you
  2031. set static values, the OpenEmbedded build system looks in
  2032. :term:`BBPATH` for ``files/passwd`` and ``files/group``
  2033. files for the values.
  2034. To use static ``uid`` and ``gid`` values, you need to set some
  2035. variables. See the :term:`USERADDEXTENSION`,
  2036. :term:`USERADD_UID_TABLES`,
  2037. :term:`USERADD_GID_TABLES`, and
  2038. :term:`USERADD_ERROR_DYNAMIC` variables.
  2039. You can also see the :ref:`useradd <ref-classes-useradd>` class for
  2040. additional information.
  2041. .. note::
  2042. You do not use the ``useradd-staticids`` class directly. You either enable
  2043. or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
  2044. enable or disable the class in a configured system, :term:`TMPDIR` might
  2045. contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
  2046. directory will correct this condition.
  2047. .. _ref-classes-utility-tasks:
  2048. ``utility-tasks.bbclass``
  2049. =========================
  2050. The ``utility-tasks`` class provides support for various "utility" type
  2051. tasks that are applicable to all recipes, such as
  2052. :ref:`ref-tasks-clean` and
  2053. :ref:`ref-tasks-listtasks`.
  2054. This class is enabled by default because it is inherited by the
  2055. :ref:`base <ref-classes-base>` class.
  2056. .. _ref-classes-utils:
  2057. ``utils.bbclass``
  2058. =================
  2059. The ``utils`` class provides some useful Python functions that are
  2060. typically used in inline Python expressions (e.g. ``${@...}``). One
  2061. example use is for ``bb.utils.contains()``.
  2062. This class is enabled by default because it is inherited by the
  2063. :ref:`base <ref-classes-base>` class.
  2064. .. _ref-classes-vala:
  2065. ``vala.bbclass``
  2066. ================
  2067. The ``vala`` class supports recipes that need to build software written
  2068. using the Vala programming language.
  2069. .. _ref-classes-waf:
  2070. ``waf.bbclass``
  2071. ===============
  2072. The ``waf`` class supports recipes that need to build software that uses
  2073. the Waf build system. You can use the
  2074. :term:`EXTRA_OECONF` or
  2075. :term:`PACKAGECONFIG_CONFARGS` variables
  2076. to specify additional configuration options to be passed on the Waf
  2077. command line.