fragments.rst 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. *****************************
  3. Using Configuration Fragments
  4. *****************************
  5. :term:`Configuration Fragments <Configuration Fragment>` define top level build
  6. configuration features that can be independently enabled and disabled using
  7. standard tooling. Such features are made of one or several build configuration
  8. statements that are either contained in a fragment file, or are set indirectly
  9. using the :term:`Built-in Fragment` mechanism.
  10. This document provides a quick reference of the :oe_git:`bitbake-config-build
  11. </bitbake/tree/bin/bitbake-config-build>` tool and lists the
  12. :term:`Configuration Fragments <Configuration Fragment>` and :term:`Built-in
  13. Fragments <Built-in Fragment>` available in the :term:`OpenEmbedded Build
  14. System` core repositories.
  15. .. note::
  16. For details on how to define new fragments in your build, see the
  17. :doc:`/dev-manual/creating-fragments` section of the Yocto Project Development
  18. Tasks Manual.
  19. ``bitbake-config-build`` Quick Reference
  20. ========================================
  21. :term:`Configuration Fragments <Configuration Fragment>` are managed with the
  22. :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>`
  23. command-line tool, which is available after :ref:`dev-manual/start:Initializing
  24. the Build Environment`.
  25. The ``bitbake-config-build`` command-line tool uses sub-commands to manage
  26. fragments, which are detailed in the sections below. For each sub-command, the
  27. ``--help`` flag can be passed to get more information on the sub-command.
  28. .. _ref-bitbake-config-build-list-fragments:
  29. ``bitbake-config-build list-fragments``
  30. ---------------------------------------
  31. The :ref:`ref-bitbake-config-build-list-fragments` command will list the :term:`Built-in
  32. Fragments <Built-in Fragment>` and :term:`Configuration Fragments <Configuration
  33. Fragment>` that are currently available, and will also print which fragments are
  34. enabled or disabled.
  35. .. _ref-bitbake-config-build-show-fragment:
  36. ``bitbake-config-build show-fragment``
  37. --------------------------------------
  38. The :ref:`ref-bitbake-config-build-show-fragment` command is used to show the
  39. location and value of a fragment. For example, running ``bitbake-config-build
  40. show-fragment core/yocto/sstate-mirror-cdn`` will show the content of the
  41. :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` fragment.
  42. .. _ref-bitbake-config-build-enable-fragment:
  43. ``bitbake-config-build enable-fragment``
  44. ----------------------------------------
  45. The :ref:`ref-bitbake-config-build-enable-fragment` command is used to enable a
  46. fragment. When a fragment is enabled, the configuration variables of this
  47. fragment are parsed by :term:`BitBake` and their values are available globally
  48. in your build.
  49. From the list obtained with the :ref:`ref-bitbake-config-build-list-fragments`
  50. command, you can determine which fragments can be enabled for your build.
  51. For example, the following command would enable the
  52. :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` fragment::
  53. bitbake-config-build enable-fragment core/yocto/sstate-mirror-cdn
  54. .. note::
  55. Multiple fragments can be enabled at once with the same command::
  56. bitbake-config-build enable-fragment <fragment1> <fragment2> ...
  57. :term:`Built-in fragments <Built-in Fragment>` are enabled the same way, and
  58. their values are defined from the command-line directly. For example, the
  59. following command sets the ``qemuarm64`` :term:`MACHINE` through the
  60. :ref:`ref-fragments-builtin-core-machine` fragment::
  61. bitbake-config-build enable-fragment machine/qemuarm64
  62. This fragment can be overridden from the command-line by setting it to another
  63. value, for example::
  64. bitbake-config-build enable-fragment machine/qemux86-64
  65. In the above example, the new value of :term:`MACHINE` is now equal to
  66. ``qemux86-64``.
  67. When a fragment is enabled with :ref:`ref-bitbake-config-build-enable-fragment`,
  68. its name is automatically appended to the :term:`OE_FRAGMENTS` variable in
  69. :ref:`structure-build-conf-toolcfg.conf`.
  70. .. note::
  71. It is also possible to manually remove or add fragments by modifying the
  72. :term:`OE_FRAGMENTS` variable in a configuration file such as
  73. :ref:`structure-build-conf-local.conf`.
  74. .. _ref-bitbake-config-build-disable-fragment:
  75. ``bitbake-config-build disable-fragment``
  76. -----------------------------------------
  77. Any fragment enabled with the :ref:`ref-bitbake-config-build-enable-fragment`
  78. command can be disabled with the :ref:`ref-bitbake-config-build-disable-fragment`
  79. command. The list of enabled fragments can be obtained with
  80. :ref:`ref-bitbake-config-build-list-fragments`.
  81. For example, the following command disables the
  82. :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` fragment::
  83. bitbake-config-build disable-fragment core/yocto/sstate-mirror-cdn
  84. Likewise, :term:`Built-in Fragments <Built-in Fragment>` are disabled the
  85. same way. For example, this would disable the ``machine/qemuarm64`` fragment::
  86. bitbake-config-build disable-fragment machine/qemuarm64
  87. .. note::
  88. Multiple fragments can be disabled at once with the same command::
  89. bitbake-config-build disable-fragment <fragment1> <fragment2>
  90. .. _ref-bitbake-config-build-disable-all-fragments:
  91. ``bitbake-config-build disable-all-fragments``
  92. ----------------------------------------------
  93. The :ref:`ref-bitbake-config-build-disable-all-fragments` command disables all of the
  94. currently enabled fragments. The list of enabled fragments can be obtained with
  95. :ref:`ref-bitbake-config-build-list-fragments`.
  96. This command is run without arguments::
  97. bitbake-config-build disable-all-fragments
  98. Core Fragments
  99. ==============
  100. Core Built-in Fragments
  101. -----------------------
  102. :term:`Built-in Fragments <Built-in Fragment>` are used to assign a single
  103. variable globally. The :term:`OpenEmbedded Build System` defines multiple
  104. built-in fragments that are detailed in this section.
  105. .. _ref-fragments-builtin-core-machine:
  106. ``machine/``
  107. ~~~~~~~~~~~~
  108. The ``machine/`` :term:`built-in fragment` can be used to assign the value of
  109. the :term:`MACHINE` variable globally.
  110. .. _ref-fragments-builtin-core-distro:
  111. ``distro/``
  112. ~~~~~~~~~~~
  113. The ``distro/`` :term:`built-in fragment` can be used to assign the value of
  114. the :term:`DISTRO` variable globally.
  115. Core Configuration Fragments
  116. ----------------------------
  117. Yocto Project Fragments
  118. ~~~~~~~~~~~~~~~~~~~~~~~
  119. This group defines fragments related to the Yocto Project infrastructure in
  120. general.
  121. .. _ref-fragments-core-yocto-sstate-mirror-cdn:
  122. ``core/yocto/sstate-mirror-cdn``
  123. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  124. The ``core/yocto/sstate-mirror-cdn`` :term:`configuration fragment` can be used
  125. to set up :term:`BB_HASHSERVE_UPSTREAM` and :term:`SSTATE_MIRRORS` to use
  126. pre-built :ref:`shared state cache <overview-manual/concepts:shared state
  127. cache>` artifacts for standard Yocto build configurations.
  128. This will mean the build will query the Yocto Project mirrors to check for
  129. artifacts at the start of builds, which does slow it down initially but it will
  130. then speed up the builds by not having to build things if they are present in
  131. the cache. It assumes you can download something faster than you can build it
  132. which will depend on your network configuration.
  133. Yocto Project Autobuilder Fragments
  134. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135. This group defines fragment used for the Yocto Project Autobuilder. For details,
  136. see the :ref:`test-manual/intro:Yocto Project Autobuilder Overview` section of
  137. the Yocto Project Test Environment Manual.
  138. .. _ref-fragment-core-yocto-autobuilder-autobuilder:
  139. ``core/yocto-autobuilder/autobuilder``
  140. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  141. The ``core/yocto-autobuilder/autobuilder`` fragment defines common variables
  142. used in builds started by the Yocto Project Autobuilder.
  143. .. _ref-fragment-core-yocto-autobuilder-autobuilder-resource-constraints:
  144. ``core/yocto-autobuilder/autobuilder-resource-constraints``
  145. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  146. The ``core/yocto-autobuilder/autobuilder`` fragment defines variables for
  147. limiting the resources used by the Yocto Project Autobuilder during builds. For
  148. more details on how to limit resources, see the :doc:`/dev-manual/limiting-resources`
  149. section of the Yocto Project Development Tasks Manual.
  150. .. _ref-fragment-core-yocto-autobuilder-multilib-mips64-n32:
  151. ``core/yocto-autobuilder/multilib-mips64-n32``
  152. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  153. The ``core/yocto-autobuilder/multilib-mips64-n32`` fragment enables
  154. tri-architecture :ref:`multilib <dev-manual/libraries:Combining Multiple
  155. Versions of Library Files into One Image>` configurations for :wikipedia:`MIPS64
  156. <MIPS_architecture>` machines, which includes ``mips64-n32``, ``mips64``, and
  157. ``mips32r2``.
  158. .. _ref-fragment-core-yocto-autobuilder-multilib-x86-lib32:
  159. ``core/yocto-autobuilder/multilib-x86-lib32``
  160. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  161. The ``core/yocto-autobuilder/multilib-x86-lib32`` fragment enables
  162. :ref:`multilib <dev-manual/libraries:Combining Multiple Versions of Library
  163. Files into One Image>` configurations for supporting 32-bit libraries on 64-bit
  164. :wikipedia:`X86 <X86>` builds.
  165. .. _ref-fragment-core-yocto-autobuilder-multilib-x86-lib64:
  166. ``core/yocto-autobuilder/multilib-x86-lib64``
  167. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  168. The ``core/yocto-autobuilder/multilib-x86-lib64`` fragment enables
  169. :ref:`multilib <dev-manual/libraries:Combining Multiple Versions of Library
  170. Files into One Image>` configurations for supporting 64-bit libraries on 32-bit
  171. :wikipedia:`X86 <X86>` builds.