diff options
Diffstat (limited to 'documentation/kernel-dev/kernel-dev-advanced.rst')
| -rw-r--r-- | documentation/kernel-dev/kernel-dev-advanced.rst | 96 |
1 files changed, 35 insertions, 61 deletions
diff --git a/documentation/kernel-dev/kernel-dev-advanced.rst b/documentation/kernel-dev/kernel-dev-advanced.rst index eeb8f87924..444037c3a7 100644 --- a/documentation/kernel-dev/kernel-dev-advanced.rst +++ b/documentation/kernel-dev/kernel-dev-advanced.rst | |||
| @@ -44,9 +44,7 @@ linux-yocto recipe. | |||
| 44 | .. note:: | 44 | .. note:: |
| 45 | 45 | ||
| 46 | A Linux kernel recipe that contains kernel Metadata (e.g. inherits | 46 | A Linux kernel recipe that contains kernel Metadata (e.g. inherits |
| 47 | from the | 47 | from the ``linux-yocto.inc`` file) is said to be a "linux-yocto style" recipe. |
| 48 | linux-yocto.inc | ||
| 49 | file) is said to be a "linux-yocto style" recipe. | ||
| 50 | 48 | ||
| 51 | Every linux-yocto style recipe must define the | 49 | Every linux-yocto style recipe must define the |
| 52 | :term:`KMACHINE` variable. This | 50 | :term:`KMACHINE` variable. This |
| @@ -70,12 +68,8 @@ to indicate the branch. | |||
| 70 | 68 | ||
| 71 | .. note:: | 69 | .. note:: |
| 72 | 70 | ||
| 73 | You can use the | 71 | You can use the ``KBRANCH`` value to define an alternate branch typically |
| 74 | KBRANCH | 72 | with a machine override as shown here from the ``meta-yocto-bsp`` layer: |
| 75 | value to define an alternate branch typically with a machine override | ||
| 76 | as shown here from the | ||
| 77 | meta-yocto-bsp | ||
| 78 | layer: | ||
| 79 | :: | 73 | :: |
| 80 | 74 | ||
| 81 | KBRANCH_edgerouter = "standard/edgerouter" | 75 | KBRANCH_edgerouter = "standard/edgerouter" |
| @@ -101,7 +95,7 @@ section for more information on kernel types. | |||
| 101 | During the build, the kern-tools search for the BSP description file | 95 | During the build, the kern-tools search for the BSP description file |
| 102 | that most closely matches the ``KMACHINE`` and ``LINUX_KERNEL_TYPE`` | 96 | that most closely matches the ``KMACHINE`` and ``LINUX_KERNEL_TYPE`` |
| 103 | variables passed in from the recipe. The tools use the first BSP | 97 | variables passed in from the recipe. The tools use the first BSP |
| 104 | description it finds that match both variables. If the tools cannot find | 98 | description they find that matches both variables. If the tools cannot find |
| 105 | a match, they issue a warning. | 99 | a match, they issue a warning. |
| 106 | 100 | ||
| 107 | The tools first search for the ``KMACHINE`` and then for the | 101 | The tools first search for the ``KMACHINE`` and then for the |
| @@ -251,8 +245,7 @@ two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the | |||
| 251 | CONFIG_X86_BIGSMP=y | 245 | CONFIG_X86_BIGSMP=y |
| 252 | 246 | ||
| 253 | You can find general information on configuration | 247 | You can find general information on configuration |
| 254 | fragment files in the "`Creating Configuration | 248 | fragment files in the ":ref:`creating-config-fragments`" section. |
| 255 | Fragments <#creating-config-fragments>`__" section. | ||
| 256 | 249 | ||
| 257 | Within the ``smp.scc`` file, the | 250 | Within the ``smp.scc`` file, the |
| 258 | :term:`KFEATURE_DESCRIPTION` | 251 | :term:`KFEATURE_DESCRIPTION` |
| @@ -269,13 +262,12 @@ non-hardware fragment. | |||
| 269 | 262 | ||
| 270 | .. note:: | 263 | .. note:: |
| 271 | 264 | ||
| 272 | The description file can include multiple | 265 | The description file can include multiple ``kconf`` statements, one per |
| 273 | kconf | 266 | fragment. |
| 274 | statements, one per fragment. | ||
| 275 | 267 | ||
| 276 | As described in the "`Validating | 268 | As described in the |
| 277 | Configuration <#validating-configuration>`__" section, you can use the | 269 | ":ref:`kernel-dev/kernel-dev-common:validating configuration`" section, you can |
| 278 | following BitBake command to audit your configuration: | 270 | use the following BitBake command to audit your configuration: |
| 279 | :: | 271 | :: |
| 280 | 272 | ||
| 281 | $ bitbake linux-yocto -c kernel_configcheck -f | 273 | $ bitbake linux-yocto -c kernel_configcheck -f |
| @@ -335,10 +327,8 @@ for the five patches in the directory. | |||
| 335 | 327 | ||
| 336 | You can create a typical ``.patch`` file using ``diff -Nurp`` or | 328 | You can create a typical ``.patch`` file using ``diff -Nurp`` or |
| 337 | ``git format-patch`` commands. For information on how to create patches, | 329 | ``git format-patch`` commands. For information on how to create patches, |
| 338 | see the "`Using ``devtool`` to Patch the | 330 | see the ":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" |
| 339 | Kernel <#using-devtool-to-patch-the-kernel>`__" and "`Using Traditional | 331 | and ":ref:`kernel-dev/kernel-dev-common:using traditional kernel development to patch the kernel`" |
| 340 | Kernel Development to Patch the | ||
| 341 | Kernel <#using-traditional-kernel-development-to-patch-the-kernel>`__" | ||
| 342 | sections. | 332 | sections. |
| 343 | 333 | ||
| 344 | Features | 334 | Features |
| @@ -397,15 +387,11 @@ type as follows: | |||
| 397 | 387 | ||
| 398 | .. note:: | 388 | .. note:: |
| 399 | 389 | ||
| 400 | You can find kernel recipes in the | 390 | You can find kernel recipes in the ``meta/recipes-kernel/linux`` directory |
| 401 | meta/recipes-kernel/linux | 391 | of the :ref:`overview-manual/overview-manual-development-environment:yocto project source repositories` |
| 402 | directory of the | 392 | (e.g. ``poky/meta/recipes-kernel/linux/linux-yocto_4.12.bb``). See the |
| 403 | Source Directory | 393 | ":ref:`kernel-dev/kernel-dev-advanced:using kernel metadata in a recipe`" |
| 404 | (e.g. | 394 | section for more information. |
| 405 | poky/meta/recipes-kernel/linux/linux-yocto_4.12.bb | ||
| 406 | ). See the " | ||
| 407 | Using Kernel Metadata in a Recipe | ||
| 408 | " section for more information. | ||
| 409 | 395 | ||
| 410 | Three kernel types ("standard", "tiny", and "preempt-rt") are supported | 396 | Three kernel types ("standard", "tiny", and "preempt-rt") are supported |
| 411 | for Linux Yocto kernels: | 397 | for Linux Yocto kernels: |
| @@ -466,16 +452,11 @@ and ``patch`` commands, respectively. | |||
| 466 | 452 | ||
| 467 | .. note:: | 453 | .. note:: |
| 468 | 454 | ||
| 469 | It is not strictly necessary to create a kernel type | 455 | It is not strictly necessary to create a kernel type ``.scc`` |
| 470 | .scc | ||
| 471 | file. The Board Support Package (BSP) file can implicitly define the | 456 | file. The Board Support Package (BSP) file can implicitly define the |
| 472 | kernel type using a | 457 | kernel type using a ``define`` :term:`KTYPE` ``myktype`` line. See the |
| 473 | define | 458 | ":ref:`kernel-dev/kernel-dev-advanced:bsp descriptions`" section for more |
| 474 | KTYPE | 459 | information. |
| 475 | myktype | ||
| 476 | line. See the " | ||
| 477 | BSP Descriptions | ||
| 478 | " section for more information. | ||
| 479 | 460 | ||
| 480 | BSP Descriptions | 461 | BSP Descriptions |
| 481 | ---------------- | 462 | ---------------- |
| @@ -488,13 +469,9 @@ supported kernel type. | |||
| 488 | .. note:: | 469 | .. note:: |
| 489 | 470 | ||
| 490 | For BSPs supported by the Yocto Project, the BSP description files | 471 | For BSPs supported by the Yocto Project, the BSP description files |
| 491 | are located in the | 472 | are located in the ``bsp`` directory of the ``yocto-kernel-cache`` |
| 492 | bsp | ||
| 493 | directory of the | ||
| 494 | yocto-kernel-cache | ||
| 495 | repository organized under the "Yocto Linux Kernel" heading in the | 473 | repository organized under the "Yocto Linux Kernel" heading in the |
| 496 | Yocto Project Source Repositories | 474 | :yocto_git:`Yocto Project Source Repositories </>`. |
| 497 | . | ||
| 498 | 475 | ||
| 499 | This section overviews the BSP description structure, the aggregation | 476 | This section overviews the BSP description structure, the aggregation |
| 500 | concepts, and presents a detailed example using a BSP supported by the | 477 | concepts, and presents a detailed example using a BSP supported by the |
| @@ -571,7 +548,7 @@ policy. See the "`Kernel Types <#kernel-types>`__" section for more | |||
| 571 | information. | 548 | information. |
| 572 | 549 | ||
| 573 | To aggregate common configurations and features specific to the kernel | 550 | To aggregate common configurations and features specific to the kernel |
| 574 | for mybsp, use the following: | 551 | for `mybsp`, use the following: |
| 575 | :: | 552 | :: |
| 576 | 553 | ||
| 577 | include mybsp.scc | 554 | include mybsp.scc |
| @@ -582,8 +559,7 @@ You can see that in the BeagleBone example with the following: | |||
| 582 | include beaglebone.scc | 559 | include beaglebone.scc |
| 583 | 560 | ||
| 584 | For information on how to break a complete ``.config`` file into the various | 561 | For information on how to break a complete ``.config`` file into the various |
| 585 | configuration fragments, see the "`Creating Configuration | 562 | configuration fragments, see the ":ref:`creating-config-fragments`" section. |
| 586 | Fragments <#creating-config-fragments>`__" section. | ||
| 587 | 563 | ||
| 588 | Finally, if you have any configurations specific to the hardware that | 564 | Finally, if you have any configurations specific to the hardware that |
| 589 | are not in a ``*.scc`` file, you can include them as follows: | 565 | are not in a ``*.scc`` file, you can include them as follows: |
| @@ -653,7 +629,7 @@ found on the machine. This ``minnow.scc`` description file is then | |||
| 653 | included in each of the three "minnow" description files for the | 629 | included in each of the three "minnow" description files for the |
| 654 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). | 630 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). |
| 655 | Consider the "minnow" description for the "standard" kernel type (i.e. | 631 | Consider the "minnow" description for the "standard" kernel type (i.e. |
| 656 | ``minnow-standard.scc``: | 632 | ``minnow-standard.scc``): |
| 657 | :: | 633 | :: |
| 658 | 634 | ||
| 659 | define KMACHINE minnow | 635 | define KMACHINE minnow |
| @@ -725,8 +701,8 @@ others, the recipe-space method is recommended. This method is also a | |||
| 725 | good approach if you are working with Linux kernel sources you do not | 701 | good approach if you are working with Linux kernel sources you do not |
| 726 | control or if you just do not want to maintain a Linux kernel Git | 702 | control or if you just do not want to maintain a Linux kernel Git |
| 727 | repository on your own. For partial information on how you can define | 703 | repository on your own. For partial information on how you can define |
| 728 | kernel Metadata in the recipe-space, see the "`Modifying an Existing | 704 | kernel Metadata in the recipe-space, see the |
| 729 | Recipe <#modifying-an-existing-recipe>`__" section. | 705 | ":ref:`kernel-dev/kernel-dev-common:modifying an existing recipe`" section. |
| 730 | 706 | ||
| 731 | Conversely, if you are actively developing a kernel and are already | 707 | Conversely, if you are actively developing a kernel and are already |
| 732 | maintaining a Linux kernel Git repository of your own, you might find it | 708 | maintaining a Linux kernel Git repository of your own, you might find it |
| @@ -746,8 +722,8 @@ modifying | |||
| 746 | ``oe-core/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb`` to | 722 | ``oe-core/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb`` to |
| 747 | a recipe in your layer, ``FILESEXTRAPATHS`` is typically set to | 723 | a recipe in your layer, ``FILESEXTRAPATHS`` is typically set to |
| 748 | ``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``. | 724 | ``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``. |
| 749 | See the "`Modifying an Existing | 725 | See the ":ref:`kernel-dev/kernel-dev-common:modifying an existing recipe`" |
| 750 | Recipe <#modifying-an-existing-recipe>`__" section for more information. | 726 | section for more information. |
| 751 | 727 | ||
| 752 | Here is an example that shows a trivial tree of kernel Metadata stored | 728 | Here is an example that shows a trivial tree of kernel Metadata stored |
| 753 | in recipe-space within a BSP layer: | 729 | in recipe-space within a BSP layer: |
| @@ -849,7 +825,7 @@ best for your development model. | |||
| 849 | Encapsulating Patches | 825 | Encapsulating Patches |
| 850 | --------------------- | 826 | --------------------- |
| 851 | 827 | ||
| 852 | if you are reusing patches from an external tree and are not working on | 828 | If you are reusing patches from an external tree and are not working on |
| 853 | the patches, you might find the encapsulated feature to be appropriate. | 829 | the patches, you might find the encapsulated feature to be appropriate. |
| 854 | Given this scenario, you do not need to create any branches in the | 830 | Given this scenario, you do not need to create any branches in the |
| 855 | source repository. Rather, you just take the static patches you need and | 831 | source repository. Rather, you just take the static patches you need and |
| @@ -881,6 +857,7 @@ new branch as the ``KBRANCH`` to use for the board as follows: | |||
| 881 | 857 | ||
| 882 | Another method is to use the ``branch`` command in the BSP | 858 | Another method is to use the ``branch`` command in the BSP |
| 883 | description: | 859 | description: |
| 860 | :: | ||
| 884 | 861 | ||
| 885 | mybsp.scc: | 862 | mybsp.scc: |
| 886 | define KMACHINE mybsp | 863 | define KMACHINE mybsp |
| @@ -902,7 +879,7 @@ repositories use: | |||
| 902 | If you had two kernel types, "standard" and "small" for instance, three | 879 | If you had two kernel types, "standard" and "small" for instance, three |
| 903 | machines, and common as ``mydir``, the branches in your Git repository | 880 | machines, and common as ``mydir``, the branches in your Git repository |
| 904 | might look like this: | 881 | might look like this: |
| 905 | : | 882 | :: |
| 906 | 883 | ||
| 907 | mydir/base | 884 | mydir/base |
| 908 | mydir/standard/base | 885 | mydir/standard/base |
| @@ -922,11 +899,8 @@ appropriate for the other branches. | |||
| 922 | 899 | ||
| 923 | The "base" branches are an artifact of the way Git manages its data | 900 | The "base" branches are an artifact of the way Git manages its data |
| 924 | internally on the filesystem: Git will not allow you to use | 901 | internally on the filesystem: Git will not allow you to use |
| 925 | mydir/standard | 902 | ``mydir/standard`` and ``mydir/standard/machine_a`` because it would have to |
| 926 | and | 903 | create a file and a directory named "standard". |
| 927 | mydir/standard/machine_a | ||
| 928 | because it would have to create a file and a directory named | ||
| 929 | "standard". | ||
| 930 | 904 | ||
| 931 | Feature Branches | 905 | Feature Branches |
| 932 | ---------------- | 906 | ---------------- |
