documentation: dev-manual - edits to the patching the kernel and model sections.

Made changes to try and clean up the process.

(From yocto-docs rev: 9c4fbcb473dc594647ba8779162379a745f8f8d6)

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 2012-10-11 14:27:48 -07:00 committed by Richard Purdie
parent e44de7bbb9
commit 715456acb8
2 changed files with 52 additions and 25 deletions

View File

@ -1623,7 +1623,15 @@
<filename>calibrate.c</filename> source code file. <filename>calibrate.c</filename> source code file.
Applying the patch and booting the modified image causes the added Applying the patch and booting the modified image causes the added
messages to appear on the emulator's console. messages to appear on the emulator's console.
</para> </para>
<para>
The example assumes a clean build exists for the <filename>x86qemu</filename>
machine in a Source Directory named <filename>poky</filename>.
Furthermore, the <link linkend='build-directory'>Build Directory</link> is
<filename>build</filename> and is located in <filename>poky</filename> and
the kernel is based on the Linux 3.4 kernel.
</para>
<section id='create-a-layer-for-your-changes'> <section id='create-a-layer-for-your-changes'>
<title>Create a Layer for your Changes</title> <title>Create a Layer for your Changes</title>
@ -1635,7 +1643,7 @@
$mkdir meta-mylayer $mkdir meta-mylayer
</literallayout> </literallayout>
Creating a directory that follows the Yocto Project layer naming Creating a directory that follows the Yocto Project layer naming
conventions sets up the area for your layer. conventions sets up the area for your changes.
The layer is where you place your configuration files, append The layer is where you place your configuration files, append
files, and patch files. files, and patch files.
To learn more about creating a layer and filling it with the To learn more about creating a layer and filling it with the
@ -1658,20 +1666,18 @@
<literallayout class='monospaced'> <literallayout class='monospaced'>
${TMPDIR}/work/${MACHINE}-poky-${TARGET_OS}/${PN}-${PV}-${PR} ${TMPDIR}/work/${MACHINE}-poky-${TARGET_OS}/${PN}-${PV}-${PR}
</literallayout> </literallayout>
Assuming a recent build for the <filename>qemux86</filename> machine For this example, the directory that
based on the Linux 3.4 kernel, a holds the temporary source code is here:
<link linkend='source-directory'>Source Directory</link> named <filename>poky</filename>, and
the existence of a default <filename>build</filename> directory, the directory that
holds the temporary source code would be here:
<literallayout class='monospaced'> <literallayout class='monospaced'>
~/poky/build/tmp/work/qemux86-poky-linux/linux-yocto-3.4.11+git1+5bdc...85f-r4.3 ~/poky/build/tmp/work/qemux86-poky-linux/linux-yocto-3.4.11+git1+5bdc...85f-r4.3
</literallayout> </literallayout>
Within the <filename>linux</filename> directory, you find the source directories. Within the <filename>linux</filename> directory, you find directories for
the source.
</para> </para>
<para> <para>
For this example, we are going to patch the <filename>init/calibrate.c</filename> file For this example, we are going to patch the <filename>init/calibrate.c</filename> file
and add some simple console <filename>printk</filename> statements that we can by adding some simple console <filename>printk</filename> statements that we can
see when we boot the image using QEMU. see when we boot the image using QEMU.
</para> </para>
</section> </section>
@ -1686,11 +1692,11 @@
</para> </para>
<para> <para>
To create the patch for the <filename>calibrate.c</filename>, follow the steps To create the patch for the <filename>calibrate.c</filename>, follow steps
outlined in the 3 through 12 outlined in the
"<link linkend='using-a-git-workflow'>Using a Git Workflow</link>" "<link linkend='using-a-git-workflow'>Using a Git Workflow</link>"
section. section.
For the steps used to edit the source file, do the following: For step 6 (Edit the Files), do the following:
</para> </para>
<para> <para>
@ -1737,16 +1743,30 @@
<title>Get Your Layer Setup for the Build</title> <title>Get Your Layer Setup for the Build</title>
<para> <para>
At this point, you have a patch file in the same directory as your original At this point, you have a patch file in the kernel's source code directory.
<filename>calibrate.c</filename>. The patch file is named according to the commit's summary line and ends
Move it to your layer and place it in a separate folder having the same with <filename>.patch</filename>.
name as the recipe, which is <filename>linux-yocto</filename> in this case. For this example, it is named <filename>0001-calibrate.c.patch</filename>.
</para> </para>
<para> <para>
Next, you need to set up your <filename>conf</filename> directory in your layer. You need to move the patch file to your layer next.
Create the <filename>conf</filename> and create the <filename>layer.conf</filename> The patch file needs to reside in the
file. <filename>meta-mylayer/recipes-kernel/linux/linux-yocto</filename> directory.
Create this directory path within your layer and move the patch file.
This directory path mirrors that used by the main kernel recipe in
the Source Directory (<filename>poky</filename>).
<literallayout class='monospaced'>
$ cd ~/poky/meta-mylayer
$ mkdir recipes-kernel
$ mkdir recipes-kernel/linux
$ mkdir recipes-kernel/linux/linux-yocto
</literallayout>
</para>
<para>
Next, you need to create a <filename>conf</filename> directory in your layer
and within it create the <filename>layer.conf</filename> file.
You can find information on this in the You can find information on this in the
"<link linkend='creating-your-own-layer'>Creating Your Own Layer</link>" "<link linkend='creating-your-own-layer'>Creating Your Own Layer</link>"
section. section.
@ -1807,12 +1827,14 @@
/home/scottrif/poky/meta-mylayer \ /home/scottrif/poky/meta-mylayer \
" "
</literallayout></para></listitem> </literallayout></para></listitem>
<listitem><para><emphasis>Create a bbappend File:</emphasis> You need to have <listitem><para><emphasis>Create a bbappend File:</emphasis> You need to create
an append file to the main 3.4 kernel recipe. an append file for the main 3.4 kernel recipe.
Locate the append file in your <filename>meta-mylayer</filename> layer. Create the append file in the <filename>linux</filename> directory you
It needs to be in a <filename>meta-mylayer/recipes-kernel/linux</filename> directory. created earlier within your layer.
Create the directory and use the following for the append file. Assuming the patch file is named
This example assumes patch file is named <filename>0001-documentation-calibrate.c.patch</filename>: <filename>0001-documentation-calibrate.c.patch</filename>, your append
file, which must be named <filename>linux-yocto_3.4.bbappend</filename>,
has these statements:
<literallayout class='monospaced'> <literallayout class='monospaced'>
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

View File

@ -1730,6 +1730,11 @@ directory.</para></listitem>
"<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>" "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>"
section of the Yocto Project Quick Start. section of the Yocto Project Quick Start.
</note></para></listitem> </note></para></listitem>
<listitem><para><emphasis>Change Your Working Directory:</emphasis>
After making your edits, move back to the directory from which you
initialized the Git repository.
Returning to this directory ensures you are using the correct branch when
you go to commit your changes.</para></listitem>
<listitem><para><emphasis>See the List of Files You Changed:</emphasis> <listitem><para><emphasis>See the List of Files You Changed:</emphasis>
Use the <filename>git status</filename> command to see what files you have actually edited. Use the <filename>git status</filename> command to see what files you have actually edited.
The ability to have Git track the files you have changed is an advantage that this The ability to have Git track the files you have changed is an advantage that this