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.rst259
1 files changed, 111 insertions, 148 deletions
diff --git a/documentation/kernel-dev/advanced.rst b/documentation/kernel-dev/advanced.rst
index dd0b76bc31..4c463503f6 100644
--- a/documentation/kernel-dev/advanced.rst
+++ b/documentation/kernel-dev/advanced.rst
@@ -21,7 +21,7 @@ is the ``yocto-kernel-cache`` Git repository. You can find this repository
21grouped under the "Yocto Linux Kernel" heading in the 21grouped under the "Yocto Linux Kernel" heading in the
22:yocto_git:`Yocto Project Source Repositories <>`. 22:yocto_git:`Yocto Project Source Repositories <>`.
23 23
24Kernel development tools ("kern-tools") exist also in the Yocto Project 24Kernel development tools ("kern-tools") are also available in the Yocto Project
25Source Repositories under the "Yocto Linux Kernel" heading in the 25Source Repositories under the "Yocto Linux Kernel" heading in the
26``yocto-kernel-tools`` Git repository. The recipe that builds these 26``yocto-kernel-tools`` Git repository. The recipe that builds these
27tools is ``meta/recipes-kernel/kern-tools/kern-tools-native_git.bb`` in 27tools is ``meta/recipes-kernel/kern-tools/kern-tools-native_git.bb`` in
@@ -46,18 +46,18 @@ linux-yocto recipe.
46 46
47Every linux-yocto style recipe must define the 47Every linux-yocto style recipe must define the
48:term:`KMACHINE` variable. This 48:term:`KMACHINE` variable. This
49variable is typically set to the same value as the ``MACHINE`` variable, 49variable is typically set to the same value as the :term:`MACHINE` variable,
50which is used by :term:`BitBake`. 50which is used by :term:`BitBake`.
51However, in some cases, the variable might instead refer to the 51However, in some cases, the variable might instead refer to the
52underlying platform of the ``MACHINE``. 52underlying platform of the :term:`MACHINE`.
53 53
54Multiple BSPs can reuse the same ``KMACHINE`` name if they are built 54Multiple BSPs can reuse the same :term:`KMACHINE` name if they are built
55using the same BSP description. Multiple Corei7-based BSPs could share 55using the same BSP description. Multiple Corei7-based BSPs could share
56the same "intel-corei7-64" value for ``KMACHINE``. It is important to 56the same "intel-corei7-64" value for :term:`KMACHINE`. It is important to
57realize that ``KMACHINE`` is just for kernel mapping, while ``MACHINE`` 57realize that :term:`KMACHINE` is just for kernel mapping, while :term:`MACHINE`
58is the machine type within a BSP Layer. Even with this distinction, 58is the machine type within a BSP Layer. Even with this distinction,
59however, these two variables can hold the same value. See the `BSP 59however, these two variables can hold the same value. See the
60Descriptions <#bsp-descriptions>`__ section for more information. 60":ref:`kernel-dev/advanced:bsp descriptions`" section for more information.
61 61
62Every linux-yocto style recipe must also indicate the Linux kernel 62Every linux-yocto style recipe must also indicate the Linux kernel
63source repository branch used to build the Linux kernel. The 63source repository branch used to build the Linux kernel. The
@@ -66,12 +66,10 @@ to indicate the branch.
66 66
67.. note:: 67.. note::
68 68
69 You can use the ``KBRANCH`` value to define an alternate branch typically 69 You can use the :term:`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
73 KBRANCH_edgerouter = "standard/edgerouter"
74 71
72 KBRANCH:beaglebone-yocto = "standard/beaglebone"
75 73
76The linux-yocto style recipes can optionally define the following 74The linux-yocto style recipes can optionally define the following
77variables: 75variables:
@@ -82,49 +80,47 @@ variables:
82 80
83:term:`LINUX_KERNEL_TYPE` 81:term:`LINUX_KERNEL_TYPE`
84defines the kernel type to be used in assembling the configuration. If 82defines the kernel type to be used in assembling the configuration. If
85you do not specify a ``LINUX_KERNEL_TYPE``, it defaults to "standard". 83you do not specify a :term:`LINUX_KERNEL_TYPE`, it defaults to "standard".
86Together with ``KMACHINE``, ``LINUX_KERNEL_TYPE`` defines the search 84Together with :term:`KMACHINE`, :term:`LINUX_KERNEL_TYPE` defines the search
87arguments used by the kernel tools to find the appropriate description 85arguments used by the kernel tools to find the appropriate description
88within the kernel Metadata with which to build out the sources and 86within the kernel Metadata with which to build out the sources and
89configuration. The linux-yocto recipes define "standard", "tiny", and 87configuration. The linux-yocto recipes define "standard", "tiny", and
90"preempt-rt" kernel types. See the "`Kernel Types <#kernel-types>`__" 88"preempt-rt" kernel types. See the ":ref:`kernel-dev/advanced:kernel types`"
91section for more information on kernel types. 89section for more information on kernel types.
92 90
93During the build, the kern-tools search for the BSP description file 91During the build, the kern-tools search for the BSP description file
94that most closely matches the ``KMACHINE`` and ``LINUX_KERNEL_TYPE`` 92that most closely matches the :term:`KMACHINE` and :term:`LINUX_KERNEL_TYPE`
95variables passed in from the recipe. The tools use the first BSP 93variables passed in from the recipe. The tools use the first BSP
96description they find that matches both variables. If the tools cannot find 94description they find that matches both variables. If the tools cannot find
97a match, they issue a warning. 95a match, they issue a warning.
98 96
99The tools first search for the ``KMACHINE`` and then for the 97The tools first search for the :term:`KMACHINE` and then for the
100``LINUX_KERNEL_TYPE``. If the tools cannot find a partial match, they 98:term:`LINUX_KERNEL_TYPE`. If the tools cannot find a partial match, they
101will use the sources from the ``KBRANCH`` and any configuration 99will use the sources from the :term:`KBRANCH` and any configuration
102specified in the :term:`SRC_URI`. 100specified in the :term:`SRC_URI`.
103 101
104You can use the 102You can use the
105:term:`KERNEL_FEATURES` 103:term:`KERNEL_FEATURES`
106variable to include features (configuration fragments, patches, or both) 104variable to include features (configuration fragments, patches, or both)
107that are not already included by the ``KMACHINE`` and 105that are not already included by the :term:`KMACHINE` and
108``LINUX_KERNEL_TYPE`` variable combination. For example, to include a 106:term:`LINUX_KERNEL_TYPE` variable combination. For example, to include a
109feature specified as "features/netfilter/netfilter.scc", specify: 107feature specified as "features/netfilter/netfilter.scc", specify::
110::
111 108
112 KERNEL_FEATURES += "features/netfilter/netfilter.scc" 109 KERNEL_FEATURES += "features/netfilter/netfilter.scc"
113 110
114To include a 111To include a
115feature called "cfg/sound.scc" just for the ``qemux86`` machine, 112feature called "cfg/sound.scc" just for the ``qemux86`` machine,
116specify: 113specify::
117::
118 114
119 KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc" 115 KERNEL_FEATURES:append:qemux86 = " cfg/sound.scc"
120 116
121The value of 117The value of
122the entries in ``KERNEL_FEATURES`` are dependent on their location 118the entries in :term:`KERNEL_FEATURES` are dependent on their location
123within the kernel Metadata itself. The examples here are taken from the 119within the kernel Metadata itself. The examples here are taken from the
124``yocto-kernel-cache`` repository. Each branch of this repository 120``yocto-kernel-cache`` repository. Each branch of this repository
125contains "features" and "cfg" subdirectories at the top-level. For more 121contains "features" and "cfg" subdirectories at the top-level. For more
126information, see the "`Kernel Metadata 122information, see the ":ref:`kernel-dev/advanced:kernel metadata syntax`"
127Syntax <#kernel-metadata-syntax>`__" section. 123section.
128 124
129Kernel Metadata Syntax 125Kernel Metadata Syntax
130====================== 126======================
@@ -148,7 +144,7 @@ Features aggregate sources in the form of patches and configuration
148fragments into a modular reusable unit. You can use features to 144fragments into a modular reusable unit. You can use features to
149implement conceptually separate kernel Metadata descriptions such as 145implement conceptually separate kernel Metadata descriptions such as
150pure configuration fragments, simple patches, complex features, and 146pure configuration fragments, simple patches, complex features, and
151kernel types. `Kernel types <#kernel-types>`__ define general kernel 147kernel types. :ref:`kernel-dev/advanced:kernel types` define general kernel
152features and policy to be reused in the BSPs. 148features and policy to be reused in the BSPs.
153 149
154BSPs define hardware-specific features and aggregate them with kernel 150BSPs define hardware-specific features and aggregate them with kernel
@@ -157,8 +153,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 153While the kernel Metadata syntax does not enforce any logical separation
158of configuration fragments, patches, features or kernel types, best 154of configuration fragments, patches, features or kernel types, best
159practices dictate a logical separation of these types of Metadata. The 155practices dictate a logical separation of these types of Metadata. The
160following Metadata file hierarchy is recommended: 156following Metadata file hierarchy is recommended::
161::
162 157
163 base/ 158 base/
164 bsp/ 159 bsp/
@@ -167,10 +162,9 @@ following Metadata file hierarchy is recommended:
167 ktypes/ 162 ktypes/
168 patches/ 163 patches/
169 164
170The ``bsp`` directory contains the `BSP 165The ``bsp`` directory contains the :ref:`kernel-dev/advanced:bsp descriptions`.
171descriptions <#bsp-descriptions>`__. The remaining directories all 166The remaining directories all contain "features". Separating ``bsp`` from the
172contain "features". Separating ``bsp`` from the rest of the structure 167rest of the structure aids conceptualizing intended usage.
173aids conceptualizing intended usage.
174 168
175Use these guidelines to help place your ``scc`` description files within 169Use these guidelines to help place your ``scc`` description files within
176the structure: 170the structure:
@@ -188,7 +182,7 @@ the structure:
188 order to define a base kernel policy or major kernel type to be 182 order to define a base kernel policy or major kernel type to be
189 reused across multiple BSPs, place the file in ``ktypes`` directory. 183 reused across multiple BSPs, place the file in ``ktypes`` directory.
190 184
191These distinctions can easily become blurred - especially as out-of-tree 185These distinctions can easily become blurred --- especially as out-of-tree
192features slowly merge upstream over time. Also, remember that how the 186features slowly merge upstream over time. Also, remember that how the
193description files are placed is a purely logical organization and has no 187description files are placed is a purely logical organization and has no
194impact on the functionality of the kernel Metadata. There is no impact 188impact on the functionality of the kernel Metadata. There is no impact
@@ -198,11 +192,12 @@ contain "features" as far as the kernel tools are concerned.
198Paths used in kernel Metadata files are relative to base, which is 192Paths used in kernel Metadata files are relative to base, which is
199either 193either
200:term:`FILESEXTRAPATHS` if 194:term:`FILESEXTRAPATHS` if
201you are creating Metadata in `recipe-space <#recipe-space-metadata>`__, 195you are creating Metadata in
196:ref:`recipe-space <kernel-dev/advanced:recipe-space metadata>`,
202or the top level of 197or the top level of
203:yocto_git:`yocto-kernel-cache </yocto-kernel-cache/tree/>` 198:yocto_git:`yocto-kernel-cache </yocto-kernel-cache/tree/>`
204if you are creating `Metadata outside of the 199if you are creating
205recipe-space <#metadata-outside-the-recipe-space>`__. 200:ref:`kernel-dev/advanced:metadata outside the recipe-space`.
206 201
207.. [1] 202.. [1]
208 ``scc`` stands for Series Configuration Control, but the naming has 203 ``scc`` stands for Series Configuration Control, but the naming has
@@ -222,8 +217,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 217recipe space (i.e. ``yocto-kernel-cache``). This Metadata consists of
223two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the 218two files: ``smp.scc`` and ``smp.cfg``. You can find these files in the
224``cfg`` directory of the ``yocto-4.12`` branch in the 219``cfg`` directory of the ``yocto-4.12`` branch in the
225``yocto-kernel-cache`` Git repository: 220``yocto-kernel-cache`` Git repository::
226::
227 221
228 cfg/smp.scc: 222 cfg/smp.scc:
229 define KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds" 223 define KFEATURE_DESCRIPTION "Enable SMP for 32 bit builds"
@@ -265,8 +259,7 @@ non-hardware fragment.
265 259
266As described in the 260As described in the
267":ref:`kernel-dev/common:validating configuration`" section, you can 261":ref:`kernel-dev/common:validating configuration`" section, you can
268use the following BitBake command to audit your configuration: 262use the following BitBake command to audit your configuration::
269::
270 263
271 $ bitbake linux-yocto -c kernel_configcheck -f 264 $ bitbake linux-yocto -c kernel_configcheck -f
272 265
@@ -287,8 +280,7 @@ in the ``patches/build`` directory of the ``yocto-4.12`` branch in the
287``yocto-kernel-cache`` Git repository. 280``yocto-kernel-cache`` Git repository.
288 281
289The following listings show the ``build.scc`` file and part of the 282The following listings show the ``build.scc`` file and part of the
290``modpost-mask-trivial-warnings.patch`` file: 283``modpost-mask-trivial-warnings.patch`` file::
291::
292 284
293 patches/build/build.scc: 285 patches/build/build.scc:
294 patch arm-serialize-build-targets.patch 286 patch arm-serialize-build-targets.patch
@@ -311,8 +303,8 @@ The following listings show the ``build.scc`` file and part of the
311 . 303 .
312 . 304 .
313 . 305 .
314 char *dump_write = NULL, *files_source = NULL; 306 char *dump_write = NULL, *files_source = NULL;
315 int opt; 307 int opt;
316 -- 308 --
317 2.10.1 309 2.10.1
318 310
@@ -320,7 +312,7 @@ The following listings show the ``build.scc`` file and part of the
320 312
321The description file can 313The description file can
322include multiple patch statements where each statement handles a single 314include multiple patch statements where each statement handles a single
323patch. In the example ``build.scc`` file, five patch statements exist 315patch. In the example ``build.scc`` file, there are five patch statements
324for the five patches in the directory. 316for the five patches in the directory.
325 317
326You can create a typical ``.patch`` file using ``diff -Nurp`` or 318You can create a typical ``.patch`` file using ``diff -Nurp`` or
@@ -334,8 +326,7 @@ Features
334 326
335Features are complex kernel Metadata types that consist of configuration 327Features are complex kernel Metadata types that consist of configuration
336fragments, patches, and possibly other feature description files. As an 328fragments, patches, and possibly other feature description files. As an
337example, consider the following generic listing: 329example, consider the following generic listing::
338::
339 330
340 features/myfeature.scc 331 features/myfeature.scc
341 define KFEATURE_DESCRIPTION "Enable myfeature" 332 define KFEATURE_DESCRIPTION "Enable myfeature"
@@ -352,34 +343,30 @@ as how an additional feature description file is included with the
352 343
353Typically, features are less granular than configuration fragments and 344Typically, features are less granular than configuration fragments and
354are more likely than configuration fragments and patches to be the types 345are more likely than configuration fragments and patches to be the types
355of things you want to specify in the ``KERNEL_FEATURES`` variable of the 346of things you want to specify in the :term:`KERNEL_FEATURES` variable of the
356Linux kernel recipe. See the "`Using Kernel Metadata in a 347Linux kernel recipe. See the
357Recipe <#using-kernel-metadata-in-a-recipe>`__" section earlier in the 348":ref:`kernel-dev/advanced:using kernel metadata in a recipe`" section earlier
358manual. 349in the manual.
359 350
360Kernel Types 351Kernel Types
361------------ 352------------
362 353
363A kernel type defines a high-level kernel policy by aggregating 354A kernel type defines a high-level kernel policy by aggregating non-hardware
364non-hardware configuration fragments with patches you want to use when 355configuration fragments with patches you want to use when building a Linux
365building a Linux kernel of a specific type (e.g. a real-time kernel). 356kernel of a specific type (e.g. a real-time kernel). Syntactically, kernel
366Syntactically, kernel types are no different than features as described 357types are no different than features as described in the
367in the "`Features <#features>`__" section. The 358":ref:`kernel-dev/advanced:features`" section. The :term:`LINUX_KERNEL_TYPE`
368:term:`LINUX_KERNEL_TYPE` 359variable in the kernel recipe selects the kernel type. For example, in the
369variable in the kernel recipe selects the kernel type. For example, in 360``linux-yocto_4.12.bb`` kernel recipe found in ``poky/meta/recipes-kernel/linux``, a
370the ``linux-yocto_4.12.bb`` kernel recipe found in 361:ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>`
371``poky/meta/recipes-kernel/linux``, a 362directive includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file,
372:ref:`require <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` directive 363which has the following statement that defines the default kernel type::
373includes the ``poky/meta/recipes-kernel/linux/linux-yocto.inc`` file,
374which has the following statement that defines the default kernel type:
375::
376 364
377 LINUX_KERNEL_TYPE ??= "standard" 365 LINUX_KERNEL_TYPE ??= "standard"
378 366
379Another example would be the real-time kernel (i.e. 367Another example would be the real-time kernel (i.e.
380``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel 368``linux-yocto-rt_4.12.bb``). This kernel recipe directly sets the kernel
381type as follows: 369type as follows::
382::
383 370
384 LINUX_KERNEL_TYPE = "preempt-rt" 371 LINUX_KERNEL_TYPE = "preempt-rt"
385 372
@@ -412,8 +399,7 @@ for Linux Yocto kernels:
412For any given kernel type, the Metadata is defined by the ``.scc`` (e.g. 399For 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`` 400``standard.scc``). Here is a partial listing for the ``standard.scc``
414file, which is found in the ``ktypes/standard`` directory of the 401file, which is found in the ``ktypes/standard`` directory of the
415``yocto-kernel-cache`` Git repository: 402``yocto-kernel-cache`` Git repository::
416::
417 403
418 # Include this kernel type fragment to get the standard features and 404 # Include this kernel type fragment to get the standard features and
419 # configuration values. 405 # configuration values.
@@ -482,15 +468,13 @@ Description Overview
482For simplicity, consider the following root BSP layer description files 468For simplicity, consider the following root BSP layer description files
483for the BeagleBone board. These files employ both a structure and naming 469for the BeagleBone board. These files employ both a structure and naming
484convention for consistency. The naming convention for the file is as 470convention for consistency. The naming convention for the file is as
485follows: 471follows::
486::
487 472
488 bsp_root_name-kernel_type.scc 473 bsp_root_name-kernel_type.scc
489 474
490Here are some example root layer 475Here are some example root layer
491BSP filenames for the BeagleBone Board BSP, which is supported by the 476BSP filenames for the BeagleBone Board BSP, which is supported by the
492Yocto Project: 477Yocto Project::
493::
494 478
495 beaglebone-standard.scc 479 beaglebone-standard.scc
496 beaglebone-preempt-rt.scc 480 beaglebone-preempt-rt.scc
@@ -498,8 +482,7 @@ Yocto Project:
498Each file uses the root name (i.e "beaglebone") BSP name followed by the 482Each file uses the root name (i.e "beaglebone") BSP name followed by the
499kernel type. 483kernel type.
500 484
501Examine the ``beaglebone-standard.scc`` file: 485Examine the ``beaglebone-standard.scc`` file::
502::
503 486
504 define KMACHINE beaglebone 487 define KMACHINE beaglebone
505 define KTYPE standard 488 define KTYPE standard
@@ -523,34 +506,31 @@ description as meeting the criteria set by the recipe being built. This
523example supports the "beaglebone" machine for the "standard" kernel and 506example supports the "beaglebone" machine for the "standard" kernel and
524the "arm" architecture. 507the "arm" architecture.
525 508
526Be aware that a hard link between the ``KTYPE`` variable and a kernel 509Be aware that there is no hard link between the :term:`KTYPE` variable and a kernel
527type description file does not exist. Thus, if you do not have the 510type description file. Thus, if you do not have the
528kernel type defined in your kernel Metadata as it is here, you only need 511kernel type defined in your kernel Metadata as it is here, you only need
529to ensure that the 512to ensure that the
530:term:`LINUX_KERNEL_TYPE` 513:term:`LINUX_KERNEL_TYPE`
531variable in the kernel recipe and the ``KTYPE`` variable in the BSP 514variable in the kernel recipe and the :term:`KTYPE` variable in the BSP
532description file match. 515description file match.
533 516
534To separate your kernel policy from your hardware configuration, you 517To separate your kernel policy from your hardware configuration, you
535include a kernel type (``ktype``), such as "standard". In the previous 518include a kernel type (``ktype``), such as "standard". In the previous
536example, this is done using the following: 519example, this is done using the following::
537::
538 520
539 include ktypes/standard/standard.scc 521 include ktypes/standard/standard.scc
540 522
541This file aggregates all the configuration 523This file aggregates all the configuration
542fragments, patches, and features that make up your standard kernel 524fragments, patches, and features that make up your standard kernel
543policy. See the "`Kernel Types <#kernel-types>`__" section for more 525policy. See the ":ref:`kernel-dev/advanced:kernel types`" section for more
544information. 526information.
545 527
546To aggregate common configurations and features specific to the kernel 528To aggregate common configurations and features specific to the kernel
547for `mybsp`, use the following: 529for `mybsp`, use the following::
548::
549 530
550 include mybsp.scc 531 include mybsp.scc
551 532
552You can see that in the BeagleBone example with the following: 533You can see that in the BeagleBone example with the following::
553::
554 534
555 include beaglebone.scc 535 include beaglebone.scc
556 536
@@ -558,15 +538,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. 538configuration fragments, see the ":ref:`kernel-dev/common:creating configuration fragments`" section.
559 539
560Finally, if you have any configurations specific to the hardware that 540Finally, if you have any configurations specific to the hardware that
561are not in a ``*.scc`` file, you can include them as follows: 541are not in a ``*.scc`` file, you can include them as follows::
562::
563 542
564 kconf hardware mybsp-extra.cfg 543 kconf hardware mybsp-extra.cfg
565 544
566The BeagleBone example does not include these 545The BeagleBone example does not include these
567types of configurations. However, the Malta 32-bit board does 546types of configurations. However, the Malta 32-bit board does
568("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file: 547("mti-malta32"). Here is the ``mti-malta32-le-standard.scc`` file::
569::
570 548
571 define KMACHINE mti-malta32-le 549 define KMACHINE mti-malta32-le
572 define KMACHINE qemumipsel 550 define KMACHINE qemumipsel
@@ -585,15 +563,7 @@ Example
585Many real-world examples are more complex. Like any other ``.scc`` file, 563Many real-world examples are more complex. Like any other ``.scc`` file,
586BSP descriptions can aggregate features. Consider the Minnow BSP 564BSP descriptions can aggregate features. Consider the Minnow BSP
587definition given the ``linux-yocto-4.4`` branch of the 565definition given the ``linux-yocto-4.4`` branch of the
588``yocto-kernel-cache`` (i.e. 566``yocto-kernel-cache`` (i.e. ``yocto-kernel-cache/bsp/minnow/minnow.scc``)::
589``yocto-kernel-cache/bsp/minnow/minnow.scc``):
590
591.. note::
592
593 Although the Minnow Board BSP is unused, the Metadata remains and is
594 being used here just as an example.
595
596::
597 567
598 include cfg/x86.scc 568 include cfg/x86.scc
599 include features/eg20t/eg20t.scc 569 include features/eg20t/eg20t.scc
@@ -616,6 +586,11 @@ definition given the ``linux-yocto-4.4`` branch of the
616 kconf hardware minnow.cfg 586 kconf hardware minnow.cfg
617 kconf hardware minnow-dev.cfg 587 kconf hardware minnow-dev.cfg
618 588
589.. note::
590
591 Although the Minnow Board BSP is unused, the Metadata remains and is
592 being used here just as an example.
593
619The ``minnow.scc`` description file includes a hardware configuration 594The ``minnow.scc`` description file includes a hardware configuration
620fragment (``minnow.cfg``) specific to the Minnow BSP as well as several 595fragment (``minnow.cfg``) specific to the Minnow BSP as well as several
621more general configuration fragments and features enabling hardware 596more general configuration fragments and features enabling hardware
@@ -623,8 +598,7 @@ found on the machine. This ``minnow.scc`` description file is then
623included in each of the three "minnow" description files for the 598included in each of the three "minnow" description files for the
624supported kernel types (i.e. "standard", "preempt-rt", and "tiny"). 599supported kernel types (i.e. "standard", "preempt-rt", and "tiny").
625Consider the "minnow" description for the "standard" kernel type (i.e. 600Consider the "minnow" description for the "standard" kernel type (i.e.
626``minnow-standard.scc``): 601``minnow-standard.scc``)::
627::
628 602
629 define KMACHINE minnow 603 define KMACHINE minnow
630 define KTYPE standard 604 define KTYPE standard
@@ -656,8 +630,7 @@ that defines all enabled hardware for the BSP that is common to all
656kernel types. Using this command significantly reduces duplication. 630kernel types. Using this command significantly reduces duplication.
657 631
658Now consider the "minnow" description for the "tiny" kernel type (i.e. 632Now consider the "minnow" description for the "tiny" kernel type (i.e.
659``minnow-tiny.scc``): 633``minnow-tiny.scc``)::
660::
661 634
662 define KMACHINE minnow 635 define KMACHINE minnow
663 define KTYPE tiny 636 define KTYPE tiny
@@ -678,7 +651,7 @@ Notice again the three critical variables:
678:term:`KMACHINE`, 651:term:`KMACHINE`,
679:term:`KTYPE`, and 652:term:`KTYPE`, and
680:term:`KARCH`. Of these variables, only 653:term:`KARCH`. Of these variables, only
681``KTYPE`` has changed to specify the "tiny" kernel type. 654:term:`KTYPE` has changed to specify the "tiny" kernel type.
682 655
683Kernel Metadata Location 656Kernel Metadata Location
684======================== 657========================
@@ -709,19 +682,17 @@ Recipe-Space Metadata
709--------------------- 682---------------------
710 683
711When stored in recipe-space, the kernel Metadata files reside in a 684When stored in recipe-space, the kernel Metadata files reside in a
712directory hierarchy below 685directory hierarchy below :term:`FILESEXTRAPATHS`. For
713:term:`FILESEXTRAPATHS`. For 686a linux-yocto recipe or for a Linux kernel recipe derived by copying
714a linux-yocto recipe or for a Linux kernel recipe derived by copying and 687:oe_git:`meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb
715modifying 688</openembedded-core/tree/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb>`
716``oe-core/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb`` to 689into your layer and modifying it, :term:`FILESEXTRAPATHS` is typically set to
717a recipe in your layer, ``FILESEXTRAPATHS`` is typically set to
718``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``. 690``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``.
719See the ":ref:`kernel-dev/common:modifying an existing recipe`" 691See the ":ref:`kernel-dev/common:modifying an existing recipe`"
720section for more information. 692section for more information.
721 693
722Here is an example that shows a trivial tree of kernel Metadata stored 694Here is an example that shows a trivial tree of kernel Metadata stored
723in recipe-space within a BSP layer: 695in recipe-space within a BSP layer::
724::
725 696
726 meta-my_bsp_layer/ 697 meta-my_bsp_layer/
727 `-- recipes-kernel 698 `-- recipes-kernel
@@ -740,14 +711,13 @@ and fetches any files referenced in the ``.scc`` files by the
740``include``, ``patch``, or ``kconf`` commands. Because of this, it is 711``include``, ``patch``, or ``kconf`` commands. Because of this, it is
741necessary to bump the recipe :term:`PR` 712necessary to bump the recipe :term:`PR`
742value when changing the content of files not explicitly listed in the 713value when changing the content of files not explicitly listed in the
743``SRC_URI``. 714:term:`SRC_URI`.
744 715
745If the BSP description is in recipe space, you cannot simply list the 716If 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 717``*.scc`` in the :term:`SRC_URI` statement. You need to use the following
747form from your kernel append file: 718form from your kernel append file::
748::
749 719
750 SRC_URI_append_myplatform = " \ 720 SRC_URI:append:myplatform = " \
751 file://myplatform;type=kmeta;destsuffix=myplatform \ 721 file://myplatform;type=kmeta;destsuffix=myplatform \
752 " 722 "
753 723
@@ -758,37 +728,35 @@ When stored outside of the recipe-space, the kernel Metadata files
758reside in a separate repository. The OpenEmbedded build system adds the 728reside in a separate repository. The OpenEmbedded build system adds the
759Metadata to the build as a "type=kmeta" repository through the 729Metadata to the build as a "type=kmeta" repository through the
760:term:`SRC_URI` variable. As an 730:term:`SRC_URI` variable. As an
761example, consider the following ``SRC_URI`` statement from the 731example, consider the following :term:`SRC_URI` statement from the
762``linux-yocto_4.12.bb`` kernel recipe: 732``linux-yocto_5.15.bb`` kernel recipe::
763::
764
765 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}"
767 733
734 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};protocol=https \
735 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA};protocol=https"
768 736
769``${KMETA}``, in this context, is simply used to name the directory into 737``${KMETA}``, in this context, is simply used to name the directory into
770which the Git fetcher places the Metadata. This behavior is no different 738which the Git fetcher places the Metadata. This behavior is no different
771than any multi-repository ``SRC_URI`` statement used in a recipe (e.g. 739than any multi-repository :term:`SRC_URI` statement used in a recipe (e.g.
772see the previous section). 740see the previous section).
773 741
774You can keep kernel Metadata in a "kernel-cache", which is a directory 742You can keep kernel Metadata in a "kernel-cache", which is a directory
775containing configuration fragments. As with any Metadata kept outside 743containing configuration fragments. As with any Metadata kept outside
776the recipe-space, you simply need to use the ``SRC_URI`` statement with 744the recipe-space, you simply need to use the :term:`SRC_URI` statement with
777the "type=kmeta" attribute. Doing so makes the kernel Metadata available 745the "type=kmeta" attribute. Doing so makes the kernel Metadata available
778during the configuration phase. 746during the configuration phase.
779 747
780If you modify the Metadata, you must not forget to update the ``SRCREV`` 748If you modify the Metadata, you must not forget to update the :term:`SRCREV`
781statements in the kernel's recipe. In particular, you need to update the 749statements in the kernel's recipe. In particular, you need to update the
782``SRCREV_meta`` variable to match the commit in the ``KMETA`` branch you 750``SRCREV_meta`` variable to match the commit in the ``KMETA`` branch you
783wish to use. Changing the data in these branches and not updating the 751wish to use. Changing the data in these branches and not updating the
784``SRCREV`` statements to match will cause the build to fetch an older 752:term:`SRCREV` statements to match will cause the build to fetch an older
785commit. 753commit.
786 754
787Organizing Your Source 755Organizing Your Source
788====================== 756======================
789 757
790Many recipes based on the ``linux-yocto-custom.bb`` recipe use Linux 758Many recipes based on the ``linux-yocto-custom.bb`` recipe use Linux
791kernel sources that have only a single branch - "master". This type of 759kernel sources that have only a single branch. This type of
792repository structure is fine for linear development supporting a single 760repository structure is fine for linear development supporting a single
793machine and architecture. However, if you work with multiple boards and 761machine and architecture. However, if you work with multiple boards and
794architectures, a kernel source repository with multiple branches is more 762architectures, a kernel source repository with multiple branches is more
@@ -797,11 +765,11 @@ board to boot. Sometimes, these patches are works-in-progress or
797fundamentally wrong, yet they are still necessary for specific boards. 765fundamentally wrong, yet they are still necessary for specific boards.
798In these situations, you most likely do not want to include these 766In these situations, you most likely do not want to include these
799patches in every kernel you build (i.e. have the patches as part of the 767patches in every kernel you build (i.e. have the patches as part of the
800lone "master" branch). It is situations like these that give rise to 768default branch). It is situations like these that give rise to
801multiple branches used within a Linux kernel sources Git repository. 769multiple branches used within a Linux kernel sources Git repository.
802 770
803Repository organization strategies exist that maximize source reuse, 771Here are repository organization strategies maximizing source reuse,
804remove redundancy, and logically order your changes. This section 772removing redundancy, and logically ordering your changes. This section
805presents strategies for the following cases: 773presents strategies for the following cases:
806 774
807- Encapsulating patches in a feature description and only including the 775- Encapsulating patches in a feature description and only including the
@@ -825,11 +793,11 @@ Given this scenario, you do not need to create any branches in the
825source repository. Rather, you just take the static patches you need and 793source repository. Rather, you just take the static patches you need and
826encapsulate them within a feature description. Once you have the feature 794encapsulate them within a feature description. Once you have the feature
827description, you simply include that into the BSP description as 795description, you simply include that into the BSP description as
828described in the "`BSP Descriptions <#bsp-descriptions>`__" section. 796described in the ":ref:`kernel-dev/advanced:bsp descriptions`" section.
829 797
830You can find information on how to create patches and BSP descriptions 798You can find information on how to create patches and BSP descriptions
831in the "`Patches <#patches>`__" and "`BSP 799in the ":ref:`kernel-dev/advanced:patches`" and
832Descriptions <#bsp-descriptions>`__" sections. 800":ref:`kernel-dev/advanced:bsp descriptions`" sections.
833 801
834Machine Branches 802Machine Branches
835---------------- 803----------------
@@ -837,21 +805,19 @@ Machine Branches
837When you have multiple machines and architectures to support, or you are 805When you have multiple machines and architectures to support, or you are
838actively working on board support, it is more efficient to create 806actively working on board support, it is more efficient to create
839branches in the repository based on individual machines. Having machine 807branches in the repository based on individual machines. Having machine
840branches allows common source to remain in the "master" branch with any 808branches allows common source to remain in the development branch with any
841features specific to a machine stored in the appropriate machine branch. 809features specific to a machine stored in the appropriate machine branch.
842This organization method frees you from continually reintegrating your 810This organization method frees you from continually reintegrating your
843patches into a feature. 811patches into a feature.
844 812
845Once you have a new branch, you can set up your kernel Metadata to use 813Once 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 814the branch a couple different ways. In the recipe, you can specify the
847new branch as the ``KBRANCH`` to use for the board as follows: 815new branch as the :term:`KBRANCH` to use for the board as follows::
848::
849 816
850 KBRANCH = "mynewbranch" 817 KBRANCH = "mynewbranch"
851 818
852Another method is to use the ``branch`` command in the BSP 819Another method is to use the ``branch`` command in the BSP
853description: 820description::
854::
855 821
856 mybsp.scc: 822 mybsp.scc:
857 define KMACHINE mybsp 823 define KMACHINE mybsp
@@ -865,15 +831,13 @@ description:
865 831
866If you find yourself with numerous branches, you might consider using a 832If you find yourself with numerous branches, you might consider using a
867hierarchical branching system similar to what the Yocto Linux Kernel Git 833hierarchical branching system similar to what the Yocto Linux Kernel Git
868repositories use: 834repositories use::
869::
870 835
871 common/kernel_type/machine 836 common/kernel_type/machine
872 837
873If you had two kernel types, "standard" and "small" for instance, three 838If you had two kernel types, "standard" and "small" for instance, three
874machines, and common as ``mydir``, the branches in your Git repository 839machines, and common as ``mydir``, the branches in your Git repository
875might look like this: 840might look like this::
876::
877 841
878 mydir/base 842 mydir/base
879 mydir/standard/base 843 mydir/standard/base
@@ -905,8 +869,7 @@ that have to be regularly updated. The Yocto Project Linux kernel tools
905provide for this with the ``git merge`` command. 869provide for this with the ``git merge`` command.
906 870
907To merge a feature branch into a BSP, insert the ``git merge`` command 871To merge a feature branch into a BSP, insert the ``git merge`` command
908after any ``branch`` commands: 872after any ``branch`` commands::
909::
910 873
911 mybsp.scc: 874 mybsp.scc:
912 define KMACHINE mybsp 875 define KMACHINE mybsp