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 |
| 52 | <ulink url='&YOCTO_DOCS_REF_URL;#source-repositories'>Source Repositories</ulink> |
| 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 |
| 242 | "<ulink url='&YOCTO_DOCS_REF_URL;#git'>Git</ulink>" |
| 243 | section in the Yocto Project Reference Manual. |
| 244 | The latter reference provides an overview of |
| 245 | Git and presents a minimal set of Git commands |
| 246 | that allows you to be functional using Git. |
| 247 | You can use as much, or as little, of what Git |
| 248 | has to offer to accomplish what you need for your |
| 249 | project. |
| 250 | You do not have to be a "Git Expert" in order to |
| 251 | use it with the Yocto Project. |
| 252 | </para></listitem> |
| 253 | </itemizedlist> |
| 254 | </note> |
| 255 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 256 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 257 | <para> |
| 258 | Using Git's tagging and branching features, the Yocto Project |
| 259 | team creates kernel branches at points where functionality is |
| 260 | no longer shared and thus, needs to be isolated. |
| 261 | For example, board-specific incompatibilities would require |
| 262 | different functionality and would require a branch to |
| 263 | separate the features. |
| 264 | Likewise, for specific kernel features, the same branching |
| 265 | strategy is used. |
| 266 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 267 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 268 | <para> |
| 269 | This "tree-like" architecture results in a structure that has |
| 270 | features organized to be specific for particular functionality, |
| 271 | single kernel types, or a subset of kernel types. |
| 272 | Thus, the user has the ability to see the added features and the |
| 273 | commits that make up those features. |
| 274 | In addition to being able to see added features, the user |
| 275 | can also view the history of what made up the baseline |
| 276 | Linux kernel. |
| 277 | </para> |
| 278 | |
| 279 | <para> |
| 280 | Another consequence of this strategy results in not having to |
| 281 | store the same feature twice internally in the tree. |
| 282 | Rather, the kernel team stores the unique differences required |
| 283 | to apply the feature onto the kernel type in question. |
| 284 | <note> |
| 285 | The Yocto Project team strives to place features in the tree |
| 286 | such that features can be shared by all boards and kernel |
| 287 | types where possible. |
| 288 | However, during development cycles or when large features |
| 289 | are merged, the team cannot always follow this practice. |
| 290 | In those cases, the team uses isolated branches to merge |
| 291 | features. |
| 292 | </note> |
| 293 | </para> |
| 294 | |
| 295 | <para> |
| 296 | BSP-specific code additions are handled in a similar manner to |
| 297 | kernel-specific additions. |
| 298 | Some BSPs only make sense given certain kernel types. |
| 299 | So, for these types, the team creates branches off the end |
| 300 | of that kernel type for all of the BSPs that are supported on |
| 301 | that kernel type. |
| 302 | From the perspective of the tools that create the BSP branch, |
| 303 | the BSP is really no different than a feature. |
| 304 | Consequently, the same branching strategy applies to BSPs as |
| 305 | it does to kernel features. |
| 306 | So again, rather than store the BSP twice, the team only |
| 307 | stores the unique differences for the BSP across the supported |
| 308 | multiple kernels. |
| 309 | </para> |
| 310 | |
| 311 | <para> |
| 312 | While this strategy can result in a tree with a significant number |
| 313 | of branches, it is important to realize that from the developer's |
| 314 | point of view, there is a linear path that travels from the |
| 315 | baseline <filename>kernel.org</filename>, through a select |
| 316 | group of features and ends with their BSP-specific commits. |
| 317 | In other words, the divisions of the kernel are transparent and |
| 318 | are not relevant to the developer on a day-to-day basis. |
| 319 | From the developer's perspective, this path is the "master" branch |
| 320 | in Git terms. |
| 321 | The developer does not need to be aware of the existence of any |
| 322 | other branches at all. |
| 323 | Of course, value exists in the having these branches in the tree, |
| 324 | should a person decide to explore them. |
| 325 | For example, a comparison between two BSPs at either the commit |
| 326 | level or at the line-by-line code <filename>diff</filename> level |
| 327 | is now a trivial operation. |
| 328 | </para> |
| 329 | |
| 330 | <para> |
| 331 | The following illustration shows the conceptual Yocto |
| 332 | Linux kernel. |
| 333 | <imagedata fileref="figures/kernel-architecture-overview.png" width="6in" depth="7in" align="center" scale="100" /> |
| 334 | </para> |
| 335 | |
| 336 | <para> |
| 337 | In the illustration, the "Kernel.org Branch Point" marks the |
| 338 | specific spot (or Linux kernel release) from which the |
| 339 | Yocto Linux kernel is created. |
| 340 | From this point forward in the tree, features and differences |
| 341 | are organized and tagged. |
| 342 | </para> |
| 343 | |
| 344 | <para> |
| 345 | The "Yocto Project Baseline Kernel" contains functionality that |
| 346 | is common to every kernel type and BSP that is organized |
| 347 | further along in the tree. |
| 348 | Placing these common features in the tree this way means |
| 349 | features do not have to be duplicated along individual |
| 350 | branches of the tree structure. |
| 351 | </para> |
| 352 | |
| 353 | <para> |
| 354 | From the "Yocto Project Baseline Kernel", branch points represent |
| 355 | specific functionality for individual Board Support Packages |
| 356 | (BSPs) as well as real-time kernels. |
| 357 | The illustration represents this through three BSP-specific |
| 358 | branches and a real-time kernel branch. |
| 359 | Each branch represents some unique functionality for the BSP |
| 360 | or for a real-time Yocto Linux kernel. |
| 361 | </para> |
| 362 | |
| 363 | <para> |
| 364 | In this example structure, the "Real-time (rt) Kernel" branch has |
| 365 | common features for all real-time Yocto Linux kernels and |
| 366 | contains more branches for individual BSP-specific real-time |
| 367 | kernels. |
| 368 | The illustration shows three branches as an example. |
| 369 | Each branch points the way to specific, unique features for a |
| 370 | respective real-time kernel as they apply to a given BSP. |
| 371 | </para> |
| 372 | |
| 373 | <para> |
| 374 | The resulting tree structure presents a clear path of markers |
| 375 | (or branches) to the developer that, for all practical |
| 376 | purposes, is the Yocto Linux kernel needed for any given set of |
| 377 | requirements. |
| 378 | <note> |
| 379 | Keep in mind the figure does not take into account all the |
| 380 | supported Yocto Linux kernels, but rather shows a single |
| 381 | generic kernel just for conceptual purposes. |
| 382 | Also keep in mind that this structure represents the Yocto |
| 383 | Project |
| 384 | <ulink url='&YOCTO_DOCS_REF_URL;#source-repositories'>Source Repositories</ulink> |
| 385 | that are either pulled from during the build or established |
| 386 | on the host development system prior to the build by either |
| 387 | cloning a particular kernel's Git repository or by |
| 388 | downloading and unpacking a tarball. |
| 389 | </note> |
| 390 | </para> |
| 391 | |
| 392 | <para> |
| 393 | Working with the kernel as a structured tree follows recognized |
| 394 | community best practices. |
| 395 | In particular, the kernel as shipped with the product, should be |
| 396 | considered an "upstream source" and viewed as a series of |
| 397 | historical and documented modifications (commits). |
| 398 | These modifications represent the development and stabilization |
| 399 | done by the Yocto Project kernel development team. |
| 400 | </para> |
| 401 | |
| 402 | <para> |
| 403 | Because commits only change at significant release points in the |
| 404 | product life cycle, developers can work on a branch created |
| 405 | from the last relevant commit in the shipped Yocto Project Linux |
| 406 | kernel. |
| 407 | As mentioned previously, the structure is transparent to the |
| 408 | developer because the kernel tree is left in this state after |
| 409 | cloning and building the kernel. |
| 410 | </para> |
| 411 | </section> |
| 412 | |
| 413 | <section id='kernel-build-file-hierarchy'> |
| 414 | <title>Kernel Build File Hierarchy</title> |
| 415 | |
| 416 | <para> |
| 417 | Upstream storage of all the available kernel source code is |
| 418 | one thing, while representing and using the code on your host |
| 419 | development system is another. |
| 420 | Conceptually, you can think of the kernel source repositories |
| 421 | as all the source files necessary for all the supported |
| 422 | Yocto Linux kernels. |
| 423 | As a developer, you are just interested in the source files |
| 424 | for the kernel on which you are working. |
| 425 | And, furthermore, you need them available on your host system. |
| 426 | </para> |
| 427 | |
| 428 | <para> |
| 429 | Kernel source code is available on your host system several |
| 430 | different ways: |
| 431 | <itemizedlist> |
| 432 | <listitem><para> |
| 433 | <emphasis>Files Accessed While using <filename>devtool</filename>:</emphasis> |
| 434 | <filename>devtool</filename>, which is available with the |
| 435 | Yocto Project, is the preferred method by which to |
| 436 | modify the kernel. |
| 437 | See the |
| 438 | "<link linkend='kernel-modification-workflow'>Kernel Modification Workflow</link>" |
| 439 | section. |
| 440 | </para></listitem> |
| 441 | <listitem><para> |
| 442 | <emphasis>Cloned Repository:</emphasis> |
| 443 | If you are working in the kernel all the time, you probably |
| 444 | would want to set up your own local Git repository of the |
| 445 | Yocto Linux kernel tree. |
| 446 | For information on how to clone a Yocto Linux kernel |
| 447 | Git repository, see the |
| 448 | "<link linkend='preparing-the-build-host-to-work-on-the-kernel'>Preparing the Build Host to Work on the Kernel</link>" |
| 449 | section. |
| 450 | </para></listitem> |
| 451 | <listitem><para> |
| 452 | <emphasis>Temporary Source Files from a Build:</emphasis> |
| 453 | If you just need to make some patches to the kernel using |
| 454 | a traditional BitBake workflow (i.e. not using the |
| 455 | <filename>devtool</filename>), you can access temporary |
| 456 | kernel source files that were extracted and used during |
| 457 | a kernel build. |
| 458 | </para></listitem> |
| 459 | </itemizedlist> |
| 460 | </para> |
| 461 | |
| 462 | <para> |
| 463 | The temporary kernel source files resulting from a build using |
| 464 | BitBake have a particular hierarchy. |
| 465 | When you build the kernel on your development system, all files |
| 466 | needed for the build are taken from the source repositories |
| 467 | pointed to by the |
| 468 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
| 469 | variable and gathered in a temporary work area where they are |
| 470 | subsequently used to create the unique kernel. |
| 471 | Thus, in a sense, the process constructs a local source tree |
| 472 | specific to your kernel from which to generate the new kernel |
| 473 | image. |
| 474 | </para> |
| 475 | |
| 476 | <para> |
| 477 | The following figure shows the temporary file structure |
| 478 | created on your host system when you build the kernel using |
| 479 | Bitbake. |
| 480 | This |
| 481 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
| 482 | contains all the source files used during the build. |
| 483 | <imagedata fileref="figures/kernel-overview-2-generic.png" |
| 484 | width="6in" depth="5in" align="center" scale="100" /> |
| 485 | </para> |
| 486 | |
| 487 | <para> |
| 488 | Again, for additional information on the Yocto Project kernel's |
| 489 | architecture and its branching strategy, see the |
| 490 | "<link linkend='yocto-linux-kernel-architecture-and-branching-strategies'>Yocto Linux Kernel Architecture and Branching Strategies</link>" |
| 491 | section. |
| 492 | You can also reference the |
| 493 | "<link linkend='using-devtool-to-patch-the-kernel'>Using <filename>devtool</filename> to Patch the Kernel</link>" |
| 494 | and |
| 495 | "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>" |
| 496 | sections for detailed example that modifies the kernel. |
| 497 | </para> |
| 498 | </section> |
| 499 | |
| 500 | <section id='determining-hardware-and-non-hardware-features-for-the-kernel-configuration-audit-phase'> |
| 501 | <title>Determining Hardware and Non-Hardware Features for the Kernel Configuration Audit Phase</title> |
| 502 | |
| 503 | <para> |
| 504 | This section describes part of the kernel configuration audit |
| 505 | phase that most developers can ignore. |
| 506 | For general information on kernel configuration including |
| 507 | <filename>menuconfig</filename>, <filename>defconfig</filename> |
| 508 | files, and configuration fragments, see the |
| 509 | "<link linkend='configuring-the-kernel'>Configuring the Kernel</link>" |
| 510 | section. |
| 511 | </para> |
| 512 | |
| 513 | <para> |
| 514 | During this part of the audit phase, the contents of the final |
| 515 | <filename>.config</filename> file are compared against the |
| 516 | fragments specified by the system. |
| 517 | These fragments can be system fragments, distro fragments, |
| 518 | or user-specified configuration elements. |
| 519 | Regardless of their origin, the OpenEmbedded build system |
| 520 | warns the user if a specific option is not included in the |
| 521 | final kernel configuration. |
| 522 | </para> |
| 523 | |
| 524 | <para> |
| 525 | By default, in order to not overwhelm the user with |
| 526 | configuration warnings, the system only reports missing |
| 527 | "hardware" options as they could result in a boot |
| 528 | failure or indicate that important hardware is not available. |
| 529 | </para> |
| 530 | |
| 531 | <para> |
| 532 | To determine whether or not a given option is "hardware" or |
| 533 | "non-hardware", the kernel Metadata in |
| 534 | <filename>yocto-kernel-cache</filename> contains files that |
| 535 | classify individual or groups of options as either hardware |
| 536 | or non-hardware. |
| 537 | To better show this, consider a situation where the |
| 538 | <filename>yocto-kernel-cache</filename> contains the following |
| 539 | files: |
| 540 | <literallayout class='monospaced'> |
| 541 | yocto-kernel-cache/features/drm-psb/hardware.cfg |
| 542 | yocto-kernel-cache/features/kgdb/hardware.cfg |
| 543 | yocto-kernel-cache/ktypes/base/hardware.cfg |
| 544 | yocto-kernel-cache/bsp/mti-malta32/hardware.cfg |
| 545 | yocto-kernel-cache/bsp/fsl-mpc8315e-rdb/hardware.cfg |
| 546 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.cfg |
| 547 | yocto-kernel-cache/bsp/qemuarma9/hardware.cfg |
| 548 | yocto-kernel-cache/bsp/mti-malta64/hardware.cfg |
| 549 | yocto-kernel-cache/bsp/arm-versatile-926ejs/hardware.cfg |
| 550 | yocto-kernel-cache/bsp/common-pc/hardware.cfg |
| 551 | yocto-kernel-cache/bsp/common-pc-64/hardware.cfg |
| 552 | yocto-kernel-cache/features/rfkill/non-hardware.cfg |
| 553 | yocto-kernel-cache/ktypes/base/non-hardware.cfg |
| 554 | yocto-kernel-cache/features/aufs/non-hardware.kcf |
| 555 | yocto-kernel-cache/features/ocf/non-hardware.kcf |
| 556 | yocto-kernel-cache/ktypes/base/non-hardware.kcf |
| 557 | yocto-kernel-cache/ktypes/base/hardware.kcf |
| 558 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.kcf |
| 559 | </literallayout> |
| 560 | The following list provides explanations for the various |
| 561 | files: |
| 562 | <itemizedlist> |
| 563 | <listitem><para> |
| 564 | <filename>hardware.kcf</filename>: |
| 565 | Specifies a list of kernel Kconfig files that contain |
| 566 | hardware options only. |
| 567 | </para></listitem> |
| 568 | <listitem><para> |
| 569 | <filename>non-hardware.kcf</filename>: |
| 570 | Specifies a list of kernel Kconfig files that contain |
| 571 | non-hardware options only. |
| 572 | </para></listitem> |
| 573 | <listitem><para> |
| 574 | <filename>hardware.cfg</filename>: |
| 575 | Specifies a list of kernel <filename>CONFIG_</filename> |
| 576 | options that are hardware, regardless of whether or not |
| 577 | they are within a Kconfig file specified by a hardware |
| 578 | or non-hardware Kconfig file (i.e. |
| 579 | <filename>hardware.kcf</filename> or |
| 580 | <filename>non-hardware.kcf</filename>). |
| 581 | </para></listitem> |
| 582 | <listitem><para> |
| 583 | <filename>non-hardware.cfg</filename>: |
| 584 | Specifies a list of kernel <filename>CONFIG_</filename> |
| 585 | options that are not hardware, regardless of whether or |
| 586 | not they are within a Kconfig file specified by a |
| 587 | hardware or non-hardware Kconfig file (i.e. |
| 588 | <filename>hardware.kcf</filename> or |
| 589 | <filename>non-hardware.kcf</filename>). |
| 590 | </para></listitem> |
| 591 | </itemizedlist> |
| 592 | Here is a specific example using the |
| 593 | <filename>kernel-cache/bsp/mti-malta32/hardware.cfg</filename>: |
| 594 | <literallayout class='monospaced'> |
| 595 | CONFIG_SERIAL_8250 |
| 596 | CONFIG_SERIAL_8250_CONSOLE |
| 597 | CONFIG_SERIAL_8250_NR_UARTS |
| 598 | CONFIG_SERIAL_8250_PCI |
| 599 | CONFIG_SERIAL_CORE |
| 600 | CONFIG_SERIAL_CORE_CONSOLE |
| 601 | CONFIG_VGA_ARB |
| 602 | </literallayout> |
| 603 | The kernel configuration audit automatically detects these |
| 604 | files (hence the names must be exactly the ones discussed here), |
| 605 | and uses them as inputs when generating warnings about the |
| 606 | final <filename>.config</filename> file. |
| 607 | </para> |
| 608 | |
| 609 | <para> |
| 610 | A user-specified kernel Metadata repository, or recipe space |
| 611 | feature, can use these same files to classify options that are |
| 612 | found within its <filename>.cfg</filename> files as hardware |
| 613 | or non-hardware, to prevent the OpenEmbedded build system from |
| 614 | producing an error or warning when an option is not in the |
| 615 | final <filename>.config</filename> file. |
| 616 | </para> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 617 | </section> |
| 618 | </appendix> |
| 619 | <!-- |
| 620 | vim: expandtab tw=80 ts=4 |
| 621 | --> |