diff options
Diffstat (limited to 'documentation/kernel-manual/kernel-concepts.xml')
-rw-r--r-- | documentation/kernel-manual/kernel-concepts.xml | 315 |
1 files changed, 315 insertions, 0 deletions
diff --git a/documentation/kernel-manual/kernel-concepts.xml b/documentation/kernel-manual/kernel-concepts.xml new file mode 100644 index 0000000000..b884f138e0 --- /dev/null +++ b/documentation/kernel-manual/kernel-concepts.xml | |||
@@ -0,0 +1,315 @@ | |||
1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | ||
2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | ||
3 | |||
4 | <chapter id='kernel-concepts'> | ||
5 | |||
6 | <title>Yocto Project Kernel Concepts</title> | ||
7 | |||
8 | <section id='concepts-org'> | ||
9 | <title>Introduction</title> | ||
10 | <para> | ||
11 | This chapter provides conceptual information about the Yocto Project kernel: | ||
12 | <itemizedlist> | ||
13 | <listitem><para>Kernel Goals</para></listitem> | ||
14 | <listitem><para>Yocto Project Kernel Development and Maintenance Overview</para></listitem> | ||
15 | <listitem><para>Kernel Architecture</para></listitem> | ||
16 | <listitem><para>Kernel Tools</para></listitem> | ||
17 | </itemizedlist> | ||
18 | </para> | ||
19 | </section> | ||
20 | |||
21 | <section id='kernel-goals'> | ||
22 | <title>Kernel Goals</title> | ||
23 | <para> | ||
24 | The complexity of embedded kernel design has increased dramatically. | ||
25 | Whether it is managing multiple implementations of a particular feature or tuning and | ||
26 | optimizing board specific features, flexibility and maintainability are key concerns. | ||
27 | The Yocto Project Linux kernel is presented with the embedded | ||
28 | developer's needs in mind and has evolved to assist in these key concerns. | ||
29 | For example, prior methods such as applying hundreds of patches to an extracted | ||
30 | tarball have been replaced with proven techniques that allow easy inspection, | ||
31 | bisection and analysis of changes. | ||
32 | Application of these techniques also creates a platform for performing integration and | ||
33 | collaboration with the thousands of upstream development projects. | ||
34 | </para> | ||
35 | <para> | ||
36 | With all these considerations in mind, the Yocto Project kernel and development team | ||
37 | strives to attain these goals: | ||
38 | <itemizedlist> | ||
39 | <listitem><para>Allow the end user to leverage community best practices to seamlessly | ||
40 | manage the development, build and debug cycles.</para></listitem> | ||
41 | <listitem><para>Create a platform for performing integration and collaboration with the | ||
42 | thousands of upstream development projects that exist.</para></listitem> | ||
43 | <listitem><para>Provide mechanisms that support many different work flows, front-ends and | ||
44 | management techniques.</para></listitem> | ||
45 | <listitem><para>Deliver the most up-to-date kernel possible while still ensuring that | ||
46 | the baseline kernel is the the most stable official release.</para></listitem> | ||
47 | <listitem><para>Include major technological features as part of Yocto Project's up-rev | ||
48 | strategy.</para></listitem> | ||
49 | <listitem><para>Present a git tree, that just like the upstream kernel.org tree, has a | ||
50 | clear and continuous history.</para></listitem> | ||
51 | <listitem><para>Deliver a key set of supported kernel types, where each type is tailored | ||
52 | to a specific use case (i.g. networking, consumer, devices, and so forth).</para></listitem> | ||
53 | <listitem><para>Employ a git branching strategy that from a customer's point of view | ||
54 | results in a linear path from the baseline kernel.org, through a select group of features and | ||
55 | ends with their BSP-specific commits.</para></listitem> | ||
56 | </itemizedlist> | ||
57 | </para> | ||
58 | </section> | ||
59 | |||
60 | <section id='kernel-big-picture'> | ||
61 | <title>Yocto Project Kernel Development and Maintenance Overview</title> | ||
62 | <para> | ||
63 | Yocto Project kernel, like other kernels, is based off the Linux kernel release | ||
64 | from <ulink url='http://www.kernel.org'></ulink>. | ||
65 | At the beginning of our major development cycle, we choose our Yocto Project kernel | ||
66 | based on factors like release timing, the anticipated release timing of "final" (i.e. non "rc") | ||
67 | upstream kernel.org versions, and Yocto Project feature requirements. | ||
68 | Typically this will be a kernel that is in the | ||
69 | final stages of development by the community (i.e. still in the release | ||
70 | candidate or "rc" phase) and not yet a final release. | ||
71 | But by being in the final stages of external development, we know that the | ||
72 | kernel.org final release will clearly land within the early stages of | ||
73 | the Yocto Project development window. | ||
74 | </para> | ||
75 | <para> | ||
76 | This balance allows us to deliver the most up-to-date kernel | ||
77 | as possible, while still ensuring that we have a stable official release as | ||
78 | our baseline kernel version. | ||
79 | </para> | ||
80 | <para> | ||
81 | The following figure represents the overall place the Yocto Project kernel fills. | ||
82 | </para> | ||
83 | <para> | ||
84 | <imagedata fileref="figures/kernel-big-picture.png" width="6in" depth="6in" align="center" scale="100" /> | ||
85 | </para> | ||
86 | <para> | ||
87 | In the figure the ultimate source for the Yocto Project kernel is a released kernel | ||
88 | from kernel.org. | ||
89 | In addition to a foundational kernel from kernel.org the commercially released | ||
90 | Yocto Project kernel contains a mix of important new mainline | ||
91 | developments, non-mainline developments, Board Support Package (BSP) developments, | ||
92 | and custom features. | ||
93 | These additions result in a commercially released Yocto Project kernel that caters | ||
94 | to specific embedded designer needs for targeted hardware. | ||
95 | </para> | ||
96 | <para> | ||
97 | Once a Yocto Project kernel is officially released the Yocto Project team goes into | ||
98 | their next development cycle, or "uprev" cycle. | ||
99 | It is important to note that the most sustainable and stable way | ||
100 | to include feature development upstream is through a kernel uprev process. | ||
101 | Back-porting of hundreds of individual fixes and minor features from various | ||
102 | kernel versions is not sustainable and can easily compromise quality. | ||
103 | During the uprev cycle, the Yocto Project team uses an ongoing analysis of | ||
104 | kernel development, BSP support, and release timing to select the best | ||
105 | possible kernel.org version. | ||
106 | The team continually monitors community kernel | ||
107 | development to look for significant features of interest. | ||
108 | The illustration depicts this by showing the team looking back to kernel.org for new features, | ||
109 | BSP features, and significant bug fixes. | ||
110 | The team does consider back-porting large features if they have a significant advantage. | ||
111 | User or community demand can also trigger a back-port or creation of new | ||
112 | functionality in the Yocto Project baseline kernel during the uprev cycle. | ||
113 | </para> | ||
114 | <para> | ||
115 | Generally speaking, every new kernel both adds features and introduces new bugs. | ||
116 | These consequences are the basic properties of upstream kernel development and are | ||
117 | managed by the Yocto Project team's kernel strategy. | ||
118 | It is the Yocto Project team's policy to not back-port minor features to the released kernel. | ||
119 | They only consider back-porting significant technological jumps - and, that is done | ||
120 | after a complete gap analysis. | ||
121 | The reason for this policy is that simply back-porting any small to medium sized change | ||
122 | from an evolving kernel can easily create mismatches, incompatibilities and very | ||
123 | subtle errors. | ||
124 | </para> | ||
125 | <para> | ||
126 | These policies result in both a stable and a cutting | ||
127 | edge kernel that mixes forward ports of existing features and significant and critical | ||
128 | new functionality. | ||
129 | Forward porting functionality in the Yocto Project kernel can be thought of as a | ||
130 | "micro uprev." | ||
131 | The many “micro uprevs” produce a kernel version with a mix of | ||
132 | important new mainline, non-mainline, BSP developments and feature integrations. | ||
133 | This kernel gives insight into new features and allows focused | ||
134 | amounts of testing to be done on the kernel, which prevents | ||
135 | surprises when selecting the next major uprev. | ||
136 | The quality of these cutting edge kernels is evolving and the kernels are used in very special | ||
137 | cases for BSP and feature development. | ||
138 | </para> | ||
139 | </section> | ||
140 | |||
141 | <section id='kernel-architecture'> | ||
142 | <title>Kernel Architecture</title> | ||
143 | <para> | ||
144 | This section describes the architecture of the Yocto Project kernel and provides information | ||
145 | on the mechanisms used to achieve that architecture. | ||
146 | </para> | ||
147 | |||
148 | <section id='architecture-overview'> | ||
149 | <title>Overview</title> | ||
150 | <para> | ||
151 | As mentioned earlier, a key goal of Yocto Project is to present the developer with | ||
152 | a kernel that has a clear and continuous history that is visible to the user. | ||
153 | The architecture and mechanisms used achieve that goal in a manner similar to the | ||
154 | upstream kernel.org. | ||
155 | |||
156 | </para> | ||
157 | <para> | ||
158 | You can think of the Yocto Project kernel as consisting of a baseline kernel with | ||
159 | added features logically structured on top of the baseline. | ||
160 | The features are tagged and organized by way of a branching strategy implemented by the | ||
161 | source code manager (SCM) git. | ||
162 | The result is that the user has the ability to see the added features and | ||
163 | the commits that make up those features. | ||
164 | In addition to being able to see added features, the user can also view the history of what | ||
165 | made up the baseline kernel as well. | ||
166 | </para> | ||
167 | <para> | ||
168 | The following illustration shows the conceptual Yocto Project kernel. | ||
169 | </para> | ||
170 | <para> | ||
171 | <imagedata fileref="figures/kernel-architecture-overview.png" width="6in" depth="7in" align="center" scale="100" /> | ||
172 | </para> | ||
173 | <para> | ||
174 | In the illustration, the "kernel.org Branch Point" marks the specific spot (or release) from | ||
175 | which the Yocto Project kernel is created. From this point "up" in the tree features and | ||
176 | differences are organized and tagged. | ||
177 | </para> | ||
178 | <para> | ||
179 | The "Yocto Project Baseline Kernel" contains functionality that is common to every kernel | ||
180 | type and BSP that is organized further up the tree. Placing these common features in the | ||
181 | tree this way means features don't have to be duplicated along individual branches of the | ||
182 | structure. | ||
183 | </para> | ||
184 | <para> | ||
185 | From the Yocto Project Baseline Kernel branch points represent specific functionality | ||
186 | for individual BSPs as well as real-time kernels. | ||
187 | The illustration represents this through three BSP-specific branches and a real-time | ||
188 | kernel branch. | ||
189 | Each branch represents some unique functionality for the BSP or a real-time kernel. | ||
190 | </para> | ||
191 | <para> | ||
192 | The real-time kernel branch has common features for all real-time kernels and contains | ||
193 | more branches for individual BSP-specific real-time kernels. | ||
194 | The illustration shows three branches as an example. | ||
195 | Each branch points the way to specific, unique features for a respective real-time | ||
196 | kernel as they apply to a given BSP. | ||
197 | </para> | ||
198 | <para> | ||
199 | The resulting tree structure presents a clear path of markers (or branches) to the user | ||
200 | that for all practical purposes is the kernel needed for any given set of requirements. | ||
201 | </para> | ||
202 | </section> | ||
203 | |||
204 | <section id='branching-and-workflow'> | ||
205 | <title>Branching Strategy and Workflow</title> | ||
206 | <para> | ||
207 | The Yocto Project team creates kernel branches at points where functionality is | ||
208 | no longer shared and thus, needs to be isolated. | ||
209 | For example, board-specific incompatibilities would require different functionality | ||
210 | and would require a branch to separate the features. | ||
211 | Likewise, for specific kernel features the same branching strategy is used. | ||
212 | This branching strategy results in a tree that has features organized to be specific | ||
213 | for particular functionality, single kernel types, or a subset of kernel types. | ||
214 | This strategy results in not having to store the same feature twice internally in the | ||
215 | tree. | ||
216 | Rather we store the unique differences required to apply the feature onto the kernel type | ||
217 | in question. | ||
218 | </para> | ||
219 | <para> | ||
220 | BSP-specific code additions are handled in a similar manner to kernel-specific additions. | ||
221 | Some BSPs only make sense given certain kernel types. | ||
222 | So, for these types, we create branches off the end of that kernel type for all | ||
223 | of the BSPs that are supported on that kernel type. | ||
224 | From the perspective of the tools that create the BSP branch, the BSP is really no | ||
225 | different than a feature. | ||
226 | Consequently, the same branching strategy applies to BSPs as it does to features. | ||
227 | So again, rather than store the BSP twice, only the unique differences for the BSP across | ||
228 | the supported multiple kernels are uniquely stored. | ||
229 | </para> | ||
230 | <para> | ||
231 | While this strategy results in a tree with a significant number of branches, it is | ||
232 | important to realize that from the customer's point of view, there is a linear | ||
233 | path that travels from the baseline kernel.org, through a select group of features and | ||
234 | ends with their BSP-specific commits. | ||
235 | In other words, the divisions of the kernel are transparent and are not relevant | ||
236 | to the developer on a day-to-day basis. | ||
237 | From the customer's perspective, this is the "master" branch. | ||
238 | They do not need not be aware of the existence of any other branches at all. | ||
239 | Of course there is value in the existence of these branches | ||
240 | in the tree, should a person decide to explore them. | ||
241 | For example, a comparison between two BSPs at either the commit level or at the line-by-line | ||
242 | code diff level is now a trivial operation. | ||
243 | </para> | ||
244 | <para> | ||
245 | Working with the kernel as a structured tree follows recognized community best practices. | ||
246 | In particular, the kernel as shipped with the product should be | ||
247 | considered an 'upstream source' and viewed as a series of | ||
248 | historical and documented modifications (commits). | ||
249 | These modifications represent the development and stabilization done | ||
250 | by the Yocto Project kernel development team. | ||
251 | </para> | ||
252 | <para> | ||
253 | Because commits only change at significant release points in the product life cycle, | ||
254 | developers can work on a branch created | ||
255 | from the last relevant commit in the shipped Yocto Project kernel. | ||
256 | As mentioned previously, the structure is transparent to the user | ||
257 | because the kernel tree is left in this state after cloning and building the kernel. | ||
258 | </para> | ||
259 | </section> | ||
260 | |||
261 | <section id='source-code-manager-git'> | ||
262 | <title>Source Code Manager - git</title> | ||
263 | <para> | ||
264 | The Source Code Manager (SCM) is git and it is the obvious mechanism for meeting the | ||
265 | previously mentioned goals. | ||
266 | Not only is it the SCM for kernel.org but git continues to grow in popularity and | ||
267 | supports many different work flows, front-ends and management techniques. | ||
268 | </para> | ||
269 | <note><para> | ||
270 | It should be noted that you can use as much, or as little, of what git has to offer | ||
271 | as is appropriate to your project. | ||
272 | </para></note> | ||
273 | </section> | ||
274 | </section> | ||
275 | |||
276 | <section id='kernel-tools'> | ||
277 | <title>Kernel Tools</title> | ||
278 | <para> | ||
279 | Since most standard workflows involve moving forward with an existing tree by | ||
280 | continuing to add and alter the underlying baseline, the tools that manage | ||
281 | Yocto Project's kernel construction are largely hidden from the developer to | ||
282 | present a simplified view of the kernel for ease of use. | ||
283 | </para> | ||
284 | <para> | ||
285 | The fundamental properties of the tools that manage and construct the | ||
286 | kernel are: | ||
287 | <itemizedlist> | ||
288 | <listitem><para>the ability to group patches into named, reusable features</para></listitem> | ||
289 | <listitem><para>to allow top down control of included features</para></listitem> | ||
290 | <listitem><para>the binding of kernel configuration to kernel patches/features</para></listitem> | ||
291 | <listitem><para>the presentation of a seamless git repository that blends Yocto Project value with the kernel.org history and development</para></listitem> | ||
292 | </itemizedlist> | ||
293 | </para> | ||
294 | <!--<para> | ||
295 | The tools that construct a kernel tree will be discussed later in this | ||
296 | document. The following tools form the foundation of the Yocto Project | ||
297 | kernel toolkit: | ||
298 | <itemizedlist> | ||
299 | <listitem><para>git : distributed revision control system created by Linus Torvalds</para></listitem> | ||
300 | <listitem><para>guilt: quilt on top of git</para></listitem> | ||
301 | <listitem><para>*cfg : kernel configuration management and classification</para></listitem> | ||
302 | <listitem><para>kgit*: Yocto Project kernel tree creation and management tools</para></listitem> | ||
303 | <listitem><para>scc : series & configuration compiler</para></listitem> | ||
304 | </itemizedlist> | ||
305 | </para> --> | ||
306 | </section> | ||
307 | |||
308 | |||
309 | |||
310 | |||
311 | |||
312 | </chapter> | ||
313 | <!-- | ||
314 | vim: expandtab tw=80 ts=4 | ||
315 | --> | ||