classes.rst 122 KB

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