ref-classes.rst 101 KB

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