Add documentation on fragments
cover Add documentation on fragments
First patch introduces doc for auto.conf, and the second one adds docs on fragments.
---
Antonin Godard (2):
ref-manual/structure: document the auto.conf file Add documentation on fragments
documentation/dev-manual/index.rst | 1 + documentation/dev-manual/using-fragments.rst | 101 +++++++++++ documentation/ref-manual/fragments.rst | 249 +++++++++++++++++++++++++++ documentation/ref-manual/index.rst | 1 + documentation/ref-manual/structure.rst | 9 + documentation/ref-manual/terms.rst | 73 ++++++++ documentation/ref-manual/variables.rst | 32 ++++ 7 files changed, 466 insertions(+)
---
base-commit: e77139b5c616e6e5ad436eb91416fd804389425f
change-id: 20250924-fragments-bb3da11e23aa
Best regards,
Signature · 1 line
Antonin Godard <[email protected]>
PATCH 1/2 ref-manual/structure: document the auto.conf file
Add documentation for auto.conf, which is used by external tools for automatically setting variables.
--- documentation/ref-manual/structure.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
documentation/ref-manual/structure.rst +9 -0
@@ -345,6 +345,15 @@ This configuration file is generated by :doc:`bblock </dev-manual/bblock>` and contains the signatures locked by ``bblock``. By default, it does not exist and will be created upon the first invocation of ``bblock``. +.. _structure-build-conf-auto.conf: + +``build/conf/auto.conf`` +------------------------ + +This file contains configuration variables that are automatically modified by +tools such as :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>`. +This file should not be modified manually. + .. _structure-build-downloads: ``build/downloads/``
Signature · 1 line
2.51.0
PATCH 2/2 Add documentation on fragments
In reply to Antonin Godard- terms.rst: Provide the definitions of a Configuration Fragment and a Built-in Fragment.
- ref-manual: Add a quick reference guide on bitbake-config-build, and list the available fragments in OE-Core.
Document the underlying variables related to fragments in the glossary.
- dev-manual: give instructions on how to create new custom fragments.
--- documentation/dev-manual/index.rst | 1 + documentation/dev-manual/using-fragments.rst | 101 +++++++++++ documentation/ref-manual/fragments.rst | 249 +++++++++++++++++++++++++++ documentation/ref-manual/index.rst | 1 + documentation/ref-manual/terms.rst | 73 ++++++++ documentation/ref-manual/variables.rst | 32 ++++ 6 files changed, 457 insertions(+)
documentation/dev-manual/index.rst +1 -0
@@ -11,6 +11,7 @@ Yocto Project Development Tasks Manual intro start layers + using-fragments customizing-images new-recipe new-machine
documentation/dev-manual/using-fragments.rst new file +101 -0
101 lines not on this page · raw message
documentation/ref-manual/fragments.rst new file +249 -0
249 lines not on this page · raw message
documentation/ref-manual/index.rst +1 -0
@@ -17,6 +17,7 @@ Yocto Project Reference Manual structure classes tasks + fragments devtool-reference kickstart qa-checks
documentation/ref-manual/terms.rst +73 -0
85 lines not on this page · raw message
documentation/ref-manual/variables.rst +32 -0
@@ -397,6 +397,18 @@ system and gives an overview of their function and contents. :term:`BB_CHECK_SSL_CERTS` See :term:`bitbake:BB_CHECK_SSL_CERTS` in the BitBake manual. + :term:`BB_CONF_FRAGMENT_DESCRIPTION` + The :term:`BB_CONF_FRAGMENT_DESCRIPTION` variable defines the textual + description of a :term:`Configuration Fragment`. For details on how to use + fragments, see the :doc:`/ref-manual/fragments` section of the Yocto + Project Reference Manual. + + :term:`BB_CONF_FRAGMENT_SUMMARY` + The :term:`BB_CONF_FRAGMENT_SUMMARY` variable defines the one-line textual + summary of a :term:`Configuration Fragment`. For details on how to use + fragments, see the :doc:`/ref-manual/fragments` section of the Yocto + Project Reference Manual. + :term:`BB_CONSOLELOG` See :term:`bitbake:BB_CONSOLELOG` in the BitBake manual.
@@ -6231,6 +6243,26 @@ system and gives an overview of their function and contents. :term:`Source Directory` for details on how this class applies these additional sed command arguments. + :term:`OE_FRAGMENTS` + The :term:`OE_FRAGMENTS` variable holds the list of :term:`Configuration + Fragments <Configuration Fragment>` currently enabled for the build. For + details on how to use fragments, see the :doc:`/ref-manual/fragments` + section of the Yocto Project Reference Manual. + + :term:`OE_FRAGMENTS_BUILTIN` + The :term:`OE_FRAGMENTS_BUILTIN` variable holds the list of + :term:`Built-in Fragments <Built-in Fragment>` available for being set with + :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>`. + For details on how to use fragments, see the :doc:`/ref-manual/fragments` + section of the Yocto Project Reference Manual. + + :term:`OE_FRAGMENTS_PREFIX` + The :term:`OE_FRAGMENTS_PREFIX` variable defines the prefix where + :term:`BitBake` tries to locate :term:`Configuration Fragments + <Configuration Fragment>` in :term:`layers <Layer>`. For details on how to + use fragments, see the :doc:`/ref-manual/fragments` section of the Yocto + Project Reference Manual. + :term:`OE_INIT_ENV_SCRIPT` The name of the build environment setup script for the purposes of setting up the environment within the extensible SDK. The default
Signature · 1 line
2.51.0
Quoted 8 lines · Antonin Godard
-
terms.rst: Provide the definitions of a Configuration Fragment and a Built-in Fragment.
- ref-manual: Add a quick reference guide on bitbake-config-build, and list the available fragments in OE-Core.
Document the underlying variables related to fragments in the glossary.
- dev-manual: give instructions on how to create new custom fragments.
Thanks for writing these up. It's mostly fine, but I do have a few comments.
documentation/dev-manual/using-fragments.rst line 4
Quoted 2 lines
documentation/dev-manual/using-fragments.rst new file +2
-0+Using Configuration Fragments In Your Build +*******************************************
What follows is not about using fragments (e.g. enabling/disabling them), it's about making new fragments. I think the section should be titled accordingly.
documentation/dev-manual/using-fragments.rst line 10
Quoted 5 lines
documentation/dev-manual/using-fragments.rst new file +5
-0+The Yocto Project supports enabling and disable some configuration variables +through :term:`Configuration Fragments <Configuration Fragment>`. This mechanism +allows modifying the top-level configuration of a build from the command-line +using the :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>` +tool. This section will describe how to create new fragments for your builds.
I think here and elsewhere (where you need to explain what fragments are) it's good to introduce fragments like this:
'Fragments define top level build configuration features that can be independently enabled and disabled using standard tooling. Such features are made of one or several build configuration statements that are either contained in a fragment file, or are set indirectly using the built-in fragment mechanism. '.
documentation/dev-manual/using-fragments.rst line 15
Quoted 4 lines
documentation/dev-manual/using-fragments.rst new file +4
-0+There are two kinds of configuration fragments: + +- :term:`Configuration Fragments <Configuration Fragment>` which a stored + in a file. These fragment include a summary and a description.
Spelling issues. They are also in some other places, I won't nit-pick on those. Let's get the content correct first.
'Standard :term:Configuration Fragments <Configuration Fragment> which are defined in a file. These fragments include a summary and a description, followed by configuration statements.
Quoted 2 lines
+- :term:`Built-in Fragments <Built-in Fragment>` which are used to set a + variable value.
... which can be used to assign a value to a single variable and do not require a separate definition file. They are especially useful when a list of possible values is very long (or infinite).
Quoted 1 line
+Creating new :term:
Built-in Fragments <Built-in Fragment>is not supported.
I think it is, but that requires putting an additional addfragment statement somewhere, or some way to append to OE_FRAGMENTS_BUILTIN *before* the oe-core's addfragments is processed.
documentation/dev-manual/using-fragments.rst line 22
Quoted 2 lines
documentation/dev-manual/using-fragments.rst new file +2
-0+You should instead create :term:`Configuration Fragment` files as documented +below to customize a build to your need.
I would try to describe adding built-in fragments as well.
documentation/dev-manual/using-fragments.rst line 29
Quoted 6 lines
documentation/dev-manual/using-fragments.rst new file +6
-0+Creating A Configuration Fragment File +====================================== + +By default, all configuration fragments are located within the +``conf/fragments`` directory of a :term:`layer`. This location is defined by the +:term:`OE_FRAGMENTS_PREFIX` variable.
... which, in turn, is used as a parameter in a addfragments statement in meta/conf/bitbake.conf
Quoted 8 lines
documentation/dev-manual/using-fragments.rst new file +8
-0+You can create one or more :term:`configuration fragment` files in your +:term:`layer` in this directory. Let's take the following example, where +``custom-fragment.conf`` is our custom fragment file:: + + meta-custom + ├── conf + │ ├── fragments + │ │ └── custom-fragment.conf
documentation/dev-manual/using-fragments.rst line 48
Quoted 10 lines
documentation/dev-manual/using-fragments.rst new file +10
-0+ │ └── layer.conf + ... + +For our ``custom-fragment.conf`` file, the following variables **must** be set +for our fragment to be considered a valid fragment by the :term:`OpenEmbedded +Build System`: + +- :term:`BB_CONF_FRAGMENT_SUMMARY`: a one-line summary of this fragment. + +- :term:`BB_CONF_FRAGMENT_DESCRIPTION`: a description of this fragment.
These are again defined through a parameter to addfragments, so it would be good to reference that.
documentation/dev-manual/using-fragments.rst line 58
Quoted 9 lines
documentation/dev-manual/using-fragments.rst new file +9
-0+After creating these variables, our custom fragment should look like the +following: + +.. code-block:: + :caption: custom-fragment.conf + + BB_CONF_FRAGMENT_SUMMARY = "My custom fragment summary" + BB_CONF_FRAGMENT_DESCRIPTION = "My custom fragment description, \ + which can be multiple lines."
"This fragment sets a limit of 4 bitbake threads and 4 parsing threads." "This fragment is useful to constrain resource consumption when the Yocto default \
is causing an overload of host machine's memory and cpu resources."
documentation/ref-manual/fragments.rst line 4
Quoted 2 lines
documentation/ref-manual/fragments.rst new file +2
-0+*********************** +Configuration Fragments
Using configuration fragments.
documentation/ref-manual/fragments.rst line 13
Quoted 9 lines
documentation/ref-manual/fragments.rst new file +9
-0+*********************** + +:term:`Configuration Fragments <Configuration Fragment>` are used to provide a +snippet of global configuration that can be enabled or disabled for a build. +This document provides a quick reference of the :oe_git:`bitbake-config-build +</bitbake/tree/bin/bitbake-config-build>` tool and lists the +:term:`Configuration Fragments <Configuration Fragment>` and :term:`Built-in +Fragments <Built-in Fragment>` available in the :term:`OpenEmbedded Build +System` core repositories.
See above how the fragments could be introduced.
documentation/ref-manual/fragments.rst line 103
Quoted 3 lines
documentation/ref-manual/fragments.rst new file +3
-0+When a fragment is enabled with :ref:`ref-bitbake-config-build-enable-fragment`, +its name is automatically appended to the :term:`OE_FRAGMENTS` variable in +:ref:`structure-build-conf-auto.conf`.
It is also possible (but not recommended) to manually add to this variable from local.conf.
Quoted 31 lines
documentation/ref-manual/terms.rst +31
-0+ :term:`Built-in Fragment` + A built-in fragment is a specific kind of :term:`Configuration Fragment` + that affects the value of a single variable globally. Like + a normal :term:`Configuration Fragment`, Built-in Fragments can be enabled + or disabled using the :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>` + command-line utility. + + When declared, a built-in fragment follows the following naming + convention:: + + <fragment>:<variable name> + + Where: + + - ``<fragment>`` is the name of the built-in fragment. + - ``<variable name>`` is the name of the variable to be modified by this + fragment. + + For example:: + + machine:MACHINE + + Will setup the ``machine`` Built-in Fragment for modifying the value of + the :term:`MACHINE` variable. + + Setting the :term:`MACHINE` variable through this fragment must follow + this syntax:: + + machine/qemux86-64 + + This sets the value of :term:`MACHINE` to ``qemux86-64``.
documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 174
Quoted 10 lines
documentation/ref-manual/terms.rst +10
-0+ + For more details on fragments, see: + + - The :doc:`/ref-manual/fragments` section of the Yocto Project Reference + Manual for a list of fragments the :term:`OpenEmbedded Build System` + supports, and a quick reference guide on how to manage fragments. + + - The :doc:`/dev-manual/using-fragments` section of the Yocto Project + Development Tasks Manual for details on how to create new fragments + in your build.
Two more points need to be made:
- built-in fragments can be used to assign a value to a single variable and do not require a separate definition file. They are especially useful when a list of possible values is very long (or infinite), as that avoids making large amounts of fragment files, all very similar to each other.
- the definition of available built-in fragments is in meta/conf/bitbake.conf:OE_FRAGMENTS_BUILTIN ?= "machine:MACHINE distro:DISTRO"
In turn, what variable contains the definition is specified in the addfragments directive in the same file:
addfragments ${OE_FRAGMENTS_PREFIX} OE_FRAGMENTS OE_FRAGMENTS_METADATA_VARS OE_FRAGMENTS_BUILTIN
Quoted 4 lines
:term:
Classes
Files that provide for logic encapsulation and inheritance so that commonly used patterns can be defined once and then easily used in
documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 205
Quoted 10 lines
documentation/ref-manual/terms.rst +7
-0@@ -154,6 +196,37 @@ universal, the list includes them just in case: only used when building for that target (e.g. the :file:`machine/beaglebone.conf` configuration file defines variables for the Texas Instruments ARM Cortex-A8 development board). + :term:`Configuration Fragments <Configuration Fragment>` such as + :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` define snippets of + configuration that can be enabled from the command-line. + + :term:`Configuration Fragment` + A configuration fragment is a :term:`Configuration File` that contains + variable assignments affecting the build at a global-level when the
And directives, such as 'require ...'. I'd instead say 'configuration statements, such as variable assignments'.
documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 212
Quoted 7 lines
documentation/ref-manual/terms.rst +7
-0+ fragment is enabled. By default, configuration fragments are located in + the :file:`conf/fragments/` directory of a :term:`Layer`. + + A fragment :term:`configuration file` must contain a summary + (:term:`BB_CONF_FRAGMENT_SUMMARY`) and a description + (:term:`BB_CONF_FRAGMENT_DESCRIPTION`) explaining the purpose of the + fragment.
In oe-core, the location of fragments and what variables are required in a fragment is specified via meta/conf/bitbake.conf:
OE_FRAGMENTS_PREFIX ?= "conf/fragments" OE_FRAGMENTS_METADATA_VARS ?= "BB_CONF_FRAGMENT_SUMMARY BB_CONF_FRAGMENT_DESCRIPTION"
addfragments ${OE_FRAGMENTS_PREFIX} OE_FRAGMENTS OE_FRAGMENTS_METADATA_VARS OE_FRAGMENTS_BUILTIN
Thanks!
Alex
Quoted 11 lines · Alexander Kanavin
Quoted 8 lines · Antonin Godard
-
terms.rst: Provide the definitions of a Configuration Fragment and a Built-in Fragment.
- ref-manual: Add a quick reference guide on bitbake-config-build, and list the available fragments in OE-Core.
Document the underlying variables related to fragments in the glossary.
- dev-manual: give instructions on how to create new custom fragments.
Quoted 8 lines
Thanks for writing these up. It's mostly fine, but I do have a few comments.
documentation/dev-manual/using-fragments.rst line 4
Quoted 2 lines
documentation/dev-manual/using-fragments.rst new file +2
-0+Using Configuration Fragments In Your Build +*******************************************What follows is not about using fragments (e.g. enabling/disabling them), it's about making new fragments. I think the section should be titled accordingly.
Right, this turned out to be a document different from my initial draft and forgot to update the title. Thanks for spotting this.
Quoted 6 lines
documentation/dev-manual/using-fragments.rst line 10
Quoted 5 lines
documentation/dev-manual/using-fragments.rst new file +5
-0+The Yocto Project supports enabling and disable some configuration variables +through :term:`Configuration Fragments <Configuration Fragment>`. This mechanism +allows modifying the top-level configuration of a build from the command-line +using the :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>` +tool. This section will describe how to create new fragments for your builds.
Quoted 7 lines
I think here and elsewhere (where you need to explain what fragments are) it's good to introduce fragments like this:
'Fragments define top level build configuration features that can be independently enabled and disabled using standard tooling. Such features are made of one or several build configuration statements that are either contained in a fragment file, or are set indirectly using the built-in fragment mechanism. '.
Ok, I felt that I needed a good catch phrase on fragments to put in different places - I'll use that one.
Quoted 11 lines
documentation/dev-manual/using-fragments.rst line 15
Quoted 4 lines
documentation/dev-manual/using-fragments.rst new file +4
-0+There are two kinds of configuration fragments: + +- :term:`Configuration Fragments <Configuration Fragment>` which a stored + in a file. These fragment include a summary and a description.Spelling issues. They are also in some other places, I won't nit-pick on those. Let's get the content correct first.
'Standard :term:
Configuration Fragments <Configuration Fragment>which are defined in a file. These fragments include a summary and a description, followed by configuration statements.
Thanks for your feedback on this. I had a struggle whether we should name fragments in file "standard" or "regular", or just "fragments". I think standard is good.
Quoted 7 lines
Quoted 2 lines
+- :term:`Built-in Fragments <Built-in Fragment>` which are used to set a + variable value.... which can be used to assign a value to a single variable and do not require a separate definition file. They are especially useful when a list of possible values is very long (or infinite).
Quoted 5 lines
Quoted 1 line
+Creating new :term:
Built-in Fragments <Built-in Fragment>is not supported.I think it is, but that requires putting an additional addfragment statement somewhere, or some way to append to
OE_FRAGMENTS_BUILTIN*before* the oe-core's addfragments is processed.
Yes exactly, I did have some struggle yesterday so in the meantime wrote this. But I know it can be supported.
Quoted 4 lines
documentation/dev-manual/using-fragments.rst line 22
Quoted 2 lines
documentation/dev-manual/using-fragments.rst new file +2
-0+You should instead create :term:`Configuration Fragment` files as documented +below to customize a build to your need.I would try to describe adding built-in fragments as well.
I tried but failed to have something consistent yesterday.
Setting it from a distro configuration file, or any configuration file that comes after the addfragments call in bitbake.conf does not work in my experience. Moving the addfragments call after the distro file include is not possible as the the distro/ builtin fragment sets the DISTRO (chicken and egg problem :)).
There are multiple solutions:
- Telling users to define their custom builtin fragments in local.conf, auto.conf, site.conf, or any file that comes before the addfragments call. This is not desirable because this means we don't encourage to share configurations.
- Telling users to defines their builtin fragments in layer.conf. This works, but this means layers can "pollute" the existing builtin fragments by overriding them when added to bblayers.conf. Other built-in fragments that have different names (not machine/ or distro/) is fine I guess, because just declaring a fragment as available does not affect the build.
Maybe this could be reasonable, but we enforce layer maintainers to _not_ override core built-in fragments (yocto-check-layer test, maybe?)
- One idea I had was to introduce an addbuiltinfragments FRAGMENTS_BUILTIN directive. This way we handle standard and built-in fragments separately. This turns out to be difficult as well, as standard and built-in fragments are mixed in together in OE_FRAGMENTS.
I feel like our best option is option 2 here. What do you think? Other ideas maybe?
Quoted 23 lines
documentation/dev-manual/using-fragments.rst line 29
Quoted 6 lines
documentation/dev-manual/using-fragments.rst new file +6
-0+Creating A Configuration Fragment File +====================================== + +By default, all configuration fragments are located within the +``conf/fragments`` directory of a :term:`layer`. This location is defined by the +:term:`OE_FRAGMENTS_PREFIX` variable.... which, in turn, is used as a parameter in a addfragments statement in
meta/conf/bitbake.confQuoted 13 lines
documentation/dev-manual/using-fragments.rst new file +13
-0+You can create one or more :term:`configuration fragment` files in your +:term:`layer` in this directory. Let's take the following example, where +``custom-fragment.conf`` is our custom fragment file:: + + meta-custom + ├── conf + │ ├── fragments + │ │ └── custom-fragment.conf + │ └── layer.conf + ... + +For our ``custom-fragment.conf`` file, the following variables **must** be set +for our fragment to be considered a valid fragment by the :term:`OpenEmbedded
Quoted 8 lines
documentation/dev-manual/using-fragments.rst line 48
Quoted 5 lines
documentation/dev-manual/using-fragments.rst new file +5
-0+Build System`: + +- :term:`BB_CONF_FRAGMENT_SUMMARY`: a one-line summary of this fragment. + +- :term:`BB_CONF_FRAGMENT_DESCRIPTION`: a description of this fragment.These are again defined through a parameter to addfragments, so it would be good to reference that.
My initial approach was to document this as if a user did not need to have custom addfragments calls and all that was required was to place fragment files in the good spot in their layer, and modify OE_FRAGMENTS_BUILTIN as needed (turns the second use case is not that easy in the end).
For example, we don't make the location of machine configurations configurable AFAIK - why would changing the location of fragments be needed for users of OE?
But I can add references to this command, I just don't think we should emphasize too much on it.
Quoted 6 lines
Quoted 6 lines
documentation/dev-manual/using-fragments.rst new file +6
-0+After creating these variables, our custom fragment should look like the +following: + +.. code-block:: + :caption: custom-fragment.conf +
Quoted 8 lines
documentation/dev-manual/using-fragments.rst line 58
Quoted 3 lines
documentation/dev-manual/using-fragments.rst new file +3
-0+ BB_CONF_FRAGMENT_SUMMARY = "My custom fragment summary" + BB_CONF_FRAGMENT_DESCRIPTION = "My custom fragment description, \ + which can be multiple lines.""This fragment sets a limit of 4 bitbake threads and 4 parsing threads." "This fragment is useful to constrain resource consumption when the Yocto default \
is causing an overload of host machine's memory and cpu resources."
Thanks :) I could have made the extra effort here!
Quoted 18 lines
documentation/ref-manual/fragments.rst line 4
Quoted 2 lines
documentation/ref-manual/fragments.rst new file +2
-0+*********************** +Configuration FragmentsUsing configuration fragments.
documentation/ref-manual/fragments.rst line 13
Quoted 9 lines
documentation/ref-manual/fragments.rst new file +9
-0+*********************** + +:term:`Configuration Fragments <Configuration Fragment>` are used to provide a +snippet of global configuration that can be enabled or disabled for a build. +This document provides a quick reference of the :oe_git:`bitbake-config-build +</bitbake/tree/bin/bitbake-config-build>` tool and lists the +:term:`Configuration Fragments <Configuration Fragment>` and :term:`Built-in +Fragments <Built-in Fragment>` available in the :term:`OpenEmbedded Build +System` core repositories.See above how the fragments could be introduced.
Quoted 6 lines
documentation/ref-manual/fragments.rst line 103
Quoted 3 lines
documentation/ref-manual/fragments.rst new file +3
-0+When a fragment is enabled with :ref:`ref-bitbake-config-build-enable-fragment`, +its name is automatically appended to the :term:`OE_FRAGMENTS` variable in +:ref:`structure-build-conf-auto.conf`.It is also possible (but not recommended) to manually add to this variable from local.conf.
Will mention this
Quoted 50 lines
Quoted 31 lines
documentation/ref-manual/terms.rst +31
-0+ :term:`Built-in Fragment` + A built-in fragment is a specific kind of :term:`Configuration Fragment` + that affects the value of a single variable globally. Like + a normal :term:`Configuration Fragment`, Built-in Fragments can be enabled + or disabled using the :oe_git:`bitbake-config-build </bitbake/tree/bin/bitbake-config-build>` + command-line utility. + + When declared, a built-in fragment follows the following naming + convention:: + + <fragment>:<variable name> + + Where: + + - ``<fragment>`` is the name of the built-in fragment. + - ``<variable name>`` is the name of the variable to be modified by this + fragment. + + For example:: + + machine:MACHINE + + Will setup the ``machine`` Built-in Fragment for modifying the value of + the :term:`MACHINE` variable. + + Setting the :term:`MACHINE` variable through this fragment must follow + this syntax:: + + machine/qemux86-64 + + This sets the value of :term:`MACHINE` to ``qemux86-64``.documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 174
Quoted 10 lines
documentation/ref-manual/terms.rst +10
-0+ + For more details on fragments, see: + + - The :doc:`/ref-manual/fragments` section of the Yocto Project Reference + Manual for a list of fragments the :term:`OpenEmbedded Build System` + supports, and a quick reference guide on how to manage fragments. + + - The :doc:`/dev-manual/using-fragments` section of the Yocto Project + Development Tasks Manual for details on how to create new fragments + in your build.Two more points need to be made:
- built-in fragments can be used to assign a value to a single variable and do not require a separate definition file. They are especially useful when a list of possible values is very long (or infinite), as that avoids making large amounts of fragment files, all very similar to each other.
Quoted 7 lines
- the definition of available built-in fragments is in
meta/conf/bitbake.conf:OE_FRAGMENTS_BUILTIN?= "machine:MACHINE distro:DISTRO"In turn, what variable contains the definition is specified in the addfragments directive in the same file:
addfragments ${OE_FRAGMENTS_PREFIX}OE_FRAGMENTSOE_FRAGMENTS_METADATA_VARSOE_FRAGMENTS_BUILTIN
Will add that
Quoted 9 lines
Quoted 9 lines
:term:
Classes
Files that provide for logic encapsulation and inheritance so that commonly used patterns can be defined once and then easily used indocumentation/ref-manual/terms.rst +2
-0@@ -154,6 +196,37 @@ universal, the list includes them just in case: only used when building for that target (e.g. the :file:`machine/beaglebone.conf` configuration file defines variables for the Texas Instruments ARM Cortex-A8 development board). + :term:`Configuration Fragments <Configuration Fragment>` such as + :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` define snippets of
Quoted 8 lines
documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 205
Quoted 5 lines
documentation/ref-manual/terms.rst +5
-0+ configuration that can be enabled from the command-line. + + :term:`Configuration Fragment` + A configuration fragment is a :term:`Configuration File` that contains + variable assignments affecting the build at a global-level when theAnd directives, such as 'require ...'. I'd instead say 'configuration statements, such as variable assignments'.
Indeed, thanks.
Quoted 8 lines
documentation/ref-manual/terms.rst universal, the list includes them just in case: · line 212
Quoted 7 lines
documentation/ref-manual/terms.rst +7
-0+ fragment is enabled. By default, configuration fragments are located in + the :file:`conf/fragments/` directory of a :term:`Layer`. + + A fragment :term:`configuration file` must contain a summary + (:term:`BB_CONF_FRAGMENT_SUMMARY`) and a description + (:term:`BB_CONF_FRAGMENT_DESCRIPTION`) explaining the purpose of the + fragment.
Quoted 9 lines
In oe-core, the location of fragments and what variables are required in a fragment is specified via
meta/conf/bitbake.conf:
OE_FRAGMENTS_PREFIX?= "conf/fragments"OE_FRAGMENTS_METADATA_VARS?= "BB_CONF_FRAGMENT_SUMMARYBB_CONF_FRAGMENT_DESCRIPTION"
addfragments ${OE_FRAGMENTS_PREFIX}OE_FRAGMENTSOE_FRAGMENTS_METADATA_VARSOE_FRAGMENTS_BUILTIN
I usually don't include code snippets from OE-Core as it is harder to maintain, but I can reference the variable and location, this should be similar without the maintenance burden.
Quoted 3 lines
Thanks!
Alex
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 26 lines · Antonin Godard
Quoted 1 line
I would try to describe adding built-in fragments as well.
I tried but failed to have something consistent yesterday.
Setting it from a distro configuration file, or any configuration file that comes after the addfragments call in bitbake.conf does not work in my experience. Moving the addfragments call after the distro file include is not possible as the the distro/ builtin fragment sets the DISTRO (chicken and egg problem :)).
There are multiple solutions:
- Telling users to define their custom builtin fragments in local.conf, auto.conf, site.conf, or any file that comes before the addfragments call. This is not desirable because this means we don't encourage to share configurations.
- Telling users to defines their builtin fragments in layer.conf. This works, but this means layers can "pollute" the existing builtin fragments by overriding them when added to bblayers.conf. Other built-in fragments that have different names (not machine/ or distro/) is fine I guess, because just declaring a fragment as available does not affect the build.
Maybe this could be reasonable, but we enforce layer maintainers to _not_ override core built-in fragments (yocto-check-layer test, maybe?)
Quoted 7 lines
- One idea I had was to introduce an
addbuiltinfragments FRAGMENTS_BUILTINdirective. This way we handle standard and built-in fragments separately. This turns out to be difficult as well, as standard and built-in fragments are mixed in together inOE_FRAGMENTS.I feel like our best option is option 2 here. What do you think? Other ideas maybe?
Right, yes, thanks for thinking it through and writing it down, and I agree with this. There indeed doesn't seem to be an easy solution. On the other hand, built-in fragments are intended for setting something really common and well known, there's currently DISTRO/MACHINE, but I can also imagine things like TCLIBC / TOOLCHAIN / INIT_MANAGER and so on. Those are not particularly controversial to just add to the existing builtin list in oecore's meta/conf/bitbake.conf. Perhaps you could somehow express this, without overwhelming the reader with the above technicalities.
Quoted 8 lines
Quoted 2 lines
These are again defined through a parameter to addfragments, so it would be good to reference that.
My initial approach was to document this as if a user did not need to have custom addfragments calls and all that was required was to place fragment files in the good spot in their layer, and modify
OE_FRAGMENTS_BUILTINas needed (turns the second use case is not that easy in the end).
Quoted 5 lines
For example, we don't make the location of machine configurations configurable AFAIK - why would changing the location of fragments be needed for users of OE?
But I can add references to this command, I just don't think we should emphasize too much on it.
Yes, I don't have a strong opinion here. If you feel that this would overwhelm the reader with unnecessary implementation details, that's fine. There's a balance to be struck here, so that people that want to know how things really work get a hint on where to look for it.
Alex