blob: 4e4fd282a53e4d09695b672336a2ea0bb0b8c7ae [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<chapter id='kernel-dev-intro'>
6<title>Introduction</title>
7
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008<section id='kernel-dev-overview'>
9 <title>Overview</title>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011 <para>
12 Regardless of how you intend to make use of the Yocto Project,
13 chances are you will work with the Linux kernel.
14 This manual describes how to set up your build host to support
15 kernel development, introduces the kernel development process,
16 provides background information on the Yocto Linux kernel
17 <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>,
18 describes common tasks you can perform using the kernel tools,
19 shows you how to use the kernel Metadata needed to work with
20 the kernel inside the Yocto Project, and provides insight into how
21 the Yocto Project team develops and maintains Yocto Linux kernel
22 Git repositories and Metadata.
23 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 <para>
26 Each Yocto Project release has a set of Yocto Linux kernel recipes,
27 whose Git repositories you can view in the Yocto
28 <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink> under
29 the "Yocto Linux Kernel" heading.
30 New recipes for the release track the latest Linux kernel
31 upstream developments from
32 <ulink url='http://www.kernel.org'></ulink> and introduce
33 newly-supported platforms.
34 Previous recipes in the release are refreshed and supported for at
35 least one additional Yocto Project release.
36 As they align, these previous releases are updated to include the
37 latest from the Long Term Support Initiative (LTSI) project.
38 You can learn more about Yocto Linux kernels and LTSI in the
39 "<link linkend='kernel-big-picture'>Yocto Project Kernel Development and Maintenance</link>"
40 section.
41 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042
Brad Bishopd7bf8c12018-02-25 22:55:05 -050043 <para>
44 Also included is a Yocto Linux kernel development recipe
45 (<filename>linux-yocto-dev.bb</filename>) should you want to work
46 with the very latest in upstream Yocto Linux kernel development and
47 kernel Metadata development.
48 <note>
49 For more on Yocto Linux kernels, see the
50 "<link linkend='kernel-big-picture'>Yocto Project Kernel Development and Maintenance</link>
51 section.
52 </note>
53 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055 <para>
56 The Yocto Project also provides a powerful set of kernel
57 tools for managing Yocto Linux kernel sources and configuration data.
58 You can use these tools to make a single configuration change,
59 apply multiple patches, or work with your own kernel sources.
60 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061
Brad Bishopd7bf8c12018-02-25 22:55:05 -050062 <para>
63 In particular, the kernel tools allow you to generate configuration
64 fragments that specify only what you must, and nothing more.
65 Configuration fragments only need to contain the highest level
66 visible <filename>CONFIG</filename> options as presented by the
67 Yocto Linux kernel <filename>menuconfig</filename> system.
68 Contrast this against a complete Yocto Linux kernel
69 <filename>.config</filename> file, which includes all the automatically
70 selected <filename>CONFIG</filename> options.
71 This efficiency reduces your maintenance effort and allows you
72 to further separate your configuration in ways that make sense for
73 your project.
74 A common split separates policy and hardware.
75 For example, all your kernels might support the
76 <filename>proc</filename> and <filename>sys</filename> filesystems,
77 but only specific boards require sound, USB, or specific drivers.
78 Specifying these configurations individually allows you to aggregate
79 them together as needed, but maintains them in only one place.
80 Similar logic applies to separating source changes.
81 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082
Brad Bishopd7bf8c12018-02-25 22:55:05 -050083 <para>
84 If you do not maintain your own kernel sources and need to make
85 only minimal changes to the sources, the released recipes provide a
86 vetted base upon which to layer your changes.
87 Doing so allows you to benefit from the continual kernel
88 integration and testing performed during development of the
89 Yocto Project.
90 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091
Brad Bishopd7bf8c12018-02-25 22:55:05 -050092 <para>
93 If, instead, you have a very specific Linux kernel source tree
94 and are unable to align with one of the official Yocto Linux kernel
95 recipes, an alternative exists by which you can use the Yocto
96 Project Linux kernel tools with your own kernel sources.
97 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098
Brad Bishopd7bf8c12018-02-25 22:55:05 -050099 <para>
100 The remainder of this manual provides instructions for completing
101 specific Linux kernel development tasks.
102 These instructions assume you are comfortable working with
103 <ulink url='http://openembedded.org/wiki/Bitbake'>BitBake</ulink>
104 recipes and basic open-source development tools.
105 Understanding these concepts will facilitate the process of working
106 with the kernel recipes.
107 If you find you need some additional background, please be sure to
108 review and understand the following documentation:
109 <itemizedlist>
110 <listitem><para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400111 <ulink url='&YOCTO_DOCS_BRIEF_URL;'>Yocto Project Quick Build</ulink>
112 document.
113 </para></listitem>
114 <listitem><para>
115 <ulink url='&YOCTO_DOCS_OM_URL;'>Yocto Project Overview and Concepts Manual</ulink>.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500116 </para></listitem>
117 <listitem><para>
118 <ulink url='&YOCTO_DOCS_SDK_URL;#using-devtool-in-your-sdk-workflow'><filename>devtool</filename> workflow</ulink>
119 as described in the Yocto Project Application Development and
120 the Extensible Software Development Kit (eSDK) manual.
121 </para></listitem>
122 <listitem><para>
123 The
124 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
125 section in the Yocto Project Development Tasks Manual.
126 </para></listitem>
127 <listitem><para>
128 The
129 "<link linkend='kernel-modification-workflow'>Kernel Modification Workflow</link>"
130 section.
131 </para></listitem>
132 </itemizedlist>
133 </para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500134</section>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500136<section id='kernel-modification-workflow'>
137 <title>Kernel Modification Workflow</title>
138
139 <para>
140 Kernel modification involves changing the Yocto Project kernel,
141 which could involve changing configuration options as well as adding
142 new kernel recipes.
143 Configuration changes can be added in the form of configuration
144 fragments, while recipe modification comes through the kernel's
145 <filename>recipes-kernel</filename> area in a kernel layer you create.
146 </para>
147
148 <para>
149 This section presents a high-level overview of the Yocto Project
150 kernel modification workflow.
151 The illustration and accompanying list provide general information
152 and references for further information.
153 <imagedata fileref="figures/kernel-dev-flow.png"
154 width="9in" depth="5in" align="center" scalefit="1" />
155 </para>
156
157 <para>
158 <orderedlist>
159 <listitem><para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400160
161
162 <emphasis>Set up Your Host Development System to Support
163 Development Using the Yocto Project</emphasis>:
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500164 See the
Brad Bishop316dfdd2018-06-25 12:45:53 -0400165 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-start'>Setting Up the Development Host to Use the Yocto Project</ulink>"
166 section in the Yocto Project Development Tasks Manual for
167 options on how to get a build host ready to use the Yocto
168 Project.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500169 </para></listitem>
170 <listitem><para>
171 <emphasis>Set Up Your Host Development System for Kernel Development:</emphasis>
172 It is recommended that you use <filename>devtool</filename>
173 and an extensible SDK for kernel development.
174 Alternatively, you can use traditional kernel development
175 methods with the Yocto Project.
176 Either way, there are steps you need to take to get the
177 development environment ready.</para>
178
179 <para>Using <filename>devtool</filename> and the eSDK requires
180 that you have a clean build of the image and that you are
181 set up with the appropriate eSDK.
182 For more information, see the
183 "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop Using <filename>devtool</filename></link>"
184 section.</para>
185
186 <para>Using traditional kernel development requires that you
187 have the kernel source available in an isolated local Git
188 repository.
189 For more information, see the
190 "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>"
191 section.
192 </para></listitem>
193 <listitem><para>
194 <emphasis>Make Changes to the Kernel Source Code if
195 applicable:</emphasis>
196 Modifying the kernel does not always mean directly
197 changing source files.
198 However, if you have to do this, you make the changes to the
199 files in the eSDK's Build Directory if you are using
200 <filename>devtool</filename>.
201 For more information, see the
202 "<link linkend='using-devtool-to-patch-the-kernel'>Using <filename>devtool</filename> to Patch the Kernel</link>"
203 section.</para>
204
205 <para>If you are using traditional kernel development, you
206 edit the source files in the kernel's local Git repository.
207 For more information, see the
208 "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>"
209 section.
210 </para></listitem>
211 <listitem><para>
212 <emphasis>Make Kernel Configuration Changes if
213 Applicable:</emphasis>
214 If your situation calls for changing the kernel's
215 configuration, you can use
216 <link linkend='using-menuconfig'><filename>menuconfig</filename></link>,
217 which allows you to interactively develop and test the
218 configuration changes you are making to the kernel.
219 Saving changes you make with <filename>menuconfig</filename>
220 updates the kernel's <filename>.config</filename> file.
221 <note><title>Warning</title>
222 Try to resist the temptation to directly edit an
223 existing <filename>.config</filename> file, which is
224 found in the Build Directory among the source code
225 used for the build.
226 Doing so, can produce unexpected results when the
227 OpenEmbedded build system regenerates the configuration
228 file.
229 </note>
230 Once you are satisfied with the configuration
231 changes made using <filename>menuconfig</filename>
232 and you have saved them, you can directly compare the
233 resulting <filename>.config</filename> file against an
234 existing original and gather those changes into a
235 <link linkend='creating-config-fragments'>configuration fragment file</link>
236 to be referenced from within the kernel's
237 <filename>.bbappend</filename> file.</para>
238
239 <para>Additionally, if you are working in a BSP layer
240 and need to modify the BSP's kernel's configuration,
Brad Bishop316dfdd2018-06-25 12:45:53 -0400241 you can use <filename>menuconfig</filename>.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500242 </para></listitem>
243 <listitem><para>
244 <emphasis>Rebuild the Kernel Image With Your Changes:</emphasis>
245 Rebuilding the kernel image applies your changes.
246 Depending on your target hardware, you can verify your changes
247 on actual hardware or perhaps QEMU.
248 </para></listitem>
249 </orderedlist>
250 The remainder of this developer's guide covers common tasks typically
251 used during kernel development, advanced Metadata usage, and Yocto Linux
252 kernel maintenance concepts.
253 </para>
254</section>
255
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500256</chapter>
257<!--
258vim: expandtab tw=80 ts=4
259-->