diff options
-rw-r--r-- | documentation/kernel-dev/kernel-dev-advanced.rst | 463 | ||||
-rw-r--r-- | documentation/kernel-dev/kernel-dev-common.rst | 1017 | ||||
-rw-r--r-- | documentation/kernel-dev/kernel-dev-concepts-appx.rst | 113 | ||||
-rw-r--r-- | documentation/kernel-dev/kernel-dev-faq.rst | 70 | ||||
-rw-r--r-- | documentation/kernel-dev/kernel-dev-intro.rst | 40 | ||||
-rw-r--r-- | documentation/kernel-dev/kernel-dev-maint-appx.rst | 35 |
6 files changed, 1182 insertions, 556 deletions
diff --git a/documentation/kernel-dev/kernel-dev-advanced.rst b/documentation/kernel-dev/kernel-dev-advanced.rst index 6d7f4c91d3..36133caae3 100644 --- a/documentation/kernel-dev/kernel-dev-advanced.rst +++ b/documentation/kernel-dev/kernel-dev-advanced.rst | |||
@@ -17,9 +17,9 @@ the Metadata and the tools that manage it is to help you manage the | |||
17 | complexity of the configuration and sources used to support multiple | 17 | complexity of the configuration and sources used to support multiple |
18 | BSPs and Linux kernel types. | 18 | BSPs and Linux kernel types. |
19 | 19 | ||
20 | Kernel Metadata exists in many places. One area in the Yocto Project | 20 | Kernel Metadata exists in many places. One area in the |
21 | `Source Repositories <&YOCTO_DOCS_OM_URL;#source-repositories>`__ is the | 21 | :ref:`overview-manual/overview-manual-development-environment:yocto project source repositories` |
22 | ``yocto-kernel-cache`` Git repository. You can find this repository | 22 | is the ``yocto-kernel-cache`` Git repository. You can find this repository |
23 | grouped under the "Yocto Linux Kernel" heading in the | 23 | grouped under the "Yocto Linux Kernel" heading in the |
24 | :yocto_git:`Yocto Project Source Repositories <>`. | 24 | :yocto_git:`Yocto Project Source Repositories <>`. |
25 | 25 | ||
@@ -79,10 +79,14 @@ to indicate the branch. | |||
79 | :: | 79 | :: |
80 | 80 | ||
81 | KBRANCH_edgerouter = "standard/edgerouter" | 81 | KBRANCH_edgerouter = "standard/edgerouter" |
82 | 82 | ||
83 | 83 | ||
84 | The linux-yocto style recipes can optionally define the following | 84 | The linux-yocto style recipes can optionally define the following |
85 | variables: KERNEL_FEATURES LINUX_KERNEL_TYPE | 85 | variables: |
86 | |||
87 | - :term:`KERNEL_FEATURES` | ||
88 | |||
89 | - :term:`LINUX_KERNEL_TYPE` | ||
86 | 90 | ||
87 | :term:`LINUX_KERNEL_TYPE` | 91 | :term:`LINUX_KERNEL_TYPE` |
88 | defines the kernel type to be used in assembling the configuration. If | 92 | defines the kernel type to be used in assembling the configuration. If |
@@ -111,9 +115,18 @@ variable to include features (configuration fragments, patches, or both) | |||
111 | that are not already included by the ``KMACHINE`` and | 115 | that are not already included by the ``KMACHINE`` and |
112 | ``LINUX_KERNEL_TYPE`` variable combination. For example, to include a | 116 | ``LINUX_KERNEL_TYPE`` variable combination. For example, to include a |
113 | feature specified as "features/netfilter/netfilter.scc", specify: | 117 | feature specified as "features/netfilter/netfilter.scc", specify: |
114 | KERNEL_FEATURES += "features/netfilter/netfilter.scc" To include a | 118 | :: |
119 | |||
120 | KERNEL_FEATURES += "features/netfilter/netfilter.scc" | ||
121 | |||
122 | To include a | ||
115 | feature called "cfg/sound.scc" just for the ``qemux86`` machine, | 123 | feature called "cfg/sound.scc" just for the ``qemux86`` machine, |
116 | specify: KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc" The value of | 124 | specify: |
125 | :: | ||
126 | |||
127 | KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc" | ||
128 | |||
129 | The value of | ||
117 | the entries in ``KERNEL_FEATURES`` are dependent on their location | 130 | the entries in ``KERNEL_FEATURES`` are dependent on their location |
118 | within the kernel Metadata itself. The examples here are taken from the | 131 | within the kernel Metadata itself. The examples here are taken from the |
119 | ``yocto-kernel-cache`` repository. Each branch of this repository | 132 | ``yocto-kernel-cache`` repository. Each branch of this repository |
@@ -125,7 +138,7 @@ Kernel Metadata Syntax | |||
125 | ====================== | 138 | ====================== |
126 | 139 | ||
127 | The kernel Metadata consists of three primary types of files: ``scc`` | 140 | The kernel Metadata consists of three primary types of files: ``scc`` |
128 | [1]_ description files, configuration fragments, and patches. The | 141 | [1]_ description files, configuration fragments, and patches. The |
129 | ``scc`` files define variables and include or otherwise reference any of | 142 | ``scc`` files define variables and include or otherwise reference any of |
130 | the three file types. The description files are used to aggregate all | 143 | the three file types. The description files are used to aggregate all |
131 | types of kernel Metadata into what ultimately describes the sources and | 144 | types of kernel Metadata into what ultimately describes the sources and |
@@ -152,8 +165,15 @@ types to form the final description of what will be assembled and built. | |||
152 | While the kernel Metadata syntax does not enforce any logical separation | 165 | While the kernel Metadata syntax does not enforce any logical separation |
153 | of configuration fragments, patches, features or kernel types, best | 166 | of configuration fragments, patches, features or kernel types, best |
154 | practices dictate a logical separation of these types of Metadata. The | 167 | practices dictate a logical separation of these types of Metadata. The |
155 | following Metadata file hierarchy is recommended: base/ bsp/ cfg/ | 168 | following Metadata file hierarchy is recommended: |
156 | features/ ktypes/ patches/ | 169 | :: |
170 | |||
171 | base/ | ||
172 | bsp/ | ||
173 | cfg/ | ||
174 | features/ | ||
175 | ktypes/ | ||
176 | patches/ | ||
157 | 177 | ||
158 | The ``bsp`` directory contains the `BSP | 178 | The ``bsp`` directory contains the `BSP |
159 | descriptions <#bsp-descriptions>`__. The remaining directories all | 179 | descriptions <#bsp-descriptions>`__. The remaining directories all |
@@ -192,6 +212,11 @@ or the top level of | |||
192 | if you are creating `Metadata outside of the | 212 | if you are creating `Metadata outside of the |
193 | recipe-space <#metadata-outside-the-recipe-space>`__. | 213 | recipe-space <#metadata-outside-the-recipe-space>`__. |
194 | 214 | ||
215 | .. [1] | ||
216 | ``scc`` stands for Series Configuration Control, but the naming has | ||
217 | less significance in the current implementation of the tooling than | ||
218 | it had in the past. Consider ``scc`` files to be description files. | ||
219 | |||
195 | Configuration | 220 | Configuration |
196 | ------------- | 221 | ------------- |
197 | 222 | ||
@@ -205,15 +230,27 @@ used with the ``linux-yocto-4.12`` kernel as defined outside of the | |||
205 | recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of | 230 | recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of |
206 | two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the | 231 | two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the |
207 | ``cfg`` directory of the ``yocto-4.12`` branch in the | 232 | ``cfg`` directory of the ``yocto-4.12`` branch in the |
208 | ``yocto-kernel-cache`` Git repository: cfg/smp.scc: define | 233 | ``yocto-kernel-cache`` Git repository: |
209 | KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds" define | 234 | :: |
210 | KFEATURE_COMPATIBILITY all kconf hardware smp.cfg cfg/smp.cfg: | 235 | |
211 | CONFIG_SMP=y CONFIG_SCHED_SMT=y # Increase default NR_CPUS from 8 to 64 | 236 | cfg/smp.scc: |
212 | so that platform with # more than 8 processors can be all activated at | 237 | define KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds" |
213 | boot time CONFIG_NR_CPUS=64 # The following is needed when setting | 238 | define KFEATURE_COMPATIBILITY all |
214 | NR_CPUS to something # greater than 8 on x86 architectures, it should be | 239 | |
215 | automatically # disregarded by Kconfig when using a different arch | 240 | kconf hardware smp.cfg |
216 | CONFIG_X86_BIGSMP=y You can find general information on configuration | 241 | |
242 | cfg/smp.cfg: | ||
243 | CONFIG_SMP=y | ||
244 | CONFIG_SCHED_SMT=y | ||
245 | # Increase default NR_CPUS from 8 to 64 so that platform with | ||
246 | # more than 8 processors can be all activated at boot time | ||
247 | CONFIG_NR_CPUS=64 | ||
248 | # The following is needed when setting NR_CPUS to something | ||
249 | # greater than 8 on x86 architectures, it should be automatically | ||
250 | # disregarded by Kconfig when using a different arch | ||
251 | CONFIG_X86_BIGSMP=y | ||
252 | |||
253 | You can find general information on configuration | ||
217 | fragment files in the "`Creating Configuration | 254 | fragment files in the "`Creating Configuration |
218 | Fragments <#creating-config-fragments>`__" section. | 255 | Fragments <#creating-config-fragments>`__" section. |
219 | 256 | ||
@@ -238,8 +275,10 @@ non-hardware fragment. | |||
238 | 275 | ||
239 | As described in the "`Validating | 276 | As described in the "`Validating |
240 | Configuration <#validating-configuration>`__" section, you can use the | 277 | Configuration <#validating-configuration>`__" section, you can use the |
241 | following BitBake command to audit your configuration: $ bitbake | 278 | following BitBake command to audit your configuration: |
242 | linux-yocto -c kernel_configcheck -f | 279 | :: |
280 | |||
281 | $ bitbake linux-yocto -c kernel_configcheck -f | ||
243 | 282 | ||
244 | Patches | 283 | Patches |
245 | ------- | 284 | ------- |
@@ -258,20 +297,38 @@ in the ``patches/build`` directory of the ``yocto-4.12`` branch in the | |||
258 | ``yocto-kernel-cache`` Git repository. | 297 | ``yocto-kernel-cache`` Git repository. |
259 | 298 | ||
260 | The following listings show the ``build.scc`` file and part of the | 299 | The following listings show the ``build.scc`` file and part of the |
261 | ``modpost-mask-trivial-warnings.patch`` file: patches/build/build.scc: | 300 | ``modpost-mask-trivial-warnings.patch`` file: |
262 | patch arm-serialize-build-targets.patch patch | 301 | :: |
263 | powerpc-serialize-image-targets.patch patch | 302 | |
264 | kbuild-exclude-meta-directory-from-distclean-processi.patch # applied by | 303 | patches/build/build.scc: |
265 | kgit # patch kbuild-add-meta-files-to-the-ignore-li.patch patch | 304 | patch arm-serialize-build-targets.patch |
266 | modpost-mask-trivial-warnings.patch patch | 305 | patch powerpc-serialize-image-targets.patch |
267 | menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch | 306 | patch kbuild-exclude-meta-directory-from-distclean-processi.patch |
268 | patches/build/modpost-mask-trivial-warnings.patch: From | 307 | |
269 | bd48931bc142bdd104668f3a062a1f22600aae61 Mon Sep 17 00:00:00 2001 From: | 308 | # applied by kgit |
270 | Paul Gortmaker <paul.gortmaker@windriver.com> Date: Sun, 25 Jan 2009 | 309 | # patch kbuild-add-meta-files-to-the-ignore-li.patch |
271 | 17:58:09 -0500 Subject: [PATCH] modpost: mask trivial warnings Newer | 310 | |
272 | HOSTCC will complain about various stdio fcns because . . . char | 311 | patch modpost-mask-trivial-warnings.patch |
273 | \*dump_write = NULL, \*files_source = NULL; int opt; -- 2.10.1 generated | 312 | patch menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch |
274 | by cgit v0.10.2 at 2017-09-28 15:23:23 (GMT) The description file can | 313 | |
314 | patches/build/modpost-mask-trivial-warnings.patch: | ||
315 | From bd48931bc142bdd104668f3a062a1f22600aae61 Mon Sep 17 00:00:00 2001 | ||
316 | From: Paul Gortmaker <paul.gortmaker@windriver.com> | ||
317 | Date: Sun, 25 Jan 2009 17:58:09 -0500 | ||
318 | Subject: [PATCH] modpost: mask trivial warnings | ||
319 | |||
320 | Newer HOSTCC will complain about various stdio fcns because | ||
321 | . | ||
322 | . | ||
323 | . | ||
324 | char *dump_write = NULL, *files_source = NULL; | ||
325 | int opt; | ||
326 | -- | ||
327 | 2.10.1 | ||
328 | |||
329 | generated by cgit v0.10.2 at 2017-09-28 15:23:23 (GMT) | ||
330 | |||
331 | The description file can | ||
275 | include multiple patch statements where each statement handles a single | 332 | include multiple patch statements where each statement handles a single |
276 | patch. In the example ``build.scc`` file, five patch statements exist | 333 | patch. In the example ``build.scc`` file, five patch statements exist |
277 | for the five patches in the directory. | 334 | for the five patches in the directory. |
@@ -289,11 +346,19 @@ Features | |||
289 | 346 | ||
290 | Features are complex kernel Metadata types that consist of configuration | 347 | Features are complex kernel Metadata types that consist of configuration |
291 | fragments, patches, and possibly other feature description files. As an | 348 | fragments, patches, and possibly other feature description files. As an |
292 | example, consider the following generic listing: features/myfeature.scc | 349 | example, consider the following generic listing: |
293 | define KFEATURE_DESCRIPTION "Enable myfeature" patch | 350 | :: |
294 | 0001-myfeature-core.patch patch 0002-myfeature-interface.patch include | 351 | |
295 | cfg/myfeature_dependency.scc kconf non-hardware myfeature.cfg This | 352 | features/myfeature.scc |
296 | example shows how the ``patch`` and ``kconf`` commands are used as well | 353 | define KFEATURE_DESCRIPTION "Enable myfeature" |
354 | |||
355 | patch 0001-myfeature-core.patch | ||
356 | patch 0002-myfeature-interface.patch | ||
357 | |||
358 | include cfg/myfeature_dependency.scc | ||
359 | kconf non-hardware myfeature.cfg | ||
360 | |||
361 | This example shows how the ``patch`` and ``kconf`` commands are used as well | ||
297 | as how an additional feature description file is included with the | 362 | as how an additional feature description file is included with the |
298 | ``include`` command. | 363 | ``include`` command. |
299 | 364 | ||
@@ -319,11 +384,16 @@ the ``linux-yocto_4.12.bb`` kernel recipe found in | |||
319 | :ref:`require <bitbake:require-inclusion>` directive | 384 | :ref:`require <bitbake:require-inclusion>` directive |
320 | includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file, | 385 | includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file, |
321 | which has the following statement that defines the default kernel type: | 386 | which has the following statement that defines the default kernel type: |
322 | LINUX_KERNEL_TYPE ??= "standard" | 387 | :: |
388 | |||
389 | LINUX_KERNEL_TYPE ??= "standard" | ||
323 | 390 | ||
324 | Another example would be the real-time kernel (i.e. | 391 | Another example would be the real-time kernel (i.e. |
325 | ``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel | 392 | ``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel |
326 | type as follows: LINUX_KERNEL_TYPE = "preempt-rt" | 393 | type as follows: |
394 | :: | ||
395 | |||
396 | LINUX_KERNEL_TYPE = "preempt-rt" | ||
327 | 397 | ||
328 | .. note:: | 398 | .. note:: |
329 | 399 | ||
@@ -358,16 +428,36 @@ for Linux Yocto kernels: | |||
358 | For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. | 428 | For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. |
359 | ``standard.scc``). Here is a partial listing for the ``standard.scc`` | 429 | ``standard.scc``). Here is a partial listing for the ``standard.scc`` |
360 | file, which is found in the ``ktypes/standard`` directory of the | 430 | file, which is found in the ``ktypes/standard`` directory of the |
361 | ``yocto-kernel-cache`` Git repository: # Include this kernel type | 431 | ``yocto-kernel-cache`` Git repository: |
362 | fragment to get the standard features and # configuration values. # | 432 | :: |
363 | Note: if only the features are desired, but not the configuration # then | 433 | |
364 | this should be included as: # include ktypes/standard/standard.scc nocfg | 434 | # Include this kernel type fragment to get the standard features and |
365 | # if no chained configuration is desired, include it as: # include | 435 | # configuration values. |
366 | ktypes/standard/standard.scc nocfg inherit include ktypes/base/base.scc | 436 | |
367 | branch standard kconf non-hardware standard.cfg include | 437 | # Note: if only the features are desired, but not the configuration |
368 | features/kgdb/kgdb.scc . . . include cfg/net/ip6_nf.scc include | 438 | # then this should be included as: |
369 | cfg/net/bridge.scc include cfg/systemd.scc include | 439 | # include ktypes/standard/standard.scc nocfg |
370 | features/rfkill/rfkill.scc | 440 | # if no chained configuration is desired, include it as: |
441 | # include ktypes/standard/standard.scc nocfg inherit | ||
442 | |||
443 | |||
444 | |||
445 | include ktypes/base/base.scc | ||
446 | branch standard | ||
447 | |||
448 | kconf non-hardware standard.cfg | ||
449 | |||
450 | include features/kgdb/kgdb.scc | ||
451 | . | ||
452 | . | ||
453 | . | ||
454 | |||
455 | include cfg/net/ip6_nf.scc | ||
456 | include cfg/net/bridge.scc | ||
457 | |||
458 | include cfg/systemd.scc | ||
459 | |||
460 | include features/rfkill/rfkill.scc | ||
371 | 461 | ||
372 | As with any ``.scc`` file, a kernel type definition can aggregate other | 462 | As with any ``.scc`` file, a kernel type definition can aggregate other |
373 | ``.scc`` files with ``include`` commands. These definitions can also | 463 | ``.scc`` files with ``include`` commands. These definitions can also |
@@ -409,29 +499,49 @@ supported kernel type. | |||
409 | This section overviews the BSP description structure, the aggregation | 499 | This section overviews the BSP description structure, the aggregation |
410 | concepts, and presents a detailed example using a BSP supported by the | 500 | concepts, and presents a detailed example using a BSP supported by the |
411 | Yocto Project (i.e. BeagleBone Board). For complete information on BSP | 501 | Yocto Project (i.e. BeagleBone Board). For complete information on BSP |
412 | layer file hierarchy, see the `Yocto Project Board Support Package (BSP) | 502 | layer file hierarchy, see the :doc:`../bsp-guide/bsp-guide`. |
413 | Developer's Guide <&YOCTO_DOCS_BSP_URL;>`__. | ||
414 | 503 | ||
415 | .. _bsp-description-file-overview: | 504 | .. _bsp-description-file-overview: |
416 | 505 | ||
417 | Overview | 506 | Description Overview |
418 | ~~~~~~~~ | 507 | ~~~~~~~~~~~~~~~~~~~~ |
419 | 508 | ||
420 | For simplicity, consider the following root BSP layer description files | 509 | For simplicity, consider the following root BSP layer description files |
421 | for the BeagleBone board. These files employ both a structure and naming | 510 | for the BeagleBone board. These files employ both a structure and naming |
422 | convention for consistency. The naming convention for the file is as | 511 | convention for consistency. The naming convention for the file is as |
423 | follows: bsp_root_name-kernel_type.scc Here are some example root layer | 512 | follows: |
513 | :: | ||
514 | |||
515 | bsp_root_name-kernel_type.scc | ||
516 | |||
517 | Here are some example root layer | ||
424 | BSP filenames for the BeagleBone Board BSP, which is supported by the | 518 | BSP filenames for the BeagleBone Board BSP, which is supported by the |
425 | Yocto Project: beaglebone-standard.scc beaglebone-preempt-rt.scc Each | 519 | Yocto Project: |
426 | file uses the root name (i.e "beaglebone") BSP name followed by the | 520 | :: |
521 | |||
522 | beaglebone-standard.scc | ||
523 | beaglebone-preempt-rt.scc | ||
524 | |||
525 | Each file uses the root name (i.e "beaglebone") BSP name followed by the | ||
427 | kernel type. | 526 | kernel type. |
428 | 527 | ||
429 | Examine the ``beaglebone-standard.scc`` file: define KMACHINE beaglebone | 528 | Examine the ``beaglebone-standard.scc`` file: |
430 | define KTYPE standard define KARCH arm include | 529 | :: |
431 | ktypes/standard/standard.scc branch beaglebone include beaglebone.scc # | 530 | |
432 | default policy for standard kernels include | 531 | define KMACHINE beaglebone |
433 | features/latencytop/latencytop.scc include | 532 | define KTYPE standard |
434 | features/profiling/profiling.scc Every top-level BSP description file | 533 | define KARCH arm |
534 | |||
535 | include ktypes/standard/standard.scc | ||
536 | branch beaglebone | ||
537 | |||
538 | include beaglebone.scc | ||
539 | |||
540 | # default policy for standard kernels | ||
541 | include features/latencytop/latencytop.scc | ||
542 | include features/profiling/profiling.scc | ||
543 | |||
544 | Every top-level BSP description file | ||
435 | should define the :term:`KMACHINE`, | 545 | should define the :term:`KMACHINE`, |
436 | :term:`KTYPE`, and | 546 | :term:`KTYPE`, and |
437 | :term:`KARCH` variables. These | 547 | :term:`KARCH` variables. These |
@@ -450,27 +560,52 @@ description file match. | |||
450 | 560 | ||
451 | To separate your kernel policy from your hardware configuration, you | 561 | To separate your kernel policy from your hardware configuration, you |
452 | include a kernel type (``ktype``), such as "standard". In the previous | 562 | include a kernel type (``ktype``), such as "standard". In the previous |
453 | example, this is done using the following: include | 563 | example, this is done using the following: |
454 | ktypes/standard/standard.scc This file aggregates all the configuration | 564 | :: |
565 | |||
566 | include ktypes/standard/standard.scc | ||
567 | |||
568 | This file aggregates all the configuration | ||
455 | fragments, patches, and features that make up your standard kernel | 569 | fragments, patches, and features that make up your standard kernel |
456 | policy. See the "`Kernel Types <#kernel-types>`__" section for more | 570 | policy. See the "`Kernel Types <#kernel-types>`__" section for more |
457 | information. | 571 | information. |
458 | 572 | ||
459 | To aggregate common configurations and features specific to the kernel | 573 | To aggregate common configurations and features specific to the kernel |
460 | for mybsp, use the following: include mybsp.scc You can see that in the | 574 | for mybsp, use the following: |
461 | BeagleBone example with the following: include beaglebone.scc For | 575 | :: |
462 | information on how to break a complete ``.config`` file into the various | 576 | |
577 | include mybsp.scc | ||
578 | |||
579 | You can see that in the BeagleBone example with the following: | ||
580 | :: | ||
581 | |||
582 | include beaglebone.scc | ||
583 | |||
584 | For information on how to break a complete ``.config`` file into the various | ||
463 | configuration fragments, see the "`Creating Configuration | 585 | configuration fragments, see the "`Creating Configuration |
464 | Fragments <#creating-config-fragments>`__" section. | 586 | Fragments <#creating-config-fragments>`__" section. |
465 | 587 | ||
466 | Finally, if you have any configurations specific to the hardware that | 588 | Finally, if you have any configurations specific to the hardware that |
467 | are not in a ``*.scc`` file, you can include them as follows: kconf | 589 | are not in a ``*.scc`` file, you can include them as follows: |
468 | hardware mybsp-extra.cfg The BeagleBone example does not include these | 590 | :: |
591 | |||
592 | kconf hardware mybsp-extra.cfg | ||
593 | |||
594 | The BeagleBone example does not include these | ||
469 | types of configurations. However, the Malta 32-bit board does | 595 | types of configurations. However, the Malta 32-bit board does |
470 | ("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file: | 596 | ("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file: |
471 | define KMACHINE mti-malta32-le define KMACHINE qemumipsel define KTYPE | 597 | :: |
472 | standard define KARCH mips include ktypes/standard/standard.scc branch | 598 | |
473 | mti-malta32 include mti-malta32.scc kconf hardware mti-malta32-le.cfg | 599 | define KMACHINE mti-malta32-le |
600 | define KMACHINE qemumipsel | ||
601 | define KTYPE standard | ||
602 | define KARCH mips | ||
603 | |||
604 | include ktypes/standard/standard.scc | ||
605 | branch mti-malta32 | ||
606 | |||
607 | include mti-malta32.scc | ||
608 | kconf hardware mti-malta32-le.cfg | ||
474 | 609 | ||
475 | .. _bsp-description-file-example-minnow: | 610 | .. _bsp-description-file-example-minnow: |
476 | 611 | ||
@@ -488,15 +623,28 @@ definition given the ``linux-yocto-4.4`` branch of the | |||
488 | Although the Minnow Board BSP is unused, the Metadata remains and is | 623 | Although the Minnow Board BSP is unused, the Metadata remains and is |
489 | being used here just as an example. | 624 | being used here just as an example. |
490 | 625 | ||
491 | include cfg/x86.scc include features/eg20t/eg20t.scc include | 626 | :: |
492 | cfg/dmaengine.scc include features/power/intel.scc include cfg/efi.scc | 627 | |
493 | include features/usb/ehci-hcd.scc include features/usb/ohci-hcd.scc | 628 | include cfg/x86.scc |
494 | include features/usb/usb-gadgets.scc include | 629 | include features/eg20t/eg20t.scc |
495 | features/usb/touchscreen-composite.scc include cfg/timer/hpet.scc | 630 | include cfg/dmaengine.scc |
496 | include features/leds/leds.scc include features/spi/spidev.scc include | 631 | include features/power/intel.scc |
497 | features/i2c/i2cdev.scc include features/mei/mei-txe.scc # Earlyprintk | 632 | include cfg/efi.scc |
498 | and port debug requires 8250 kconf hardware cfg/8250.cfg kconf hardware | 633 | include features/usb/ehci-hcd.scc |
499 | minnow.cfg kconf hardware minnow-dev.cfg | 634 | include features/usb/ohci-hcd.scc |
635 | include features/usb/usb-gadgets.scc | ||
636 | include features/usb/touchscreen-composite.scc | ||
637 | include cfg/timer/hpet.scc | ||
638 | include features/leds/leds.scc | ||
639 | include features/spi/spidev.scc | ||
640 | include features/i2c/i2cdev.scc | ||
641 | include features/mei/mei-txe.scc | ||
642 | |||
643 | # Earlyprintk and port debug requires 8250 | ||
644 | kconf hardware cfg/8250.cfg | ||
645 | |||
646 | kconf hardware minnow.cfg | ||
647 | kconf hardware minnow-dev.cfg | ||
500 | 648 | ||
501 | The ``minnow.scc`` description file includes a hardware configuration | 649 | The ``minnow.scc`` description file includes a hardware configuration |
502 | fragment (``minnow.cfg``) specific to the Minnow BSP as well as several | 650 | fragment (``minnow.cfg``) specific to the Minnow BSP as well as several |
@@ -505,23 +653,51 @@ found on the machine. This ``minnow.scc`` description file is then | |||
505 | included in each of the three "minnow" description files for the | 653 | included in each of the three "minnow" description files for the |
506 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). | 654 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). |
507 | Consider the "minnow" description for the "standard" kernel type (i.e. | 655 | Consider the "minnow" description for the "standard" kernel type (i.e. |
508 | ``minnow-standard.scc``: define KMACHINE minnow define KTYPE standard | 656 | ``minnow-standard.scc``: |
509 | define KARCH i386 include ktypes/standard include minnow.scc # Extra | 657 | :: |
510 | minnow configs above the minimal defined in minnow.scc include | 658 | |
511 | cfg/efi-ext.scc include features/media/media-all.scc include | 659 | define KMACHINE minnow |
512 | features/sound/snd_hda_intel.scc # The following should really be in | 660 | define KTYPE standard |
513 | standard.scc # USB live-image support include cfg/usb-mass-storage.scc | 661 | define KARCH i386 |
514 | include cfg/boot-live.scc # Basic profiling include | 662 | |
515 | features/latencytop/latencytop.scc include | 663 | include ktypes/standard |
516 | features/profiling/profiling.scc # Requested drivers that don't have an | 664 | |
517 | existing scc kconf hardware minnow-drivers-extra.cfg The ``include`` | 665 | include minnow.scc |
518 | command midway through the file includes the ``minnow.scc`` description | 666 | |
667 | # Extra minnow configs above the minimal defined in minnow.scc | ||
668 | include cfg/efi-ext.scc | ||
669 | include features/media/media-all.scc | ||
670 | include features/sound/snd_hda_intel.scc | ||
671 | |||
672 | # The following should really be in standard.scc | ||
673 | # USB live-image support | ||
674 | include cfg/usb-mass-storage.scc | ||
675 | include cfg/boot-live.scc | ||
676 | |||
677 | # Basic profiling | ||
678 | include features/latencytop/latencytop.scc | ||
679 | include features/profiling/profiling.scc | ||
680 | |||
681 | # Requested drivers that don't have an existing scc | ||
682 | kconf hardware minnow-drivers-extra.cfg | ||
683 | |||
684 | The ``include`` command midway through the file includes the ``minnow.scc`` description | ||
519 | that defines all enabled hardware for the BSP that is common to all | 685 | that defines all enabled hardware for the BSP that is common to all |
520 | kernel types. Using this command significantly reduces duplication. | 686 | kernel types. Using this command significantly reduces duplication. |
521 | 687 | ||
522 | Now consider the "minnow" description for the "tiny" kernel type (i.e. | 688 | Now consider the "minnow" description for the "tiny" kernel type (i.e. |
523 | ``minnow-tiny.scc``): define KMACHINE minnow define KTYPE tiny define | 689 | ``minnow-tiny.scc``): |
524 | KARCH i386 include ktypes/tiny include minnow.scc As you might expect, | 690 | :: |
691 | |||
692 | define KMACHINE minnow | ||
693 | define KTYPE tiny | ||
694 | define KARCH i386 | ||
695 | |||
696 | include ktypes/tiny | ||
697 | |||
698 | include minnow.scc | ||
699 | |||
700 | As you might expect, | ||
525 | the "tiny" description includes quite a bit less. In fact, it includes | 701 | the "tiny" description includes quite a bit less. In fact, it includes |
526 | only the minimal policy defined by the "tiny" kernel type and the | 702 | only the minimal policy defined by the "tiny" kernel type and the |
527 | hardware-specific configuration required for booting the machine along | 703 | hardware-specific configuration required for booting the machine along |
@@ -574,9 +750,16 @@ See the "`Modifying an Existing | |||
574 | Recipe <#modifying-an-existing-recipe>`__" section for more information. | 750 | Recipe <#modifying-an-existing-recipe>`__" section for more information. |
575 | 751 | ||
576 | Here is an example that shows a trivial tree of kernel Metadata stored | 752 | Here is an example that shows a trivial tree of kernel Metadata stored |
577 | in recipe-space within a BSP layer: meta-my_bsp_layer/ \`-- | 753 | in recipe-space within a BSP layer: |
578 | recipes-kernel \`-- linux \`-- linux-yocto \|-- bsp-standard.scc \|-- | 754 | :: |
579 | bsp.cfg \`-- standard.cfg | 755 | |
756 | meta-my_bsp_layer/ | ||
757 | `-- recipes-kernel | ||
758 | `-- linux | ||
759 | `-- linux-yocto | ||
760 | |-- bsp-standard.scc | ||
761 | |-- bsp.cfg | ||
762 | `-- standard.cfg | ||
580 | 763 | ||
581 | When the Metadata is stored in recipe-space, you must take steps to | 764 | When the Metadata is stored in recipe-space, you must take steps to |
582 | ensure BitBake has the necessary information to decide what files to | 765 | ensure BitBake has the necessary information to decide what files to |
@@ -591,8 +774,12 @@ value when changing the content of files not explicitly listed in the | |||
591 | 774 | ||
592 | If the BSP description is in recipe space, you cannot simply list the | 775 | If the BSP description is in recipe space, you cannot simply list the |
593 | ``*.scc`` in the ``SRC_URI`` statement. You need to use the following | 776 | ``*.scc`` in the ``SRC_URI`` statement. You need to use the following |
594 | form from your kernel append file: SRC_URI_append_myplatform = " \\ | 777 | form from your kernel append file: |
595 | file://myplatform;type=kmeta;destsuffix=myplatform \\ " | 778 | :: |
779 | |||
780 | SRC_URI_append_myplatform = " \ | ||
781 | file://myplatform;type=kmeta;destsuffix=myplatform \ | ||
782 | " | ||
596 | 783 | ||
597 | Metadata Outside the Recipe-Space | 784 | Metadata Outside the Recipe-Space |
598 | --------------------------------- | 785 | --------------------------------- |
@@ -602,10 +789,13 @@ reside in a separate repository. The OpenEmbedded build system adds the | |||
602 | Metadata to the build as a "type=kmeta" repository through the | 789 | Metadata to the build as a "type=kmeta" repository through the |
603 | :term:`SRC_URI` variable. As an | 790 | :term:`SRC_URI` variable. As an |
604 | example, consider the following ``SRC_URI`` statement from the | 791 | example, consider the following ``SRC_URI`` statement from the |
605 | ``linux-yocto_4.12.bb`` kernel recipe: SRC_URI = | 792 | ``linux-yocto_4.12.bb`` kernel recipe: |
606 | "git://git.yoctoproject.org/linux-yocto-4.12.git;name=machine;branch=${KBRANCH}; | 793 | :: |
607 | \\ | 794 | |
608 | git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | 795 | SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.12.git;name=machine;branch=${KBRANCH}; \ |
796 | git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | ||
797 | |||
798 | |||
609 | ``${KMETA}``, in this context, is simply used to name the directory into | 799 | ``${KMETA}``, in this context, is simply used to name the directory into |
610 | which the Git fetcher places the Metadata. This behavior is no different | 800 | which the Git fetcher places the Metadata. This behavior is no different |
611 | than any multi-repository ``SRC_URI`` statement used in a recipe (e.g. | 801 | than any multi-repository ``SRC_URI`` statement used in a recipe (e.g. |
@@ -684,21 +874,43 @@ patches into a feature. | |||
684 | 874 | ||
685 | Once you have a new branch, you can set up your kernel Metadata to use | 875 | Once you have a new branch, you can set up your kernel Metadata to use |
686 | the branch a couple different ways. In the recipe, you can specify the | 876 | the branch a couple different ways. In the recipe, you can specify the |
687 | new branch as the ``KBRANCH`` to use for the board as follows: KBRANCH = | 877 | new branch as the ``KBRANCH`` to use for the board as follows: |
688 | "mynewbranch" Another method is to use the ``branch`` command in the BSP | 878 | :: |
689 | description: mybsp.scc: define KMACHINE mybsp define KTYPE standard | 879 | |
690 | define KARCH i386 include standard.scc branch mynewbranch include | 880 | KBRANCH = "mynewbranch" |
691 | mybsp-hw.scc | 881 | |
882 | Another method is to use the ``branch`` command in the BSP | ||
883 | description: | ||
884 | |||
885 | mybsp.scc: | ||
886 | define KMACHINE mybsp | ||
887 | define KTYPE standard | ||
888 | define KARCH i386 | ||
889 | include standard.scc | ||
890 | |||
891 | branch mynewbranch | ||
892 | |||
893 | include mybsp-hw.scc | ||
692 | 894 | ||
693 | If you find yourself with numerous branches, you might consider using a | 895 | If you find yourself with numerous branches, you might consider using a |
694 | hierarchical branching system similar to what the Yocto Linux Kernel Git | 896 | hierarchical branching system similar to what the Yocto Linux Kernel Git |
695 | repositories use: common/kernel_type/machine | 897 | repositories use: |
898 | :: | ||
899 | |||
900 | common/kernel_type/machine | ||
696 | 901 | ||
697 | If you had two kernel types, "standard" and "small" for instance, three | 902 | If you had two kernel types, "standard" and "small" for instance, three |
698 | machines, and common as ``mydir``, the branches in your Git repository | 903 | machines, and common as ``mydir``, the branches in your Git repository |
699 | might look like this: mydir/base mydir/standard/base | 904 | might look like this: |
700 | mydir/standard/machine_a mydir/standard/machine_b | 905 | : |
701 | mydir/standard/machine_c mydir/small/base mydir/small/machine_a | 906 | |
907 | mydir/base | ||
908 | mydir/standard/base | ||
909 | mydir/standard/machine_a | ||
910 | mydir/standard/machine_b | ||
911 | mydir/standard/machine_c | ||
912 | mydir/small/base | ||
913 | mydir/small/machine_a | ||
702 | 914 | ||
703 | This organization can help clarify the branch relationships. In this | 915 | This organization can help clarify the branch relationships. In this |
704 | case, ``mydir/standard/machine_a`` includes everything in ``mydir/base`` | 916 | case, ``mydir/standard/machine_a`` includes everything in ``mydir/base`` |
@@ -725,9 +937,19 @@ that have to be regularly updated. The Yocto Project Linux kernel tools | |||
725 | provide for this with the ``git merge`` command. | 937 | provide for this with the ``git merge`` command. |
726 | 938 | ||
727 | To merge a feature branch into a BSP, insert the ``git merge`` command | 939 | To merge a feature branch into a BSP, insert the ``git merge`` command |
728 | after any ``branch`` commands: mybsp.scc: define KMACHINE mybsp define | 940 | after any ``branch`` commands: |
729 | KTYPE standard define KARCH i386 include standard.scc branch mynewbranch | 941 | :: |
730 | git merge myfeature include mybsp-hw.scc | 942 | |
943 | mybsp.scc: | ||
944 | define KMACHINE mybsp | ||
945 | define KTYPE standard | ||
946 | define KARCH i386 | ||
947 | include standard.scc | ||
948 | |||
949 | branch mynewbranch | ||
950 | git merge myfeature | ||
951 | |||
952 | include mybsp-hw.scc | ||
731 | 953 | ||
732 | .. _scc-reference: | 954 | .. _scc-reference: |
733 | 955 | ||
@@ -758,7 +980,4 @@ within an SCC description file (``.scc``): | |||
758 | 980 | ||
759 | - ``patch PATCH_FILE``: Applies the patch to the current Git branch. | 981 | - ``patch PATCH_FILE``: Applies the patch to the current Git branch. |
760 | 982 | ||
761 | .. [1] | 983 | |
762 | ``scc`` stands for Series Configuration Control, but the naming has | ||
763 | less significance in the current implementation of the tooling than | ||
764 | it had in the past. Consider ``scc`` files to be description files. | ||
diff --git a/documentation/kernel-dev/kernel-dev-common.rst b/documentation/kernel-dev/kernel-dev-common.rst index ef3a9f710a..d4b60a9dc9 100644 --- a/documentation/kernel-dev/kernel-dev-common.rst +++ b/documentation/kernel-dev/kernel-dev-common.rst | |||
@@ -21,13 +21,11 @@ Preparing the Build Host to Work on the Kernel | |||
21 | 21 | ||
22 | Before you can do any kernel development, you need to be sure your build | 22 | Before you can do any kernel development, you need to be sure your build |
23 | host is set up to use the Yocto Project. For information on how to get | 23 | host is set up to use the Yocto Project. For information on how to get |
24 | set up, see the "`Preparing the Build | 24 | set up, see the ":doc:`../dev-manual/dev-manual-start`" section in |
25 | Host <&YOCTO_DOCS_DEV_URL;#dev-preparing-the-build-host>`__" section in | ||
26 | the Yocto Project Development Tasks Manual. Part of preparing the system | 25 | the Yocto Project Development Tasks Manual. Part of preparing the system |
27 | is creating a local Git repository of the | 26 | is creating a local Git repository of the |
28 | :term:`Source Directory` (``poky``) on your | 27 | :term:`Source Directory` (``poky``) on your system. Follow the steps in the |
29 | system. Follow the steps in the "`Cloning the ``poky`` | 28 | ":ref:`dev-manual/dev-manual-start:cloning the \`\`poky\`\` repository`" |
30 | Repository <&YOCTO_DOCS_DEV_URL;#cloning-the-poky-repository>`__" | ||
31 | section in the Yocto Project Development Tasks Manual to set up your | 29 | section in the Yocto Project Development Tasks Manual to set up your |
32 | Source Directory. | 30 | Source Directory. |
33 | 31 | ||
@@ -43,7 +41,7 @@ Source Directory. | |||
43 | information. | 41 | information. |
44 | 42 | ||
45 | Kernel development is best accomplished using | 43 | Kernel development is best accomplished using |
46 | ```devtool`` <&YOCTO_DOCS_SDK_URL;#using-devtool-in-your-sdk-workflow>`__ | 44 | :ref:`devtool <sdk-manual/sdk-extensible:using \`\`devtool\`\` in your sdk workflow>` |
47 | and not through traditional kernel workflow methods. The remainder of | 45 | and not through traditional kernel workflow methods. The remainder of |
48 | this section provides information for both scenarios. | 46 | this section provides information for both scenarios. |
49 | 47 | ||
@@ -52,15 +50,17 @@ Getting Ready to Develop Using ``devtool`` | |||
52 | 50 | ||
53 | Follow these steps to prepare to update the kernel image using | 51 | Follow these steps to prepare to update the kernel image using |
54 | ``devtool``. Completing this procedure leaves you with a clean kernel | 52 | ``devtool``. Completing this procedure leaves you with a clean kernel |
55 | image and ready to make modifications as described in the "`Using | 53 | image and ready to make modifications as described in the " |
56 | ``devtool`` to Patch the Kernel <#using-devtool-to-patch-the-kernel>`__" | 54 | :ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
57 | section: | 55 | section: |
58 | 56 | ||
59 | 1. *Initialize the BitBake Environment:* Before building an extensible | 57 | 1. *Initialize the BitBake Environment:* Before building an extensible |
60 | SDK, you need to initialize the BitBake build environment by sourcing | 58 | SDK, you need to initialize the BitBake build environment by sourcing |
61 | the build environment script (i.e. | 59 | the build environment script (i.e. :ref:`structure-core-script`): |
62 | ```oe-init-build-env`` <&YOCTO_DOCS_REF_URL;#structure-core-script>`__): | 60 | :: |
63 | $ cd ~/poky $ source oe-init-build-env | 61 | |
62 | $ cd ~/poky | ||
63 | $ source oe-init-build-env | ||
64 | 64 | ||
65 | .. note:: | 65 | .. note:: |
66 | 66 | ||
@@ -71,7 +71,7 @@ section: | |||
71 | ) have been cloned using Git and the local repository is named | 71 | ) have been cloned using Git and the local repository is named |
72 | "poky". | 72 | "poky". |
73 | 73 | ||
74 | 2. *Prepare Your ``local.conf`` File:* By default, the | 74 | 2. *Prepare Your local.conf File:* By default, the |
75 | :term:`MACHINE` variable is set to | 75 | :term:`MACHINE` variable is set to |
76 | "qemux86-64", which is fine if you are building for the QEMU emulator | 76 | "qemux86-64", which is fine if you are building for the QEMU emulator |
77 | in 64-bit mode. However, if you are not, you need to set the | 77 | in 64-bit mode. However, if you are not, you need to set the |
@@ -87,15 +87,22 @@ section: | |||
87 | 87 | ||
88 | In this example we wish to build for qemux86 so we must set the | 88 | In this example we wish to build for qemux86 so we must set the |
89 | ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". | 89 | ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". |
90 | As described we do this by appending to ``conf/local.conf``: MACHINE | 90 | As described we do this by appending to ``conf/local.conf``: |
91 | = "qemux86" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" | 91 | :: |
92 | |||
93 | MACHINE = "qemux86" | ||
94 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" | ||
92 | 95 | ||
93 | 3. *Create a Layer for Patches:* You need to create a layer to hold | 96 | 3. *Create a Layer for Patches:* You need to create a layer to hold |
94 | patches created for the kernel image. You can use the | 97 | patches created for the kernel image. You can use the |
95 | ``bitbake-layers create-layer`` command as follows: $ cd ~/poky/build | 98 | ``bitbake-layers create-layer`` command as follows: |
96 | $ bitbake-layers create-layer ../../meta-mylayer NOTE: Starting | 99 | :: |
97 | bitbake server... Add your new layer with 'bitbake-layers add-layer | 100 | |
98 | ../../meta-mylayer' $ | 101 | $ cd ~/poky/build |
102 | $ bitbake-layers create-layer ../../meta-mylayer | ||
103 | NOTE: Starting bitbake server... | ||
104 | Add your new layer with 'bitbake-layers add-layer ../../meta-mylayer' | ||
105 | $ | ||
99 | 106 | ||
100 | .. note:: | 107 | .. note:: |
101 | 108 | ||
@@ -116,12 +123,22 @@ section: | |||
116 | 4. *Inform the BitBake Build Environment About Your Layer:* As directed | 123 | 4. *Inform the BitBake Build Environment About Your Layer:* As directed |
117 | when you created your layer, you need to add the layer to the | 124 | when you created your layer, you need to add the layer to the |
118 | :term:`BBLAYERS` variable in the | 125 | :term:`BBLAYERS` variable in the |
119 | ``bblayers.conf`` file as follows: $ cd ~/poky/build $ bitbake-layers | 126 | ``bblayers.conf`` file as follows: |
120 | add-layer ../../meta-mylayer NOTE: Starting bitbake server... $ | 127 | :: |
128 | |||
129 | $ cd ~/poky/build | ||
130 | $ bitbake-layers add-layer ../../meta-mylayer | ||
131 | NOTE: Starting bitbake server... | ||
132 | $ | ||
121 | 133 | ||
122 | 5. *Build the Extensible SDK:* Use BitBake to build the extensible SDK | 134 | 5. *Build the Extensible SDK:* Use BitBake to build the extensible SDK |
123 | specifically for use with images to be run using QEMU: $ cd | 135 | specifically for use with images to be run using QEMU: |
124 | ~/poky/build $ bitbake core-image-minimal -c populate_sdk_ext Once | 136 | :: |
137 | |||
138 | $ cd ~/poky/build | ||
139 | $ bitbake core-image-minimal -c populate_sdk_ext | ||
140 | |||
141 | Once | ||
125 | the build finishes, you can find the SDK installer file (i.e. | 142 | the build finishes, you can find the SDK installer file (i.e. |
126 | ``*.sh`` file) in the following directory: | 143 | ``*.sh`` file) in the following directory: |
127 | ~/poky/build/tmp/deploy/sdk For this example, the installer file is | 144 | ~/poky/build/tmp/deploy/sdk For this example, the installer file is |
@@ -130,39 +147,41 @@ section: | |||
130 | 147 | ||
131 | 6. *Install the Extensible SDK:* Use the following command to install | 148 | 6. *Install the Extensible SDK:* Use the following command to install |
132 | the SDK. For this example, install the SDK in the default | 149 | the SDK. For this example, install the SDK in the default |
133 | ``~/poky_sdk`` directory: $ cd ~/poky/build/tmp/deploy/sdk $ | 150 | ``~/poky_sdk`` directory: |
134 | ./poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-DISTRO.sh | 151 | :: |
135 | Poky (Yocto Project Reference Distro) Extensible SDK installer | 152 | |
136 | version DISTRO | 153 | $ cd ~/poky/build/tmp/deploy/sdk |
137 | ============================================================================ | 154 | $ ./poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-3.1.2.sh |
138 | Enter target directory for SDK (default: ~/poky_sdk): You are about | 155 | Poky (Yocto Project Reference Distro) Extensible SDK installer version 3.1.2 |
139 | to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y | 156 | ============================================================================ |
140 | Extracting SDK......................................done Setting it | 157 | Enter target directory for SDK (default: ~/poky_sdk): |
141 | up... Extracting buildtools... Preparing build system... Parsing | 158 | You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y |
142 | recipes: 100% | 159 | Extracting SDK......................................done |
143 | \|#################################################################\| | 160 | Setting it up... |
144 | Time: 0:00:52 Initializing tasks: 100% \|############## | 161 | Extracting buildtools... |
145 | ###############################################\| Time: 0:00:04 | 162 | Preparing build system... |
146 | Checking sstate mirror object availability: 100% | 163 | Parsing recipes: 100% |#################################################################| Time: 0:00:52 |
147 | \|######################################\| Time: 0:00:00 Parsing | 164 | Initializing tasks: 100% |############## ###############################################| Time: 0:00:04 |
148 | recipes: 100% | 165 | Checking sstate mirror object availability: 100% |######################################| Time: 0:00:00 |
149 | \|#################################################################\| | 166 | Parsing recipes: 100% |#################################################################| Time: 0:00:33 |
150 | Time: 0:00:33 Initializing tasks: 100% | 167 | Initializing tasks: 100% |##############################################################| Time: 0:00:00 |
151 | \|##############################################################\| | 168 | done |
152 | Time: 0:00:00 done SDK has been successfully set up and is ready to | 169 | SDK has been successfully set up and is ready to be used. |
153 | be used. Each time you wish to use the SDK in a new shell session, | 170 | Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. |
154 | you need to source the environment setup script e.g. $ . | 171 | $ . /home/scottrif/poky_sdk/environment-setup-i586-poky-linux |
155 | /home/scottrif/poky_sdk/environment-setup-i586-poky-linux | 172 | |
156 | 173 | ||
157 | 7. *Set Up a New Terminal to Work With the Extensible SDK:* You must set | 174 | 7. *Set Up a New Terminal to Work With the Extensible SDK:* You must set |
158 | up a new terminal to work with the SDK. You cannot use the same | 175 | up a new terminal to work with the SDK. You cannot use the same |
159 | BitBake shell used to build the installer. | 176 | BitBake shell used to build the installer. |
160 | 177 | ||
161 | After opening a new shell, run the SDK environment setup script as | 178 | After opening a new shell, run the SDK environment setup script as |
162 | directed by the output from installing the SDK: $ source | 179 | directed by the output from installing the SDK: |
163 | ~/poky_sdk/environment-setup-i586-poky-linux "SDK environment now set | 180 | :: |
164 | up; additionally you may now run devtool to perform development | 181 | |
165 | tasks. Run devtool --help for further details. | 182 | $ source ~/poky_sdk/environment-setup-i586-poky-linux |
183 | "SDK environment now set up; additionally you may now run devtool to perform development tasks. | ||
184 | Run devtool --help for further details. | ||
166 | 185 | ||
167 | .. note:: | 186 | .. note:: |
168 | 187 | ||
@@ -171,22 +190,24 @@ section: | |||
171 | 190 | ||
172 | 8. *Build the Clean Image:* The final step in preparing to work on the | 191 | 8. *Build the Clean Image:* The final step in preparing to work on the |
173 | kernel is to build an initial image using ``devtool`` in the new | 192 | kernel is to build an initial image using ``devtool`` in the new |
174 | terminal you just set up and initialized for SDK work: $ devtool | 193 | terminal you just set up and initialized for SDK work: |
175 | build-image Parsing recipes: 100% | 194 | :: |
176 | \|##########################################\| Time: 0:00:05 Parsing | 195 | |
177 | of 830 .bb files complete (0 cached, 830 parsed). 1299 targets, 47 | 196 | $ devtool build-image |
178 | skipped, 0 masked, 0 errors. WARNING: No packages to add, building | 197 | Parsing recipes: 100% |##########################################| Time: 0:00:05 |
179 | image core-image-minimal unmodified Loading cache: 100% | 198 | Parsing of 830 .bb files complete (0 cached, 830 parsed). 1299 targets, 47 skipped, 0 masked, 0 errors. |
180 | \|############################################\| Time: 0:00:00 Loaded | 199 | WARNING: No packages to add, building image core-image-minimal unmodified |
181 | 1299 entries from dependency cache. NOTE: Resolving any missing task | 200 | Loading cache: 100% |############################################| Time: 0:00:00 |
182 | queue dependencies Initializing tasks: 100% | 201 | Loaded 1299 entries from dependency cache. |
183 | \|#######################################\| Time: 0:00:07 Checking | 202 | NOTE: Resolving any missing task queue dependencies |
184 | sstate mirror object availability: 100% \|###############\| Time: | 203 | Initializing tasks: 100% |#######################################| Time: 0:00:07 |
185 | 0:00:00 NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks | 204 | Checking sstate mirror object availability: 100% |###############| Time: 0:00:00 |
186 | NOTE: Tasks Summary: Attempted 2866 tasks of which 2604 didn't need | 205 | NOTE: Executing SetScene Tasks |
187 | to be rerun and all succeeded. NOTE: Successfully built | 206 | NOTE: Executing RunQueue Tasks |
188 | core-image-minimal. You can find output files in | 207 | NOTE: Tasks Summary: Attempted 2866 tasks of which 2604 didn't need to be rerun and all succeeded. |
189 | /home/scottrif/poky_sdk/tmp/deploy/images/qemux86 If you were | 208 | NOTE: Successfully built core-image-minimal. You can find output files in /home/scottrif/poky_sdk/tmp/deploy/images/qemux86 |
209 | |||
210 | If you were | ||
190 | building for actual hardware and not for emulation, you could flash | 211 | building for actual hardware and not for emulation, you could flash |
191 | the image to a USB stick on ``/dev/sdd`` and boot your device. For an | 212 | the image to a USB stick on ``/dev/sdd`` and boot your device. For an |
192 | example that uses a Minnowboard, see the | 213 | example that uses a Minnowboard, see the |
@@ -195,8 +216,8 @@ section: | |||
195 | 216 | ||
196 | At this point you have set up to start making modifications to the | 217 | At this point you have set up to start making modifications to the |
197 | kernel by using the extensible SDK. For a continued example, see the | 218 | kernel by using the extensible SDK. For a continued example, see the |
198 | "`Using ``devtool`` to Patch the | 219 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
199 | Kernel <#using-devtool-to-patch-the-kernel>`__" section. | 220 | section. |
200 | 221 | ||
201 | Getting Ready for Traditional Kernel Development | 222 | Getting Ready for Traditional Kernel Development |
202 | ------------------------------------------------ | 223 | ------------------------------------------------ |
@@ -209,22 +230,25 @@ you will be editing these files. | |||
209 | Follow these steps to prepare to update the kernel image using | 230 | Follow these steps to prepare to update the kernel image using |
210 | traditional kernel development flow with the Yocto Project. Completing | 231 | traditional kernel development flow with the Yocto Project. Completing |
211 | this procedure leaves you ready to make modifications to the kernel | 232 | this procedure leaves you ready to make modifications to the kernel |
212 | source as described in the "`Using Traditional Kernel Development to | 233 | source as described in the ":ref:`kernel-dev/kernel-dev-common:using traditional kernel development to patch the kernel`" |
213 | Patch the | ||
214 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | ||
215 | section: | 234 | section: |
216 | 235 | ||
217 | 1. *Initialize the BitBake Environment:* Before you can do anything | 236 | 1. *Initialize the BitBake Environment:* Before you can do anything |
218 | using BitBake, you need to initialize the BitBake build environment | 237 | using BitBake, you need to initialize the BitBake build environment |
219 | by sourcing the build environment script (i.e. | 238 | by sourcing the build environment script (i.e. |
220 | ```oe-init-build-env`` <&YOCTO_DOCS_REF_URL;#structure-core-script>`__). | 239 | :ref:`structure-core-script`). |
221 | Also, for this example, be sure that the local branch you have | 240 | Also, for this example, be sure that the local branch you have |
222 | checked out for ``poky`` is the Yocto Project DISTRO_NAME branch. If | 241 | checked out for ``poky`` is the Yocto Project &DISTRO_NAME; branch. If |
223 | you need to checkout out the DISTRO_NAME branch, see the "`Checking | 242 | you need to checkout out the &DISTRO_NAME; branch, see the |
224 | out by Branch in | 243 | ":ref:`dev-manual/dev-manual-start:checking out by branch in poky`" |
225 | Poky <&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky>`__" | 244 | section in the Yocto Project Development Tasks Manual. |
226 | section in the Yocto Project Development Tasks Manual. $ cd ~/poky $ | 245 | :: |
227 | git branch master \* DISTRO_NAME $ source oe-init-build-env | 246 | |
247 | $ cd ~/poky | ||
248 | $ git branch | ||
249 | master | ||
250 | * &DISTRO_NAME; | ||
251 | $ source oe-init-build-env | ||
228 | 252 | ||
229 | .. note:: | 253 | .. note:: |
230 | 254 | ||
@@ -235,7 +259,7 @@ section: | |||
235 | ) have been cloned using Git and the local repository is named | 259 | ) have been cloned using Git and the local repository is named |
236 | "poky". | 260 | "poky". |
237 | 261 | ||
238 | 2. *Prepare Your ``local.conf`` File:* By default, the | 262 | 2. *Prepare Your local.conf File:* By default, the |
239 | :term:`MACHINE` variable is set to | 263 | :term:`MACHINE` variable is set to |
240 | "qemux86-64", which is fine if you are building for the QEMU emulator | 264 | "qemux86-64", which is fine if you are building for the QEMU emulator |
241 | in 64-bit mode. However, if you are not, you need to set the | 265 | in 64-bit mode. However, if you are not, you need to set the |
@@ -251,15 +275,21 @@ section: | |||
251 | 275 | ||
252 | In this example we wish to build for qemux86 so we must set the | 276 | In this example we wish to build for qemux86 so we must set the |
253 | ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". | 277 | ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". |
254 | As described we do this by appending to ``conf/local.conf``: MACHINE | 278 | As described we do this by appending to ``conf/local.conf``: |
255 | = "qemux86" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" | 279 | :: |
280 | |||
281 | MACHINE = "qemux86" | ||
282 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" | ||
256 | 283 | ||
257 | 3. *Create a Layer for Patches:* You need to create a layer to hold | 284 | 3. *Create a Layer for Patches:* You need to create a layer to hold |
258 | patches created for the kernel image. You can use the | 285 | patches created for the kernel image. You can use the |
259 | ``bitbake-layers create-layer`` command as follows: $ cd ~/poky/build | 286 | ``bitbake-layers create-layer`` command as follows: |
260 | $ bitbake-layers create-layer ../../meta-mylayer NOTE: Starting | 287 | :: |
261 | bitbake server... Add your new layer with 'bitbake-layers add-layer | 288 | |
262 | ../../meta-mylayer' | 289 | $ cd ~/poky/build |
290 | $ bitbake-layers create-layer ../../meta-mylayer | ||
291 | NOTE: Starting bitbake server... | ||
292 | Add your new layer with 'bitbake-layers add-layer ../../meta-mylayer' | ||
263 | 293 | ||
264 | .. note:: | 294 | .. note:: |
265 | 295 | ||
@@ -280,8 +310,13 @@ section: | |||
280 | 4. *Inform the BitBake Build Environment About Your Layer:* As directed | 310 | 4. *Inform the BitBake Build Environment About Your Layer:* As directed |
281 | when you created your layer, you need to add the layer to the | 311 | when you created your layer, you need to add the layer to the |
282 | :term:`BBLAYERS` variable in the | 312 | :term:`BBLAYERS` variable in the |
283 | ``bblayers.conf`` file as follows: $ cd ~/poky/build $ bitbake-layers | 313 | ``bblayers.conf`` file as follows: |
284 | add-layer ../../meta-mylayer NOTE: Starting bitbake server ... $ | 314 | :: |
315 | |||
316 | $ cd ~/poky/build | ||
317 | $ bitbake-layers add-layer ../../meta-mylayer | ||
318 | NOTE: Starting bitbake server ... | ||
319 | $ | ||
285 | 320 | ||
286 | 5. *Create a Local Copy of the Kernel Git Repository:* You can find Git | 321 | 5. *Create a Local Copy of the Kernel Git Repository:* You can find Git |
287 | repositories of supported Yocto Project kernels organized under | 322 | repositories of supported Yocto Project kernels organized under |
@@ -306,14 +341,17 @@ section: | |||
306 | linux-yocto-4.12 | 341 | linux-yocto-4.12 |
307 | kernel with releases prior to Yocto Project 2.4: | 342 | kernel with releases prior to Yocto Project 2.4: |
308 | 343 | ||
309 | $ cd ~ $ git clone git://git.yoctoproject.org/linux-yocto-4.12 | 344 | :: |
310 | --branch standard/base Cloning into 'linux-yocto-4.12'... remote: | 345 | |
311 | Counting objects: 6097195, done. remote: Compressing objects: 100% | 346 | $ cd ~ |
312 | (901026/901026), done. remote: Total 6097195 (delta 5152604), reused | 347 | $ git clone git://git.yoctoproject.org/linux-yocto-4.12 --branch standard/base |
313 | 6096847 (delta 5152256) Receiving objects: 100% (6097195/6097195), | 348 | Cloning into 'linux-yocto-4.12'... |
314 | 1.24 GiB \| 7.81 MiB/s, done. Resolving deltas: 100% | 349 | remote: Counting objects: 6097195, done. |
315 | (5152604/5152604), done. Checking connectivity... done. Checking out | 350 | remote: Compressing objects: 100% (901026/901026), done. |
316 | files: 100% (59846/59846), done. | 351 | remote: Total 6097195 (delta 5152604), reused 6096847 (delta 5152256) |
352 | Receiving objects: 100% (6097195/6097195), 1.24 GiB | 7.81 MiB/s, done. | ||
353 | Resolving deltas: 100% (5152604/5152604), done. Checking connectivity... done. | ||
354 | Checking out files: 100% (59846/59846), done. | ||
317 | 355 | ||
318 | 6. *Create a Local Copy of the Kernel Cache Git Repository:* For | 356 | 6. *Create a Local Copy of the Kernel Cache Git Repository:* For |
319 | simplicity, it is recommended that you create your copy of the kernel | 357 | simplicity, it is recommended that you create your copy of the kernel |
@@ -323,14 +361,18 @@ section: | |||
323 | the ``yocto-4.12`` branch. | 361 | the ``yocto-4.12`` branch. |
324 | 362 | ||
325 | The following commands show how to create a local copy of the | 363 | The following commands show how to create a local copy of the |
326 | ``yocto-kernel-cache`` and be in the ``yocto-4.12`` branch: $ cd ~ $ | 364 | ``yocto-kernel-cache`` and be in the ``yocto-4.12`` branch: |
327 | git clone git://git.yoctoproject.org/yocto-kernel-cache --branch | 365 | :: |
328 | yocto-4.12 Cloning into 'yocto-kernel-cache'... remote: Counting | 366 | |
329 | objects: 22639, done. remote: Compressing objects: 100% (9761/9761), | 367 | $ cd ~ |
330 | done. remote: Total 22639 (delta 12400), reused 22586 (delta 12347) | 368 | $ git clone git://git.yoctoproject.org/yocto-kernel-cache --branch yocto-4.12 |
331 | Receiving objects: 100% (22639/22639), 22.34 MiB \| 6.27 MiB/s, done. | 369 | Cloning into 'yocto-kernel-cache'... |
332 | Resolving deltas: 100% (12400/12400), done. Checking connectivity... | 370 | remote: Counting objects: 22639, done. |
333 | done. | 371 | remote: Compressing objects: 100% (9761/9761), done. |
372 | remote: Total 22639 (delta 12400), reused 22586 (delta 12347) | ||
373 | Receiving objects: 100% (22639/22639), 22.34 MiB | 6.27 MiB/s, done. | ||
374 | Resolving deltas: 100% (12400/12400), done. | ||
375 | Checking connectivity... done. | ||
334 | 376 | ||
335 | At this point, you are ready to start making modifications to the kernel | 377 | At this point, you are ready to start making modifications to the kernel |
336 | using traditional kernel development steps. For a continued example, see | 378 | using traditional kernel development steps. For a continued example, see |
@@ -347,8 +389,7 @@ layer contains its own :term:`BitBake` | |||
347 | append files (``.bbappend``) and provides a convenient mechanism to | 389 | append files (``.bbappend``) and provides a convenient mechanism to |
348 | create your own recipe files (``.bb``) as well as store and use kernel | 390 | create your own recipe files (``.bb``) as well as store and use kernel |
349 | patch files. For background information on working with layers, see the | 391 | patch files. For background information on working with layers, see the |
350 | "`Understanding and Creating | 392 | ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`" |
351 | Layers <&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers>`__" | ||
352 | section in the Yocto Project Development Tasks Manual. | 393 | section in the Yocto Project Development Tasks Manual. |
353 | 394 | ||
354 | .. note:: | 395 | .. note:: |
@@ -368,37 +409,56 @@ following section describes how to create a layer without the aid of | |||
368 | tools. These steps assume creation of a layer named ``mylayer`` in your | 409 | tools. These steps assume creation of a layer named ``mylayer`` in your |
369 | home directory: | 410 | home directory: |
370 | 411 | ||
371 | 1. *Create Structure*: Create the layer's structure: $ cd $HOME $ mkdir | 412 | 1. *Create Structure*: Create the layer's structure: |
372 | meta-mylayer $ mkdir meta-mylayer/conf $ mkdir | 413 | :: |
373 | meta-mylayer/recipes-kernel $ mkdir meta-mylayer/recipes-kernel/linux | 414 | |
374 | $ mkdir meta-mylayer/recipes-kernel/linux/linux-yocto The ``conf`` | 415 | $ cd $HOME |
375 | directory holds your configuration files, while the | 416 | $ mkdir meta-mylayer |
417 | $ mkdir meta-mylayer/conf | ||
418 | $ mkdir meta-mylayer/recipes-kernel | ||
419 | $ mkdir meta-mylayer/recipes-kernel/linux | ||
420 | $ mkdir meta-mylayer/recipes-kernel/linux/linux-yocto | ||
421 | |||
422 | The ``conf`` directory holds your configuration files, while the | ||
376 | ``recipes-kernel`` directory holds your append file and eventual | 423 | ``recipes-kernel`` directory holds your append file and eventual |
377 | patch files. | 424 | patch files. |
378 | 425 | ||
379 | 2. *Create the Layer Configuration File*: Move to the | 426 | 2. *Create the Layer Configuration File*: Move to the |
380 | ``meta-mylayer/conf`` directory and create the ``layer.conf`` file as | 427 | ``meta-mylayer/conf`` directory and create the ``layer.conf`` file as |
381 | follows: # We have a conf and classes directory, add to BBPATH BBPATH | 428 | follows: |
382 | .= ":${LAYERDIR}" # We have recipes-\* directories, add to BBFILES | 429 | :: |
383 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \\ | 430 | |
384 | ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "mylayer" | 431 | # We have a conf and classes directory, add to BBPATH |
385 | BBFILE_PATTERN_mylayer = "^${LAYERDIR}/" BBFILE_PRIORITY_mylayer = | 432 | BBPATH .= ":${LAYERDIR}" |
386 | "5" Notice ``mylayer`` as part of the last three statements. | 433 | |
434 | # We have recipes-* directories, add to BBFILES | ||
435 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
436 | ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
437 | |||
438 | BBFILE_COLLECTIONS += "mylayer" | ||
439 | BBFILE_PATTERN_mylayer = "^${LAYERDIR}/" | ||
440 | BBFILE_PRIORITY_mylayer = "5" | ||
441 | |||
442 | Notice ``mylayer`` as part of the last three statements. | ||
387 | 443 | ||
388 | 3. *Create the Kernel Recipe Append File*: Move to the | 444 | 3. *Create the Kernel Recipe Append File*: Move to the |
389 | ``meta-mylayer/recipes-kernel/linux`` directory and create the | 445 | ``meta-mylayer/recipes-kernel/linux`` directory and create the |
390 | kernel's append file. This example uses the ``linux-yocto-4.12`` | 446 | kernel's append file. This example uses the ``linux-yocto-4.12`` |
391 | kernel. Thus, the name of the append file is | 447 | kernel. Thus, the name of the append file is |
392 | ``linux-yocto_4.12.bbappend``: FILESEXTRAPATHS_prepend := | 448 | ``linux-yocto_4.12.bbappend``: |
393 | "${THISDIR}/${PN}:" SRC_URI_append = " file://patch-file-one" | 449 | :: |
394 | SRC_URI_append = " file://patch-file-two" SRC_URI_append = " | 450 | |
395 | file://patch-file-three" The | 451 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
396 | :term:`FILESEXTRAPATHS` | 452 | |
397 | and :term:`SRC_URI` statements | 453 | SRC_URI_append = " file://patch-file-one" |
454 | SRC_URI_append = " file://patch-file-two" | ||
455 | SRC_URI_append = " file://patch-file-three" | ||
456 | |||
457 | The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements | ||
398 | enable the OpenEmbedded build system to find patch files. For more | 458 | enable the OpenEmbedded build system to find patch files. For more |
399 | information on using append files, see the "`Using .bbappend Files in | 459 | information on using append files, see the |
400 | Your Layer <&YOCTO_DOCS_DEV_URL;#using-bbappend-files>`__" section in | 460 | ":ref:`dev-manual/dev-manual-common-tasks:using .bbappend files in your layer`" |
401 | the Yocto Project Development Tasks Manual. | 461 | section in the Yocto Project Development Tasks Manual. |
402 | 462 | ||
403 | Modifying an Existing Recipe | 463 | Modifying an Existing Recipe |
404 | ============================ | 464 | ============================ |
@@ -429,19 +489,28 @@ You create this file in your custom layer. You also name it accordingly | |||
429 | based on the linux-yocto recipe you are using. For example, if you are | 489 | based on the linux-yocto recipe you are using. For example, if you are |
430 | modifying the ``meta/recipes-kernel/linux/linux-yocto_4.12.bb`` recipe, | 490 | modifying the ``meta/recipes-kernel/linux/linux-yocto_4.12.bb`` recipe, |
431 | the append file will typically be located as follows within your custom | 491 | the append file will typically be located as follows within your custom |
432 | layer: your-layer/recipes-kernel/linux/linux-yocto_4.12.bbappend The | 492 | layer: |
433 | append file should initially extend the | 493 | :: |
494 | |||
495 | your-layer/recipes-kernel/linux/linux-yocto_4.12.bbappend | ||
496 | |||
497 | The append file should initially extend the | ||
434 | :term:`FILESPATH` search path by | 498 | :term:`FILESPATH` search path by |
435 | prepending the directory that contains your files to the | 499 | prepending the directory that contains your files to the |
436 | :term:`FILESEXTRAPATHS` | 500 | :term:`FILESEXTRAPATHS` |
437 | variable as follows: FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" The | 501 | variable as follows: |
438 | path | 502 | :: |
439 | ``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}`` | 503 | |
504 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
505 | |||
506 | The path ``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}`` | ||
440 | expands to "linux-yocto" in the current directory for this example. If | 507 | expands to "linux-yocto" in the current directory for this example. If |
441 | you add any new files that modify the kernel recipe and you have | 508 | you add any new files that modify the kernel recipe and you have |
442 | extended ``FILESPATH`` as described above, you must place the files in | 509 | extended ``FILESPATH`` as described above, you must place the files in |
443 | your layer in the following area: | 510 | your layer in the following area: |
444 | your-layer/recipes-kernel/linux/linux-yocto/ | 511 | :: |
512 | |||
513 | your-layer/recipes-kernel/linux/linux-yocto/ | ||
445 | 514 | ||
446 | .. note:: | 515 | .. note:: |
447 | 516 | ||
@@ -452,24 +521,40 @@ your-layer/recipes-kernel/linux/linux-yocto/ | |||
452 | 521 | ||
453 | As an example, consider the following append file used by the BSPs in | 522 | As an example, consider the following append file used by the BSPs in |
454 | ``meta-yocto-bsp``: | 523 | ``meta-yocto-bsp``: |
455 | meta-yocto-bsp/recipes-kernel/linux/linux-yocto_4.12.bbappend The | 524 | :: |
456 | following listing shows the file. Be aware that the actual commit ID | 525 | |
526 | meta-yocto-bsp/recipes-kernel/linux/linux-yocto_4.12.bbappend | ||
527 | |||
528 | The following listing shows the file. Be aware that the actual commit ID | ||
457 | strings in this example listing might be different than the actual | 529 | strings in this example listing might be different than the actual |
458 | strings in the file from the ``meta-yocto-bsp`` layer upstream. | 530 | strings in the file from the ``meta-yocto-bsp`` layer upstream. |
459 | KBRANCH_genericx86 = "standard/base" KBRANCH_genericx86-64 = | 531 | :: |
460 | "standard/base" KMACHINE_genericx86 ?= "common-pc" | 532 | |
461 | KMACHINE_genericx86-64 ?= "common-pc-64" KBRANCH_edgerouter = | 533 | KBRANCH_genericx86 = "standard/base" |
462 | "standard/edgerouter" KBRANCH_beaglebone = "standard/beaglebone" | 534 | KBRANCH_genericx86-64 = "standard/base" |
463 | SRCREV_machine_genericx86 ?= "d09f2ce584d60ecb7890550c22a80c48b83c2e19" | 535 | |
464 | SRCREV_machine_genericx86-64 ?= | 536 | KMACHINE_genericx86 ?= "common-pc" |
465 | "d09f2ce584d60ecb7890550c22a80c48b83c2e19" SRCREV_machine_edgerouter ?= | 537 | KMACHINE_genericx86-64 ?= "common-pc-64" |
466 | "b5c8cfda2dfe296410d51e131289fb09c69e1e7d" SRCREV_machine_beaglebone ?= | 538 | KBRANCH_edgerouter = "standard/edgerouter" |
467 | "b5c8cfda2dfe296410d51e131289fb09c69e1e7d" COMPATIBLE_MACHINE_genericx86 | 539 | KBRANCH_beaglebone = "standard/beaglebone" |
468 | = "genericx86" COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64" | 540 | |
469 | COMPATIBLE_MACHINE_edgerouter = "edgerouter" | 541 | SRCREV_machine_genericx86 ?= "d09f2ce584d60ecb7890550c22a80c48b83c2e19" |
470 | COMPATIBLE_MACHINE_beaglebone = "beaglebone" LINUX_VERSION_genericx86 = | 542 | SRCREV_machine_genericx86-64 ?= "d09f2ce584d60ecb7890550c22a80c48b83c2e19" |
471 | "4.12.7" LINUX_VERSION_genericx86-64 = "4.12.7" LINUX_VERSION_edgerouter | 543 | SRCREV_machine_edgerouter ?= "b5c8cfda2dfe296410d51e131289fb09c69e1e7d" |
472 | = "4.12.10" LINUX_VERSION_beaglebone = "4.12.10" This append file | 544 | SRCREV_machine_beaglebone ?= "b5c8cfda2dfe296410d51e131289fb09c69e1e7d" |
545 | |||
546 | |||
547 | COMPATIBLE_MACHINE_genericx86 = "genericx86" | ||
548 | COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64" | ||
549 | COMPATIBLE_MACHINE_edgerouter = "edgerouter" | ||
550 | COMPATIBLE_MACHINE_beaglebone = "beaglebone" | ||
551 | |||
552 | LINUX_VERSION_genericx86 = "4.12.7" | ||
553 | LINUX_VERSION_genericx86-64 = "4.12.7" | ||
554 | LINUX_VERSION_edgerouter = "4.12.10" | ||
555 | LINUX_VERSION_beaglebone = "4.12.10" | ||
556 | |||
557 | This append file | ||
473 | contains statements used to support several BSPs that ship with the | 558 | contains statements used to support several BSPs that ship with the |
474 | Yocto Project. The file defines machines using the | 559 | Yocto Project. The file defines machines using the |
475 | :term:`COMPATIBLE_MACHINE` | 560 | :term:`COMPATIBLE_MACHINE` |
@@ -504,15 +589,21 @@ For example, suppose you had some configuration options in a file called | |||
504 | ``network_configs.cfg``. You can place that file inside a directory | 589 | ``network_configs.cfg``. You can place that file inside a directory |
505 | named ``linux-yocto`` and then add a ``SRC_URI`` statement such as the | 590 | named ``linux-yocto`` and then add a ``SRC_URI`` statement such as the |
506 | following to the append file. When the OpenEmbedded build system builds | 591 | following to the append file. When the OpenEmbedded build system builds |
507 | the kernel, the configuration options are picked up and applied. SRC_URI | 592 | the kernel, the configuration options are picked up and applied. |
508 | += "file://network_configs.cfg" | 593 | :: |
594 | |||
595 | SRC_URI += "file://network_configs.cfg" | ||
509 | 596 | ||
510 | To group related configurations into multiple files, you perform a | 597 | To group related configurations into multiple files, you perform a |
511 | similar procedure. Here is an example that groups separate | 598 | similar procedure. Here is an example that groups separate |
512 | configurations specifically for Ethernet and graphics into their own | 599 | configurations specifically for Ethernet and graphics into their own |
513 | files and adds the configurations by using a ``SRC_URI`` statement like | 600 | files and adds the configurations by using a ``SRC_URI`` statement like |
514 | the following in your append file: SRC_URI += "file://myconfig.cfg \\ | 601 | the following in your append file: |
515 | file://eth.cfg \\ file://gfx.cfg" | 602 | :: |
603 | |||
604 | SRC_URI += "file://myconfig.cfg \ | ||
605 | file://eth.cfg \ | ||
606 | file://gfx.cfg" | ||
516 | 607 | ||
517 | Another variable you can use in your kernel recipe append file is the | 608 | Another variable you can use in your kernel recipe append file is the |
518 | :term:`FILESEXTRAPATHS` | 609 | :term:`FILESEXTRAPATHS` |
@@ -552,18 +643,22 @@ reference them in :term:`SRC_URI` | |||
552 | statements. | 643 | statements. |
553 | 644 | ||
554 | For example, you can apply a three-patch series by adding the following | 645 | For example, you can apply a three-patch series by adding the following |
555 | lines to your linux-yocto ``.bbappend`` file in your layer: SRC_URI += | 646 | lines to your linux-yocto ``.bbappend`` file in your layer: |
556 | "file://0001-first-change.patch" SRC_URI += | 647 | :: |
557 | "file://0002-second-change.patch" SRC_URI += | 648 | |
558 | "file://0003-third-change.patch" The next time you run BitBake to build | 649 | SRC_URI += "file://0001-first-change.patch" |
650 | SRC_URI += "file://0002-second-change.patch" | ||
651 | SRC_URI += "file://0003-third-change.patch" | ||
652 | |||
653 | The next time you run BitBake to build | ||
559 | the Linux kernel, BitBake detects the change in the recipe and fetches | 654 | the Linux kernel, BitBake detects the change in the recipe and fetches |
560 | and applies the patches before building the kernel. | 655 | and applies the patches before building the kernel. |
561 | 656 | ||
562 | For a detailed example showing how to patch the kernel using | 657 | For a detailed example showing how to patch the kernel using |
563 | ``devtool``, see the "`Using ``devtool`` to Patch the | 658 | ``devtool``, see the |
564 | Kernel <#using-devtool-to-patch-the-kernel>`__" and "`Using Traditional | 659 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
565 | Kernel Development to Patch the | 660 | and |
566 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | 661 | ":ref:`kernel-dev/kernel-dev-common:using traditional kernel development to patch the kernel`" |
567 | sections. | 662 | sections. |
568 | 663 | ||
569 | Changing the Configuration | 664 | Changing the Configuration |
@@ -580,8 +675,12 @@ to use for the configuration, as before, copy that file to the | |||
580 | appropriate ``${PN}`` directory in your layer's ``recipes-kernel/linux`` | 675 | appropriate ``${PN}`` directory in your layer's ``recipes-kernel/linux`` |
581 | directory, and rename the copied file to "defconfig". Then, add the | 676 | directory, and rename the copied file to "defconfig". Then, add the |
582 | following lines to the linux-yocto ``.bbappend`` file in your layer: | 677 | following lines to the linux-yocto ``.bbappend`` file in your layer: |
583 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += | 678 | :: |
584 | "file://defconfig" The ``SRC_URI`` tells the build system how to search | 679 | |
680 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
681 | SRC_URI += "file://defconfig" | ||
682 | |||
683 | The ``SRC_URI`` tells the build system how to search | ||
585 | for the file, while the | 684 | for the file, while the |
586 | :term:`FILESEXTRAPATHS` | 685 | :term:`FILESEXTRAPATHS` |
587 | extends the :term:`FILESPATH` | 686 | extends the :term:`FILESPATH` |
@@ -606,13 +705,26 @@ Generally speaking, the preferred approach is to determine the | |||
606 | incremental change you want to make and add that as a configuration | 705 | incremental change you want to make and add that as a configuration |
607 | fragment. For example, if you want to add support for a basic serial | 706 | fragment. For example, if you want to add support for a basic serial |
608 | console, create a file named ``8250.cfg`` in the ``${PN}`` directory | 707 | console, create a file named ``8250.cfg`` in the ``${PN}`` directory |
609 | with the following content (without indentation): CONFIG_SERIAL_8250=y | 708 | with the following content (without indentation): |
610 | CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_PCI=y | 709 | :: |
611 | CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | 710 | |
612 | CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y Next, include this | 711 | CONFIG_SERIAL_8250=y |
712 | CONFIG_SERIAL_8250_CONSOLE=y | ||
713 | CONFIG_SERIAL_8250_PCI=y | ||
714 | CONFIG_SERIAL_8250_NR_UARTS=4 | ||
715 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
716 | CONFIG_SERIAL_CORE=y | ||
717 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
718 | |||
719 | Next, include this | ||
613 | configuration fragment and extend the ``FILESPATH`` variable in your | 720 | configuration fragment and extend the ``FILESPATH`` variable in your |
614 | ``.bbappend`` file: FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 721 | ``.bbappend`` file: |
615 | SRC_URI += "file://8250.cfg" The next time you run BitBake to build the | 722 | :: |
723 | |||
724 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
725 | SRC_URI += "file://8250.cfg" | ||
726 | |||
727 | The next time you run BitBake to build the | ||
616 | Linux kernel, BitBake detects the change in the recipe and fetches and | 728 | Linux kernel, BitBake detects the change in the recipe and fetches and |
617 | applies the new configuration before building the kernel. | 729 | applies the new configuration before building the kernel. |
618 | 730 | ||
@@ -626,8 +738,12 @@ It might be desirable to have kernel configuration fragment support | |||
626 | through a ``defconfig`` file that is pulled from the kernel source tree | 738 | through a ``defconfig`` file that is pulled from the kernel source tree |
627 | for the configured machine. By default, the OpenEmbedded build system | 739 | for the configured machine. By default, the OpenEmbedded build system |
628 | looks for ``defconfig`` files in the layer used for Metadata, which is | 740 | looks for ``defconfig`` files in the layer used for Metadata, which is |
629 | "out-of-tree", and then configures them using the following: SRC_URI += | 741 | "out-of-tree", and then configures them using the following: |
630 | "file://defconfig" If you do not want to maintain copies of | 742 | :: |
743 | |||
744 | SRC_URI += "file://defconfig" | ||
745 | |||
746 | If you do not want to maintain copies of | ||
631 | ``defconfig`` files in your layer but would rather allow users to use | 747 | ``defconfig`` files in your layer but would rather allow users to use |
632 | the default configuration from the kernel tree and still be able to add | 748 | the default configuration from the kernel tree and still be able to add |
633 | configuration fragments to the | 749 | configuration fragments to the |
@@ -636,11 +752,18 @@ append files, you can direct the OpenEmbedded build system to use a | |||
636 | ``defconfig`` file that is "in-tree". | 752 | ``defconfig`` file that is "in-tree". |
637 | 753 | ||
638 | To specify an "in-tree" ``defconfig`` file, use the following statement | 754 | To specify an "in-tree" ``defconfig`` file, use the following statement |
639 | form: KBUILD_DEFCONFIG_KMACHINE ?= defconfig_file Here is an example | 755 | form: |
756 | :: | ||
757 | |||
758 | KBUILD_DEFCONFIG_KMACHINE ?= defconfig_file | ||
759 | |||
760 | Here is an example | ||
640 | that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2" | 761 | that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2" |
641 | and provides the path to the "in-tree" ``defconfig`` file to be used for | 762 | and provides the path to the "in-tree" ``defconfig`` file to be used for |
642 | a Raspberry Pi 2, which is based on the Broadcom 2708/2709 chipset: | 763 | a Raspberry Pi 2, which is based on the Broadcom 2708/2709 chipset: |
643 | KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig" | 764 | :: |
765 | |||
766 | KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig" | ||
644 | 767 | ||
645 | Aside from modifying your kernel recipe and providing your own | 768 | Aside from modifying your kernel recipe and providing your own |
646 | ``defconfig`` file, you need to be sure no files or statements set | 769 | ``defconfig`` file, you need to be sure no files or statements set |
@@ -678,8 +801,7 @@ output at boot time through ``printk`` statements in the kernel's | |||
678 | ``calibrate.c`` source code file. Applying the patch and booting the | 801 | ``calibrate.c`` source code file. Applying the patch and booting the |
679 | modified image causes the added messages to appear on the emulator's | 802 | modified image causes the added messages to appear on the emulator's |
680 | console. The example is a continuation of the setup procedure found in | 803 | console. The example is a continuation of the setup procedure found in |
681 | the "`Getting Ready to Develop Using | 804 | the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devtool\`\``" Section. |
682 | ``devtool`` <#getting-ready-to-develop-using-devtool>`__" Section. | ||
683 | 805 | ||
684 | 1. *Check Out the Kernel Source Files:* First you must use ``devtool`` | 806 | 1. *Check Out the Kernel Source Files:* First you must use ``devtool`` |
685 | to checkout the kernel source code in its workspace. Be sure you are | 807 | to checkout the kernel source code in its workspace. Be sure you are |
@@ -694,8 +816,10 @@ the "`Getting Ready to Develop Using | |||
694 | devtool | 816 | devtool |
695 | " section for more information. | 817 | " section for more information. |
696 | 818 | ||
697 | Use the following ``devtool`` command to check out the code: $ | 819 | Use the following ``devtool`` command to check out the code: |
698 | devtool modify linux-yocto | 820 | :: |
821 | |||
822 | $ devtool modify linux-yocto | ||
699 | 823 | ||
700 | .. note:: | 824 | .. note:: |
701 | 825 | ||
@@ -706,7 +830,7 @@ the "`Getting Ready to Develop Using | |||
706 | ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus | 830 | ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus |
707 | be3a89ce7c47178880ba7bf6293d7404 for | 831 | be3a89ce7c47178880ba7bf6293d7404 for |
708 | /path/to/esdk/layers/poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb.do_unpack | 832 | /path/to/esdk/layers/poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb.do_unpack |
709 | 833 | ||
710 | 834 | ||
711 | You can safely ignore these messages. The source code is correctly | 835 | You can safely ignore these messages. The source code is correctly |
712 | checked out. | 836 | checked out. |
@@ -718,19 +842,37 @@ the "`Getting Ready to Develop Using | |||
718 | noted where you can find the source files (e.g. | 842 | noted where you can find the source files (e.g. |
719 | ``~/poky_sdk/workspace/sources/linux-yocto``). Change to where the | 843 | ``~/poky_sdk/workspace/sources/linux-yocto``). Change to where the |
720 | kernel source code is before making your edits to the | 844 | kernel source code is before making your edits to the |
721 | ``calibrate.c`` file: $ cd | 845 | ``calibrate.c`` file: |
722 | ~/poky_sdk/workspace/sources/linux-yocto | 846 | :: |
847 | |||
848 | $ cd ~/poky_sdk/workspace/sources/linux-yocto | ||
723 | 849 | ||
724 | 2. *Edit the source file*: Edit the ``init/calibrate.c`` file to have | 850 | 2. *Edit the source file*: Edit the ``init/calibrate.c`` file to have |
725 | the following changes: void calibrate_delay(void) { unsigned long | 851 | the following changes: |
726 | lpj; static bool printed; int this_cpu = smp_processor_id(); | 852 | :: |
727 | printk("*************************************\n"); printk("\* | 853 | |
728 | \*\n"); printk("\* HELLO YOCTO KERNEL \*\n"); printk("\* \*\n"); | 854 | void calibrate_delay(void) |
729 | printk("*************************************\n"); if | 855 | { |
730 | (per_cpu(cpu_loops_per_jiffy, this_cpu)) { . . . | 856 | unsigned long lpj; |
857 | static bool printed; | ||
858 | int this_cpu = smp_processor_id(); | ||
859 | |||
860 | printk("*************************************\n"); | ||
861 | printk("* *\n"); | ||
862 | printk("* HELLO YOCTO KERNEL *\n"); | ||
863 | printk("* *\n"); | ||
864 | printk("*************************************\n"); | ||
865 | |||
866 | if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { | ||
867 | . | ||
868 | . | ||
869 | . | ||
731 | 870 | ||
732 | 3. *Build the Updated Kernel Source:* To build the updated kernel | 871 | 3. *Build the Updated Kernel Source:* To build the updated kernel |
733 | source, use ``devtool``: $ devtool build linux-yocto | 872 | source, use ``devtool``: |
873 | :: | ||
874 | |||
875 | $ devtool build linux-yocto | ||
734 | 876 | ||
735 | 4. *Create the Image With the New Kernel:* Use the | 877 | 4. *Create the Image With the New Kernel:* Use the |
736 | ``devtool build-image`` command to create a new image that has the | 878 | ``devtool build-image`` command to create a new image that has the |
@@ -744,25 +886,40 @@ the "`Getting Ready to Develop Using | |||
744 | TipsAndTricks/KernelDevelopmentWithEsdk | 886 | TipsAndTricks/KernelDevelopmentWithEsdk |
745 | Wiki Page. | 887 | Wiki Page. |
746 | 888 | ||
747 | $ cd ~ $ devtool build-image core-image-minimal | 889 | :: |
890 | |||
891 | $ cd ~ | ||
892 | $ devtool build-image core-image-minimal | ||
748 | 893 | ||
749 | 5. *Test the New Image:* For this example, you can run the new image | 894 | 5. *Test the New Image:* For this example, you can run the new image |
750 | using QEMU to verify your changes: | 895 | using QEMU to verify your changes: |
751 | 896 | ||
752 | 1. *Boot the image*: Boot the modified image in the QEMU emulator | 897 | 1. *Boot the image*: Boot the modified image in the QEMU emulator |
753 | using this command: $ runqemu qemux86 | 898 | using this command: |
899 | :: | ||
900 | |||
901 | $ runqemu qemux86 | ||
754 | 902 | ||
755 | 2. *Verify the changes*: Log into the machine using ``root`` with no | 903 | 2. *Verify the changes*: Log into the machine using ``root`` with no |
756 | password and then use the following shell command to scroll | 904 | password and then use the following shell command to scroll |
757 | through the console's boot output. # dmesg \| less You should see | 905 | through the console's boot output. |
906 | :: | ||
907 | |||
908 | # dmesg | less | ||
909 | |||
910 | You should see | ||
758 | the results of your ``printk`` statements as part of the output | 911 | the results of your ``printk`` statements as part of the output |
759 | when you scroll down the console window. | 912 | when you scroll down the console window. |
760 | 913 | ||
761 | 6. *Stage and commit your changes*: Within your eSDK terminal, change | 914 | 6. *Stage and commit your changes*: Within your eSDK terminal, change |
762 | your working directory to where you modified the ``calibrate.c`` file | 915 | your working directory to where you modified the ``calibrate.c`` file |
763 | and use these Git commands to stage and commit your changes: $ cd | 916 | and use these Git commands to stage and commit your changes: |
764 | ~/poky_sdk/workspace/sources/linux-yocto $ git status $ git add | 917 | :: |
765 | init/calibrate.c $ git commit -m "calibrate: Add printk example" | 918 | |
919 | $ cd ~/poky_sdk/workspace/sources/linux-yocto | ||
920 | $ git status | ||
921 | $ git add init/calibrate.c | ||
922 | $ git commit -m "calibrate: Add printk example" | ||
766 | 923 | ||
767 | 7. *Export the Patches and Create an Append File:* To export your | 924 | 7. *Export the Patches and Create an Append File:* To export your |
768 | commits as patches and create a ``.bbappend`` file, use the following | 925 | commits as patches and create a ``.bbappend`` file, use the following |
@@ -775,7 +932,9 @@ the "`Getting Ready to Develop Using | |||
775 | Getting Ready to Develop Using devtool | 932 | Getting Ready to Develop Using devtool |
776 | " section for information on setting up this layer. | 933 | " section for information on setting up this layer. |
777 | 934 | ||
778 | $ devtool finish linux-yocto ~/meta-mylayer Once the command | 935 | $ devtool finish linux-yocto ~/meta-mylayer |
936 | |||
937 | Once the command | ||
779 | finishes, the patches and the ``.bbappend`` file are located in the | 938 | finishes, the patches and the ``.bbappend`` file are located in the |
780 | ``~/meta-mylayer/recipes-kernel/linux`` directory. | 939 | ``~/meta-mylayer/recipes-kernel/linux`` directory. |
781 | 940 | ||
@@ -783,15 +942,20 @@ the "`Getting Ready to Develop Using | |||
783 | image that includes your kernel patches. Execute the following | 942 | image that includes your kernel patches. Execute the following |
784 | command from your | 943 | command from your |
785 | :term:`Build Directory` in the terminal | 944 | :term:`Build Directory` in the terminal |
786 | set up to run BitBake: $ cd ~/poky/build $ bitbake core-image-minimal | 945 | set up to run BitBake: |
946 | :: | ||
947 | |||
948 | $ cd ~/poky/build | ||
949 | $ bitbake core-image-minimal | ||
787 | 950 | ||
788 | Using Traditional Kernel Development to Patch the Kernel | 951 | Using Traditional Kernel Development to Patch the Kernel |
789 | ======================================================== | 952 | ======================================================== |
790 | 953 | ||
791 | The steps in this procedure show you how you can patch the kernel using | 954 | The steps in this procedure show you how you can patch the kernel using |
792 | traditional kernel development (i.e. not using ``devtool`` and the | 955 | traditional kernel development (i.e. not using ``devtool`` and the |
793 | extensible SDK as described in the "`Using ``devtool`` to Patch the | 956 | extensible SDK as described in the |
794 | Kernel <#using-devtool-to-patch-the-kernel>`__" section). | 957 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
958 | section). | ||
795 | 959 | ||
796 | .. note:: | 960 | .. note:: |
797 | 961 | ||
@@ -824,35 +988,61 @@ Section. | |||
824 | 1. *Change the working directory*: You need to locate the source | 988 | 1. *Change the working directory*: You need to locate the source |
825 | files in the local copy of the kernel Git repository: Change to | 989 | files in the local copy of the kernel Git repository: Change to |
826 | where the kernel source code is before making your edits to the | 990 | where the kernel source code is before making your edits to the |
827 | ``calibrate.c`` file: $ cd ~/linux-yocto-4.12/init | 991 | ``calibrate.c`` file: |
992 | :: | ||
993 | |||
994 | $ cd ~/linux-yocto-4.12/init | ||
828 | 995 | ||
829 | 2. *Edit the source file*: Edit the ``calibrate.c`` file to have the | 996 | 2. *Edit the source file*: Edit the ``calibrate.c`` file to have the |
830 | following changes: void calibrate_delay(void) { unsigned long lpj; | 997 | following changes: |
831 | static bool printed; int this_cpu = smp_processor_id(); | 998 | :: |
832 | printk("*************************************\n"); printk("\* | 999 | |
833 | \*\n"); printk("\* HELLO YOCTO KERNEL \*\n"); printk("\* \*\n"); | 1000 | void calibrate_delay(void) |
834 | printk("*************************************\n"); if | 1001 | { |
835 | (per_cpu(cpu_loops_per_jiffy, this_cpu)) { . . . | 1002 | unsigned long lpj; |
1003 | static bool printed; | ||
1004 | int this_cpu = smp_processor_id(); | ||
1005 | |||
1006 | printk("*************************************\n"); | ||
1007 | printk("* *\n"); | ||
1008 | printk("* HELLO YOCTO KERNEL *\n"); | ||
1009 | printk("* *\n"); | ||
1010 | printk("*************************************\n"); | ||
1011 | |||
1012 | if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { | ||
1013 | . | ||
1014 | . | ||
1015 | . | ||
836 | 1016 | ||
837 | 2. *Stage and Commit Your Changes:* Use standard Git commands to stage | 1017 | 2. *Stage and Commit Your Changes:* Use standard Git commands to stage |
838 | and commit the changes you just made: $ git add calibrate.c $ git | 1018 | and commit the changes you just made: |
839 | commit -m "calibrate.c - Added some printk statements" If you do not | 1019 | :: |
1020 | |||
1021 | $ git add calibrate.c | ||
1022 | $ git commit -m "calibrate.c - Added some printk statements" | ||
1023 | |||
1024 | If you do not | ||
840 | stage and commit your changes, the OpenEmbedded Build System will not | 1025 | stage and commit your changes, the OpenEmbedded Build System will not |
841 | pick up the changes. | 1026 | pick up the changes. |
842 | 1027 | ||
843 | 3. *Update Your ``local.conf`` File to Point to Your Source Files:* In | 1028 | 3. *Update Your local.conf File to Point to Your Source Files:* In |
844 | addition to your ``local.conf`` file specifying to use | 1029 | addition to your ``local.conf`` file specifying to use |
845 | "kernel-modules" and the "qemux86" machine, it must also point to the | 1030 | "kernel-modules" and the "qemux86" machine, it must also point to the |
846 | updated kernel source files. Add | 1031 | updated kernel source files. Add |
847 | :term:`SRC_URI` and | 1032 | :term:`SRC_URI` and |
848 | :term:`SRCREV` statements similar | 1033 | :term:`SRCREV` statements similar |
849 | to the following to your ``local.conf``: $ cd ~/poky/build/conf Add | 1034 | to the following to your ``local.conf``: |
850 | the following to the ``local.conf``: SRC_URI_pn-linux-yocto = | 1035 | :: |
851 | "git:///path-to/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; | 1036 | |
852 | \\ | 1037 | $ cd ~/poky/build/conf |
853 | git:///path-to/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | 1038 | |
854 | SRCREV_meta_qemux86 = "${AUTOREV}" SRCREV_machine_qemux86 = | 1039 | Add the following to the ``local.conf``: |
855 | "${AUTOREV}" | 1040 | :: |
1041 | |||
1042 | SRC_URI_pn-linux-yocto = "git:///path-to/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ | ||
1043 | git:///path-to/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | ||
1044 | SRCREV_meta_qemux86 = "${AUTOREV}" | ||
1045 | SRCREV_machine_qemux86 = "${AUTOREV}" | ||
856 | 1046 | ||
857 | .. note:: | 1047 | .. note:: |
858 | 1048 | ||
@@ -866,23 +1056,39 @@ Section. | |||
866 | 1056 | ||
867 | 4. *Build the Image:* With the source modified, your changes staged and | 1057 | 4. *Build the Image:* With the source modified, your changes staged and |
868 | committed, and the ``local.conf`` file pointing to the kernel files, | 1058 | committed, and the ``local.conf`` file pointing to the kernel files, |
869 | you can now use BitBake to build the image: $ cd ~/poky/build $ | 1059 | you can now use BitBake to build the image: |
870 | bitbake core-image-minimal | 1060 | :: |
1061 | |||
1062 | $ cd ~/poky/build | ||
1063 | $ bitbake core-image-minimal | ||
871 | 1064 | ||
872 | 5. *Boot the image*: Boot the modified image in the QEMU emulator using | 1065 | 5. *Boot the image*: Boot the modified image in the QEMU emulator using |
873 | this command. When prompted to login to the QEMU console, use "root" | 1066 | this command. When prompted to login to the QEMU console, use "root" |
874 | with no password: $ cd ~/poky/build $ runqemu qemux86 | 1067 | with no password: |
1068 | :: | ||
1069 | |||
1070 | $ cd ~/poky/build | ||
1071 | $ runqemu qemux86 | ||
875 | 1072 | ||
876 | 6. *Look for Your Changes:* As QEMU booted, you might have seen your | 1073 | 6. *Look for Your Changes:* As QEMU booted, you might have seen your |
877 | changes rapidly scroll by. If not, use these commands to see your | 1074 | changes rapidly scroll by. If not, use these commands to see your |
878 | changes: # dmesg \| less You should see the results of your | 1075 | changes: |
1076 | :: | ||
1077 | |||
1078 | # dmesg | less | ||
1079 | |||
1080 | You should see the results of your | ||
879 | ``printk`` statements as part of the output when you scroll down the | 1081 | ``printk`` statements as part of the output when you scroll down the |
880 | console window. | 1082 | console window. |
881 | 1083 | ||
882 | 7. *Generate the Patch File:* Once you are sure that your patch works | 1084 | 7. *Generate the Patch File:* Once you are sure that your patch works |
883 | correctly, you can generate a ``*.patch`` file in the kernel source | 1085 | correctly, you can generate a ``*.patch`` file in the kernel source |
884 | repository: $ cd ~/linux-yocto-4.12/init $ git format-patch -1 | 1086 | repository: |
885 | 0001-calibrate.c-Added-some-printk-statements.patch | 1087 | :: |
1088 | |||
1089 | $ cd ~/linux-yocto-4.12/init | ||
1090 | $ git format-patch -1 | ||
1091 | 0001-calibrate.c-Added-some-printk-statements.patch | ||
886 | 1092 | ||
887 | 8. *Move the Patch File to Your Layer:* In order for subsequent builds | 1093 | 8. *Move the Patch File to Your Layer:* In order for subsequent builds |
888 | to pick up patches, you need to move the patch file you created in | 1094 | to pick up patches, you need to move the patch file you created in |
@@ -891,32 +1097,40 @@ Section. | |||
891 | ``meta-mylayer``. When the layer was created using the | 1097 | ``meta-mylayer``. When the layer was created using the |
892 | ``yocto-create`` script, no additional hierarchy was created to | 1098 | ``yocto-create`` script, no additional hierarchy was created to |
893 | support patches. Before moving the patch file, you need to add | 1099 | support patches. Before moving the patch file, you need to add |
894 | additional structure to your layer using the following commands: $ cd | 1100 | additional structure to your layer using the following commands: |
895 | ~/meta-mylayer $ mkdir recipes-kernel $ mkdir recipes-kernel/linux $ | 1101 | :: |
896 | mkdir recipes-kernel/linux/linux-yocto Once you have created this | 1102 | |
1103 | $ cd ~/meta-mylayer | ||
1104 | $ mkdir recipes-kernel | ||
1105 | $ mkdir recipes-kernel/linux | ||
1106 | $ mkdir recipes-kernel/linux/linux-yocto | ||
1107 | |||
1108 | Once you have created this | ||
897 | hierarchy in your layer, you can move the patch file using the | 1109 | hierarchy in your layer, you can move the patch file using the |
898 | following command: $ mv | 1110 | following command: |
899 | ~/linux-yocto-4.12/init/0001-calibrate.c-Added-some-printk-statements.patch | 1111 | :: |
900 | ~/meta-mylayer/recipes-kernel/linux/linux-yocto | 1112 | |
1113 | $ mv ~/linux-yocto-4.12/init/0001-calibrate.c-Added-some-printk-statements.patch ~/meta-mylayer/recipes-kernel/linux/linux-yocto | ||
901 | 1114 | ||
902 | 9. *Create the Append File:* Finally, you need to create the | 1115 | 9. *Create the Append File:* Finally, you need to create the |
903 | ``linux-yocto_4.12.bbappend`` file and insert statements that allow | 1116 | ``linux-yocto_4.12.bbappend`` file and insert statements that allow |
904 | the OpenEmbedded build system to find the patch. The append file | 1117 | the OpenEmbedded build system to find the patch. The append file |
905 | needs to be in your layer's ``recipes-kernel/linux`` directory and it | 1118 | needs to be in your layer's ``recipes-kernel/linux`` directory and it |
906 | must be named ``linux-yocto_4.12.bbappend`` and have the following | 1119 | must be named ``linux-yocto_4.12.bbappend`` and have the following |
907 | contents: FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 1120 | contents: |
908 | SRC_URI_append = " | 1121 | :: |
909 | file://0001-calibrate.c-Added-some-printk-statements.patch" The | 1122 | |
910 | :term:`FILESEXTRAPATHS` | 1123 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
911 | and :term:`SRC_URI` statements | 1124 | SRC_URI_append = "file://0001-calibrate.c-Added-some-printk-statements.patch" |
1125 | |||
1126 | The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements | ||
912 | enable the OpenEmbedded build system to find the patch file. | 1127 | enable the OpenEmbedded build system to find the patch file. |
913 | 1128 | ||
914 | For more information on append files and patches, see the "`Creating | 1129 | For more information on append files and patches, see the "`Creating |
915 | the Append File <#creating-the-append-file>`__" and "`Applying | 1130 | the Append File <#creating-the-append-file>`__" and "`Applying |
916 | Patches <#applying-patches>`__" sections. You can also see the | 1131 | Patches <#applying-patches>`__" sections. You can also see the |
917 | "`Using .bbappend Files in Your | 1132 | ":ref:`dev-manual/dev-manual-common-tasks:using .bbappend files in your layer`" |
918 | Layer" <&YOCTO_DOCS_DEV_URL;#using-bbappend-files>`__" section in the | 1133 | section in the Yocto Project Development Tasks Manual. |
919 | Yocto Project Development Tasks Manual. | ||
920 | 1134 | ||
921 | .. note:: | 1135 | .. note:: |
922 | 1136 | ||
@@ -934,7 +1148,7 @@ Section. | |||
934 | $ bitbake core-image-minimal -c cleanall | 1148 | $ bitbake core-image-minimal -c cleanall |
935 | $ bitbake core-image-minimal | 1149 | $ bitbake core-image-minimal |
936 | $ runqemu qemux86 | 1150 | $ runqemu qemux86 |
937 | 1151 | ||
938 | 1152 | ||
939 | Configuring the Kernel | 1153 | Configuring the Kernel |
940 | ====================== | 1154 | ====================== |
@@ -967,21 +1181,30 @@ environment, you must do the following: | |||
967 | 1181 | ||
968 | - Because you launch ``menuconfig`` using BitBake, you must be sure to | 1182 | - Because you launch ``menuconfig`` using BitBake, you must be sure to |
969 | set up your environment by running the | 1183 | set up your environment by running the |
970 | ````` <&YOCTO_DOCS_REF_URL;#structure-core-script>`__ script found in | 1184 | :ref:`structure-core-script` script found in |
971 | the :term:`Build Directory`. | 1185 | the :term:`Build Directory`. |
972 | 1186 | ||
973 | - You must be sure of the state of your build's configuration in the | 1187 | - You must be sure of the state of your build's configuration in the |
974 | :term:`Source Directory`. | 1188 | :term:`Source Directory`. |
975 | 1189 | ||
976 | - Your build host must have the following two packages installed: | 1190 | - Your build host must have the following two packages installed: |
977 | libncurses5-dev libtinfo-dev | 1191 | :: |
1192 | |||
1193 | libncurses5-dev | ||
1194 | libtinfo-dev | ||
978 | 1195 | ||
979 | The following commands initialize the BitBake environment, run the | 1196 | The following commands initialize the BitBake environment, run the |
980 | :ref:`ref-tasks-kernel_configme` | 1197 | :ref:`ref-tasks-kernel_configme` |
981 | task, and launch ``menuconfig``. These commands assume the Source | 1198 | task, and launch ``menuconfig``. These commands assume the Source |
982 | Directory's top-level folder is ``~/poky``: $ cd poky $ source | 1199 | Directory's top-level folder is ``~/poky``: |
983 | oe-init-build-env $ bitbake linux-yocto -c kernel_configme -f $ bitbake | 1200 | :: |
984 | linux-yocto -c menuconfig Once ``menuconfig`` comes up, its standard | 1201 | |
1202 | $ cd poky | ||
1203 | $ source oe-init-build-env | ||
1204 | $ bitbake linux-yocto -c kernel_configme -f | ||
1205 | $ bitbake linux-yocto -c menuconfig | ||
1206 | |||
1207 | Once ``menuconfig`` comes up, its standard | ||
985 | interface allows you to interactively examine and configure all the | 1208 | interface allows you to interactively examine and configure all the |
986 | kernel configuration parameters. After making your changes, simply exit | 1209 | kernel configuration parameters. After making your changes, simply exit |
987 | the tool and save your changes to create an updated version of the | 1210 | the tool and save your changes to create an updated version of the |
@@ -1036,8 +1259,10 @@ area where the specific kernel is built. For example, if you were | |||
1036 | building a Linux Yocto kernel based on the ``linux-yocto-4.12`` kernel | 1259 | building a Linux Yocto kernel based on the ``linux-yocto-4.12`` kernel |
1037 | and you were building a QEMU image targeted for ``x86`` architecture, | 1260 | and you were building a QEMU image targeted for ``x86`` architecture, |
1038 | the ``.config`` file would be: | 1261 | the ``.config`` file would be: |
1039 | poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18... | 1262 | :: |
1040 | ...967-r0/linux-qemux86-standard-build/.config | 1263 | |
1264 | poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18... | ||
1265 | ...967-r0/linux-qemux86-standard-build/.config | ||
1041 | 1266 | ||
1042 | .. note:: | 1267 | .. note:: |
1043 | 1268 | ||
@@ -1048,7 +1273,10 @@ poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18... | |||
1048 | 1273 | ||
1049 | Within the ``.config`` file, you can see the kernel settings. For | 1274 | Within the ``.config`` file, you can see the kernel settings. For |
1050 | example, the following entry shows that symmetric multi-processor | 1275 | example, the following entry shows that symmetric multi-processor |
1051 | support is not set: # CONFIG_SMP is not set | 1276 | support is not set: |
1277 | :: | ||
1278 | |||
1279 | # CONFIG_SMP is not set | ||
1052 | 1280 | ||
1053 | A good method to isolate changed configurations is to use a combination | 1281 | A good method to isolate changed configurations is to use a combination |
1054 | of the ``menuconfig`` tool and simple shell commands. Before changing | 1282 | of the ``menuconfig`` tool and simple shell commands. Before changing |
@@ -1094,12 +1322,14 @@ your layer's ``recipes-kernel/linux`` directory, and rename the copied | |||
1094 | file to "defconfig" (e.g. | 1322 | file to "defconfig" (e.g. |
1095 | ``~/meta-mylayer/recipes-kernel/linux/linux-yocto/defconfig``). Then, | 1323 | ``~/meta-mylayer/recipes-kernel/linux/linux-yocto/defconfig``). Then, |
1096 | add the following lines to the linux-yocto ``.bbappend`` file in your | 1324 | add the following lines to the linux-yocto ``.bbappend`` file in your |
1097 | layer: FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += | 1325 | layer: |
1098 | "file://defconfig" The | 1326 | :: |
1099 | :term:`SRC_URI` tells the build | 1327 | |
1100 | system how to search for the file, while the | 1328 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
1101 | :term:`FILESEXTRAPATHS` | 1329 | SRC_URI += "file://defconfig" |
1102 | extends the :term:`FILESPATH` | 1330 | |
1331 | The :term:`SRC_URI` tells the build system how to search for the file, while the | ||
1332 | :term:`FILESEXTRAPATHS` extends the :term:`FILESPATH` | ||
1103 | variable (search directories) to include the ``${PN}`` directory you | 1333 | variable (search directories) to include the ``${PN}`` directory you |
1104 | created to hold the configuration changes. | 1334 | created to hold the configuration changes. |
1105 | 1335 | ||
@@ -1140,16 +1370,17 @@ appear in the ``.config`` file, which is in the :term:`Build Directory`. | |||
1140 | 1370 | ||
1141 | For more information about where the | 1371 | For more information about where the |
1142 | .config | 1372 | .config |
1143 | file is located, see the example in the " | 1373 | file is located, see the example in the |
1144 | Using | 1374 | ":ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\``" |
1145 | menuconfig | 1375 | section. |
1146 | " section. | ||
1147 | 1376 | ||
1148 | It is simple to create a configuration fragment. One method is to use | 1377 | It is simple to create a configuration fragment. One method is to use |
1149 | shell commands. For example, issuing the following from the shell | 1378 | shell commands. For example, issuing the following from the shell |
1150 | creates a configuration fragment file named ``my_smp.cfg`` that enables | 1379 | creates a configuration fragment file named ``my_smp.cfg`` that enables |
1151 | multi-processor support within the kernel: $ echo "CONFIG_SMP=y" >> | 1380 | multi-processor support within the kernel: |
1152 | my_smp.cfg | 1381 | :: |
1382 | |||
1383 | $ echo "CONFIG_SMP=y" >> my_smp.cfg | ||
1153 | 1384 | ||
1154 | .. note:: | 1385 | .. note:: |
1155 | 1386 | ||
@@ -1166,20 +1397,29 @@ To create a configuration fragment using this method, follow these | |||
1166 | steps: | 1397 | steps: |
1167 | 1398 | ||
1168 | 1. *Complete a Build Through Kernel Configuration:* Complete a build at | 1399 | 1. *Complete a Build Through Kernel Configuration:* Complete a build at |
1169 | least through the kernel configuration task as follows: $ bitbake | 1400 | least through the kernel configuration task as follows: |
1170 | linux-yocto -c kernel_configme -f This step ensures that you create a | 1401 | :: |
1402 | |||
1403 | $ bitbake linux-yocto -c kernel_configme -f | ||
1404 | |||
1405 | This step ensures that you create a | ||
1171 | ``.config`` file from a known state. Because situations exist where | 1406 | ``.config`` file from a known state. Because situations exist where |
1172 | your build state might become unknown, it is best to run this task | 1407 | your build state might become unknown, it is best to run this task |
1173 | prior to starting ``menuconfig``. | 1408 | prior to starting ``menuconfig``. |
1174 | 1409 | ||
1175 | 2. *Launch ``menuconfig``:* Run the ``menuconfig`` command: $ bitbake | 1410 | 2. *Launch menuconfig:* Run the ``menuconfig`` command: |
1176 | linux-yocto -c menuconfig | 1411 | :: |
1412 | |||
1413 | $ bitbake linux-yocto -c menuconfig | ||
1177 | 1414 | ||
1178 | 3. *Create the Configuration Fragment:* Run the ``diffconfig`` command | 1415 | 3. *Create the Configuration Fragment:* Run the ``diffconfig`` command |
1179 | to prepare a configuration fragment. The resulting file | 1416 | to prepare a configuration fragment. The resulting file |
1180 | ``fragment.cfg`` is placed in the | 1417 | ``fragment.cfg`` is placed in the |
1181 | ``${``\ :term:`WORKDIR`\ ``}`` | 1418 | ``${``\ :term:`WORKDIR`\ ``}`` |
1182 | directory: $ bitbake linux-yocto -c diffconfig | 1419 | directory: |
1420 | :: | ||
1421 | |||
1422 | $ bitbake linux-yocto -c diffconfig | ||
1183 | 1423 | ||
1184 | The ``diffconfig`` command creates a file that is a list of Linux kernel | 1424 | The ``diffconfig`` command creates a file that is a list of Linux kernel |
1185 | ``CONFIG_`` assignments. See the "`Changing the | 1425 | ``CONFIG_`` assignments. See the "`Changing the |
@@ -1204,59 +1444,94 @@ directory named ``linux-yocto`` that resides in the same directory as | |||
1204 | the kernel's append file within your layer and then add the following | 1444 | the kernel's append file within your layer and then add the following |
1205 | statements to the kernel's append file, those configuration options will | 1445 | statements to the kernel's append file, those configuration options will |
1206 | be picked up and applied when the kernel is built: | 1446 | be picked up and applied when the kernel is built: |
1207 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += | 1447 | :: |
1208 | "file://myconfig.cfg" | 1448 | |
1449 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
1450 | SRC_URI += "file://myconfig.cfg" | ||
1209 | 1451 | ||
1210 | As mentioned earlier, you can group related configurations into multiple | 1452 | As mentioned earlier, you can group related configurations into multiple |
1211 | files and name them all in the ``SRC_URI`` statement as well. For | 1453 | files and name them all in the ``SRC_URI`` statement as well. For |
1212 | example, you could group separate configurations specifically for | 1454 | example, you could group separate configurations specifically for |
1213 | Ethernet and graphics into their own files and add those by using a | 1455 | Ethernet and graphics into their own files and add those by using a |
1214 | ``SRC_URI`` statement like the following in your append file: SRC_URI += | 1456 | ``SRC_URI`` statement like the following in your append file: |
1215 | "file://myconfig.cfg \\ file://eth.cfg \\ file://gfx.cfg" | 1457 | :: |
1458 | |||
1459 | SRC_URI += "file://myconfig.cfg \ | ||
1460 | file://eth.cfg \ | ||
1461 | file://gfx.cfg" | ||
1216 | 1462 | ||
1217 | Validating Configuration | 1463 | Validating Configuration |
1218 | ------------------------ | 1464 | ------------------------ |
1219 | 1465 | ||
1220 | You can use the | 1466 | You can use the |
1221 | :ref:`ref-tasks-kernel_configcheck` | 1467 | :ref:`ref-tasks-kernel_configcheck` |
1222 | task to provide configuration validation: $ bitbake linux-yocto -c | 1468 | task to provide configuration validation: |
1223 | kernel_configcheck -f Running this task produces warnings for when a | 1469 | :: |
1470 | |||
1471 | $ bitbake linux-yocto -c kernel_configcheck -f | ||
1472 | |||
1473 | Running this task produces warnings for when a | ||
1224 | requested configuration does not appear in the final ``.config`` file or | 1474 | requested configuration does not appear in the final ``.config`` file or |
1225 | when you override a policy configuration in a hardware configuration | 1475 | when you override a policy configuration in a hardware configuration |
1226 | fragment. | 1476 | fragment. |
1227 | 1477 | ||
1228 | In order to run this task, you must have an existing ``.config`` file. | 1478 | In order to run this task, you must have an existing ``.config`` file. |
1229 | See the "`Using ``menuconfig`` <#using-menuconfig>`__" section for | 1479 | See the ":ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\``" section for |
1230 | information on how to create a configuration file. | 1480 | information on how to create a configuration file. |
1231 | 1481 | ||
1232 | Following is sample output from the ``do_kernel_configcheck`` task: | 1482 | Following is sample output from the ``do_kernel_configcheck`` task: |
1233 | Loading cache: 100% | 1483 | :: |
1234 | \|########################################################\| Time: | 1484 | |
1235 | 0:00:00 Loaded 1275 entries from dependency cache. NOTE: Resolving any | 1485 | Loading cache: 100% |########################################################| Time: 0:00:00 |
1236 | missing task queue dependencies Build Configuration: . . . NOTE: | 1486 | Loaded 1275 entries from dependency cache. |
1237 | Executing SetScene Tasks NOTE: Executing RunQueue Tasks WARNING: | 1487 | NOTE: Resolving any missing task queue dependencies |
1238 | linux-yocto-4.12.12+gitAUTOINC+eda4d18ce4_16de014967-r0 | 1488 | |
1239 | do_kernel_configcheck: [kernel config]: specified values did not make it | 1489 | Build Configuration: |
1240 | into the kernel's final configuration: ---------- CONFIG_X86_TSC | 1490 | . |
1241 | ----------------- Config: CONFIG_X86_TSC From: | 1491 | . |
1242 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/bsp/common-pc/common-pc-cpu.cfg | 1492 | . |
1243 | Requested value: CONFIG_X86_TSC=y Actual value: ---------- | 1493 | |
1244 | CONFIG_X86_BIGSMP ----------------- Config: CONFIG_X86_BIGSMP From: | 1494 | NOTE: Executing SetScene Tasks |
1245 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg | 1495 | NOTE: Executing RunQueue Tasks |
1246 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig | 1496 | WARNING: linux-yocto-4.12.12+gitAUTOINC+eda4d18ce4_16de014967-r0 do_kernel_configcheck: |
1247 | Requested value: # CONFIG_X86_BIGSMP is not set Actual value: ---------- | 1497 | [kernel config]: specified values did not make it into the kernel's final configuration: |
1248 | CONFIG_NR_CPUS ----------------- Config: CONFIG_NR_CPUS From: | 1498 | |
1249 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg | 1499 | ---------- CONFIG_X86_TSC ----------------- |
1250 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/bsp/common-pc/common-pc.cfg | 1500 | Config: CONFIG_X86_TSC |
1251 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig | 1501 | From: /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/bsp/common-pc/common-pc-cpu.cfg |
1252 | Requested value: CONFIG_NR_CPUS=8 Actual value: CONFIG_NR_CPUS=1 | 1502 | Requested value: CONFIG_X86_TSC=y |
1253 | ---------- CONFIG_SCHED_SMT ----------------- Config: CONFIG_SCHED_SMT | 1503 | Actual value: |
1254 | From: | 1504 | |
1255 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg | 1505 | |
1256 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig | 1506 | ---------- CONFIG_X86_BIGSMP ----------------- |
1257 | Requested value: CONFIG_SCHED_SMT=y Actual value: NOTE: Tasks Summary: | 1507 | Config: CONFIG_X86_BIGSMP |
1258 | Attempted 288 tasks of which 285 didn't need to be rerun and all | 1508 | From: /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg |
1259 | succeeded. Summary: There were 3 WARNING messages shown. | 1509 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig |
1510 | Requested value: # CONFIG_X86_BIGSMP is not set | ||
1511 | Actual value: | ||
1512 | |||
1513 | |||
1514 | ---------- CONFIG_NR_CPUS ----------------- | ||
1515 | Config: CONFIG_NR_CPUS | ||
1516 | From: /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg | ||
1517 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/bsp/common-pc/common-pc.cfg | ||
1518 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig | ||
1519 | Requested value: CONFIG_NR_CPUS=8 | ||
1520 | Actual value: CONFIG_NR_CPUS=1 | ||
1521 | |||
1522 | |||
1523 | ---------- CONFIG_SCHED_SMT ----------------- | ||
1524 | Config: CONFIG_SCHED_SMT | ||
1525 | From: /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/cfg/smp.cfg | ||
1526 | /home/scottrif/poky/build/tmp/work-shared/qemux86/kernel-source/.kernel-meta/configs/standard/defconfig | ||
1527 | Requested value: CONFIG_SCHED_SMT=y | ||
1528 | Actual value: | ||
1529 | |||
1530 | |||
1531 | |||
1532 | NOTE: Tasks Summary: Attempted 288 tasks of which 285 didn't need to be rerun and all succeeded. | ||
1533 | |||
1534 | Summary: There were 3 WARNING messages shown. | ||
1260 | 1535 | ||
1261 | .. note:: | 1536 | .. note:: |
1262 | 1537 | ||
@@ -1273,7 +1548,7 @@ and | |||
1273 | tasks until they produce no warnings. | 1548 | tasks until they produce no warnings. |
1274 | 1549 | ||
1275 | For more information on how to use the ``menuconfig`` tool, see the | 1550 | For more information on how to use the ``menuconfig`` tool, see the |
1276 | "`Using ``menuconfig`` <#using-menuconfig>`__" section. | 1551 | :ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\`` section. |
1277 | 1552 | ||
1278 | Fine-Tuning the Kernel Configuration File | 1553 | Fine-Tuning the Kernel Configuration File |
1279 | ----------------------------------------- | 1554 | ----------------------------------------- |
@@ -1319,9 +1594,11 @@ To streamline the configuration, do the following: | |||
1319 | successfully. Use this configuration file as your baseline. | 1594 | successfully. Use this configuration file as your baseline. |
1320 | 1595 | ||
1321 | 2. *Run Configure and Check Tasks:* Separately run the | 1596 | 2. *Run Configure and Check Tasks:* Separately run the |
1322 | ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks: $ bitbake | 1597 | ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks: |
1323 | linux-yocto -c kernel_configme -f $ bitbake linux-yocto -c | 1598 | :: |
1324 | kernel_configcheck -f | 1599 | |
1600 | $ bitbake linux-yocto -c kernel_configme -f | ||
1601 | $ bitbake linux-yocto -c kernel_configcheck -f | ||
1325 | 1602 | ||
1326 | 3. *Process the Results:* Take the resulting list of files from the | 1603 | 3. *Process the Results:* Take the resulting list of files from the |
1327 | ``do_kernel_configcheck`` task warnings and do the following: | 1604 | ``do_kernel_configcheck`` task warnings and do the following: |
@@ -1352,8 +1629,12 @@ Expanding Variables | |||
1352 | Sometimes it is helpful to determine what a variable expands to during a | 1629 | Sometimes it is helpful to determine what a variable expands to during a |
1353 | build. You can do examine the values of variables by examining the | 1630 | build. You can do examine the values of variables by examining the |
1354 | output of the ``bitbake -e`` command. The output is long and is more | 1631 | output of the ``bitbake -e`` command. The output is long and is more |
1355 | easily managed in a text file, which allows for easy searches: $ bitbake | 1632 | easily managed in a text file, which allows for easy searches: |
1356 | -e virtual/kernel > some_text_file Within the text file, you can see | 1633 | :: |
1634 | |||
1635 | $ bitbake -e virtual/kernel > some_text_file | ||
1636 | |||
1637 | Within the text file, you can see | ||
1357 | exactly how each variable is expanded and used by the OpenEmbedded build | 1638 | exactly how each variable is expanded and used by the OpenEmbedded build |
1358 | system. | 1639 | system. |
1359 | 1640 | ||
@@ -1366,22 +1647,27 @@ source directory. Follow these steps to clean up the version string: | |||
1366 | 1647 | ||
1367 | 1. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned | 1648 | 1. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned |
1368 | Git repository (source directory) and use the following Git command | 1649 | Git repository (source directory) and use the following Git command |
1369 | to list the files that have been changed, added, or removed: $ git | 1650 | to list the files that have been changed, added, or removed: |
1370 | status | 1651 | :: |
1652 | |||
1653 | $ git status | ||
1371 | 1654 | ||
1372 | 2. *Commit the Changes:* You should commit those changes to the kernel | 1655 | 2. *Commit the Changes:* You should commit those changes to the kernel |
1373 | source tree regardless of whether or not you will save, export, or | 1656 | source tree regardless of whether or not you will save, export, or |
1374 | use the changes: $ git add $ git commit -s -a -m "getting rid of | 1657 | use the changes: |
1375 | -dirty" | 1658 | :: |
1659 | |||
1660 | $ git add | ||
1661 | $ git commit -s -a -m "getting rid of -dirty" | ||
1376 | 1662 | ||
1377 | 3. *Rebuild the Kernel Image:* Once you commit the changes, rebuild the | 1663 | 3. *Rebuild the Kernel Image:* Once you commit the changes, rebuild the |
1378 | kernel. | 1664 | kernel. |
1379 | 1665 | ||
1380 | Depending on your particular kernel development workflow, the | 1666 | Depending on your particular kernel development workflow, the |
1381 | commands you use to rebuild the kernel might differ. For information | 1667 | commands you use to rebuild the kernel might differ. For information |
1382 | on building the kernel image when using ``devtool``, see the "`Using | 1668 | on building the kernel image when using ``devtool``, see the |
1383 | ``devtool`` to Patch the | 1669 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
1384 | Kernel <#using-devtool-to-patch-the-kernel>`__" section. For | 1670 | section. For |
1385 | information on building the kernel image when using Bitbake, see the | 1671 | information on building the kernel image when using Bitbake, see the |
1386 | "`Using Traditional Kernel Development to Patch the | 1672 | "`Using Traditional Kernel Development to Patch the |
1387 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | 1673 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" |
@@ -1405,7 +1691,10 @@ linux-yocto custom recipe (``linux-yocto-custom.bb``) that uses | |||
1405 | ``kernel.org`` sources and the Yocto Project Linux kernel tools for | 1691 | ``kernel.org`` sources and the Yocto Project Linux kernel tools for |
1406 | managing kernel Metadata. You can find this recipe in the ``poky`` Git | 1692 | managing kernel Metadata. You can find this recipe in the ``poky`` Git |
1407 | repository of the Yocto Project :yocto_git:`Source Repository <>` | 1693 | repository of the Yocto Project :yocto_git:`Source Repository <>` |
1408 | at: poky/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb | 1694 | at: |
1695 | :: | ||
1696 | |||
1697 | poky/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb | ||
1409 | 1698 | ||
1410 | Here are some basic steps you can use to work with your own sources: | 1699 | Here are some basic steps you can use to work with your own sources: |
1411 | 1700 | ||
@@ -1424,7 +1713,12 @@ Here are some basic steps you can use to work with your own sources: | |||
1424 | ``defconfig`` file or configuration fragment files in your layer. | 1713 | ``defconfig`` file or configuration fragment files in your layer. |
1425 | When you use the ``linux-yocto-custom.bb`` recipe, you must specify a | 1714 | When you use the ``linux-yocto-custom.bb`` recipe, you must specify a |
1426 | configuration. If you do not have a ``defconfig`` file, you can run | 1715 | configuration. If you do not have a ``defconfig`` file, you can run |
1427 | the following: $ make defconfig After running the command, copy the | 1716 | the following: |
1717 | :: | ||
1718 | |||
1719 | $ make defconfig | ||
1720 | |||
1721 | After running the command, copy the | ||
1428 | resulting ``.config`` file to the ``files`` directory in your layer | 1722 | resulting ``.config`` file to the ``files`` directory in your layer |
1429 | as "defconfig" and then add it to the | 1723 | as "defconfig" and then add it to the |
1430 | :term:`SRC_URI` variable in the | 1724 | :term:`SRC_URI` variable in the |
@@ -1518,8 +1812,13 @@ is running that image. | |||
1518 | 1812 | ||
1519 | Prior to attempting to build the out-of-tree modules, you need to be on | 1813 | Prior to attempting to build the out-of-tree modules, you need to be on |
1520 | the target as root and you need to change to the ``/usr/src/kernel`` | 1814 | the target as root and you need to change to the ``/usr/src/kernel`` |
1521 | directory. Next, ``make`` the scripts: # cd /usr/src/kernel # make | 1815 | directory. Next, ``make`` the scripts: |
1522 | scripts Because all SDK image recipes include ``dev-pkgs``, the | 1816 | :: |
1817 | |||
1818 | # cd /usr/src/kernel | ||
1819 | # make scripts | ||
1820 | |||
1821 | Because all SDK image recipes include ``dev-pkgs``, the | ||
1523 | ``kernel-dev`` packages will be installed as part of the SDK image and | 1822 | ``kernel-dev`` packages will be installed as part of the SDK image and |
1524 | the ``kernel-devsrc`` packages will be installed as part of applicable | 1823 | the ``kernel-devsrc`` packages will be installed as part of applicable |
1525 | SDK images. The SDK uses the scripts when building out-of-tree modules. | 1824 | SDK images. The SDK uses the scripts when building out-of-tree modules. |
@@ -1536,7 +1835,9 @@ create your own out-of-tree Linux kernel module recipe. | |||
1536 | 1835 | ||
1537 | This template recipe is located in the ``poky`` Git repository of the | 1836 | This template recipe is located in the ``poky`` Git repository of the |
1538 | Yocto Project :yocto_git:`Source Repository <>` at: | 1837 | Yocto Project :yocto_git:`Source Repository <>` at: |
1539 | poky/meta-skeleton/recipes-kernel/hello-mod/hello-mod_0.1.bb | 1838 | :: |
1839 | |||
1840 | poky/meta-skeleton/recipes-kernel/hello-mod/hello-mod_0.1.bb | ||
1540 | 1841 | ||
1541 | To get started, copy this recipe to your layer and give it a meaningful | 1842 | To get started, copy this recipe to your layer and give it a meaningful |
1542 | name (e.g. ``mymodule_1.0.bb``). In the same directory, create a new | 1843 | name (e.g. ``mymodule_1.0.bb``). In the same directory, create a new |
@@ -1555,14 +1856,22 @@ Typically, you will need to set the following variables: | |||
1555 | 1856 | ||
1556 | Depending on the build system used by the module sources, you might need | 1857 | Depending on the build system used by the module sources, you might need |
1557 | to make some adjustments. For example, a typical module ``Makefile`` | 1858 | to make some adjustments. For example, a typical module ``Makefile`` |
1558 | looks much like the one provided with the ``hello-mod`` template: obj-m | 1859 | looks much like the one provided with the ``hello-mod`` template: |
1559 | := hello.o SRC := $(shell pwd) all: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) | 1860 | :: |
1560 | modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install ... | 1861 | |
1561 | 1862 | obj-m := hello.o | |
1562 | The important point to note here is the | 1863 | |
1563 | :term:`KERNEL_SRC` variable. The | 1864 | SRC := $(shell pwd) |
1564 | :ref:`module <ref-classes-module>` class sets this | 1865 | |
1565 | variable and the | 1866 | all: |
1867 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) | ||
1868 | |||
1869 | modules_install: | ||
1870 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install | ||
1871 | ... | ||
1872 | |||
1873 | The important point to note here is the :term:`KERNEL_SRC` variable. The | ||
1874 | :ref:`module <ref-classes-module>` class sets this variable and the | ||
1566 | :term:`KERNEL_PATH` variable to | 1875 | :term:`KERNEL_PATH` variable to |
1567 | ``${STAGING_KERNEL_DIR}`` with the necessary Linux kernel build | 1876 | ``${STAGING_KERNEL_DIR}`` with the necessary Linux kernel build |
1568 | information to build modules. If your module ``Makefile`` uses a | 1877 | information to build modules. If your module ``Makefile`` uses a |
@@ -1586,7 +1895,11 @@ them appropriately for your machine configuration file: | |||
1586 | 1895 | ||
1587 | Modules are often not required for boot and can be excluded from certain | 1896 | Modules are often not required for boot and can be excluded from certain |
1588 | build configurations. The following allows for the most flexibility: | 1897 | build configurations. The following allows for the most flexibility: |
1589 | MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule" The value is | 1898 | :: |
1899 | |||
1900 | MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule" | ||
1901 | |||
1902 | The value is | ||
1590 | derived by appending the module filename without the ``.ko`` extension | 1903 | derived by appending the module filename without the ``.ko`` extension |
1591 | to the string "kernel-module-". | 1904 | to the string "kernel-module-". |
1592 | 1905 | ||
@@ -1628,32 +1941,50 @@ Here is an example that looks at what has changed in the ``emenlow`` | |||
1628 | branch of the ``linux-yocto-3.19`` kernel. The lower commit range is the | 1941 | branch of the ``linux-yocto-3.19`` kernel. The lower commit range is the |
1629 | commit associated with the ``standard/base`` branch, while the upper | 1942 | commit associated with the ``standard/base`` branch, while the upper |
1630 | commit range is the commit associated with the ``standard/emenlow`` | 1943 | commit range is the commit associated with the ``standard/emenlow`` |
1631 | branch. $ git whatchanged origin/standard/base..origin/standard/emenlow | 1944 | branch. |
1945 | :: | ||
1946 | |||
1947 | $ git whatchanged origin/standard/base..origin/standard/emenlow | ||
1632 | 1948 | ||
1633 | To see short, one line summaries of changes use the ``git log`` command: | 1949 | To see short, one line summaries of changes use the ``git log`` command: |
1634 | $ git log --oneline origin/standard/base..origin/standard/emenlow | 1950 | :: |
1951 | |||
1952 | $ git log --oneline origin/standard/base..origin/standard/emenlow | ||
1953 | |||
1954 | Use this command to see code differences for the changes: | ||
1955 | :: | ||
1635 | 1956 | ||
1636 | Use this command to see code differences for the changes: $ git diff | 1957 | $ git diff origin/standard/base..origin/standard/emenlow |
1637 | origin/standard/base..origin/standard/emenlow | ||
1638 | 1958 | ||
1639 | Use this command to see the commit log messages and the text | 1959 | Use this command to see the commit log messages and the text |
1640 | differences: $ git show origin/standard/base..origin/standard/emenlow | 1960 | differences: |
1961 | :: | ||
1962 | |||
1963 | $ git show origin/standard/base..origin/standard/emenlow | ||
1641 | 1964 | ||
1642 | Use this command to create individual patches for each change. Here is | 1965 | Use this command to create individual patches for each change. Here is |
1643 | an example that that creates patch files for each commit and places them | 1966 | an example that that creates patch files for each commit and places them |
1644 | in your ``Documents`` directory: $ git format-patch -o $HOME/Documents | 1967 | in your ``Documents`` directory: |
1645 | origin/standard/base..origin/standard/emenlow | 1968 | :: |
1969 | |||
1970 | $ git format-patch -o $HOME/Documents origin/standard/base..origin/standard/emenlow | ||
1646 | 1971 | ||
1647 | Showing a Particular Feature or Branch Change | 1972 | Showing a Particular Feature or Branch Change |
1648 | --------------------------------------------- | 1973 | --------------------------------------------- |
1649 | 1974 | ||
1650 | Tags in the Yocto Project kernel tree divide changes for significant | 1975 | Tags in the Yocto Project kernel tree divide changes for significant |
1651 | features or branches. The ``git show``Â tag command shows changes based | 1976 | features or branches. The ``git show``Â tag command shows changes based |
1652 | on a tag. Here is an example that shows ``systemtap`` changes: $ git | 1977 | on a tag. Here is an example that shows ``systemtap`` changes: |
1653 | show systemtap You can use the ``git branch --contains``Â tag command to | 1978 | :: |
1979 | |||
1980 | $ git show systemtap | ||
1981 | |||
1982 | You can use the ``git branch --contains``Â tag command to | ||
1654 | show the branches that contain a particular feature. This command shows | 1983 | show the branches that contain a particular feature. This command shows |
1655 | the branches that contain the ``systemtap`` feature: $ git branch | 1984 | the branches that contain the ``systemtap`` feature: |
1656 | --contains systemtap | 1985 | :: |
1986 | |||
1987 | $ git branch --contains systemtap | ||
1657 | 1988 | ||
1658 | Adding Recipe-Space Kernel Features | 1989 | Adding Recipe-Space Kernel Features |
1659 | =================================== | 1990 | =================================== |
@@ -1706,19 +2037,37 @@ build. | |||
1706 | searched during the build as potential feature directories. | 2037 | searched during the build as potential feature directories. |
1707 | 2038 | ||
1708 | Continuing with the example, suppose the "test.scc" feature you are | 2039 | Continuing with the example, suppose the "test.scc" feature you are |
1709 | adding has a ``test.scc`` file in the following directory: my_recipe | 2040 | adding has a ``test.scc`` file in the following directory: |
1710 | \| +-linux-yocto \| +-test.cfg +-test.scc In this example, the | 2041 | :: |
2042 | |||
2043 | my_recipe | ||
2044 | | | ||
2045 | +-linux-yocto | ||
2046 | | | ||
2047 | +-test.cfg | ||
2048 | +-test.scc | ||
2049 | |||
2050 | In this example, the | ||
1711 | ``linux-yocto`` directory has both the feature ``test.scc`` file and | 2051 | ``linux-yocto`` directory has both the feature ``test.scc`` file and |
1712 | a similarly named configuration fragment file ``test.cfg``. | 2052 | a similarly named configuration fragment file ``test.cfg``. |
1713 | 2053 | ||
1714 | 2. *Add the Feature File to ``SRC_URI``:* Add the ``.scc`` file to the | 2054 | 2. *Add the Feature File to SRC_URI:* Add the ``.scc`` file to the |
1715 | recipe's ``SRC_URI`` statement: SRC_URI_append = " file://test.scc" | 2055 | recipe's ``SRC_URI`` statement: |
2056 | :: | ||
2057 | |||
2058 | SRC_URI_append = " file://test.scc" | ||
2059 | |||
1716 | The leading space before the path is important as the path is | 2060 | The leading space before the path is important as the path is |
1717 | appended to the existing path. | 2061 | appended to the existing path. |
1718 | 2062 | ||
1719 | 3. *Specify the Feature as a Kernel Feature:* Use the | 2063 | 3. *Specify the Feature as a Kernel Feature:* Use the |
1720 | ``KERNEL_FEATURES`` statement to specify the feature as a kernel | 2064 | ``KERNEL_FEATURES`` statement to specify the feature as a kernel |
1721 | feature: KERNEL_FEATURES_append = " test.scc" The OpenEmbedded build | 2065 | feature: |
2066 | :: | ||
2067 | |||
2068 | KERNEL_FEATURES_append = " test.scc" | ||
2069 | |||
2070 | The OpenEmbedded build | ||
1722 | system processes the kernel feature when it builds the kernel. | 2071 | system processes the kernel feature when it builds the kernel. |
1723 | 2072 | ||
1724 | .. note:: | 2073 | .. note:: |
diff --git a/documentation/kernel-dev/kernel-dev-concepts-appx.rst b/documentation/kernel-dev/kernel-dev-concepts-appx.rst index a4611d1ae4..4ddb7ddb60 100644 --- a/documentation/kernel-dev/kernel-dev-concepts-appx.rst +++ b/documentation/kernel-dev/kernel-dev-concepts-appx.rst | |||
@@ -36,47 +36,46 @@ and custom features. These additions result in a commercially released | |||
36 | Yocto Project Linux kernel that caters to specific embedded designer | 36 | Yocto Project Linux kernel that caters to specific embedded designer |
37 | needs for targeted hardware. | 37 | needs for targeted hardware. |
38 | 38 | ||
39 | You can find a web interface to the Yocto Linux kernels in the `Source | 39 | You can find a web interface to the Yocto Linux kernels in the |
40 | Repositories <&YOCTO_DOCS_OM_URL;#source-repositories>`__ at | 40 | :ref:`overview-manual/overview-manual-development-environment:yocto project source repositories` |
41 | :yocto_git:`/`. If you look at the interface, you will see to | 41 | at :yocto_git:`/`. If you look at the interface, you will see to |
42 | the left a grouping of Git repositories titled "Yocto Linux Kernel". | 42 | the left a grouping of Git repositories titled "Yocto Linux Kernel". |
43 | Within this group, you will find several Linux Yocto kernels developed | 43 | Within this group, you will find several Linux Yocto kernels developed |
44 | and included with Yocto Project releases: | 44 | and included with Yocto Project releases: |
45 | 45 | ||
46 | - *``linux-yocto-4.1``:* The stable Yocto Project kernel to use with | 46 | - *linux-yocto-4.1:* The stable Yocto Project kernel to use with |
47 | the Yocto Project Release 2.0. This kernel is based on the Linux 4.1 | 47 | the Yocto Project Release 2.0. This kernel is based on the Linux 4.1 |
48 | released kernel. | 48 | released kernel. |
49 | 49 | ||
50 | - *``linux-yocto-4.4``:* The stable Yocto Project kernel to use with | 50 | - *linux-yocto-4.4:* The stable Yocto Project kernel to use with |
51 | the Yocto Project Release 2.1. This kernel is based on the Linux 4.4 | 51 | the Yocto Project Release 2.1. This kernel is based on the Linux 4.4 |
52 | released kernel. | 52 | released kernel. |
53 | 53 | ||
54 | - *``linux-yocto-4.6``:* A temporary kernel that is not tied to any | 54 | - *linux-yocto-4.6:* A temporary kernel that is not tied to any |
55 | Yocto Project release. | 55 | Yocto Project release. |
56 | 56 | ||
57 | - *``linux-yocto-4.8``:* The stable yocto Project kernel to use with | 57 | - *linux-yocto-4.8:* The stable yocto Project kernel to use with |
58 | the Yocto Project Release 2.2. | 58 | the Yocto Project Release 2.2. |
59 | 59 | ||
60 | - *``linux-yocto-4.9``:* The stable Yocto Project kernel to use with | 60 | - *linux-yocto-4.9:* The stable Yocto Project kernel to use with |
61 | the Yocto Project Release 2.3. This kernel is based on the Linux 4.9 | 61 | the Yocto Project Release 2.3. This kernel is based on the Linux 4.9 |
62 | released kernel. | 62 | released kernel. |
63 | 63 | ||
64 | - *``linux-yocto-4.10``:* The default stable Yocto Project kernel to | 64 | - *linux-yocto-4.10:* The default stable Yocto Project kernel to |
65 | use with the Yocto Project Release 2.3. This kernel is based on the | 65 | use with the Yocto Project Release 2.3. This kernel is based on the |
66 | Linux 4.10 released kernel. | 66 | Linux 4.10 released kernel. |
67 | 67 | ||
68 | - *``linux-yocto-4.12``:* The default stable Yocto Project kernel to | 68 | - *linux-yocto-4.12:* The default stable Yocto Project kernel to |
69 | use with the Yocto Project Release 2.4. This kernel is based on the | 69 | use with the Yocto Project Release 2.4. This kernel is based on the |
70 | Linux 4.12 released kernel. | 70 | Linux 4.12 released kernel. |
71 | 71 | ||
72 | - *``yocto-kernel-cache``:* The ``linux-yocto-cache`` contains patches | 72 | - *yocto-kernel-cache:* The ``linux-yocto-cache`` contains patches |
73 | and configurations for the linux-yocto kernel tree. This repository | 73 | and configurations for the linux-yocto kernel tree. This repository |
74 | is useful when working on the linux-yocto kernel. For more | 74 | is useful when working on the linux-yocto kernel. For more |
75 | information on this "Advanced Kernel Metadata", see the "`Working | 75 | information on this "Advanced Kernel Metadata", see the |
76 | With Advanced Metadata | 76 | ":doc:`kernel-dev-advanced`" Chapter. |
77 | (``yocto-kernel-cache``) <#kernel-dev-advanced>`__" Chapter. | ||
78 | 77 | ||
79 | - *``linux-yocto-dev``:* A development kernel based on the latest | 78 | - *linux-yocto-dev:* A development kernel based on the latest |
80 | upstream release candidate available. | 79 | upstream release candidate available. |
81 | 80 | ||
82 | .. note:: | 81 | .. note:: |
@@ -164,7 +163,7 @@ implemented by the Yocto Project team using the Source Code Manager | |||
164 | - You can find documentation on Git at | 163 | - You can find documentation on Git at |
165 | http://git-scm.com/documentation. You can also get an | 164 | http://git-scm.com/documentation. You can also get an |
166 | introduction to Git as it applies to the Yocto Project in the | 165 | introduction to Git as it applies to the Yocto Project in the |
167 | "`Git <&YOCTO_DOCS_OM_URL;#git>`__" section in the Yocto Project | 166 | ":ref:`overview-manual/overview-manual-development-environment:git`" section in the Yocto Project |
168 | Overview and Concepts Manual. The latter reference provides an | 167 | Overview and Concepts Manual. The latter reference provides an |
169 | overview of Git and presents a minimal set of Git commands that | 168 | overview of Git and presents a minimal set of Git commands that |
170 | allows you to be functional using Git. You can use as much, or as | 169 | allows you to be functional using Git. You can use as much, or as |
@@ -295,17 +294,16 @@ available on your host system. | |||
295 | Kernel source code is available on your host system several different | 294 | Kernel source code is available on your host system several different |
296 | ways: | 295 | ways: |
297 | 296 | ||
298 | - *Files Accessed While using ``devtool``:* ``devtool``, which is | 297 | - *Files Accessed While using devtool:* ``devtool``, which is |
299 | available with the Yocto Project, is the preferred method by which to | 298 | available with the Yocto Project, is the preferred method by which to |
300 | modify the kernel. See the "`Kernel Modification | 299 | modify the kernel. See the ":ref:`kernel-dev/kernel-dev-intro:kernel modification workflow`" section. |
301 | Workflow <#kernel-modification-workflow>`__" section. | ||
302 | 300 | ||
303 | - *Cloned Repository:* If you are working in the kernel all the time, | 301 | - *Cloned Repository:* If you are working in the kernel all the time, |
304 | you probably would want to set up your own local Git repository of | 302 | you probably would want to set up your own local Git repository of |
305 | the Yocto Linux kernel tree. For information on how to clone a Yocto | 303 | the Yocto Linux kernel tree. For information on how to clone a Yocto |
306 | Linux kernel Git repository, see the "`Preparing the Build Host to | 304 | Linux kernel Git repository, see the |
307 | Work on the | 305 | ":ref:`kernel-dev/kernel-dev-common:preparing the build host to work on the kernel`" |
308 | Kernel <#preparing-the-build-host-to-work-on-the-kernel>`__" section. | 306 | section. |
309 | 307 | ||
310 | - *Temporary Source Files from a Build:* If you just need to make some | 308 | - *Temporary Source Files from a Build:* If you just need to make some |
311 | patches to the kernel using a traditional BitBake workflow (i.e. not | 309 | patches to the kernel using a traditional BitBake workflow (i.e. not |
@@ -331,13 +329,12 @@ source files used during the build. | |||
331 | :align: center | 329 | :align: center |
332 | 330 | ||
333 | Again, for additional information on the Yocto Project kernel's | 331 | Again, for additional information on the Yocto Project kernel's |
334 | architecture and its branching strategy, see the "`Yocto Linux Kernel | 332 | architecture and its branching strategy, see the |
335 | Architecture and Branching | 333 | ":ref:`kernel-dev/kernel-dev-concepts-appx:yocto linux kernel architecture and branching strategies`" |
336 | Strategies <#yocto-linux-kernel-architecture-and-branching-strategies>`__" | 334 | section. You can also reference the |
337 | section. You can also reference the "`Using ``devtool`` to Patch the | 335 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
338 | Kernel <#using-devtool-to-patch-the-kernel>`__" and "`Using Traditional | 336 | and |
339 | Kernel Development to Patch the | 337 | ":ref:`kernel-dev/kernel-dev-common:using traditional kernel development to patch the kernel`" |
340 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | ||
341 | sections for detailed example that modifies the kernel. | 338 | sections for detailed example that modifies the kernel. |
342 | 339 | ||
343 | Determining Hardware and Non-Hardware Features for the Kernel Configuration Audit Phase | 340 | Determining Hardware and Non-Hardware Features for the Kernel Configuration Audit Phase |
@@ -346,8 +343,8 @@ Determining Hardware and Non-Hardware Features for the Kernel Configuration Audi | |||
346 | This section describes part of the kernel configuration audit phase that | 343 | This section describes part of the kernel configuration audit phase that |
347 | most developers can ignore. For general information on kernel | 344 | most developers can ignore. For general information on kernel |
348 | configuration including ``menuconfig``, ``defconfig`` files, and | 345 | configuration including ``menuconfig``, ``defconfig`` files, and |
349 | configuration fragments, see the "`Configuring the | 346 | configuration fragments, see the |
350 | Kernel <#configuring-the-kernel>`__" section. | 347 | ":ref:`kernel-dev/kernel-dev-common:configuring the kernel`" section. |
351 | 348 | ||
352 | During this part of the audit phase, the contents of the final | 349 | During this part of the audit phase, the contents of the final |
353 | ``.config`` file are compared against the fragments specified by the | 350 | ``.config`` file are compared against the fragments specified by the |
@@ -366,23 +363,27 @@ To determine whether or not a given option is "hardware" or | |||
366 | files that classify individual or groups of options as either hardware | 363 | files that classify individual or groups of options as either hardware |
367 | or non-hardware. To better show this, consider a situation where the | 364 | or non-hardware. To better show this, consider a situation where the |
368 | ``yocto-kernel-cache`` contains the following files: | 365 | ``yocto-kernel-cache`` contains the following files: |
369 | yocto-kernel-cache/features/drm-psb/hardware.cfg | 366 | :: |
370 | yocto-kernel-cache/features/kgdb/hardware.cfg | 367 | |
371 | yocto-kernel-cache/ktypes/base/hardware.cfg | 368 | yocto-kernel-cache/features/drm-psb/hardware.cfg |
372 | yocto-kernel-cache/bsp/mti-malta32/hardware.cfg | 369 | yocto-kernel-cache/features/kgdb/hardware.cfg |
373 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.cfg | 370 | yocto-kernel-cache/ktypes/base/hardware.cfg |
374 | yocto-kernel-cache/bsp/qemuarma9/hardware.cfg | 371 | yocto-kernel-cache/bsp/mti-malta32/hardware.cfg |
375 | yocto-kernel-cache/bsp/mti-malta64/hardware.cfg | 372 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.cfg |
376 | yocto-kernel-cache/bsp/arm-versatile-926ejs/hardware.cfg | 373 | yocto-kernel-cache/bsp/qemuarma9/hardware.cfg |
377 | yocto-kernel-cache/bsp/common-pc/hardware.cfg | 374 | yocto-kernel-cache/bsp/mti-malta64/hardware.cfg |
378 | yocto-kernel-cache/bsp/common-pc-64/hardware.cfg | 375 | yocto-kernel-cache/bsp/arm-versatile-926ejs/hardware.cfg |
379 | yocto-kernel-cache/features/rfkill/non-hardware.cfg | 376 | yocto-kernel-cache/bsp/common-pc/hardware.cfg |
380 | yocto-kernel-cache/ktypes/base/non-hardware.cfg | 377 | yocto-kernel-cache/bsp/common-pc-64/hardware.cfg |
381 | yocto-kernel-cache/features/aufs/non-hardware.kcf | 378 | yocto-kernel-cache/features/rfkill/non-hardware.cfg |
382 | yocto-kernel-cache/features/ocf/non-hardware.kcf | 379 | yocto-kernel-cache/ktypes/base/non-hardware.cfg |
383 | yocto-kernel-cache/ktypes/base/non-hardware.kcf | 380 | yocto-kernel-cache/features/aufs/non-hardware.kcf |
384 | yocto-kernel-cache/ktypes/base/hardware.kcf | 381 | yocto-kernel-cache/features/ocf/non-hardware.kcf |
385 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.kcf The following list | 382 | yocto-kernel-cache/ktypes/base/non-hardware.kcf |
383 | yocto-kernel-cache/ktypes/base/hardware.kcf | ||
384 | yocto-kernel-cache/bsp/qemu-ppc32/hardware.kcf | ||
385 | |||
386 | The following list | ||
386 | provides explanations for the various files: | 387 | provides explanations for the various files: |
387 | 388 | ||
388 | - ``hardware.kcf``: Specifies a list of kernel Kconfig files that | 389 | - ``hardware.kcf``: Specifies a list of kernel Kconfig files that |
@@ -402,10 +403,18 @@ provides explanations for the various files: | |||
402 | (i.e. ``hardware.kcf`` or ``non-hardware.kcf``). | 403 | (i.e. ``hardware.kcf`` or ``non-hardware.kcf``). |
403 | 404 | ||
404 | Here is a specific example using the | 405 | Here is a specific example using the |
405 | ``kernel-cache/bsp/mti-malta32/hardware.cfg``: CONFIG_SERIAL_8250 | 406 | ``kernel-cache/bsp/mti-malta32/hardware.cfg``: |
406 | CONFIG_SERIAL_8250_CONSOLE CONFIG_SERIAL_8250_NR_UARTS | 407 | :: |
407 | CONFIG_SERIAL_8250_PCI CONFIG_SERIAL_CORE CONFIG_SERIAL_CORE_CONSOLE | 408 | |
408 | CONFIG_VGA_ARB The kernel configuration audit automatically detects | 409 | CONFIG_SERIAL_8250 |
410 | CONFIG_SERIAL_8250_CONSOLE | ||
411 | CONFIG_SERIAL_8250_NR_UARTS | ||
412 | CONFIG_SERIAL_8250_PCI | ||
413 | CONFIG_SERIAL_CORE | ||
414 | CONFIG_SERIAL_CORE_CONSOLE | ||
415 | CONFIG_VGA_ARB | ||
416 | |||
417 | The kernel configuration audit automatically detects | ||
409 | these files (hence the names must be exactly the ones discussed here), | 418 | these files (hence the names must be exactly the ones discussed here), |
410 | and uses them as inputs when generating warnings about the final | 419 | and uses them as inputs when generating warnings about the final |
411 | ``.config`` file. | 420 | ``.config`` file. |
diff --git a/documentation/kernel-dev/kernel-dev-faq.rst b/documentation/kernel-dev/kernel-dev-faq.rst index fd9f8ce33d..b5e6a84eba 100644 --- a/documentation/kernel-dev/kernel-dev-faq.rst +++ b/documentation/kernel-dev/kernel-dev-faq.rst | |||
@@ -9,23 +9,46 @@ Kernel Development FAQ | |||
9 | Common Questions and Solutions | 9 | Common Questions and Solutions |
10 | ============================== | 10 | ============================== |
11 | 11 | ||
12 | The following lists some solutions for common questions. How do I use my | 12 | The following lists some solutions for common questions. |
13 | own Linux kernel ``.config`` file? Refer to the "`Changing the | 13 | |
14 | Configuration <#changing-the-configuration>`__" section for information. | 14 | How do I use my own Linux kernel ``.config`` file? |
15 | How do I create configuration fragments? Refer to the "`Creating | 15 | -------------------------------------------------- |
16 | Configuration Fragments <#creating-config-fragments>`__" section for | 16 | |
17 | information. How do I use my own Linux kernel sources? Refer to the | 17 | Refer to the |
18 | "`Working With Your Own Sources <#working-with-your-own-sources>`__" | 18 | ":ref:`kernel-dev/kernel-dev-common:changing the configuration`" |
19 | section for information. How do I install/not-install the kernel image | 19 | section for information. |
20 | on the rootfs? The kernel image (e.g. ``vmlinuz``) is provided by the | 20 | |
21 | How do I create configuration fragments? | ||
22 | ---------------------------------------- | ||
23 | |||
24 | A: Refer to the | ||
25 | ":ref:`kernel-dev/kernel-dev-common:creating configuration fragments`" | ||
26 | section for information. | ||
27 | |||
28 | How do I use my own Linux kernel sources? | ||
29 | ----------------------------------------- | ||
30 | |||
31 | Refer to the | ||
32 | ":ref:`kernel-dev/kernel-dev-common:working with your own sources`" | ||
33 | section for information. | ||
34 | |||
35 | How do I install/not-install the kernel image on the rootfs? | ||
36 | ------------------------------------------------------------ | ||
37 | |||
38 | The kernel image (e.g. ``vmlinuz``) is provided by the | ||
21 | ``kernel-image`` package. Image recipes depend on ``kernel-base``. To | 39 | ``kernel-image`` package. Image recipes depend on ``kernel-base``. To |
22 | specify whether or not the kernel image is installed in the generated | 40 | specify whether or not the kernel image is installed in the generated |
23 | root filesystem, override ``RDEPENDS_kernel-base`` to include or not | 41 | root filesystem, override ``RDEPENDS_kernel-base`` to include or not |
24 | include "kernel-image". See the "`Using .bbappend Files in Your | 42 | include "kernel-image". See the |
25 | Layer <&YOCTO_DOCS_DEV_URL;#using-bbappend-files>`__" section in the | 43 | ":ref:`dev-manual/dev-manual-common-tasks:using .bbappend files in your layer`" |
44 | section in the | ||
26 | Yocto Project Development Tasks Manual for information on how to use an | 45 | Yocto Project Development Tasks Manual for information on how to use an |
27 | append file to override metadata. How do I install a specific kernel | 46 | append file to override metadata. |
28 | module? Linux kernel modules are packaged individually. To ensure a | 47 | |
48 | How do I install a specific kernel module? | ||
49 | ------------------------------------------ | ||
50 | |||
51 | Linux kernel modules are packaged individually. To ensure a | ||
29 | specific kernel module is included in an image, include it in the | 52 | specific kernel module is included in an image, include it in the |
30 | appropriate machine | 53 | appropriate machine |
31 | :term:`RRECOMMENDS` variable. | 54 | :term:`RRECOMMENDS` variable. |
@@ -36,10 +59,23 @@ These other variables are useful for installing specific modules: | |||
36 | :term:`MACHINE_EXTRA_RRECOMMENDS` | 59 | :term:`MACHINE_EXTRA_RRECOMMENDS` |
37 | For example, set the following in the ``qemux86.conf`` file to include | 60 | For example, set the following in the ``qemux86.conf`` file to include |
38 | the ``ab123`` kernel modules with images built for the ``qemux86`` | 61 | the ``ab123`` kernel modules with images built for the ``qemux86`` |
39 | machine: MACHINE_EXTRA_RRECOMMENDS += "kernel-module-ab123" For more | 62 | machine: |
63 | :: | ||
64 | |||
65 | MACHINE_EXTRA_RRECOMMENDS += "kernel-module-ab123" | ||
66 | |||
67 | For more | ||
40 | information, see the "`Incorporating Out-of-Tree | 68 | information, see the "`Incorporating Out-of-Tree |
41 | Modules <#incorporating-out-of-tree-modules>`__" section. How do I | 69 | Modules <#incorporating-out-of-tree-modules>`__" section. |
42 | change the Linux kernel command line? The Linux kernel command line is | 70 | |
71 | How do I change the Linux kernel command line? | ||
72 | ---------------------------------------------- | ||
73 | |||
74 | The Linux kernel command line is | ||
43 | typically specified in the machine config using the ``APPEND`` variable. | 75 | typically specified in the machine config using the ``APPEND`` variable. |
44 | For example, you can add some helpful debug information doing the | 76 | For example, you can add some helpful debug information doing the |
45 | following: APPEND += "printk.time=y initcall_debug debug" | 77 | following: |
78 | :: | ||
79 | |||
80 | APPEND += "printk.time=y initcall_debug debug" | ||
81 | |||
diff --git a/documentation/kernel-dev/kernel-dev-intro.rst b/documentation/kernel-dev/kernel-dev-intro.rst index 6708a6afe9..21d43d5e80 100644 --- a/documentation/kernel-dev/kernel-dev-intro.rst +++ b/documentation/kernel-dev/kernel-dev-intro.rst | |||
@@ -28,8 +28,8 @@ newly-supported platforms. Previous recipes in the release are refreshed | |||
28 | and supported for at least one additional Yocto Project release. As they | 28 | and supported for at least one additional Yocto Project release. As they |
29 | align, these previous releases are updated to include the latest from | 29 | align, these previous releases are updated to include the latest from |
30 | the Long Term Support Initiative (LTSI) project. You can learn more | 30 | the Long Term Support Initiative (LTSI) project. You can learn more |
31 | about Yocto Linux kernels and LTSI in the "`Yocto Project Kernel | 31 | about Yocto Linux kernels and LTSI in the ":ref:`Yocto Project Kernel |
32 | Development and Maintenance <#kernel-big-picture>`__" section. | 32 | Development and Maintenance <kernel-big-picture>`" section. |
33 | 33 | ||
34 | Also included is a Yocto Linux kernel development recipe | 34 | Also included is a Yocto Linux kernel development recipe |
35 | (``linux-yocto-dev.bb``) should you want to work with the very latest in | 35 | (``linux-yocto-dev.bb``) should you want to work with the very latest in |
@@ -81,17 +81,16 @@ facilitate the process of working with the kernel recipes. If you find | |||
81 | you need some additional background, please be sure to review and | 81 | you need some additional background, please be sure to review and |
82 | understand the following documentation: | 82 | understand the following documentation: |
83 | 83 | ||
84 | - `Yocto Project Quick Build <&YOCTO_DOCS_BRIEF_URL;>`__ document. | 84 | - :doc:`../brief-yoctoprojectqs/brief-yoctoprojectqs` document. |
85 | 85 | ||
86 | - `Yocto Project Overview and Concepts Manual <&YOCTO_DOCS_OM_URL;>`__. | 86 | - :doc:`../overview-manual/overview-manual`. |
87 | 87 | ||
88 | - ```devtool`` | 88 | - :ref:`devtool |
89 | workflow <&YOCTO_DOCS_SDK_URL;#using-devtool-in-your-sdk-workflow>`__ | 89 | workflow <sdk-manual/sdk-extensible:using \`\`devtool\`\` in your sdk workflow>` |
90 | as described in the Yocto Project Application Development and the | 90 | as described in the Yocto Project Application Development and the |
91 | Extensible Software Development Kit (eSDK) manual. | 91 | Extensible Software Development Kit (eSDK) manual. |
92 | 92 | ||
93 | - The "`Understanding and Creating | 93 | - The ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`" |
94 | Layers <&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers>`__" | ||
95 | section in the Yocto Project Development Tasks Manual. | 94 | section in the Yocto Project Development Tasks Manual. |
96 | 95 | ||
97 | - The "`Kernel Modification | 96 | - The "`Kernel Modification |
@@ -114,8 +113,7 @@ general information and references for further information. | |||
114 | :align: center | 113 | :align: center |
115 | 114 | ||
116 | 1. *Set up Your Host Development System to Support Development Using the | 115 | 1. *Set up Your Host Development System to Support Development Using the |
117 | Yocto Project*: See the "`Setting Up the Development Host to Use the | 116 | Yocto Project*: See the ":doc:`../dev-manual/dev-manual-start`" section in |
118 | Yocto Project <&YOCTO_DOCS_DEV_URL;#dev-manual-start>`__" section in | ||
119 | the Yocto Project Development Tasks Manual for options on how to get | 117 | the Yocto Project Development Tasks Manual for options on how to get |
120 | a build host ready to use the Yocto Project. | 118 | a build host ready to use the Yocto Project. |
121 | 119 | ||
@@ -127,31 +125,33 @@ general information and references for further information. | |||
127 | 125 | ||
128 | Using ``devtool`` and the eSDK requires that you have a clean build | 126 | Using ``devtool`` and the eSDK requires that you have a clean build |
129 | of the image and that you are set up with the appropriate eSDK. For | 127 | of the image and that you are set up with the appropriate eSDK. For |
130 | more information, see the "`Getting Ready to Develop Using | 128 | more information, see the |
131 | ``devtool`` <#getting-ready-to-develop-using-devtool>`__" section. | 129 | ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devtool\`\``" |
130 | section. | ||
132 | 131 | ||
133 | Using traditional kernel development requires that you have the | 132 | Using traditional kernel development requires that you have the |
134 | kernel source available in an isolated local Git repository. For more | 133 | kernel source available in an isolated local Git repository. For more |
135 | information, see the "`Getting Ready for Traditional Kernel | 134 | information, see the |
136 | Development <#getting-ready-for-traditional-kernel-development>`__" | 135 | ":ref:`kernel-dev/kernel-dev-common:getting ready for traditional kernel development`" |
137 | section. | 136 | section. |
138 | 137 | ||
139 | 3. *Make Changes to the Kernel Source Code if applicable:* Modifying the | 138 | 3. *Make Changes to the Kernel Source Code if applicable:* Modifying the |
140 | kernel does not always mean directly changing source files. However, | 139 | kernel does not always mean directly changing source files. However, |
141 | if you have to do this, you make the changes to the files in the | 140 | if you have to do this, you make the changes to the files in the |
142 | eSDK's Build Directory if you are using ``devtool``. For more | 141 | eSDK's Build Directory if you are using ``devtool``. For more |
143 | information, see the "`Using ``devtool`` to Patch the | 142 | information, see the |
144 | Kernel <#using-devtool-to-patch-the-kernel>`__" section. | 143 | ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
144 | section. | ||
145 | 145 | ||
146 | If you are using traditional kernel development, you edit the source | 146 | If you are using traditional kernel development, you edit the source |
147 | files in the kernel's local Git repository. For more information, see | 147 | files in the kernel's local Git repository. For more information, see the |
148 | the "`Using Traditional Kernel Development to Patch the | 148 | ":ref:`kernel-dev/kernel-dev-common:using traditional kernel development to patch the kernel`" |
149 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | ||
150 | section. | 149 | section. |
151 | 150 | ||
152 | 4. *Make Kernel Configuration Changes if Applicable:* If your situation | 151 | 4. *Make Kernel Configuration Changes if Applicable:* If your situation |
153 | calls for changing the kernel's configuration, you can use | 152 | calls for changing the kernel's configuration, you can use |
154 | ```menuconfig`` <#using-menuconfig>`__, which allows you to | 153 | :ref:`menuconfig <kernel-dev/kernel-dev-common:using \`\`menuconfig\`\`>`, |
154 | which allows you to | ||
155 | interactively develop and test the configuration changes you are | 155 | interactively develop and test the configuration changes you are |
156 | making to the kernel. Saving changes you make with ``menuconfig`` | 156 | making to the kernel. Saving changes you make with ``menuconfig`` |
157 | updates the kernel's ``.config`` file. | 157 | updates the kernel's ``.config`` file. |
diff --git a/documentation/kernel-dev/kernel-dev-maint-appx.rst b/documentation/kernel-dev/kernel-dev-maint-appx.rst index 0b0cca14a7..5514dac876 100644 --- a/documentation/kernel-dev/kernel-dev-maint-appx.rst +++ b/documentation/kernel-dev/kernel-dev-maint-appx.rst | |||
@@ -28,12 +28,17 @@ in the Yocto Project Linux kernel in any clone of the Yocto Project | |||
28 | Linux kernel source repository and ``yocto-kernel-cache`` Git trees. For | 28 | Linux kernel source repository and ``yocto-kernel-cache`` Git trees. For |
29 | example, the following commands clone the Yocto Project baseline Linux | 29 | example, the following commands clone the Yocto Project baseline Linux |
30 | kernel that branches off ``linux.org`` version 4.12 and the | 30 | kernel that branches off ``linux.org`` version 4.12 and the |
31 | ``yocto-kernel-cache``, which contains stores of kernel Metadata: $ git | 31 | ``yocto-kernel-cache``, which contains stores of kernel Metadata: |
32 | clone git://git.yoctoproject.org/linux-yocto-4.12 $ git clone | 32 | :: |
33 | git://git.yoctoproject.org/linux-kernel-cache For more information on | 33 | |
34 | $ git clone git://git.yoctoproject.org/linux-yocto-4.12 | ||
35 | $ git clone git://git.yoctoproject.org/linux-kernel-cache | ||
36 | |||
37 | For more information on | ||
34 | how to set up a local Git repository of the Yocto Project Linux kernel | 38 | how to set up a local Git repository of the Yocto Project Linux kernel |
35 | files, see the "`Preparing the Build Host to Work on the | 39 | files, see the |
36 | Kernel <#preparing-the-build-host-to-work-on-the-kernel>`__" section. | 40 | ":ref:`kernel-dev/kernel-dev-common:preparing the build host to work on the kernel`" |
41 | section. | ||
37 | 42 | ||
38 | Once you have cloned the kernel Git repository and the cache of Metadata | 43 | Once you have cloned the kernel Git repository and the cache of Metadata |
39 | on your local machine, you can discover the branches that are available | 44 | on your local machine, you can discover the branches that are available |
@@ -41,10 +46,13 @@ in the repository using the following Git command: $ git branch -a | |||
41 | Checking out a branch allows you to work with a particular Yocto Linux | 46 | Checking out a branch allows you to work with a particular Yocto Linux |
42 | kernel. For example, the following commands check out the | 47 | kernel. For example, the following commands check out the |
43 | "standard/beagleboard" branch of the Yocto Linux kernel repository and | 48 | "standard/beagleboard" branch of the Yocto Linux kernel repository and |
44 | the "yocto-4.12" branch of the ``yocto-kernel-cache`` repository: $ cd | 49 | the "yocto-4.12" branch of the ``yocto-kernel-cache`` repository: |
45 | ~/linux-yocto-4.12 $ git checkout -b my-kernel-4.12 | 50 | :: |
46 | remotes/origin/standard/beagleboard $ cd ~/linux-kernel-cache $ git | 51 | |
47 | checkout -b my-4.12-metadata remotes/origin/yocto-4.12 | 52 | $ cd ~/linux-yocto-4.12 |
53 | $ git checkout -b my-kernel-4.12 remotes/origin/standard/beagleboard | ||
54 | $ cd ~/linux-kernel-cache | ||
55 | $ git checkout -b my-4.12-metadata remotes/origin/yocto-4.12 | ||
48 | 56 | ||
49 | .. note:: | 57 | .. note:: |
50 | 58 | ||
@@ -102,7 +110,9 @@ patch, or BSP: | |||
102 | For a typical build, the target of the search is a feature | 110 | For a typical build, the target of the search is a feature |
103 | description in an ``.scc`` file whose name follows this format (e.g. | 111 | description in an ``.scc`` file whose name follows this format (e.g. |
104 | ``beaglebone-standard.scc`` and ``beaglebone-preempt-rt.scc``): | 112 | ``beaglebone-standard.scc`` and ``beaglebone-preempt-rt.scc``): |
105 | bsp_root_name-kernel_type.scc | 113 | :: |
114 | |||
115 | bsp_root_name-kernel_type.scc | ||
106 | 116 | ||
107 | 3. *Expand Feature:* Once located, the feature description is either | 117 | 3. *Expand Feature:* Once located, the feature description is either |
108 | expanded into a simple script of actions, or into an existing | 118 | expanded into a simple script of actions, or into an existing |
@@ -212,7 +222,10 @@ build process generates a build tree that is separate from your kernel's | |||
212 | local Git source repository tree. This build tree has a name that uses | 222 | local Git source repository tree. This build tree has a name that uses |
213 | the following form, where ``${MACHINE}`` is the metadata name of the | 223 | the following form, where ``${MACHINE}`` is the metadata name of the |
214 | machine (BSP) and "kernel_type" is one of the Yocto Project supported | 224 | machine (BSP) and "kernel_type" is one of the Yocto Project supported |
215 | kernel types (e.g. "standard"): linux-${MACHINE}-kernel_type-build | 225 | kernel types (e.g. "standard"): |
226 | :: | ||
227 | |||
228 | linux-${MACHINE}-kernel_type-build | ||
216 | 229 | ||
217 | The existing support in the ``kernel.org`` tree achieves this default | 230 | The existing support in the ``kernel.org`` tree achieves this default |
218 | functionality. | 231 | functionality. |