diff options
Diffstat (limited to 'documentation/kernel-dev/kernel-dev-advanced.rst')
-rw-r--r-- | documentation/kernel-dev/kernel-dev-advanced.rst | 463 |
1 files changed, 341 insertions, 122 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. | ||