summaryrefslogtreecommitdiffstats
path: root/documentation/kernel-dev/advanced.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/kernel-dev/advanced.rst')
-rw-r--r--documentation/kernel-dev/advanced.rst87
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
106variable to include features (configuration fragments, patches, or both) 105variable to include features (configuration fragments, patches, or both)
107that are not already included by the ``KMACHINE`` and 106that 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
109feature specified as "features/netfilter/netfilter.scc", specify: 108feature 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
114To include a 112To include a
115feature called "cfg/sound.scc" just for the ``qemux86`` machine, 113feature called "cfg/sound.scc" just for the ``qemux86`` machine,
116specify: 114specify::
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.
157While the kernel Metadata syntax does not enforce any logical separation 154While the kernel Metadata syntax does not enforce any logical separation
158of configuration fragments, patches, features or kernel types, best 155of configuration fragments, patches, features or kernel types, best
159practices dictate a logical separation of these types of Metadata. The 156practices dictate a logical separation of these types of Metadata. The
160following Metadata file hierarchy is recommended: 157following 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
222recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of 218recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of
223two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the 219two 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
266As described in the 261As described in the
267":ref:`kernel-dev/common:validating configuration`" section, you can 262":ref:`kernel-dev/common:validating configuration`" section, you can
268use the following BitBake command to audit your configuration: 263use 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
289The following listings show the ``build.scc`` file and part of the 283The 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
335Features are complex kernel Metadata types that consist of configuration 328Features are complex kernel Metadata types that consist of configuration
336fragments, patches, and possibly other feature description files. As an 329fragments, patches, and possibly other feature description files. As an
337example, consider the following generic listing: 330example, 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
373includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file, 365includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file,
374which has the following statement that defines the default kernel type: 366which 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
379Another example would be the real-time kernel (i.e. 370Another 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
381type as follows: 372type 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:
412For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. 402For 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``
414file, which is found in the ``ktypes/standard`` directory of the 404file, 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
482For simplicity, consider the following root BSP layer description files 471For simplicity, consider the following root BSP layer description files
483for the BeagleBone board. These files employ both a structure and naming 472for the BeagleBone board. These files employ both a structure and naming
484convention for consistency. The naming convention for the file is as 473convention for consistency. The naming convention for the file is as
485follows: 474follows::
486::
487 475
488 bsp_root_name-kernel_type.scc 476 bsp_root_name-kernel_type.scc
489 477
490Here are some example root layer 478Here are some example root layer
491BSP filenames for the BeagleBone Board BSP, which is supported by the 479BSP filenames for the BeagleBone Board BSP, which is supported by the
492Yocto Project: 480Yocto 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:
498Each file uses the root name (i.e "beaglebone") BSP name followed by the 485Each file uses the root name (i.e "beaglebone") BSP name followed by the
499kernel type. 486kernel type.
500 487
501Examine the ``beaglebone-standard.scc`` file: 488Examine 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
534To separate your kernel policy from your hardware configuration, you 520To separate your kernel policy from your hardware configuration, you
535include a kernel type (``ktype``), such as "standard". In the previous 521include a kernel type (``ktype``), such as "standard". In the previous
536example, this is done using the following: 522example, 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
544information. 529information.
545 530
546To aggregate common configurations and features specific to the kernel 531To aggregate common configurations and features specific to the kernel
547for `mybsp`, use the following: 532for `mybsp`, use the following::
548::
549 533
550 include mybsp.scc 534 include mybsp.scc
551 535
552You can see that in the BeagleBone example with the following: 536You 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
558configuration fragments, see the ":ref:`kernel-dev/common:creating configuration fragments`" section. 541configuration fragments, see the ":ref:`kernel-dev/common:creating configuration fragments`" section.
559 542
560Finally, if you have any configurations specific to the hardware that 543Finally, if you have any configurations specific to the hardware that
561are not in a ``*.scc`` file, you can include them as follows: 544are 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
566The BeagleBone example does not include these 548The BeagleBone example does not include these
567types of configurations. However, the Malta 32-bit board does 549types 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
623included in each of the three "minnow" description files for the 604included in each of the three "minnow" description files for the
624supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). 605supported kernel types (i.e. "standard", "preempt-rt", and "tiny").
625Consider the "minnow" description for the "standard" kernel type (i.e. 606Consider 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
656kernel types. Using this command significantly reduces duplication. 636kernel types. Using this command significantly reduces duplication.
657 637
658Now consider the "minnow" description for the "tiny" kernel type (i.e. 638Now 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`"
720section for more information. 699section for more information.
721 700
722Here is an example that shows a trivial tree of kernel Metadata stored 701Here is an example that shows a trivial tree of kernel Metadata stored
723in recipe-space within a BSP layer: 702in 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
745If the BSP description is in recipe space, you cannot simply list the 723If 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
747form from your kernel append file: 725form 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
759Metadata to the build as a "type=kmeta" repository through the 736Metadata to the build as a "type=kmeta" repository through the
760:term:`SRC_URI` variable. As an 737:term:`SRC_URI` variable. As an
761example, consider the following ``SRC_URI`` statement from the 738example, 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
845Once you have a new branch, you can set up your kernel Metadata to use 821Once you have a new branch, you can set up your kernel Metadata to use
846the branch a couple different ways. In the recipe, you can specify the 822the branch a couple different ways. In the recipe, you can specify the
847new branch as the ``KBRANCH`` to use for the board as follows: 823new branch as the ``KBRANCH`` to use for the board as follows::
848::
849 824
850 KBRANCH = "mynewbranch" 825 KBRANCH = "mynewbranch"
851 826
852Another method is to use the ``branch`` command in the BSP 827Another method is to use the ``branch`` command in the BSP
853description: 828description::
854::
855 829
856 mybsp.scc: 830 mybsp.scc:
857 define KMACHINE mybsp 831 define KMACHINE mybsp
@@ -865,15 +839,13 @@ description:
865 839
866If you find yourself with numerous branches, you might consider using a 840If you find yourself with numerous branches, you might consider using a
867hierarchical branching system similar to what the Yocto Linux Kernel Git 841hierarchical branching system similar to what the Yocto Linux Kernel Git
868repositories use: 842repositories use::
869::
870 843
871 common/kernel_type/machine 844 common/kernel_type/machine
872 845
873If you had two kernel types, "standard" and "small" for instance, three 846If you had two kernel types, "standard" and "small" for instance, three
874machines, and common as ``mydir``, the branches in your Git repository 847machines, and common as ``mydir``, the branches in your Git repository
875might look like this: 848might 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
905provide for this with the ``git merge`` command. 877provide for this with the ``git merge`` command.
906 878
907To merge a feature branch into a BSP, insert the ``git merge`` command 879To merge a feature branch into a BSP, insert the ``git merge`` command
908after any ``branch`` commands: 880after any ``branch`` commands::
909::
910 881
911 mybsp.scc: 882 mybsp.scc:
912 define KMACHINE mybsp 883 define KMACHINE mybsp