blob: dba45495f26bd6de6af0750fdc3bc9c6337f2675 [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>
111 <ulink url='&YOCTO_DOCS_QS_URL;'>Yocto Project Quick Start</ulink>
112 </para></listitem>
113 <listitem><para>
114 <ulink url='&YOCTO_DOCS_SDK_URL;#using-devtool-in-your-sdk-workflow'><filename>devtool</filename> workflow</ulink>
115 as described in the Yocto Project Application Development and
116 the Extensible Software Development Kit (eSDK) manual.
117 </para></listitem>
118 <listitem><para>
119 The
120 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
121 section in the Yocto Project Development Tasks Manual.
122 </para></listitem>
123 <listitem><para>
124 The
125 "<link linkend='kernel-modification-workflow'>Kernel Modification Workflow</link>"
126 section.
127 </para></listitem>
128 </itemizedlist>
129 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500130
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500131 <para>
132 Finally, while this document focuses on the manual creation of
133 recipes, patches, and configuration files, the Yocto Project
134 Board Support Package (BSP) tools are available to automate
135 this process with existing content and work well to create the
136 initial framework and boilerplate code.
137 For details on these tools, see the
138 "<ulink url='&YOCTO_DOCS_BSP_URL;#using-the-yocto-projects-bsp-tools'>Using the Yocto Project's BSP Tools</ulink>"
139 section in the Yocto Project Board Support Package (BSP) Developer's
140 Guide.
141 </para>
142</section>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500143
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500144<section id='kernel-modification-workflow'>
145 <title>Kernel Modification Workflow</title>
146
147 <para>
148 Kernel modification involves changing the Yocto Project kernel,
149 which could involve changing configuration options as well as adding
150 new kernel recipes.
151 Configuration changes can be added in the form of configuration
152 fragments, while recipe modification comes through the kernel's
153 <filename>recipes-kernel</filename> area in a kernel layer you create.
154 </para>
155
156 <para>
157 This section presents a high-level overview of the Yocto Project
158 kernel modification workflow.
159 The illustration and accompanying list provide general information
160 and references for further information.
161 <imagedata fileref="figures/kernel-dev-flow.png"
162 width="9in" depth="5in" align="center" scalefit="1" />
163 </para>
164
165 <para>
166 <orderedlist>
167 <listitem><para>
168 <emphasis>Set Up Your Host Development System to Support
169 Development Using the Yocto Project:</emphasis>
170 See the
171 "<ulink url='&YOCTO_DOCS_QS_URL;#yp-resources'>Setting Up to Use the Yocto Project</ulink>"
172 section in the Yocto Project Quick Start for options on how
173 to get a build host ready to use the Yocto Project.
174 </para></listitem>
175 <listitem><para>
176 <emphasis>Set Up Your Host Development System for Kernel Development:</emphasis>
177 It is recommended that you use <filename>devtool</filename>
178 and an extensible SDK for kernel development.
179 Alternatively, you can use traditional kernel development
180 methods with the Yocto Project.
181 Either way, there are steps you need to take to get the
182 development environment ready.</para>
183
184 <para>Using <filename>devtool</filename> and the eSDK requires
185 that you have a clean build of the image and that you are
186 set up with the appropriate eSDK.
187 For more information, see the
188 "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop Using <filename>devtool</filename></link>"
189 section.</para>
190
191 <para>Using traditional kernel development requires that you
192 have the kernel source available in an isolated local Git
193 repository.
194 For more information, see the
195 "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>"
196 section.
197 </para></listitem>
198 <listitem><para>
199 <emphasis>Make Changes to the Kernel Source Code if
200 applicable:</emphasis>
201 Modifying the kernel does not always mean directly
202 changing source files.
203 However, if you have to do this, you make the changes to the
204 files in the eSDK's Build Directory if you are using
205 <filename>devtool</filename>.
206 For more information, see the
207 "<link linkend='using-devtool-to-patch-the-kernel'>Using <filename>devtool</filename> to Patch the Kernel</link>"
208 section.</para>
209
210 <para>If you are using traditional kernel development, you
211 edit the source files in the kernel's local Git repository.
212 For more information, see the
213 "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>"
214 section.
215 </para></listitem>
216 <listitem><para>
217 <emphasis>Make Kernel Configuration Changes if
218 Applicable:</emphasis>
219 If your situation calls for changing the kernel's
220 configuration, you can use
221 <link linkend='using-menuconfig'><filename>menuconfig</filename></link>,
222 which allows you to interactively develop and test the
223 configuration changes you are making to the kernel.
224 Saving changes you make with <filename>menuconfig</filename>
225 updates the kernel's <filename>.config</filename> file.
226 <note><title>Warning</title>
227 Try to resist the temptation to directly edit an
228 existing <filename>.config</filename> file, which is
229 found in the Build Directory among the source code
230 used for the build.
231 Doing so, can produce unexpected results when the
232 OpenEmbedded build system regenerates the configuration
233 file.
234 </note>
235 Once you are satisfied with the configuration
236 changes made using <filename>menuconfig</filename>
237 and you have saved them, you can directly compare the
238 resulting <filename>.config</filename> file against an
239 existing original and gather those changes into a
240 <link linkend='creating-config-fragments'>configuration fragment file</link>
241 to be referenced from within the kernel's
242 <filename>.bbappend</filename> file.</para>
243
244 <para>Additionally, if you are working in a BSP layer
245 and need to modify the BSP's kernel's configuration,
246 you can use the
247 <ulink url='&YOCTO_DOCS_BSP_URL;#managing-kernel-patches-and-config-items-with-yocto-kernel'><filename>yocto-kernel</filename></ulink>
248 script as well as <filename>menuconfig</filename>.
249 The <filename>yocto-kernel</filename> script lets
250 you interactively set up kernel configurations.
251 </para></listitem>
252 <listitem><para>
253 <emphasis>Rebuild the Kernel Image With Your Changes:</emphasis>
254 Rebuilding the kernel image applies your changes.
255 Depending on your target hardware, you can verify your changes
256 on actual hardware or perhaps QEMU.
257 </para></listitem>
258 </orderedlist>
259 The remainder of this developer's guide covers common tasks typically
260 used during kernel development, advanced Metadata usage, and Yocto Linux
261 kernel maintenance concepts.
262 </para>
263</section>
264
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500265</chapter>
266<!--
267vim: expandtab tw=80 ts=4
268-->