diff options
Diffstat (limited to 'documentation/kernel-dev/advanced.rst')
| -rw-r--r-- | documentation/kernel-dev/advanced.rst | 87 |
1 files changed, 29 insertions, 58 deletions
diff --git a/documentation/kernel-dev/advanced.rst b/documentation/kernel-dev/advanced.rst index fb6dfca85f..b0d03851b3 100644 --- a/documentation/kernel-dev/advanced.rst +++ b/documentation/kernel-dev/advanced.rst | |||
| @@ -67,8 +67,7 @@ to indicate the branch. | |||
| 67 | .. note:: | 67 | .. note:: |
| 68 | 68 | ||
| 69 | You can use the ``KBRANCH`` value to define an alternate branch typically | 69 | You can use the ``KBRANCH`` value to define an alternate branch typically |
| 70 | with a machine override as shown here from the ``meta-yocto-bsp`` layer: | 70 | with a machine override as shown here from the ``meta-yocto-bsp`` layer:: |
| 71 | :: | ||
| 72 | 71 | ||
| 73 | KBRANCH_edgerouter = "standard/edgerouter" | 72 | KBRANCH_edgerouter = "standard/edgerouter" |
| 74 | 73 | ||
| @@ -106,15 +105,13 @@ You can use the | |||
| 106 | variable to include features (configuration fragments, patches, or both) | 105 | variable to include features (configuration fragments, patches, or both) |
| 107 | that are not already included by the ``KMACHINE`` and | 106 | that are not already included by the ``KMACHINE`` and |
| 108 | ``LINUX_KERNEL_TYPE`` variable combination. For example, to include a | 107 | ``LINUX_KERNEL_TYPE`` variable combination. For example, to include a |
| 109 | feature specified as "features/netfilter/netfilter.scc", specify: | 108 | feature specified as "features/netfilter/netfilter.scc", specify:: |
| 110 | :: | ||
| 111 | 109 | ||
| 112 | KERNEL_FEATURES += "features/netfilter/netfilter.scc" | 110 | KERNEL_FEATURES += "features/netfilter/netfilter.scc" |
| 113 | 111 | ||
| 114 | To include a | 112 | To include a |
| 115 | feature called "cfg/sound.scc" just for the ``qemux86`` machine, | 113 | feature called "cfg/sound.scc" just for the ``qemux86`` machine, |
| 116 | specify: | 114 | specify:: |
| 117 | :: | ||
| 118 | 115 | ||
| 119 | KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc" | 116 | KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc" |
| 120 | 117 | ||
| @@ -157,8 +154,7 @@ types to form the final description of what will be assembled and built. | |||
| 157 | While the kernel Metadata syntax does not enforce any logical separation | 154 | While the kernel Metadata syntax does not enforce any logical separation |
| 158 | of configuration fragments, patches, features or kernel types, best | 155 | of configuration fragments, patches, features or kernel types, best |
| 159 | practices dictate a logical separation of these types of Metadata. The | 156 | practices dictate a logical separation of these types of Metadata. The |
| 160 | following Metadata file hierarchy is recommended: | 157 | following Metadata file hierarchy is recommended:: |
| 161 | :: | ||
| 162 | 158 | ||
| 163 | base/ | 159 | base/ |
| 164 | bsp/ | 160 | bsp/ |
| @@ -222,8 +218,7 @@ used with the ``linux-yocto-4.12`` kernel as defined outside of the | |||
| 222 | recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of | 218 | recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of |
| 223 | two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the | 219 | two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the |
| 224 | ``cfg`` directory of the ``yocto-4.12`` branch in the | 220 | ``cfg`` directory of the ``yocto-4.12`` branch in the |
| 225 | ``yocto-kernel-cache`` Git repository: | 221 | ``yocto-kernel-cache`` Git repository:: |
| 226 | :: | ||
| 227 | 222 | ||
| 228 | cfg/smp.scc: | 223 | cfg/smp.scc: |
| 229 | define KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds" | 224 | define KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds" |
| @@ -265,8 +260,7 @@ non-hardware fragment. | |||
| 265 | 260 | ||
| 266 | As described in the | 261 | As described in the |
| 267 | ":ref:`kernel-dev/common:validating configuration`" section, you can | 262 | ":ref:`kernel-dev/common:validating configuration`" section, you can |
| 268 | use the following BitBake command to audit your configuration: | 263 | use the following BitBake command to audit your configuration:: |
| 269 | :: | ||
| 270 | 264 | ||
| 271 | $ bitbake linux-yocto -c kernel_configcheck -f | 265 | $ bitbake linux-yocto -c kernel_configcheck -f |
| 272 | 266 | ||
| @@ -287,8 +281,7 @@ in the ``patches/build`` directory of the ``yocto-4.12`` branch in the | |||
| 287 | ``yocto-kernel-cache`` Git repository. | 281 | ``yocto-kernel-cache`` Git repository. |
| 288 | 282 | ||
| 289 | The following listings show the ``build.scc`` file and part of the | 283 | The following listings show the ``build.scc`` file and part of the |
| 290 | ``modpost-mask-trivial-warnings.patch`` file: | 284 | ``modpost-mask-trivial-warnings.patch`` file:: |
| 291 | :: | ||
| 292 | 285 | ||
| 293 | patches/build/build.scc: | 286 | patches/build/build.scc: |
| 294 | patch arm-serialize-build-targets.patch | 287 | patch arm-serialize-build-targets.patch |
| @@ -334,8 +327,7 @@ Features | |||
| 334 | 327 | ||
| 335 | Features are complex kernel Metadata types that consist of configuration | 328 | Features are complex kernel Metadata types that consist of configuration |
| 336 | fragments, patches, and possibly other feature description files. As an | 329 | fragments, patches, and possibly other feature description files. As an |
| 337 | example, consider the following generic listing: | 330 | example, consider the following generic listing:: |
| 338 | :: | ||
| 339 | 331 | ||
| 340 | features/myfeature.scc | 332 | features/myfeature.scc |
| 341 | define KFEATURE_DESCRIPTION "Enable myfeature" | 333 | define KFEATURE_DESCRIPTION "Enable myfeature" |
| @@ -371,15 +363,13 @@ the ``linux-yocto_4.12.bb`` kernel recipe found in | |||
| 371 | ``poky/meta/recipes-kernel/linux``, a | 363 | ``poky/meta/recipes-kernel/linux``, a |
| 372 | :ref:`require <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` directive | 364 | :ref:`require <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` directive |
| 373 | includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file, | 365 | includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file, |
| 374 | which has the following statement that defines the default kernel type: | 366 | which has the following statement that defines the default kernel type:: |
| 375 | :: | ||
| 376 | 367 | ||
| 377 | LINUX_KERNEL_TYPE ??= "standard" | 368 | LINUX_KERNEL_TYPE ??= "standard" |
| 378 | 369 | ||
| 379 | Another example would be the real-time kernel (i.e. | 370 | Another example would be the real-time kernel (i.e. |
| 380 | ``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel | 371 | ``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel |
| 381 | type as follows: | 372 | type as follows:: |
| 382 | :: | ||
| 383 | 373 | ||
| 384 | LINUX_KERNEL_TYPE = "preempt-rt" | 374 | LINUX_KERNEL_TYPE = "preempt-rt" |
| 385 | 375 | ||
| @@ -412,8 +402,7 @@ for Linux Yocto kernels: | |||
| 412 | For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. | 402 | For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. |
| 413 | ``standard.scc``). Here is a partial listing for the ``standard.scc`` | 403 | ``standard.scc``). Here is a partial listing for the ``standard.scc`` |
| 414 | file, which is found in the ``ktypes/standard`` directory of the | 404 | file, which is found in the ``ktypes/standard`` directory of the |
| 415 | ``yocto-kernel-cache`` Git repository: | 405 | ``yocto-kernel-cache`` Git repository:: |
| 416 | :: | ||
| 417 | 406 | ||
| 418 | # Include this kernel type fragment to get the standard features and | 407 | # Include this kernel type fragment to get the standard features and |
| 419 | # configuration values. | 408 | # configuration values. |
| @@ -482,15 +471,13 @@ Description Overview | |||
| 482 | For simplicity, consider the following root BSP layer description files | 471 | For simplicity, consider the following root BSP layer description files |
| 483 | for the BeagleBone board. These files employ both a structure and naming | 472 | for the BeagleBone board. These files employ both a structure and naming |
| 484 | convention for consistency. The naming convention for the file is as | 473 | convention for consistency. The naming convention for the file is as |
| 485 | follows: | 474 | follows:: |
| 486 | :: | ||
| 487 | 475 | ||
| 488 | bsp_root_name-kernel_type.scc | 476 | bsp_root_name-kernel_type.scc |
| 489 | 477 | ||
| 490 | Here are some example root layer | 478 | Here are some example root layer |
| 491 | BSP filenames for the BeagleBone Board BSP, which is supported by the | 479 | BSP filenames for the BeagleBone Board BSP, which is supported by the |
| 492 | Yocto Project: | 480 | Yocto Project:: |
| 493 | :: | ||
| 494 | 481 | ||
| 495 | beaglebone-standard.scc | 482 | beaglebone-standard.scc |
| 496 | beaglebone-preempt-rt.scc | 483 | beaglebone-preempt-rt.scc |
| @@ -498,8 +485,7 @@ Yocto Project: | |||
| 498 | Each file uses the root name (i.e "beaglebone") BSP name followed by the | 485 | Each file uses the root name (i.e "beaglebone") BSP name followed by the |
| 499 | kernel type. | 486 | kernel type. |
| 500 | 487 | ||
| 501 | Examine the ``beaglebone-standard.scc`` file: | 488 | Examine the ``beaglebone-standard.scc`` file:: |
| 502 | :: | ||
| 503 | 489 | ||
| 504 | define KMACHINE beaglebone | 490 | define KMACHINE beaglebone |
| 505 | define KTYPE standard | 491 | define KTYPE standard |
| @@ -533,8 +519,7 @@ description file match. | |||
| 533 | 519 | ||
| 534 | To separate your kernel policy from your hardware configuration, you | 520 | To separate your kernel policy from your hardware configuration, you |
| 535 | include a kernel type (``ktype``), such as "standard". In the previous | 521 | include a kernel type (``ktype``), such as "standard". In the previous |
| 536 | example, this is done using the following: | 522 | example, this is done using the following:: |
| 537 | :: | ||
| 538 | 523 | ||
| 539 | include ktypes/standard/standard.scc | 524 | include ktypes/standard/standard.scc |
| 540 | 525 | ||
| @@ -544,13 +529,11 @@ policy. See the ":ref:`kernel-dev/advanced:kernel types`" section for more | |||
| 544 | information. | 529 | information. |
| 545 | 530 | ||
| 546 | To aggregate common configurations and features specific to the kernel | 531 | To aggregate common configurations and features specific to the kernel |
| 547 | for `mybsp`, use the following: | 532 | for `mybsp`, use the following:: |
| 548 | :: | ||
| 549 | 533 | ||
| 550 | include mybsp.scc | 534 | include mybsp.scc |
| 551 | 535 | ||
| 552 | You can see that in the BeagleBone example with the following: | 536 | You can see that in the BeagleBone example with the following:: |
| 553 | :: | ||
| 554 | 537 | ||
| 555 | include beaglebone.scc | 538 | include beaglebone.scc |
| 556 | 539 | ||
| @@ -558,15 +541,13 @@ For information on how to break a complete ``.config`` file into the various | |||
| 558 | configuration fragments, see the ":ref:`kernel-dev/common:creating configuration fragments`" section. | 541 | configuration fragments, see the ":ref:`kernel-dev/common:creating configuration fragments`" section. |
| 559 | 542 | ||
| 560 | Finally, if you have any configurations specific to the hardware that | 543 | Finally, if you have any configurations specific to the hardware that |
| 561 | are not in a ``*.scc`` file, you can include them as follows: | 544 | are not in a ``*.scc`` file, you can include them as follows:: |
| 562 | :: | ||
| 563 | 545 | ||
| 564 | kconf hardware mybsp-extra.cfg | 546 | kconf hardware mybsp-extra.cfg |
| 565 | 547 | ||
| 566 | The BeagleBone example does not include these | 548 | The BeagleBone example does not include these |
| 567 | types of configurations. However, the Malta 32-bit board does | 549 | types of configurations. However, the Malta 32-bit board does |
| 568 | ("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file: | 550 | ("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file:: |
| 569 | :: | ||
| 570 | 551 | ||
| 571 | define KMACHINE mti-malta32-le | 552 | define KMACHINE mti-malta32-le |
| 572 | define KMACHINE qemumipsel | 553 | define KMACHINE qemumipsel |
| @@ -623,8 +604,7 @@ found on the machine. This ``minnow.scc`` description file is then | |||
| 623 | included in each of the three "minnow" description files for the | 604 | included in each of the three "minnow" description files for the |
| 624 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). | 605 | supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). |
| 625 | Consider the "minnow" description for the "standard" kernel type (i.e. | 606 | Consider the "minnow" description for the "standard" kernel type (i.e. |
| 626 | ``minnow-standard.scc``): | 607 | ``minnow-standard.scc``):: |
| 627 | :: | ||
| 628 | 608 | ||
| 629 | define KMACHINE minnow | 609 | define KMACHINE minnow |
| 630 | define KTYPE standard | 610 | define KTYPE standard |
| @@ -656,8 +636,7 @@ that defines all enabled hardware for the BSP that is common to all | |||
| 656 | kernel types. Using this command significantly reduces duplication. | 636 | kernel types. Using this command significantly reduces duplication. |
| 657 | 637 | ||
| 658 | Now consider the "minnow" description for the "tiny" kernel type (i.e. | 638 | Now consider the "minnow" description for the "tiny" kernel type (i.e. |
| 659 | ``minnow-tiny.scc``): | 639 | ``minnow-tiny.scc``):: |
| 660 | :: | ||
| 661 | 640 | ||
| 662 | define KMACHINE minnow | 641 | define KMACHINE minnow |
| 663 | define KTYPE tiny | 642 | define KTYPE tiny |
| @@ -720,8 +699,7 @@ See the ":ref:`kernel-dev/common:modifying an existing recipe`" | |||
| 720 | section for more information. | 699 | section for more information. |
| 721 | 700 | ||
| 722 | Here is an example that shows a trivial tree of kernel Metadata stored | 701 | Here is an example that shows a trivial tree of kernel Metadata stored |
| 723 | in recipe-space within a BSP layer: | 702 | in recipe-space within a BSP layer:: |
| 724 | :: | ||
| 725 | 703 | ||
| 726 | meta-my_bsp_layer/ | 704 | meta-my_bsp_layer/ |
| 727 | `-- recipes-kernel | 705 | `-- recipes-kernel |
| @@ -744,8 +722,7 @@ value when changing the content of files not explicitly listed in the | |||
| 744 | 722 | ||
| 745 | If the BSP description is in recipe space, you cannot simply list the | 723 | If the BSP description is in recipe space, you cannot simply list the |
| 746 | ``*.scc`` in the ``SRC_URI`` statement. You need to use the following | 724 | ``*.scc`` in the ``SRC_URI`` statement. You need to use the following |
| 747 | form from your kernel append file: | 725 | form from your kernel append file:: |
| 748 | :: | ||
| 749 | 726 | ||
| 750 | SRC_URI_append_myplatform = " \ | 727 | SRC_URI_append_myplatform = " \ |
| 751 | file://myplatform;type=kmeta;destsuffix=myplatform \ | 728 | file://myplatform;type=kmeta;destsuffix=myplatform \ |
| @@ -759,8 +736,7 @@ reside in a separate repository. The OpenEmbedded build system adds the | |||
| 759 | Metadata to the build as a "type=kmeta" repository through the | 736 | Metadata to the build as a "type=kmeta" repository through the |
| 760 | :term:`SRC_URI` variable. As an | 737 | :term:`SRC_URI` variable. As an |
| 761 | example, consider the following ``SRC_URI`` statement from the | 738 | example, consider the following ``SRC_URI`` statement from the |
| 762 | ``linux-yocto_4.12.bb`` kernel recipe: | 739 | ``linux-yocto_4.12.bb`` kernel recipe:: |
| 763 | :: | ||
| 764 | 740 | ||
| 765 | SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.12.git;name=machine;branch=${KBRANCH}; \ | 741 | SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.12.git;name=machine;branch=${KBRANCH}; \ |
| 766 | git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | 742 | git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" |
| @@ -844,14 +820,12 @@ patches into a feature. | |||
| 844 | 820 | ||
| 845 | Once you have a new branch, you can set up your kernel Metadata to use | 821 | Once you have a new branch, you can set up your kernel Metadata to use |
| 846 | the branch a couple different ways. In the recipe, you can specify the | 822 | the branch a couple different ways. In the recipe, you can specify the |
| 847 | new branch as the ``KBRANCH`` to use for the board as follows: | 823 | new branch as the ``KBRANCH`` to use for the board as follows:: |
| 848 | :: | ||
| 849 | 824 | ||
| 850 | KBRANCH = "mynewbranch" | 825 | KBRANCH = "mynewbranch" |
| 851 | 826 | ||
| 852 | Another method is to use the ``branch`` command in the BSP | 827 | Another method is to use the ``branch`` command in the BSP |
| 853 | description: | 828 | description:: |
| 854 | :: | ||
| 855 | 829 | ||
| 856 | mybsp.scc: | 830 | mybsp.scc: |
| 857 | define KMACHINE mybsp | 831 | define KMACHINE mybsp |
| @@ -865,15 +839,13 @@ description: | |||
| 865 | 839 | ||
| 866 | If you find yourself with numerous branches, you might consider using a | 840 | If you find yourself with numerous branches, you might consider using a |
| 867 | hierarchical branching system similar to what the Yocto Linux Kernel Git | 841 | hierarchical branching system similar to what the Yocto Linux Kernel Git |
| 868 | repositories use: | 842 | repositories use:: |
| 869 | :: | ||
| 870 | 843 | ||
| 871 | common/kernel_type/machine | 844 | common/kernel_type/machine |
| 872 | 845 | ||
| 873 | If you had two kernel types, "standard" and "small" for instance, three | 846 | If you had two kernel types, "standard" and "small" for instance, three |
| 874 | machines, and common as ``mydir``, the branches in your Git repository | 847 | machines, and common as ``mydir``, the branches in your Git repository |
| 875 | might look like this: | 848 | might look like this:: |
| 876 | :: | ||
| 877 | 849 | ||
| 878 | mydir/base | 850 | mydir/base |
| 879 | mydir/standard/base | 851 | mydir/standard/base |
| @@ -905,8 +877,7 @@ that have to be regularly updated. The Yocto Project Linux kernel tools | |||
| 905 | provide for this with the ``git merge`` command. | 877 | provide for this with the ``git merge`` command. |
| 906 | 878 | ||
| 907 | To merge a feature branch into a BSP, insert the ``git merge`` command | 879 | To merge a feature branch into a BSP, insert the ``git merge`` command |
| 908 | after any ``branch`` commands: | 880 | after any ``branch`` commands:: |
| 909 | :: | ||
| 910 | 881 | ||
| 911 | mybsp.scc: | 882 | mybsp.scc: |
| 912 | define KMACHINE mybsp | 883 | define KMACHINE mybsp |
