dev-manual: Updated the "Create Your Own Layer" section

Updated the explanation of the layer.conf file.  I am going
to use this section as the definitive section that explains
the layer.conf file.

(From yocto-docs rev: 4c70c7467f0ca5cf2346ef8d10bde437b971d2d2)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark
2018-03-23 16:34:08 -07:00
committed by Richard Purdie
parent c286781b42
commit 9e8f28a469

View File

@@ -94,23 +94,23 @@
to several variables used in the configuration. to several variables used in the configuration.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
<emphasis>Create a Layer Configuration <emphasis>Create a Layer Configuration File:</emphasis>
File:</emphasis> Inside your new layer folder, you need to create a
Inside your new layer folder, you need to create a <filename>conf/layer.conf</filename> file.
<filename>conf/layer.conf</filename> file. It is easiest to take an existing layer configuration
It is easiest to take an existing layer configuration file and copy that to your layer's
file and copy that to your layer's <filename>conf</filename> directory and then modify the
<filename>conf</filename> directory and then modify the file as needed.</para>
file as needed.</para>
<para>The <para>The
<filename>meta-yocto-bsp/conf/layer.conf</filename> file <filename>meta-yocto-bsp/conf/layer.conf</filename> file
in the Yocto Project in the Yocto Project
<ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf'>Source Repositories</ulink> <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf'>Source Repositories</ulink>
demonstrates the required syntax. demonstrates the required syntax.
For your layer, you need to replace "yoctobsp" with the For your layer, you need to replace "yoctobsp" with
root name of your layer: a unique identifier for your layer (e.g. "machinexyz"
<literallayout class='monospaced'> for a layer named "meta-machinexyz"):
<literallayout class='monospaced'>
# We have a conf and classes directory, add to BBPATH # We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}" BBPATH .= ":${LAYERDIR}"
@@ -123,93 +123,76 @@
BBFILE_PRIORITY_yoctobsp = "5" BBFILE_PRIORITY_yoctobsp = "5"
LAYERVERSION_yoctobsp = "4" LAYERVERSION_yoctobsp = "4"
LAYERSERIES_COMPAT_yoctobsp = "&DISTRO_NAME_NO_CAP;" LAYERSERIES_COMPAT_yoctobsp = "&DISTRO_NAME_NO_CAP;"
</literallayout></para> </literallayout>
Following is an explanation of the layer configuration
<para>Here is an explanation of the example: file:
<itemizedlist> <itemizedlist>
<listitem><para> <listitem><para>
The configuration and classes directory is <ulink url='&YOCTO_DOCS_REF_URL;#var-BBPATH'><filename>BBPATH</filename></ulink>:
appended to Adds the layer's root directory to BitBake's
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBPATH'><filename>BBPATH</filename></ulink>. search path.
<note> Through the use of the
All non-distro layers are expected to <filename>BBPATH</filename> variable, BitBake
append the layer directory to locates class files
<filename>BBPATH</filename>. (<filename>.bbclass</filename>),
On the other hand, distro layers, such as configuration files, and files that are
<filename>meta-poky</filename>, can choose included with <filename>include</filename> and
to enforce their own precedence over <filename>require</filename> statements.
<filename>BBPATH</filename>. For these cases, BitBake uses the first file
For an example of that syntax, see the that matches the name found in
<filename>meta-poky/conf/layer.conf</filename> <filename>BBPATH</filename>.
file for in the This is similar to the way the
<ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-poky/conf'>Source Repositories</ulink>. <filename>PATH</filename> variable is used for
</note> binaries.
It is recommended, therefore, that you use
unique class and configuration filenames in
your custom layer.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The recipes for the layers are appended to <ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILES'><filename>BBFILES</filename></ulink>:
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILES'><filename>BBFILES</filename></ulink>. Defines the location for all recipes in the
</para></listitem>
<listitem><para>
The
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_COLLECTIONS'><filename>BBFILE_COLLECTIONS</filename></ulink>
variable is appended with the layer's root name,
which is "yoctobsp" in this example.
</para></listitem>
<listitem><para>
The
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PATTERN'><filename>BBFILE_PATTERN</filename></ulink>
variable is set to a regular expression and is
used to match files from
<filename>BBFILES</filename> into a particular
layer. layer.
In this case,
<ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERDIR'><filename>LAYERDIR</filename></ulink>
is used to make
<filename>BBFILE_PATTERN</filename> match
within the layer's path.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The <ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_COLLECTIONS'><filename>BBFILE_COLLECTIONS</filename></ulink>:
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PRIORITY'><filename>BBFILE_PRIORITY</filename></ulink> Establishes the current layer through a
variable assigns a priority to the layer. unique identifier that is used throughout the
Applying priorities is useful in situations OpenEmbedded build system to refer to the layer.
where the same recipe might appear in multiple In this example, the identifier "yoctobsp" is
the representation for the container layer
named "meta-yocto-bsp".
</para></listitem>
<listitem><para>
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PATTERN'><filename>BBFILE_PATTERN</filename></ulink>:
Expands immediately during parsing to
provide the directory of the layer.
</para></listitem>
<listitem><para>
<ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PRIORITY'><filename>BBFILE_PRIORITY</filename></ulink>:
Establishes a priority to use for
recipes in the layer when the OpenEmbedded build
finds recipes of the same name in different
layers. layers.
A priority allows you to choose the layer
that takes precedence.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The <ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERVERSION'><filename>LAYERVERSION</filename></ulink>:
<ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERDIR'><filename>LAYERDIR</filename></ulink> Establishes a version number for the layer.
variable expands to the directory of the You can use this version number to specify this
current layer exact version of the layer as a dependency when
using the
<ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERDEPENDS'><filename>LAYERDEPENDS</filename></ulink>
variable.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The <ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERSERIES_COMPAT'><filename>LAYERSERIES_COMPAT</filename></ulink>:
<ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERVERSION'><filename>LAYERVERSION</filename></ulink> Lists the
variable optionally specifies the version of a <ulink url='&YOCTO_WIKI_URL;/wiki/Releases'>Yocto Project</ulink>
layer as a single number. releases for which the current version is
compatible.
This variable is a good way to indicate how
up-to-date your particular layer is.
</para></listitem> </para></listitem>
<listitem><para> </itemizedlist>
The
<ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERSERIES_COMPAT'><filename>LAYERSERIES_COMPAT</filename></ulink>
lists the Yocto Project releases for which the
layer is compatible.
</para></listitem>
</itemizedlist></para>
<para>Through the use of the <filename>BBPATH</filename>
variable, BitBake locates class files
(<filename>.bbclass</filename>),
configuration files, and files that are included
with <filename>include</filename> and
<filename>require</filename> statements.
For these cases, BitBake uses the first file that
matches the name found in <filename>BBPATH</filename>.
This is similar to the way the <filename>PATH</filename>
variable is used for binaries.
It is recommended, therefore, that you use unique
class and configuration filenames in your custom layer.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
<emphasis>Add Content:</emphasis> <emphasis>Add Content:</emphasis>