From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.37505.1796223372508003551 for ; Wed, 02 Dec 2026 06:56:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=dkim header.b=Y9mxHc6E; spf=pass (domain: bootlin.com, ip: 185.246.84.56, mailfrom: antonin.godard@bootlin.com) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id CDFD61A18E3 for ; Wed, 2 Dec 2026 14:56:10 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A469E6075F for ; Wed, 2 Dec 2026 14:56:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B09E511EA1BDC; Wed, 02 Dec 2026 15:56:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796223370; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=xYWK90LfXqrmvUpX18AH6pO9do+lHxLEKTdC36/4CA4=; b=Y9mxHc6ETA6DekgBVU4KF8UzWig/4o/+pTVFsuSejiNGTiKbxZNjDRvQqfhz8riPl7+gbg ktB8mmdOs868s3cjUXBTwrenlftqAf6JCdq/yuCtXDexIsVeLas3wlWHcoSm7E96U/vx9s Z2cjJXaHOVMElz08D9qua7B8FKVk+yXGIjAtpA4YmToQxj2VHY96gfQxlcN7/AT085eIEl w0uyLpv0I8ddfiRHlsDLevgOvgKKwGU1VEudNtLhtZwrIeDIztS0MxJH8ndCPbp46mcZUP VAo77fiWFCcT1SZ675JpbzBaG1Xs+OcuNvbprvTVGjc0OBdlJbAijAWdJSZ5JA== From: Antonin Godard Date: Wed, 02 Dec 2026 15:55:45 +0100 Subject: [PATCH 10/18] dev-manual/layers.rst: refresh after layer configuration format changes MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-layer-conf-changes-v1-10-da34d4c770c6@bootlin.com> References: <20261202-layer-conf-changes-v1-0-da34d4c770c6@bootlin.com> In-Reply-To: <20261202-layer-conf-changes-v1-0-da34d4c770c6@bootlin.com> To: docs@lists.yoctoproject.org Cc: Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=17256; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=LS3WdmLOXHdr4G2aQeTUa5LtDvWGbBecuePkP6UGG3I=; b=owEBbQKS/ZANAwAKAdGAQUApo6g2AcsmYgBrEDFuxR2jTBthO3nHaA9sC9MfqFuaS+21w89I2 x7ytHHC/WqJAjMEAAEKAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCaxAxbgAKCRDRgEFAKaOo NsF9EACVhSb44eOOfF8/YOd2WDPXVy17o8ZFVcInAYD2UxCFwwiSaWNqvU/RoqOhezq73ozmlpi wUcHvuWl0IhusIR6kH6qdnC4JXZNUKdmfV9oLpV514+0O0gZNnFN1LOvXgXjtV6naPJPbXB1h8A 5OpiW8sub1W6wNny/vFIa3Q4XCd4Vrz3vD8ginyCvFqW6i1mSOwBxOhT/G2WVaqhTMhSX3iALRQ Hx5sqQSZWgIVsuaxues33B9iQLnGKLOxrEd1K2eDHmHUE24fnnNXKuVTbtUPkGTqppPpAgr8ERL axm1bT25KQ7er97NM/euDhZuvepE/G23K/208PLCgWFGSYDPH+N9htK2f0jaLWpJbMuLr6oqftk w0r5lyMBKB8lEPYOKGv0ZQxR6c0R2KpVr0QTx+F+ObFyaE0YcFSf1tqj/J9b2VIXRmtDiU8akUD dZYTaZpzIAb5yl3a0kzCPFGjJMVQKAzLwghp1Rv4DT6/f0birPaHwVoTikk1+dTKmALsDh9xVv+ E9FIsM+b1fros5E5AzG+mQTLwOvONOcpK+YIc2fZNjkcDx8C3e0bNBBE3mhWsu4kB/0ISgxRWts 9BfL0IqK8bwYdIladEElGkqZRbG8nKN5oRt81PDwUaICPVyAR0v+pEEjZ6Q9hs8DsGmNynoSYqN cSEt2PTA+9+KlKA== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-Last-TLS-Session-Version: TLSv1.3 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 02 Dec 2026 14:56:22 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/10897 Rework the layers development manual document to reflect the new layer configuration formation. This removes all the details about the various BBFILE* variables that were removed and instead links to the layers reference manual document we now have. Otherwise the rest of this patch are added links or rewordings. Signed-off-by: Antonin Godard --- documentation/dev-manual/layers.rst | 238 ++++++------------------------------ 1 file changed, 37 insertions(+), 201 deletions(-) diff --git a/documentation/dev-manual/layers.rst b/documentation/dev-manual/layers.rst index cfe476624..b4a8571ac 100644 --- a/documentation/dev-manual/layers.rst +++ b/documentation/dev-manual/layers.rst @@ -9,7 +9,10 @@ Layers allow you to isolate different types of customizations from each other. For introductory information on the Yocto Project Layer Model, see the ":ref:`overview-manual/yp-intro:the yocto project layer model`" -section in the Yocto Project Overview and Concepts Manual. +section in the Yocto Project Overview and Concepts Manual. For reference +documentation on layers, see the :doc:`/ref-manual/layers` section. This +document shows how to create and manipulate layers within the +:term:`OpenEmbedded Build System`. Note well that to properly call the ``bitbake-layers`` command explained below, you must first @@ -83,58 +86,12 @@ Follow these general steps to create your layer without using tools: By default, the ``bitbake-layers create-layer`` command creates a layer with the following: - - A ``conf/layer.conf`` configuration file with default definitions. - - Here is an explanation of the typical content of the layer configuration file: - - - :term:`BBPATH`: Adds the layer's root directory to BitBake's search - path. Through the use of the :term:`BBPATH` variable, BitBake locates - class files (``.bbclass``), configuration files, and files that are - included with ``include`` and ``require`` statements. For these cases, - BitBake uses the first file that matches the name found in - :term:`BBPATH`. This is similar to the way the ``PATH`` variable is - used for binaries. It is recommended, therefore, that you use unique - class and configuration filenames in your custom layer. - - See the :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:Locating Include - Files` section of the BitBake User Manual for more details on how - files are included with :term:`BitBake`. - - - :term:`BBFILES`: Defines the location for all recipes in the layer. - - - :term:`BBFILE_COLLECTIONS`: Establishes the current layer through a - unique identifier that is used throughout the :term:`OpenEmbedded Build - System` to refer to the layer. In this example, the identifier - "yoctobsp" is the representation for the container layer named - "meta-yocto-bsp". - - This name is used by other layers when specifying the layer - dependencies via the :term:`LAYERDEPENDS` variable. - - - :term:`BBFILE_PATTERN`: Expands immediately during parsing to provide - the directory of the layer. - - - :term:`BBFILE_PRIORITY`: Establishes a priority to use for recipes in - the layer when the :term:`OpenEmbedded Build System` finds recipes of - the same name in different layers. - - - :term:`LAYERVERSION`: Establishes a version number for the layer. You - can use this version number to specify this exact version of the layer - as a dependency when using the :term:`LAYERDEPENDS` variable. - - - :term:`LAYERDEPENDS`: Lists all layers on which this layer depends (if - any). It uses the layer names specified by the - :term:`BBFILE_COLLECTIONS` variable. - - - :term:`LAYERSERIES_COMPAT`: Lists the :yocto_home:`Yocto Project - release ` codenames (in lowercase) this layer is - compatible with. For example: "&DISTRO_NAME_NO_CAP;". - - This variable is a good way to indicate if a particular layer is - current. + - A ``conf/layer.conf`` configuration file with default definitions. See the + :ref:`structure-conf-layer.conf` section for reference documentation on + this file. - A ``recipes-example`` subdirectory that itself contains a - subdirectory named ``example``, which contains an ``example.bb`` + subdirectory named ``example``, which contains an ``example_0.1.bb`` recipe file. - A ``COPYING.MIT``, which is the license statement for the layer. The @@ -144,11 +101,7 @@ Follow these general steps to create your layer without using tools: - A ``README`` file, which is a file describing the contents of your new layer. - - If you want to set the priority of the layer to other than the default value - of "6", you can either use the ``--priority`` option or you can edit the - :term:`BBFILE_PRIORITY` value in the ``conf/layer.conf`` after the script - creates it. Furthermore, if you want to give the example recipe file some + If you want to give the example recipe file some name or version other than the defaults, you can use the ``--example-recipe-name`` and/or ``--example-recipe-version`` options. @@ -156,18 +109,23 @@ Follow these general steps to create your layer without using tools: works is to experiment with the script. You can also read the usage information by running ``bitbake-layers create-layer --help``. -#. *Add Content:* Depending on the type of layer, add the content. If - the layer adds support for a machine, add the machine configuration - in a ``conf/machine/`` file within the layer. If the layer adds - distro policy, add the distro configuration in a ``conf/distro/`` - file within the layer. If the layer introduces new recipes, put the - recipes you need in ``recipes-*`` subdirectories within the layer. +#. *Add Content:* Depending on the type of layer, add the content: + + - If the layer adds support for a machine, add the machine configuration in + a ``conf/machine/`` file within the layer. See the :doc:`/bsp-manual/index` + section for more information. + + - If the layer adds distro policy, add the distro configuration in a + ``conf/distro/`` file within the layer. See the + :doc:`/dev-manual/custom-distribution` section for more information. + + - If the layer introduces new recipes, put the recipes you need in + ``recipes-*`` subdirectories within the layer. .. note:: For an explanation of layer hierarchy that is compliant with the - Yocto Project, see the ":ref:`bsp-manual/bsp:example filesystem layout`" - section in the Yocto Project Board Support Package (BSP) Developer's Guide. + Yocto Project, see the :doc:`/ref-manual/layers` section. #. *Optionally Test for Compatibility:* If you want permission to use the Yocto Project Compatibility logo with your layer or application @@ -185,11 +143,11 @@ following list: - *Avoid "Overlaying" Entire Recipes from Other Layers in Your Configuration:* In other words, do not copy an entire recipe into - your layer and then modify it. Rather, use an append file + your layer and then modify it. Rather, use an :term:`append file ` (``.bbappend``) to override only those parts of the original recipe you need to modify. -- *Avoid Duplicating Include Files:* Use append files (``.bbappend``) +- *Avoid Duplicating Include Files:* Use :term:`append files` (``.bbappend``) for each recipe that uses an include file. Or, if you are introducing a new recipe that requires the included file, use the path relative to the original layer directory to refer to the file. For example, @@ -506,19 +464,14 @@ enable it. To enable your layer, simply add your layer's path to the found in the :term:`Build Directory`. The following example shows how to enable your new ``meta-mylayer`` layer:: - # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf - # changes incompatibly - POKY_BBLAYERS_CONF_VERSION = "2" - BBPATH = "${TOPDIR}" - BBFILES ?= "" BBLAYERS ?= " \ - /home/user/poky/meta \ - /home/user/poky/meta-poky \ - /home/user/poky/meta-yocto-bsp \ - /home/user/mystuff/meta-mylayer \ + /home/user/openembedded-core/meta \ + /home/user/meta-poky \ + /home/user/meta-yocto-bsp \ + /home/user/meta-mylayer \ " -BitBake parses each ``conf/layer.conf`` file from the top down as +BitBake parses each :ref:`structure-conf-layer.conf` file from the top down as specified in the :term:`BBLAYERS` variable within the :ref:`structure-build-conf-bblayers.conf` file. During the processing of each ``conf/layer.conf`` file, BitBake adds the recipes, classes and configurations contained within the @@ -528,7 +481,7 @@ Appending Other Layers Metadata With Your Layer =============================================== A recipe that appends Metadata to another recipe is called a BitBake -append file. A BitBake append file uses the ``.bbappend`` file type +:term:`append file `. A BitBake append file uses the ``.bbappend`` file type suffix, while the corresponding recipe to which Metadata is being appended uses the ``.bb`` file type suffix. @@ -706,123 +659,6 @@ check for an additional :term:`MACHINE_FEATURES` that if set will cause these additional files to be installed. These additional files are listed in :term:`FILES` so that they will be packaged. -Prioritizing Your Layer -======================= - -Each layer is assigned a priority value. Priority values control which -layer takes precedence if there are recipe files with the same name in -multiple layers. For these cases, the recipe file from the layer with a -higher priority number takes precedence. Priority values also affect the -order in which multiple ``.bbappend`` files for the same recipe are -applied. You can either specify the priority manually, or allow the -build system to calculate it based on the layer's dependencies. - -To specify the layer's priority manually, use the -:term:`BBFILE_PRIORITY` -variable and append the layer's root name:: - - BBFILE_PRIORITY_mylayer = "1" - -.. note:: - - It is possible for a recipe with a lower version number - :term:`PV` in a layer that has a higher - priority to take precedence. - - Also, the layer priority does not currently affect the precedence - order of ``.conf`` or ``.bbclass`` files. Future versions of BitBake - might address this. - -Providing Global-level Configurations With Your Layer ------------------------------------------------------ - -When creating a layer, you may need to define configurations that should take -effect globally in your build environment when the layer is part of the build. -The ``layer.conf`` file is a :term:`configuration file` that affects the build -system globally, so it is a candidate for this use-case. - -.. warning:: - - Providing unconditional global level configuration from the ``layer.conf`` - file is *not* a good practice, and should be avoided. For this reason, the - section :ref:`ref-conditional-layer-confs` below shows how the ``layer.conf`` - file can be used to provide configurations only if a certain condition is - met. - -For example, if your layer provides a Linux kernel recipe named -``linux-custom``, you may want to make :term:`PREFERRED_PROVIDER_virtual/kernel -` point to ``linux-custom``:: - - PREFERRED_PROVIDER_virtual/kernel = "linux-custom" - -This can be defined in the ``layer.conf`` file. If your layer is at the last -position in the :term:`BBLAYERS` list, it will take precedence over previous -``PREFERRED_PROVIDER_virtual/kernel`` assignments (unless one is set from a -:term:`configuration file` that is parsed later, such as machine or distro -configuration files). - -.. _ref-conditional-layer-confs: - -Conditionally Provide Global-level Configurations With Your Layer -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In some cases, your layer may provide global configurations only if some -features it provides are enabled. Since the ``layer.conf`` file is parsed at an -earlier stage in the parsing process, the :term:`DISTRO_FEATURES` and -:term:`MACHINE_FEATURES` variables are not yet available to ``layer.conf``, and -declaring conditional assignments based on these variables is not possible. The -following technique shows a way to bypass this limitation by using the -:term:`USER_CLASSES` variable and a conditional ``require`` command. - -In the following steps, let's assume our layer is named ``meta-mylayer`` and -that this layer defines a custom :ref:`distro feature ` -named ``mylayer-kernel``. We will set the :term:`PREFERRED_PROVIDER` variable -for the kernel only if our feature ``mylayer-kernel`` is part of the -:term:`DISTRO_FEATURES`: - -#. Create an include file in the directory - ``meta-mylayer/conf/distro/include/``, for example a file named - ``mylayer-kernel-provider.inc`` that sets the kernel provider to - ``linux-custom``:: - - PREFERRED_PROVIDER_virtual/kernel = "linux-custom" - -#. Provide a path to this include file in your ``layer.conf``:: - - META_MYLAYER_KERNEL_PROVIDER_PATH = "${LAYERDIR}/conf/distro/include/mylayer-kernel-provider.inc" - -#. Create a new class in ``meta-mylayer/classes-global/``, for example a class - ``meta-mylayer-cfg.bbclass``. Make it conditionally require the file - ``mylayer-kernel-provider.inc`` defined above, using the variable - ``META_MYLAYER_KERNEL_PROVIDER_PATH`` defined in ``layer.conf``:: - - require ${@bb.utils.contains('DISTRO_FEATURES', 'mylayer-kernel', '${META_MYLAYER_KERNEL_PROVIDER_PATH}', '', d)} - - For details on the ``bb.utils.contains`` function, see its definition in - :bitbake_git:`lib/bb/utils.py `. - - .. note:: - - The ``require`` command is designed to not fail if the function - ``bb.utils.contains`` returns an empty string. - -#. Back to your ``layer.conf`` file, add the class ``meta-mylayer-cfg`` class to - the :term:`USER_CLASSES` variable:: - - USER_CLASSES:append = " meta-mylayer-cfg" - - This will add the class ``meta-mylayer-cfg`` to the list of classes to - globally inherit. Since the ``require`` command is conditional in - ``meta-mylayer-cfg.bbclass``, even though inherited the class will have no - effect unless the feature ``mylayer-kernel`` is enabled through - :term:`DISTRO_FEATURES`. - -This technique can also be used for :ref:`Machine features -` by following the same steps. Though not mandatory, it is -recommended to put include files for :term:`DISTRO_FEATURES` in your layer's -``conf/distro/include`` and the ones for :term:`MACHINE_FEATURES` in your -layer's ``conf/machine/include``. - Managing Layers =============== @@ -948,13 +784,13 @@ shows the layers that are in your :ref:`structure-build-conf-bblayers.conf` file Parsing of 1441 .bb files complete (0 cached, 1441 parsed). 2055 targets, 56 skipped, 0 masked, 0 errors. $ bitbake-layers show-layers NOTE: Starting bitbake server... - layer path priority - ============================================================================================== - meta /home/user/bitbake-builds/layers/openembedded-core/meta 5 - meta-poky /home/user/bitbake-builds/layers/meta-yocto/meta-poky 5 - meta-yocto-bsp /home/user/bitbake-builds/layers/meta-yocto/meta-yocto-bsp 5 - workspace /home/user/bitbake-builds/build/workspace 99 - meta-scottrif /home/user/bitbake-builds/build/meta-scottrif 6 + layer path version depends + ================================================================================================================= + oe-core /home/user/bitbake-builds/layers/openembedded-core/meta 1 + meta-yocto-poky /home/user/bitbake-builds/layers/meta-yocto/meta-poky 1 oe-core + meta-yocto-bsp /home/user/bitbake-builds/layers/meta-yocto/meta-yocto-bsp 1 oe-core + workspace /home/user/bitbake-builds/build/workspace 1 oe-core + meta-scottrif /home/user/bitbake-builds/build/meta-scottrif 1 oe-core Adding the layer to this file enables the build system to locate the layer during the build. -- 2.56.0