ref-classes.rst 101 KB

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