dev-manual: Integrated Hello World section into new writing recipe section
This change merged in the Hello World section as a summarizing example section to the new "Writing a New Recipe" section. (From yocto-docs rev: 79c858e1590e5ab4c56b19dc51b03e0e570b6209) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
3ad993da10
commit
71460e5fc2
|
@ -1146,6 +1146,12 @@
|
|||
requires a recipe to define the component.
|
||||
This section describes how to create, write, and test a new
|
||||
recipe.
|
||||
<note>
|
||||
For information on variables that are useful for recipes and
|
||||
for information about recipe naming issues, see the
|
||||
"<ulink url='&YOCTO_DOCS_REF_URL;#ref-varlocality-recipe-required'>Required</ulink>"
|
||||
section of the Yocto Project Reference Manual.
|
||||
</note>
|
||||
</para>
|
||||
|
||||
<section id='new-recipe-overview'>
|
||||
|
@ -1162,6 +1168,16 @@
|
|||
<section id='new-recipe-locate-a-base-recipe'>
|
||||
<title>Locate a Base Recipe</title>
|
||||
|
||||
<para>
|
||||
Before writing a recipe from scratch, it is often useful to
|
||||
check whether someone else has written one already.
|
||||
OpenEmbedded is a good place to look as it has a wider scope
|
||||
and range of packages.
|
||||
Because the Yocto Project aims to be compatible with
|
||||
OpenEmbedded, most recipes you find there should work for
|
||||
you.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Working from an existing recipe or a skeleton recipe is the
|
||||
best way to get started.
|
||||
|
@ -1204,6 +1220,42 @@
|
|||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>When writing shell functions, you need to be aware of BitBake's
|
||||
curly brace parsing.
|
||||
If a recipe uses a closing curly brace within the function and
|
||||
the character has no leading spaces, BitBake produces a parsing
|
||||
error.
|
||||
If you use a pair of curly brace in a shell function, the
|
||||
closing curly brace must not be located at the start of the line
|
||||
without leading spaces.</para>
|
||||
<para>Here is an example that causes BitBake to produce a parsing
|
||||
error:
|
||||
<literallayout class='monospaced'>
|
||||
fakeroot create_shar() {
|
||||
cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
|
||||
usage()
|
||||
{
|
||||
echo "test"
|
||||
###### The following "}" at the start of the line causes a parsing error ######
|
||||
}
|
||||
EOF
|
||||
}
|
||||
</literallayout>
|
||||
Writing the recipe this way avoids the error:
|
||||
<literallayout class='monospaced'>
|
||||
fakeroot create_shar() {
|
||||
cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
|
||||
usage()
|
||||
{
|
||||
echo "test"
|
||||
######The following "}" with a leading space at the start of the line avoids the error ######
|
||||
}
|
||||
EOF
|
||||
}
|
||||
</literallayout></para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id='new-recipe-naming-the-recipe'>
|
||||
|
@ -2036,72 +2088,15 @@ do_unpack unpacks the source, and S must be set
|
|||
section.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id='usingpoky-extend-addpkg'>
|
||||
<title>Writing a Recipe to Add a Package to Your Image</title>
|
||||
<section id='new-recipe-testing-hello-world-example'>
|
||||
<title>Hello World Example</title>
|
||||
|
||||
<para>
|
||||
Recipes let you define packages you can add to your image.
|
||||
Writing a recipe means creating a <filename>.bb</filename> file that sets some
|
||||
variables.
|
||||
For information on variables that are useful for recipes and for information about recipe naming
|
||||
issues, see the
|
||||
"<ulink url='&YOCTO_DOCS_REF_URL;#ref-varlocality-recipe-required'>Required</ulink>"
|
||||
section of the Yocto Project Reference Manual.
|
||||
To help summarize how to write a recipe, this section provides
|
||||
an example recipe that builds a single "Hello World!" package.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Before writing a recipe from scratch, it is often useful to check
|
||||
whether someone else has written one already.
|
||||
OpenEmbedded is a good place to look as it has a wider scope and range of packages.
|
||||
Because the Yocto Project aims to be compatible with OpenEmbedded, most recipes
|
||||
you find there should work for you.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For new packages, the simplest way to add a recipe is to base it on a similar
|
||||
pre-existing recipe.
|
||||
The sections that follow provide some examples that show how to add standard
|
||||
types of packages.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>When writing shell functions, you need to be aware of BitBake's
|
||||
curly brace parsing.
|
||||
If a recipe uses a closing curly brace within the function and
|
||||
the character has no leading spaces, BitBake produces a parsing
|
||||
error.
|
||||
If you use a pair of curly brace in a shell function, the
|
||||
closing curly brace must not be located at the start of the line
|
||||
without leading spaces.</para>
|
||||
<para>Here is an example that causes BitBake to produce a parsing
|
||||
error:
|
||||
<literallayout class='monospaced'>
|
||||
fakeroot create_shar() {
|
||||
cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
|
||||
usage()
|
||||
{
|
||||
echo "test"
|
||||
###### The following "}" at the start of the line causes a parsing error ######
|
||||
}
|
||||
EOF
|
||||
}
|
||||
</literallayout>
|
||||
Writing the recipe this way avoids the error:
|
||||
<literallayout class='monospaced'>
|
||||
fakeroot create_shar() {
|
||||
cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
|
||||
usage()
|
||||
{
|
||||
echo "test"
|
||||
######The following "}" with a leading space at the start of the line avoids the error ######
|
||||
}
|
||||
EOF
|
||||
}
|
||||
</literallayout></para>
|
||||
</note>
|
||||
|
||||
<section id='usingpoky-extend-addpkg-singlec'>
|
||||
<title>Single .c File Package (Hello World!)</title>
|
||||
|
||||
|
@ -2373,6 +2368,26 @@ do_unpack unpacks the source, and S must be set
|
|||
is unset when executed on the first boot.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<section id='writer-notes'>
|
||||
<title>Writer Notes</title>
|
||||
|
||||
<para>
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Need to edit the faq.xml chapter and find the single reference to
|
||||
<filename>usingpoky-extend-addpkg</filename> and replace it
|
||||
with <filename>new-recipe-testing-hello-world-example</filename>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="platdev-newmachine">
|
||||
|
|
Loading…
Reference in New Issue