dev-manual: Read-through edits to "Understanding and Creating Layers".

Some minor edits applied.

(From yocto-docs rev: 1897997ad3ef3ada76de77c7fb886fb624dcdfdb)

Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark 2014-03-18 12:55:20 -06:00 committed by Richard Purdie
parent c7fb9a6147
commit 23da05febb
1 changed files with 38 additions and 29 deletions

View File

@ -64,8 +64,8 @@
the string <filename>meta-</filename>. the string <filename>meta-</filename>.
<note> <note>
It is not a requirement that a layer name begin with the It is not a requirement that a layer name begin with the
prefix <filename>meta-</filename>, but it's a commonly accepted prefix <filename>meta-</filename>, but it is a commonly
standard in the Yocto Project community. accepted standard in the Yocto Project community.
</note> </note>
For example, when you set up the Source Directory structure, For example, when you set up the Source Directory structure,
you will see several layers: you will see several layers:
@ -194,8 +194,8 @@
variable then assigns a priority to the layer. variable then assigns a priority to the layer.
Applying priorities is useful in situations Applying priorities is useful in situations
where the same package might appear in multiple where the same package might appear in multiple
layers and allows you to choose what layer layers and allows you to choose the layer
should take precedence.</para></listitem> that takes precedence.</para></listitem>
<listitem><para>The <listitem><para>The
<filename><ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERVERSION'>LAYERVERSION</ulink></filename> <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-LAYERVERSION'>LAYERVERSION</ulink></filename>
variable optionally specifies the version of a variable optionally specifies the version of a
@ -206,16 +206,17 @@
variable, which expands to the directory of the current variable, which expands to the directory of the current
layer.</para> layer.</para>
<para>Through the use of the <filename>BBPATH</filename> <para>Through the use of the <filename>BBPATH</filename>
variable, BitBake locates <filename>.bbclass</filename> variable, BitBake locates class files
files, configuration files, and files that are included (<filename>.bbclass</filename>),
configuration files, and files that are included
with <filename>include</filename> and with <filename>include</filename> and
<filename>require</filename> statements. <filename>require</filename> statements.
For these cases, BitBake uses the first file that For these cases, BitBake uses the first file that
matches the name found in <filename>BBPATH</filename>. matches the name found in <filename>BBPATH</filename>.
This is similar to the way the <filename>PATH</filename> This is similar to the way the <filename>PATH</filename>
variable is used for binaries. variable is used for binaries.
We recommend, therefore, that you use unique It is recommended, therefore, that you use unique
<filename>.bbclass</filename> and configuration class and configuration
filenames in your custom layer.</para></listitem> filenames in your custom layer.</para></listitem>
<listitem><para><emphasis>Add Content:</emphasis> Depending <listitem><para><emphasis>Add Content:</emphasis> Depending
on the type of layer, add the content. on the type of layer, add the content.
@ -253,7 +254,8 @@
configuration. configuration.
In other words, do not copy an entire recipe into your In other words, do not copy an entire recipe into your
layer and then modify it. layer and then modify it.
Rather, use <filename>.bbappend</filename> files to override Rather, use an append file (<filename>.bbappend</filename>)
to override
only those parts of the original recipe you need to modify. only those parts of the original recipe you need to modify.
</para> </para>
</section> </section>
@ -263,7 +265,8 @@
<para> <para>
Avoid duplicating include files. Avoid duplicating include files.
Use <filename>.bbappend</filename> files for each recipe Use append files (<filename>.bbappend</filename>)
for each recipe
that uses an include file. that uses an include file.
Or, if you are introducing a new recipe that requires Or, if you are introducing a new recipe that requires
the included file, use the path relative to the original the included file, use the path relative to the original
@ -285,7 +288,7 @@
However, OpenEmbedded's layer <filename>meta-oe</filename> However, OpenEmbedded's layer <filename>meta-oe</filename>
does. does.
Consequently, <filename>meta-oe</filename> uses Consequently, <filename>meta-oe</filename> uses
<filename>.bbappend</filename> files to modify the append files to modify the
<filename>QT_SQL_DRIVER_FLAGS</filename> variable to <filename>QT_SQL_DRIVER_FLAGS</filename> variable to
enable the appropriate plug-ins. enable the appropriate plug-ins.
This variable was added to the <filename>qt4.inc</filename> This variable was added to the <filename>qt4.inc</filename>
@ -392,7 +395,7 @@
as shown above, put it in as shown above, put it in
<filename>meta-one/recipes-core/base-files/base-files/one/</filename>. <filename>meta-one/recipes-core/base-files/base-files/one/</filename>.
Not only does this make sure the file is used Not only does this make sure the file is used
only when building for machine "one" but the only when building for machine "one", but the
build process locates the file more quickly.</para> build process locates the file more quickly.</para>
<para>In summary, you need to place all files <para>In summary, you need to place all files
referenced from <filename>SRC_URI</filename> referenced from <filename>SRC_URI</filename>
@ -526,12 +529,12 @@
"meta" layer at "meta" layer at
<filename>meta/recipes-bsp/formfactor</filename>: <filename>meta/recipes-bsp/formfactor</filename>:
<literallayout class='monospaced'> <literallayout class='monospaced'>
DESCRIPTION = "Device formfactor information" SUMMARY = "Device formfactor information"
SECTION = "base" SECTION = "base"
LICENSE = "MIT" LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
PR = "r41" PR = "r44"
SRC_URI = "file://config file://machconfig" SRC_URI = "file://config file://machconfig"
S = "${WORKDIR}" S = "${WORKDIR}"
@ -540,12 +543,12 @@
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_DEFAULT_DEPS = "1"
do_install() { do_install() {
# Only install file if it has a contents # Only install file if it has a contents
install -d ${D}${sysconfdir}/formfactor/ install -d ${D}${sysconfdir}/formfactor/
install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/ install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/
if [ -s "${S}/machconfig" ]; then if [ -s "${S}/machconfig" ]; then
install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/ install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/
fi fi
} }
</literallayout> </literallayout>
In the main recipe, note the In the main recipe, note the
@ -596,16 +599,22 @@
<filename>THISDIR</filename>. <filename>THISDIR</filename>.
The trailing colon character is important as it ensures that The trailing colon character is important as it ensures that
items in the list remain colon-separated. items in the list remain colon-separated.
<note><para>BitBake automatically defines the <note>
<filename>THISDIR</filename> variable. <para>
You should never set this variable yourself. BitBake automatically defines the
Using <filename>_prepend</filename> ensures your path will <filename>THISDIR</filename> variable.
be searched prior to other paths in the final list.</para> You should never set this variable yourself.
<para>Also, not all append files add extra files. Using "_prepend" ensures your path will
Many append files simply exist to add build options be searched prior to other paths in the final list.
(e.g. <filename>systemd</filename>). </para>
For these cases, it is not necessary to use the
"_prepend" part of the statement.</para> <para>
Also, not all append files add extra files.
Many append files simply exist to add build options
(e.g. <filename>systemd</filename>).
For these cases, it is not necessary to use the
"_prepend" part of the statement.
</para>
</note> </note>
</para> </para>
</section> </section>