Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | <!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 | <appendix id='kernel-dev-concepts-appx'> |
| 6 | <title>Advanced Kernel Concepts</title> |
| 7 | |
| 8 | <section id='kernel-big-picture'> |
| 9 | <title>Yocto Project Kernel Development and Maintenance</title> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 10 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 12 | Kernels available through the Yocto Project (Yocto Linux kernels), |
| 13 | like other kernels, are based off the Linux kernel releases from |
| 14 | <ulink url='http://www.kernel.org'></ulink>. |
| 15 | At the beginning of a major Linux kernel development cycle, the |
| 16 | Yocto Project team chooses a Linux kernel based on factors such as |
| 17 | release timing, the anticipated release timing of final upstream |
| 18 | <filename>kernel.org</filename> versions, and Yocto Project |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | feature requirements. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 20 | Typically, the Linux kernel chosen is in the final stages of |
| 21 | development by the Linux community. |
| 22 | In other words, the Linux kernel is in the release candidate |
| 23 | or "rc" phase and has yet to reach final release. |
| 24 | But, by being in the final stages of external development, the |
| 25 | team knows that the <filename>kernel.org</filename> final release |
| 26 | will clearly be within the early stages of the Yocto Project |
| 27 | development window. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 29 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 31 | This balance allows the Yocto Project team to deliver the most |
| 32 | up-to-date Yocto Linux kernel possible, while still ensuring that |
| 33 | the team has a stable official release for the baseline Linux |
| 34 | kernel version. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 38 | As implied earlier, the ultimate source for Yocto Linux kernels |
| 39 | are released kernels from <filename>kernel.org</filename>. |
| 40 | In addition to a foundational kernel from |
| 41 | <filename>kernel.org</filename>, the available Yocto Linux kernels |
| 42 | contain a mix of important new mainline developments, non-mainline |
| 43 | developments (when no alternative exists), Board Support Package |
| 44 | (BSP) developments, and custom features. |
| 45 | These additions result in a commercially released Yocto |
| 46 | Project Linux kernel that caters to specific embedded designer |
| 47 | needs for targeted hardware. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 49 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 51 | You can find a web interface to the Yocto Linux kernels in the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 52 | <ulink url='&YOCTO_DOCS_OM_URL;#source-repositories'>Source Repositories</ulink> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 53 | at |
| 54 | <ulink url='&YOCTO_GIT_URL;'></ulink>. |
| 55 | If you look at the interface, you will see to the left a |
| 56 | grouping of Git repositories titled "Yocto Linux Kernel". |
| 57 | Within this group, you will find several Linux Yocto kernels |
| 58 | developed and included with Yocto Project releases: |
| 59 | <itemizedlist> |
| 60 | <listitem><para> |
| 61 | <emphasis><filename>linux-yocto-4.1</filename>:</emphasis> |
| 62 | The stable Yocto Project kernel to use with the Yocto |
| 63 | Project Release 2.0. |
| 64 | This kernel is based on the Linux 4.1 released kernel. |
| 65 | </para></listitem> |
| 66 | <listitem><para> |
| 67 | <emphasis><filename>linux-yocto-4.4</filename>:</emphasis> |
| 68 | The stable Yocto Project kernel to use with the Yocto |
| 69 | Project Release 2.1. |
| 70 | This kernel is based on the Linux 4.4 released kernel. |
| 71 | </para></listitem> |
| 72 | <listitem><para> |
| 73 | <emphasis><filename>linux-yocto-4.6</filename>:</emphasis> |
| 74 | A temporary kernel that is not tied to any Yocto Project |
| 75 | release. |
| 76 | </para></listitem> |
| 77 | <listitem><para> |
| 78 | <emphasis><filename>linux-yocto-4.8</filename>:</emphasis> |
| 79 | The stable yocto Project kernel to use with the Yocto |
| 80 | Project Release 2.2. |
| 81 | </para></listitem> |
| 82 | <listitem><para> |
| 83 | <emphasis><filename>linux-yocto-4.9</filename>:</emphasis> |
| 84 | The stable Yocto Project kernel to use with the Yocto |
| 85 | Project Release 2.3. |
| 86 | This kernel is based on the Linux 4.9 released kernel. |
| 87 | </para></listitem> |
| 88 | <listitem><para> |
| 89 | <emphasis><filename>linux-yocto-4.10</filename>:</emphasis> |
| 90 | The default stable Yocto Project kernel to use with the |
| 91 | Yocto Project Release 2.3. |
| 92 | This kernel is based on the Linux 4.10 released kernel. |
| 93 | </para></listitem> |
| 94 | <listitem><para> |
| 95 | <emphasis><filename>linux-yocto-4.12</filename>:</emphasis> |
| 96 | The default stable Yocto Project kernel to use with the |
| 97 | Yocto Project Release 2.4. |
| 98 | This kernel is based on the Linux 4.12 released kernel. |
| 99 | </para></listitem> |
| 100 | <listitem><para> |
| 101 | <emphasis><filename>yocto-kernel-cache</filename>:</emphasis> |
| 102 | The <filename>linux-yocto-cache</filename> contains |
| 103 | patches and configurations for the linux-yocto kernel |
| 104 | tree. |
| 105 | This repository is useful when working on the linux-yocto |
| 106 | kernel. |
| 107 | For more information on this "Advanced Kernel Metadata", |
| 108 | see the |
| 109 | "<link linkend='kernel-dev-advanced'>Working With Advanced Metadata (<filename>yocto-kernel-cache</filename>)</link>" |
| 110 | Chapter. |
| 111 | </para></listitem> |
| 112 | <listitem><para> |
| 113 | <emphasis><filename>linux-yocto-dev</filename>:</emphasis> |
| 114 | A development kernel based on the latest upstream release |
| 115 | candidate available. |
| 116 | </para></listitem> |
| 117 | </itemizedlist> |
| 118 | <note><title>Notes</title> |
| 119 | Long Term Support Initiative (LTSI) for Yocto Linux |
| 120 | kernels is as follows: |
| 121 | <itemizedlist> |
| 122 | <listitem><para> |
| 123 | For Yocto Project releases 1.7, 1.8, and 2.0, |
| 124 | the LTSI kernel is |
| 125 | <filename>linux-yocto-3.14</filename>. |
| 126 | </para></listitem> |
| 127 | <listitem><para> |
| 128 | For Yocto Project releases 2.1, 2.2, and 2.3, |
| 129 | the LTSI kernel is <filename>linux-yocto-4.1</filename>. |
| 130 | </para></listitem> |
| 131 | <listitem><para> |
| 132 | For Yocto Project release 2.4, the LTSI kernel is |
| 133 | <filename>linux-yocto-4.9</filename> |
| 134 | </para></listitem> |
| 135 | <listitem><para> |
| 136 | <filename>linux-yocto-4.4</filename> is an LTS |
| 137 | kernel. |
| 138 | </para></listitem> |
| 139 | </itemizedlist> |
| 140 | </note> |
| 141 | </para> |
| 142 | |
| 143 | <para> |
| 144 | Once a Yocto Linux kernel is officially released, the Yocto |
| 145 | Project team goes into their next development cycle, or upward |
| 146 | revision (uprev) cycle, while still continuing maintenance on the |
| 147 | released kernel. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 148 | It is important to note that the most sustainable and stable way |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 149 | to include feature development upstream is through a kernel uprev |
| 150 | process. |
| 151 | Back-porting hundreds of individual fixes and minor features from |
| 152 | various kernel versions is not sustainable and can easily |
| 153 | compromise quality. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 154 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 155 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 156 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 157 | During the uprev cycle, the Yocto Project team uses an ongoing |
| 158 | analysis of Linux kernel development, BSP support, and release |
| 159 | timing to select the best possible <filename>kernel.org</filename> |
| 160 | Linux kernel version on which to base subsequent Yocto Linux |
| 161 | kernel development. |
| 162 | The team continually monitors Linux community kernel development |
| 163 | to look for significant features of interest. |
| 164 | The team does consider back-porting large features if they have a |
| 165 | significant advantage. |
| 166 | User or community demand can also trigger a back-port or creation |
| 167 | of new functionality in the Yocto Project baseline kernel during |
| 168 | the uprev cycle. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 169 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 170 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 171 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 172 | Generally speaking, every new Linux kernel both adds features and |
| 173 | introduces new bugs. |
| 174 | These consequences are the basic properties of upstream |
| 175 | Linux kernel development and are managed by the Yocto Project |
| 176 | team's Yocto Linux kernel development strategy. |
| 177 | It is the Yocto Project team's policy to not back-port minor |
| 178 | features to the released Yocto Linux kernel. |
| 179 | They only consider back-porting significant technological |
| 180 | jumps ‐ and, that is done after a complete gap analysis. |
| 181 | The reason for this policy is that back-porting any small to |
| 182 | medium sized change from an evolving Linux kernel can easily |
| 183 | create mismatches, incompatibilities and very subtle errors. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 184 | </para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 185 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 186 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 187 | The policies described in this section result in both a stable |
| 188 | and a cutting edge Yocto Linux kernel that mixes forward ports of |
| 189 | existing Linux kernel features and significant and critical new |
| 190 | functionality. |
| 191 | Forward porting Linux kernel functionality into the Yocto Linux |
| 192 | kernels available through the Yocto Project can be thought of as |
| 193 | a "micro uprev." |
| 194 | The many “micro uprevs” produce a Yocto Linux kernel version with |
| 195 | a mix of important new mainline, non-mainline, BSP developments |
| 196 | and feature integrations. |
| 197 | This Yocto Linux kernel gives insight into new features and |
| 198 | allows focused amounts of testing to be done on the kernel, |
| 199 | which prevents surprises when selecting the next major uprev. |
| 200 | The quality of these cutting edge Yocto Linux kernels is evolving |
| 201 | and the kernels are used in leading edge feature and BSP |
| 202 | development. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 203 | </para> |
| 204 | </section> |
| 205 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 206 | <section id='yocto-linux-kernel-architecture-and-branching-strategies'> |
| 207 | <title>Yocto Linux Kernel Architecture and Branching Strategies</title> |
| 208 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 209 | <para> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 210 | As mentioned earlier, a key goal of the Yocto Project is |
| 211 | to present the developer with a kernel that has a clear and |
| 212 | continuous history that is visible to the user. |
| 213 | The architecture and mechanisms, in particular the branching |
| 214 | strategies, used achieve that goal in a manner similar to |
| 215 | upstream Linux kernel development in |
| 216 | <filename>kernel.org</filename>. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 217 | </para> |
| 218 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 219 | <para> |
| 220 | You can think of a Yocto Linux kernel as consisting of a |
| 221 | baseline Linux kernel with added features logically structured |
| 222 | on top of the baseline. |
| 223 | The features are tagged and organized by way of a branching |
| 224 | strategy implemented by the Yocto Project team using the |
| 225 | Source Code Manager (SCM) Git. |
| 226 | <note><title>Notes</title> |
| 227 | <itemizedlist> |
| 228 | <listitem><para> |
| 229 | Git is the obvious SCM for meeting the Yocto Linux |
| 230 | kernel organizational and structural goals described |
| 231 | in this section. |
| 232 | Not only is Git the SCM for Linux kernel development in |
| 233 | <filename>kernel.org</filename> but, Git continues to |
| 234 | grow in popularity and supports many different work |
| 235 | flows, front-ends and management techniques. |
| 236 | </para></listitem> |
| 237 | <listitem><para> |
| 238 | You can find documentation on Git at |
| 239 | <ulink url='http://git-scm.com/documentation'></ulink>. |
| 240 | You can also get an introduction to Git as it |
| 241 | applies to the Yocto Project in the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 242 | "<ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>" |
| 243 | section in the Yocto Project Overview and Concepts |
| 244 | Manual. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 245 | The latter reference provides an overview of |
| 246 | Git and presents a minimal set of Git commands |
| 247 | that allows you to be functional using Git. |
| 248 | You can use as much, or as little, of what Git |
| 249 | has to offer to accomplish what you need for your |
| 250 | project. |
| 251 | You do not have to be a "Git Expert" in order to |
| 252 | use it with the Yocto Project. |
| 253 | </para></listitem> |
| 254 | </itemizedlist> |
| 255 | </note> |
| 256 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 257 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 258 | <para> |
| 259 | Using Git's tagging and branching features, the Yocto Project |
| 260 | team creates kernel branches at points where functionality is |
| 261 | no longer shared and thus, needs to be isolated. |
| 262 | For example, board-specific incompatibilities would require |
| 263 | different functionality and would require a branch to |
| 264 | separate the features. |
| 265 | Likewise, for specific kernel features, the same branching |
| 266 | strategy is used. |
| 267 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 268 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 269 | <para> |
| 270 | This "tree-like" architecture results in a structure that has |
| 271 | features organized to be specific for particular functionality, |
| 272 | single kernel types, or a subset of kernel types. |
| 273 | Thus, the user has the ability to see the added features and the |
| 274 | commits that make up those features. |
| 275 | In addition to being able to see added features, the user |
| 276 | can also view the history of what made up the baseline |
| 277 | Linux kernel. |
| 278 | </para> |
| 279 | |
| 280 | <para> |
| 281 | Another consequence of this strategy results in not having to |
| 282 | store the same feature twice internally in the tree. |
| 283 | Rather, the kernel team stores the unique differences required |
| 284 | to apply the feature onto the kernel type in question. |
| 285 | <note> |
| 286 | The Yocto Project team strives to place features in the tree |
| 287 | such that features can be shared by all boards and kernel |
| 288 | types where possible. |
| 289 | However, during development cycles or when large features |
| 290 | are merged, the team cannot always follow this practice. |
| 291 | In those cases, the team uses isolated branches to merge |
| 292 | features. |
| 293 | </note> |
| 294 | </para> |
| 295 | |
| 296 | <para> |
| 297 | BSP-specific code additions are handled in a similar manner to |
| 298 | kernel-specific additions. |
| 299 | Some BSPs only make sense given certain kernel types. |
| 300 | So, for these types, the team creates branches off the end |
| 301 | of that kernel type for all of the BSPs that are supported on |
| 302 | that kernel type. |
| 303 | From the perspective of the tools that create the BSP branch, |
| 304 | the BSP is really no different than a feature. |
| 305 | Consequently, the same branching strategy applies to BSPs as |
| 306 | it does to kernel features. |
| 307 | So again, rather than store the BSP twice, the team only |
| 308 | stores the unique differences for the BSP across the supported |
| 309 | multiple kernels. |
| 310 | </para> |
| 311 | |
| 312 | <para> |
| 313 | While this strategy can result in a tree with a significant number |
| 314 | of branches, it is important to realize that from the developer's |
| 315 | point of view, there is a linear path that travels from the |
| 316 | baseline <filename>kernel.org</filename>, through a select |
| 317 | group of features and ends with their BSP-specific commits. |
| 318 | In other words, the divisions of the kernel are transparent and |
| 319 | are not relevant to the developer on a day-to-day basis. |
| 320 | From the developer's perspective, this path is the "master" branch |
| 321 | in Git terms. |
| 322 | The developer does not need to be aware of the existence of any |
| 323 | other branches at all. |
| 324 | Of course, value exists in the having these branches in the tree, |
| 325 | should a person decide to explore them. |
| 326 | For example, a comparison between two BSPs at either the commit |
| 327 | level or at the line-by-line code <filename>diff</filename> level |
| 328 | is now a trivial operation. |
| 329 | </para> |
| 330 | |
| 331 | <para> |
| 332 | The following illustration shows the conceptual Yocto |
| 333 | Linux kernel. |
| 334 | <imagedata fileref="figures/kernel-architecture-overview.png" width="6in" depth="7in" align="center" scale="100" /> |
| 335 | </para> |
| 336 | |
| 337 | <para> |
| 338 | In the illustration, the "Kernel.org Branch Point" marks the |
| 339 | specific spot (or Linux kernel release) from which the |
| 340 | Yocto Linux kernel is created. |
| 341 | From this point forward in the tree, features and differences |
| 342 | are organized and tagged. |
| 343 | </para> |
| 344 | |
| 345 | <para> |
| 346 | The "Yocto Project Baseline Kernel" contains functionality that |
| 347 | is common to every kernel type and BSP that is organized |
| 348 | further along in the tree. |
| 349 | Placing these common features in the tree this way means |
| 350 | features do not have to be duplicated along individual |
| 351 | branches of the tree structure. |
| 352 | </para> |
| 353 | |
| 354 | <para> |
| 355 | From the "Yocto Project Baseline Kernel", branch points represent |
| 356 | specific functionality for individual Board Support Packages |
| 357 | (BSPs) as well as real-time kernels. |
| 358 | The illustration represents this through three BSP-specific |
| 359 | branches and a real-time kernel branch. |
| 360 | Each branch represents some unique functionality for the BSP |
| 361 | or for a real-time Yocto Linux kernel. |
| 362 | </para> |
| 363 | |
| 364 | <para> |
| 365 | In this example structure, the "Real-time (rt) Kernel" branch has |
| 366 | common features for all real-time Yocto Linux kernels and |
| 367 | contains more branches for individual BSP-specific real-time |
| 368 | kernels. |
| 369 | The illustration shows three branches as an example. |
| 370 | Each branch points the way to specific, unique features for a |
| 371 | respective real-time kernel as they apply to a given BSP. |
| 372 | </para> |
| 373 | |
| 374 | <para> |
| 375 | The resulting tree structure presents a clear path of markers |
| 376 | (or branches) to the developer that, for all practical |
| 377 | purposes, is the Yocto Linux kernel needed for any given set of |
| 378 | requirements. |
| 379 | <note> |
| 380 | Keep in mind the figure does not take into account all the |
| 381 | supported Yocto Linux kernels, but rather shows a single |
| 382 | generic kernel just for conceptual purposes. |
| 383 | Also keep in mind that this structure represents the Yocto |
| 384 | Project |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 385 | <ulink url='&YOCTO_DOCS_OM_URL;#source-repositories'>Source Repositories</ulink> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 386 | that are either pulled from during the build or established |
| 387 | on the host development system prior to the build by either |
| 388 | cloning a particular kernel's Git repository or by |
| 389 | downloading and unpacking a tarball. |
| 390 | </note> |
| 391 | </para> |
| 392 | |
| 393 | <para> |
| 394 | Working with the kernel as a structured tree follows recognized |
| 395 | community best practices. |
| 396 | In particular, the kernel as shipped with the product, should be |
| 397 | considered an "upstream source" and viewed as a series of |
| 398 | historical and documented modifications (commits). |
| 399 | These modifications represent the development and stabilization |
| 400 | done by the Yocto Project kernel development team. |
| 401 | </para> |
| 402 | |
| 403 | <para> |
| 404 | Because commits only change at significant release points in the |
| 405 | product life cycle, developers can work on a branch created |
| 406 | from the last relevant commit in the shipped Yocto Project Linux |
| 407 | kernel. |
| 408 | As mentioned previously, the structure is transparent to the |
| 409 | developer because the kernel tree is left in this state after |
| 410 | cloning and building the kernel. |
| 411 | </para> |
| 412 | </section> |
| 413 | |
| 414 | <section id='kernel-build-file-hierarchy'> |
| 415 | <title>Kernel Build File Hierarchy</title> |
| 416 | |
| 417 | <para> |
| 418 | Upstream storage of all the available kernel source code is |
| 419 | one thing, while representing and using the code on your host |
| 420 | development system is another. |
| 421 | Conceptually, you can think of the kernel source repositories |
| 422 | as all the source files necessary for all the supported |
| 423 | Yocto Linux kernels. |
| 424 | As a developer, you are just interested in the source files |
| 425 | for the kernel on which you are working. |
| 426 | And, furthermore, you need them available on your host system. |
| 427 | </para> |
| 428 | |
| 429 | <para> |
| 430 | Kernel source code is available on your host system several |
| 431 | different ways: |
| 432 | <itemizedlist> |
| 433 | <listitem><para> |
| 434 | <emphasis>Files Accessed While using <filename>devtool</filename>:</emphasis> |
| 435 | <filename>devtool</filename>, which is available with the |
| 436 | Yocto Project, is the preferred method by which to |
| 437 | modify the kernel. |
| 438 | See the |
| 439 | "<link linkend='kernel-modification-workflow'>Kernel Modification Workflow</link>" |
| 440 | section. |
| 441 | </para></listitem> |
| 442 | <listitem><para> |
| 443 | <emphasis>Cloned Repository:</emphasis> |
| 444 | If you are working in the kernel all the time, you probably |
| 445 | would want to set up your own local Git repository of the |
| 446 | Yocto Linux kernel tree. |
| 447 | For information on how to clone a Yocto Linux kernel |
| 448 | Git repository, see the |
| 449 | "<link linkend='preparing-the-build-host-to-work-on-the-kernel'>Preparing the Build Host to Work on the Kernel</link>" |
| 450 | section. |
| 451 | </para></listitem> |
| 452 | <listitem><para> |
| 453 | <emphasis>Temporary Source Files from a Build:</emphasis> |
| 454 | If you just need to make some patches to the kernel using |
| 455 | a traditional BitBake workflow (i.e. not using the |
| 456 | <filename>devtool</filename>), you can access temporary |
| 457 | kernel source files that were extracted and used during |
| 458 | a kernel build. |
| 459 | </para></listitem> |
| 460 | </itemizedlist> |
| 461 | </para> |
| 462 | |
| 463 | <para> |
| 464 | The temporary kernel source files resulting from a build using |
| 465 | BitBake have a particular hierarchy. |
| 466 | When you build the kernel on your development system, all files |
| 467 | needed for the build are taken from the source repositories |
| 468 | pointed to by the |
| 469 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
| 470 | variable and gathered in a temporary work area where they are |
| 471 | subsequently used to create the unique kernel. |
| 472 | Thus, in a sense, the process constructs a local source tree |
| 473 | specific to your kernel from which to generate the new kernel |
| 474 | image. |
| 475 | </para> |
| 476 | |
| 477 | <para> |
| 478 | The following figure shows the temporary file structure |
| 479 | created on your host system when you build the kernel using |
| 480 | Bitbake. |
| 481 | This |
| 482 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
| 483 | contains all the source files used during the build. |
| 484 | <imagedata fileref="figures/kernel-overview-2-generic.png" |
| 485 | width="6in" depth="5in" align="center" scale="100" /> |
| 486 | </para> |
| 487 | |
| 488 | <para> |
| 489 | Again, for additional information on the Yocto Project kernel's |
| 490 | architecture and its branching strategy, see the |
| 491 | "<link linkend='yocto-linux-kernel-architecture-and-branching-strategies'>Yocto Linux Kernel Architecture and Branching Strategies</link>" |
| 492 | section. |
| 493 | You can also reference the |
| 494 | "<link linkend='using-devtool-to-patch-the-kernel'>Using <filename>devtool</filename> to Patch the Kernel</link>" |
| 495 | and |
| 496 | "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>" |
| 497 | sections for detailed example that modifies the kernel. |
| 498 | </para> |
| 499 | </section> |
| 500 | |
| 501 | <section id='determining-hardware-and-non-hardware-features-for-the-kernel-configuration-audit-phase'> |
| 502 | <title>Determining Hardware and Non-Hardware Features for the Kernel Configuration Audit Phase</title> |
| 503 | |
| 504 | <para> |
| 505 | This section describes part of the kernel configuration audit |
| 506 | phase that most developers can ignore. |
| 507 | For general information on kernel configuration including |
| 508 | <filename>menuconfig</filename>, <filename>defconfig</filename> |
| 509 | files, and configuration fragments, see the |
| 510 | "<link linkend='configuring-the-kernel'>Configuring the Kernel</link>" |
| 511 | section. |
| 512 | </para> |
| 513 | |
| 514 | <para> |
| 515 | During this part of the audit phase, the contents of the final |
| 516 | <filename>.config</filename> file are compared against the |
| 517 | fragments specified by the system. |
| 518 | These fragments can be system fragments, distro fragments, |
| 519 | or user-specified configuration elements. |
| 520 | Regardless of their origin, the OpenEmbedded build system |
| 521 | warns the user if a specific option is not included in the |
| 522 | final kernel configuration. |
| 523 | </para> |
| 524 | |
| 525 | <para> |
| 526 | By default, in order to not overwhelm the user with |
| 527 | configuration warnings, the system only reports missing |
| 528 | "hardware" options as they could result in a boot |
| 529 | failure or indicate that important hardware is not available. |
| 530 | </para> |
| 531 | |
| 532 | <para> |
| 533 | To determine whether or not a given option is "hardware" or |
| 534 | "non-hardware", the kernel Metadata in |
| 535 | <filename>yocto-kernel-cache</filename> contains files that |
| 536 | classify individual or groups of options as either hardware |
| 537 | or non-hardware. |
| 538 | To better show this, consider a situation where the |
| 539 | <filename>yocto-kernel-cache</filename> contains the following |
| 540 | files: |
| 541 | <literallayout class='monospaced'> |
| 542 | yocto-kernel-cache/features/drm-psb/hardware.cfg |
| 543 | yocto-kernel-cache/features/kgdb/hardware.cfg |
| 544 | yocto-kernel-cache/ktypes/base/hardware.cfg |
| 545 | yocto-kernel-cache/bsp/mti-malta32/hardware.cfg |
| 546 | yocto-kernel-cache/bsp/fsl-mpc8315e-rdb/hardware.cfg |
| 547 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.cfg |
| 548 | yocto-kernel-cache/bsp/qemuarma9/hardware.cfg |
| 549 | yocto-kernel-cache/bsp/mti-malta64/hardware.cfg |
| 550 | yocto-kernel-cache/bsp/arm-versatile-926ejs/hardware.cfg |
| 551 | yocto-kernel-cache/bsp/common-pc/hardware.cfg |
| 552 | yocto-kernel-cache/bsp/common-pc-64/hardware.cfg |
| 553 | yocto-kernel-cache/features/rfkill/non-hardware.cfg |
| 554 | yocto-kernel-cache/ktypes/base/non-hardware.cfg |
| 555 | yocto-kernel-cache/features/aufs/non-hardware.kcf |
| 556 | yocto-kernel-cache/features/ocf/non-hardware.kcf |
| 557 | yocto-kernel-cache/ktypes/base/non-hardware.kcf |
| 558 | yocto-kernel-cache/ktypes/base/hardware.kcf |
| 559 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.kcf |
| 560 | </literallayout> |
| 561 | The following list provides explanations for the various |
| 562 | files: |
| 563 | <itemizedlist> |
| 564 | <listitem><para> |
| 565 | <filename>hardware.kcf</filename>: |
| 566 | Specifies a list of kernel Kconfig files that contain |
| 567 | hardware options only. |
| 568 | </para></listitem> |
| 569 | <listitem><para> |
| 570 | <filename>non-hardware.kcf</filename>: |
| 571 | Specifies a list of kernel Kconfig files that contain |
| 572 | non-hardware options only. |
| 573 | </para></listitem> |
| 574 | <listitem><para> |
| 575 | <filename>hardware.cfg</filename>: |
| 576 | Specifies a list of kernel <filename>CONFIG_</filename> |
| 577 | options that are hardware, regardless of whether or not |
| 578 | they are within a Kconfig file specified by a hardware |
| 579 | or non-hardware Kconfig file (i.e. |
| 580 | <filename>hardware.kcf</filename> or |
| 581 | <filename>non-hardware.kcf</filename>). |
| 582 | </para></listitem> |
| 583 | <listitem><para> |
| 584 | <filename>non-hardware.cfg</filename>: |
| 585 | Specifies a list of kernel <filename>CONFIG_</filename> |
| 586 | options that are not hardware, regardless of whether or |
| 587 | not they are within a Kconfig file specified by a |
| 588 | hardware or non-hardware Kconfig file (i.e. |
| 589 | <filename>hardware.kcf</filename> or |
| 590 | <filename>non-hardware.kcf</filename>). |
| 591 | </para></listitem> |
| 592 | </itemizedlist> |
| 593 | Here is a specific example using the |
| 594 | <filename>kernel-cache/bsp/mti-malta32/hardware.cfg</filename>: |
| 595 | <literallayout class='monospaced'> |
| 596 | CONFIG_SERIAL_8250 |
| 597 | CONFIG_SERIAL_8250_CONSOLE |
| 598 | CONFIG_SERIAL_8250_NR_UARTS |
| 599 | CONFIG_SERIAL_8250_PCI |
| 600 | CONFIG_SERIAL_CORE |
| 601 | CONFIG_SERIAL_CORE_CONSOLE |
| 602 | CONFIG_VGA_ARB |
| 603 | </literallayout> |
| 604 | The kernel configuration audit automatically detects these |
| 605 | files (hence the names must be exactly the ones discussed here), |
| 606 | and uses them as inputs when generating warnings about the |
| 607 | final <filename>.config</filename> file. |
| 608 | </para> |
| 609 | |
| 610 | <para> |
| 611 | A user-specified kernel Metadata repository, or recipe space |
| 612 | feature, can use these same files to classify options that are |
| 613 | found within its <filename>.cfg</filename> files as hardware |
| 614 | or non-hardware, to prevent the OpenEmbedded build system from |
| 615 | producing an error or warning when an option is not in the |
| 616 | final <filename>.config</filename> file. |
| 617 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 618 | </section> |
| 619 | </appendix> |
| 620 | <!-- |
| 621 | vim: expandtab tw=80 ts=4 |
| 622 | --> |