diff options
Diffstat (limited to 'documentation/kernel-dev')
| -rw-r--r-- | documentation/kernel-dev/kernel-dev-advanced.xml | 390 | ||||
| -rw-r--r-- | documentation/kernel-dev/kernel-dev-common.xml | 149 |
2 files changed, 374 insertions, 165 deletions
diff --git a/documentation/kernel-dev/kernel-dev-advanced.xml b/documentation/kernel-dev/kernel-dev-advanced.xml index 1c1b6366db..434c01fafb 100644 --- a/documentation/kernel-dev/kernel-dev-advanced.xml +++ b/documentation/kernel-dev/kernel-dev-advanced.xml | |||
| @@ -524,170 +524,219 @@ | |||
| 524 | <title>BSP Descriptions</title> | 524 | <title>BSP Descriptions</title> |
| 525 | 525 | ||
| 526 | <para> | 526 | <para> |
| 527 | BSP descriptions combine kernel types with hardware-specific | 527 | BSP descriptions (i.e. <filename>*.scc</filename> files) |
| 528 | features. | 528 | combine kernel types with hardware-specific features. |
| 529 | The hardware-specific portion is typically defined | 529 | The hardware-specific Metadata is typically defined |
| 530 | independently, and then aggregated with each supported kernel | 530 | independently in the BSP layer, and then aggregated with each |
| 531 | type. | 531 | supported kernel type. |
| 532 | Consider this simple BSP description that supports the | ||
| 533 | <replaceable>mybsp</replaceable> machine: | ||
| 534 | <literallayout class='monospaced'> | ||
| 535 | <replaceable>mybsp</replaceable>.scc: | ||
| 536 | define KMACHINE <replaceable>mybsp</replaceable> | ||
| 537 | define KTYPE standard | ||
| 538 | define KARCH i386 | ||
| 539 | |||
| 540 | kconf <replaceable>mybsp</replaceable>.cfg | ||
| 541 | </literallayout> | ||
| 542 | Every BSP description should define the | ||
| 543 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KMACHINE'><filename>KMACHINE</filename></ulink>, | ||
| 544 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KTYPE'><filename>KTYPE</filename></ulink>, | ||
| 545 | and <ulink url='&YOCTO_DOCS_REF_URL;#var-KARCH'><filename>KARCH</filename></ulink> | ||
| 546 | variables. | ||
| 547 | These variables allow the OpenEmbedded build system to identify | ||
| 548 | the description as meeting the criteria set by the recipe being | ||
| 549 | built. | ||
| 550 | This simple example supports the "mybsp" machine for the "standard" | ||
| 551 | kernel and the "i386" architecture. | ||
| 552 | </para> | ||
| 553 | |||
| 554 | <para> | ||
| 555 | Be aware that a hard link between the | ||
| 556 | <filename>KTYPE</filename> variable and a kernel type | ||
| 557 | description file does not exist. | ||
| 558 | Thus, if you do not have kernel types defined in your kernel | ||
| 559 | Metadata, you only need to ensure that the kernel recipe's | ||
| 560 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LINUX_KERNEL_TYPE'><filename>LINUX_KERNEL_TYPE</filename></ulink> | ||
| 561 | variable and the <filename>KTYPE</filename> variable in the | ||
| 562 | BSP description file match. | ||
| 563 | <note> | 532 | <note> |
| 564 | Future versions of the tooling make the specification of | 533 | For BSPs supported by the Yocto Project, the BSP description |
| 565 | <filename>KTYPE</filename> in the BSP optional. | 534 | files are located in the <filename>bsp</filename> directory |
| 535 | of the <filename>yocto-kernel-cache</filename> repository | ||
| 536 | organized under the "Yocto Linux Kernel" heading in the | ||
| 537 | <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi'>Yocto Project Source Repositories</ulink>. | ||
| 566 | </note> | 538 | </note> |
| 567 | </para> | 539 | </para> |
| 568 | 540 | ||
| 569 | <para> | 541 | <para> |
| 570 | If you did want to separate your kernel policy from your | 542 | This section provides a BSP description structural overview along |
| 571 | hardware configuration, you could do so by specifying a kernel | 543 | with aggregation concepts as well as a detailed example using |
| 572 | type, such as "standard" and including that description file | 544 | a BSP supported by the Yocto Project (i.e. Minnow Board). |
| 573 | in the BSP description file. | ||
| 574 | See the "<link linkend='kernel-types'>Kernel Types</link>" section | ||
| 575 | for more information. | ||
| 576 | </para> | 545 | </para> |
| 577 | 546 | ||
| 578 | <para> | 547 | <section id='bsp-description-file-overview'> |
| 579 | You might also have multiple hardware configurations that you | 548 | <title>Overview</title> |
| 580 | aggregate into a single hardware description file that you | ||
| 581 | could include in the BSP description file, rather than referencing | ||
| 582 | a single <filename>.cfg</filename> file. | ||
| 583 | Consider the following: | ||
| 584 | <literallayout class='monospaced'> | ||
| 585 | <replaceable>mybsp</replaceable>.scc: | ||
| 586 | define KMACHINE mybsp | ||
| 587 | define KTYPE standard | ||
| 588 | define KARCH i386 | ||
| 589 | |||
| 590 | include standard.scc | ||
| 591 | include <replaceable>mybsp</replaceable>-hw.scc | ||
| 592 | </literallayout> | ||
| 593 | </para> | ||
| 594 | 549 | ||
| 595 | <para> | 550 | <para> |
| 596 | In the above example, <filename>standard.scc</filename> | 551 | For simplicity, consider the following top-level BSP |
| 597 | aggregates all the configuration fragments, patches, and | 552 | description file. |
| 598 | features that make up your standard kernel policy whereas | 553 | Top-level BSP descriptions files employ both a structure |
| 599 | <replaceable>mybsp</replaceable><filename>-hw.scc</filename> | 554 | and naming convention for consistency. |
| 600 | aggregates all those necessary | 555 | The naming convention for the file is as follows: |
| 601 | to support the hardware available on the | 556 | <literallayout class='monospaced'> |
| 602 | <replaceable>mybsp</replaceable> machine. | 557 | <replaceable>bsp_name</replaceable>-<replaceable>kernel_type</replaceable>.scc |
| 603 | For information on how to break a complete | 558 | </literallayout> |
| 604 | <filename>.config</filename> file into the various | 559 | Here are some example top-level BSP filenames for the |
| 605 | configuration fragments, see the | 560 | Minnow Board BSP, which is supported by the Yocto Project: |
| 606 | "<link linkend='generating-configuration-files'>Generating Configuration Files</link>" | 561 | <literallayout class='monospaced'> |
| 607 | section. | 562 | minnow-standard.scc |
| 608 | </para> | 563 | minnow-preempt-rt.scc |
| 564 | minnow-tiny.scc | ||
| 565 | </literallayout> | ||
| 566 | Each file uses the BSP name followed by the kernel type. | ||
| 567 | </para> | ||
| 609 | 568 | ||
| 610 | <para> | 569 | <para> |
| 611 | Many real-world examples are more complex. | 570 | is simple BSP description file whose name has the |
| 612 | Like any other <filename>.scc</filename> file, BSP | 571 | form |
| 613 | descriptions can aggregate features. | 572 | <replaceable>mybsp</replaceable><filename>-standard</filename> |
| 614 | Consider the Minnow BSP definition from the | 573 | and supports the <replaceable>mybsp</replaceable> machine using |
| 615 | <filename>linux-yocto-3.19</filename> | 574 | a standard kernel: |
| 616 | Git repository: | 575 | <literallayout class='monospaced'> |
| 617 | <literallayout class='monospaced'> | 576 | define KMACHINE <replaceable>mybsp</replaceable> |
| 618 | minnow.scc: | 577 | define KTYPE standard |
| 619 | include cfg/x86.scc | 578 | define KARCH i386 |
| 620 | include features/eg20t/eg20t.scc | 579 | |
| 621 | include cfg/dmaengine.scc | 580 | include ktypes/standard |
| 622 | include features/power/intel.scc | 581 | |
| 623 | include cfg/efi.scc | 582 | include <replaceable>mybsp</replaceable>.scc |
| 624 | include features/usb/ehci-hcd.scc | 583 | |
| 625 | include features/usb/ohci-hcd.scc | 584 | kconf hardware <replaceable>mybsp</replaceable>-<replaceable>extra</replaceable>.cfg |
| 626 | include features/usb/usb-gadgets.scc | 585 | </literallayout> |
| 627 | include features/usb/touchscreen-composite.scc | 586 | Every top-level BSP description file should define the |
| 628 | include cfg/timer/hpet.scc | 587 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KMACHINE'><filename>KMACHINE</filename></ulink>, |
| 629 | include cfg/timer/rtc.scc | 588 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KTYPE'><filename>KTYPE</filename></ulink>, |
| 630 | include features/leds/leds.scc | 589 | and <ulink url='&YOCTO_DOCS_REF_URL;#var-KARCH'><filename>KARCH</filename></ulink> |
| 631 | include features/spi/spidev.scc | 590 | variables. |
| 632 | include features/i2c/i2cdev.scc | 591 | These variables allow the OpenEmbedded build system to identify |
| 633 | 592 | the description as meeting the criteria set by the recipe being | |
| 634 | # Earlyprintk and port debug requires 8250 | 593 | built. |
| 635 | kconf hardware cfg/8250.cfg | 594 | This simple example supports the "mybsp" machine for the "standard" |
| 636 | 595 | kernel and the "i386" architecture. | |
| 637 | kconf hardware minnow.cfg | 596 | </para> |
| 638 | kconf hardware minnow-dev.cfg | ||
| 639 | </literallayout> | ||
| 640 | </para> | ||
| 641 | 597 | ||
| 642 | <para> | 598 | <para> |
| 643 | The <filename>minnow.scc</filename> description file includes | 599 | Be aware that a hard link between the |
| 644 | a hardware configuration fragment | 600 | <filename>KTYPE</filename> variable and a kernel type description |
| 645 | (<filename>minnow.cfg</filename>) specific to the Minnow | 601 | file does not exist. |
| 646 | BSP as well as several more general configuration | 602 | Thus, if you do not have kernel types defined in your kernel |
| 647 | fragments and features enabling hardware found on the | 603 | Metadata, you only need to ensure that the kernel recipe's |
| 648 | machine. | 604 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LINUX_KERNEL_TYPE'><filename>LINUX_KERNEL_TYPE</filename></ulink> |
| 649 | This description file is then included in each of the three | 605 | variable and the <filename>KTYPE</filename> variable in the |
| 650 | "minnow" description files for the supported kernel types | 606 | BSP description file match. |
| 651 | (i.e. "standard", "preempt-rt", and "tiny"). | 607 | <note> |
| 652 | Consider the "minnow" description for the "standard" kernel | 608 | Future versions of the tooling make the specification of |
| 653 | type: | 609 | <filename>KTYPE</filename> in the BSP optional. |
| 654 | <literallayout class='monospaced'> | 610 | </note> |
| 655 | minnow-standard.scc: | 611 | </para> |
| 656 | define KMACHINE minnow | ||
| 657 | define KTYPE standard | ||
| 658 | define KARCH i386 | ||
| 659 | 612 | ||
| 660 | include ktypes/standard | 613 | <para> |
| 614 | To separate your kernel policy from your hardware configuration, | ||
| 615 | you include a kernel type (<filename>ktype</filename>), such as | ||
| 616 | "standard". | ||
| 617 | In the previous example, this is done using the following: | ||
| 618 | <literallayout class='monospaced'> | ||
| 619 | include ktypes/standard | ||
| 620 | </literallayout> | ||
| 621 | In the previous example, <filename>ktypes/standard.scc</filename> | ||
| 622 | aggregates all the configuration fragments, patches, and | ||
| 623 | features that make up your standard kernel policy. | ||
| 624 | See the "<link linkend='kernel-types'>Kernel Types</link>" section | ||
| 625 | for more information. | ||
| 626 | </para> | ||
| 661 | 627 | ||
| 662 | include minnow.scc | 628 | <para> |
| 629 | To aggregate common configurations and features specific to the | ||
| 630 | kernel for <replaceable>mybsp</replaceable>, use the following: | ||
| 631 | <literallayout class='monospaced'> | ||
| 632 | include <replaceable>mybsp</replaceable>.scc | ||
| 633 | </literallayout> | ||
| 634 | For information on how to break a complete | ||
| 635 | <filename>.config</filename> file into the various | ||
| 636 | configuration fragments, see the | ||
| 637 | "<link linkend='generating-configuration-files'>Generating Configuration Files</link>" | ||
| 638 | section. | ||
| 639 | </para> | ||
| 663 | 640 | ||
| 664 | # Extra minnow configs above the minimal defined in minnow.scc | 641 | <para> |
| 665 | include cfg/efi-ext.scc | 642 | Finally, if you have any configurations specific to the |
| 666 | include features/media/media-all.scc | 643 | hardware that are not in a <filename>*.scc</filename> file, |
| 667 | include features/sound/snd_hda_intel.scc | 644 | you can include them as follows: |
| 645 | <literallayout class='monospaced'> | ||
| 646 | kconf hardware <replaceable>mybsp</replaceable>-<replaceable>extra</replaceable>.cfg | ||
| 647 | </literallayout> | ||
| 648 | </para> | ||
| 649 | </section> | ||
| 668 | 650 | ||
| 669 | # The following should really be in standard.scc | 651 | <section id='bsp-description-file-example-minnow'> |
| 670 | # USB live-image support | 652 | <title>Example</title> |
| 671 | include cfg/usb-mass-storage.scc | ||
| 672 | include cfg/boot-live.scc | ||
| 673 | 653 | ||
| 674 | # Basic profiling | 654 | <para> |
| 675 | include features/latencytop/latencytop.scc | 655 | Many real-world examples are more complex. |
| 676 | include features/profiling/profiling.scc | 656 | Like any other <filename>.scc</filename> file, BSP |
| 657 | descriptions can aggregate features. | ||
| 658 | Consider the Minnow BSP definition from the | ||
| 659 | <filename>linux-yocto-4.4</filename> in the | ||
| 660 | Yocto Project | ||
| 661 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-repositories'>Source Repositories</ulink> | ||
| 662 | (i.e. | ||
| 663 | <filename>yocto-kernel-cache/bsp/minnow</filename>): | ||
| 664 | <literallayout class='monospaced'> | ||
| 665 | minnow.scc: | ||
| 666 | include cfg/x86.scc | ||
| 667 | include features/eg20t/eg20t.scc | ||
| 668 | include cfg/dmaengine.scc | ||
| 669 | include features/power/intel.scc | ||
| 670 | include cfg/efi.scc | ||
| 671 | include features/usb/ehci-hcd.scc | ||
| 672 | include features/usb/ohci-hcd.scc | ||
| 673 | include features/usb/usb-gadgets.scc | ||
| 674 | include features/usb/touchscreen-composite.scc | ||
| 675 | include cfg/timer/hpet.scc | ||
| 676 | include features/leds/leds.scc | ||
| 677 | include features/spi/spidev.scc | ||
| 678 | include features/i2c/i2cdev.scc | ||
| 679 | include features/mei/mei-txe.scc | ||
| 680 | |||
| 681 | # Earlyprintk and port debug requires 8250 | ||
| 682 | kconf hardware cfg/8250.cfg | ||
| 683 | |||
| 684 | kconf hardware minnow.cfg | ||
| 685 | kconf hardware minnow-dev.cfg | ||
| 686 | </literallayout> | ||
| 687 | </para> | ||
| 677 | 688 | ||
| 678 | # Requested drivers that don't have an existing scc | 689 | <para> |
| 679 | kconf hardware minnow-drivers-extra.cfg | 690 | The <filename>minnow.scc</filename> description file includes |
| 680 | </literallayout> | 691 | a hardware configuration fragment |
| 681 | The <filename>include</filename> command midway through the file | 692 | (<filename>minnow.cfg</filename>) specific to the Minnow |
| 682 | includes the <filename>minnow.scc</filename> description that | 693 | BSP as well as several more general configuration |
| 683 | defines all hardware enablements for the BSP that is common to all | 694 | fragments and features enabling hardware found on the |
| 684 | kernel types. | 695 | machine. |
| 685 | Using this command significantly reduces duplication. | 696 | This <filename>minnow.scc</filename> description file is then |
| 686 | </para> | 697 | included in each of the three |
| 698 | "minnow" description files for the supported kernel types | ||
| 699 | (i.e. "standard", "preempt-rt", and "tiny"). | ||
| 700 | Consider the "minnow" description for the "standard" kernel | ||
| 701 | type: | ||
| 702 | <literallayout class='monospaced'> | ||
| 703 | minnow-standard.scc: | ||
| 704 | define KMACHINE minnow | ||
| 705 | define KTYPE standard | ||
| 706 | define KARCH i386 | ||
| 707 | |||
| 708 | include ktypes/standard | ||
| 709 | |||
| 710 | include minnow.scc | ||
| 711 | |||
| 712 | # Extra minnow configs above the minimal defined in minnow.scc | ||
| 713 | include cfg/efi-ext.scc | ||
| 714 | include features/media/media-all.scc | ||
| 715 | include features/sound/snd_hda_intel.scc | ||
| 716 | |||
| 717 | # The following should really be in standard.scc | ||
| 718 | # USB live-image support | ||
| 719 | include cfg/usb-mass-storage.scc | ||
| 720 | include cfg/boot-live.scc | ||
| 721 | |||
| 722 | # Basic profiling | ||
| 723 | include features/latencytop/latencytop.scc | ||
| 724 | include features/profiling/profiling.scc | ||
| 725 | |||
| 726 | # Requested drivers that don't have an existing scc | ||
| 727 | kconf hardware minnow-drivers-extra.cfg | ||
| 728 | </literallayout> | ||
| 729 | The <filename>include</filename> command midway through the file | ||
| 730 | includes the <filename>minnow.scc</filename> description that | ||
| 731 | defines all enabled hardware for the BSP that is common to | ||
| 732 | all kernel types. | ||
| 733 | Using this command significantly reduces duplication. | ||
| 734 | </para> | ||
| 687 | 735 | ||
| 688 | <para> | 736 | <para> |
| 689 | Now consider the "minnow" description for the "tiny" kernel type: | 737 | Now consider the "minnow" description for the "tiny" kernel |
| 690 | <literallayout class='monospaced'> | 738 | type: |
| 739 | <literallayout class='monospaced'> | ||
| 691 | minnow-tiny.scc: | 740 | minnow-tiny.scc: |
| 692 | define KMACHINE minnow | 741 | define KMACHINE minnow |
| 693 | define KTYPE tiny | 742 | define KTYPE tiny |
| @@ -696,22 +745,24 @@ | |||
| 696 | include ktypes/tiny | 745 | include ktypes/tiny |
| 697 | 746 | ||
| 698 | include minnow.scc | 747 | include minnow.scc |
| 699 | </literallayout> | 748 | </literallayout> |
| 700 | As you might expect, the "tiny" description includes quite a | 749 | As you might expect, the "tiny" description includes quite a |
| 701 | bit less. | 750 | bit less. |
| 702 | In fact, it includes only the minimal policy defined by the | 751 | In fact, it includes only the minimal policy defined by the |
| 703 | "tiny" kernel type and the hardware-specific configuration required | 752 | "tiny" kernel type and the hardware-specific configuration |
| 704 | for booting the machine along with the most basic functionality of | 753 | required for booting the machine along with the most basic |
| 705 | the system as defined in the base "minnow" description file. | 754 | functionality of the system as defined in the base "minnow" |
| 706 | </para> | 755 | description file. |
| 756 | </para> | ||
| 707 | 757 | ||
| 708 | <para> | 758 | <para> |
| 709 | Notice again the three critical variables: | 759 | Notice again the three critical variables: |
| 710 | <filename>KMACHINE</filename>, <filename>KTYPE</filename>, | 760 | <filename>KMACHINE</filename>, <filename>KTYPE</filename>, |
| 711 | and <filename>KARCH</filename>. | 761 | and <filename>KARCH</filename>. |
| 712 | Of these variables, only the <filename>KTYPE</filename> has changed. | 762 | Of these variables, only the <filename>KTYPE</filename> has changed. |
| 713 | It is now set to "tiny". | 763 | It is now set to "tiny". |
| 714 | </para> | 764 | </para> |
| 765 | </section> | ||
| 715 | </section> | 766 | </section> |
| 716 | </section> | 767 | </section> |
| 717 | 768 | ||
| @@ -795,6 +846,18 @@ | |||
| 795 | value when changing the content of files not explicitly listed | 846 | value when changing the content of files not explicitly listed |
| 796 | in the <filename>SRC_URI</filename>. | 847 | in the <filename>SRC_URI</filename>. |
| 797 | </para> | 848 | </para> |
| 849 | |||
| 850 | <para> | ||
| 851 | If the kernel Metadata is in a layer, you cannot simply list the | ||
| 852 | <filename>*.scc</filename> in the <filename>SRC_URI</filename> | ||
| 853 | statement. | ||
| 854 | You need to use the following form from your kernel append file: | ||
| 855 | <literallayout class='monospaced'> | ||
| 856 | SRC_URI_append_<replaceable>myplatform</replaceable> = " \ | ||
| 857 | file://<replaceable>myplatform</replaceable>;type=kmeta;destsuffix=<replaceable>myplatform</replaceable> \ | ||
| 858 | " | ||
| 859 | </literallayout> | ||
| 860 | </para> | ||
| 798 | </section> | 861 | </section> |
| 799 | 862 | ||
| 800 | <section id='metadata-outside-the-recipe-space'> | 863 | <section id='metadata-outside-the-recipe-space'> |
| @@ -817,7 +880,8 @@ | |||
| 817 | <filename>${KMETA}</filename>, in this context, is simply used to | 880 | <filename>${KMETA}</filename>, in this context, is simply used to |
| 818 | name the directory into which the Git fetcher places the Metadata. | 881 | name the directory into which the Git fetcher places the Metadata. |
| 819 | This behavior is no different than any multi-repository | 882 | This behavior is no different than any multi-repository |
| 820 | <filename>SRC_URI</filename> statement used in a recipe. | 883 | <filename>SRC_URI</filename> statement used in a recipe (e.g. |
| 884 | see the previous section). | ||
| 821 | </para> | 885 | </para> |
| 822 | 886 | ||
| 823 | <para> | 887 | <para> |
diff --git a/documentation/kernel-dev/kernel-dev-common.xml b/documentation/kernel-dev/kernel-dev-common.xml index a9aafd3c21..d49aa3ce17 100644 --- a/documentation/kernel-dev/kernel-dev-common.xml +++ b/documentation/kernel-dev/kernel-dev-common.xml | |||
| @@ -84,11 +84,11 @@ | |||
| 84 | You also name it accordingly based on the linux-yocto recipe | 84 | You also name it accordingly based on the linux-yocto recipe |
| 85 | you are using. | 85 | you are using. |
| 86 | For example, if you are modifying the | 86 | For example, if you are modifying the |
| 87 | <filename>meta/recipes-kernel/linux/linux-yocto_3.19.bb</filename> | 87 | <filename>meta/recipes-kernel/linux/linux-yocto_4.4.bb</filename> |
| 88 | recipe, the append file will typically be located as follows | 88 | recipe, the append file will typically be located as follows |
| 89 | within your custom layer: | 89 | within your custom layer: |
| 90 | <literallayout class='monospaced'> | 90 | <literallayout class='monospaced'> |
| 91 | <replaceable>your-layer</replaceable>/recipes-kernel/linux/linux-yocto_3.19.bbappend | 91 | <replaceable>your-layer</replaceable>/recipes-kernel/linux/linux-yocto_4.4.bbappend |
| 92 | </literallayout> | 92 | </literallayout> |
| 93 | The append file should initially extend the | 93 | The append file should initially extend the |
| 94 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESPATH'><filename>FILESPATH</filename></ulink> | 94 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESPATH'><filename>FILESPATH</filename></ulink> |
| @@ -114,6 +114,151 @@ | |||
| 114 | <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>. | 114 | <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>. |
| 115 | </note> | 115 | </note> |
| 116 | </para> | 116 | </para> |
| 117 | |||
| 118 | <para> | ||
| 119 | As an example, consider the following append file | ||
| 120 | used by the BSPs in <filename>meta-yocto-bsp</filename>: | ||
| 121 | <literallayout class='monospaced'> | ||
| 122 | meta-yocto-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend | ||
| 123 | </literallayout> | ||
| 124 | The following listing shows the file. | ||
| 125 | Be aware that the actual commit ID strings in this | ||
| 126 | example listing might be different than the actual strings | ||
| 127 | in the file from the <filename>meta-yocto-bsp</filename> | ||
| 128 | layer upstream. | ||
| 129 | <literallayout class='monospaced'> | ||
| 130 | KBRANCH_genericx86 = "standard/base" | ||
| 131 | KBRANCH_genericx86-64 = "standard/base" | ||
| 132 | |||
| 133 | KMACHINE_genericx86 ?= "common-pc" | ||
| 134 | KMACHINE_genericx86-64 ?= "common-pc-64" | ||
| 135 | KBRANCH_edgerouter = "standard/edgerouter" | ||
| 136 | KBRANCH_beaglebone = "standard/beaglebone" | ||
| 137 | KBRANCH_mpc8315e-rdb = "standard/fsl-mpc8315e-rdb" | ||
| 138 | |||
| 139 | SRCREV_machine_genericx86 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" | ||
| 140 | SRCREV_machine_genericx86-64 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" | ||
| 141 | SRCREV_machine_edgerouter ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" | ||
| 142 | SRCREV_machine_beaglebone ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" | ||
| 143 | SRCREV_machine_mpc8315e-rdb ?= "06c0dbdcba374ca7f92a53d69292d6bb7bc9b0f3" | ||
| 144 | |||
| 145 | COMPATIBLE_MACHINE_genericx86 = "genericx86" | ||
| 146 | COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64" | ||
| 147 | COMPATIBLE_MACHINE_edgerouter = "edgerouter" | ||
| 148 | COMPATIBLE_MACHINE_beaglebone = "beaglebone" | ||
| 149 | COMPATIBLE_MACHINE_mpc8315e-rdb = "mpc8315e-rdb" | ||
| 150 | |||
| 151 | LINUX_VERSION_genericx86 = "4.4.41" | ||
| 152 | LINUX_VERSION_genericx86-64 = "4.4.41" | ||
| 153 | LINUX_VERSION_edgerouter = "4.4.53" | ||
| 154 | LINUX_VERSION_beaglebone = "4.4.53" | ||
| 155 | LINUX_VERSION_mpc8315e-rdb = "4.4.53" | ||
| 156 | </literallayout> | ||
| 157 | This append file contains statements used to support | ||
| 158 | several BSPs that ship with the Yocto Project. | ||
| 159 | The file defines machines using the | ||
| 160 | <ulink url='&YOCTO_DOCS_REF_URL;#var-COMPATIBLE_MACHINE'><filename>COMPATIBLE_MACHINE</filename></ulink> | ||
| 161 | variable and uses the | ||
| 162 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KMACHINE'><filename>KMACHINE</filename></ulink> | ||
| 163 | variable to ensure the machine name used by the OpenEmbedded | ||
| 164 | build system maps to the machine name used by the Linux Yocto | ||
| 165 | kernel. | ||
| 166 | The file also uses the optional | ||
| 167 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KBRANCH'><filename>KBRANCH</filename></ulink> | ||
| 168 | variable to ensure the build process uses the | ||
| 169 | appropriate kernel branch. | ||
| 170 | </para> | ||
| 171 | |||
| 172 | <para> | ||
| 173 | Although this particular example does not use it, the | ||
| 174 | <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_FEATURES'><filename>KERNEL_FEATURES</filename></ulink> | ||
| 175 | variable could be used to enable features specific to | ||
| 176 | the kernel. | ||
| 177 | The append file points to specific commits in the | ||
| 178 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink> | ||
| 179 | Git repository and the <filename>meta</filename> Git repository | ||
| 180 | branches to identify the exact kernel needed to build the | ||
| 181 | BSP. | ||
| 182 | </para> | ||
| 183 | |||
| 184 | <para> | ||
| 185 | One thing missing in this particular BSP, which you will | ||
| 186 | typically need when developing a BSP, is the kernel configuration | ||
| 187 | file (<filename>.config</filename>) for your BSP. | ||
| 188 | When developing a BSP, you probably have a kernel configuration | ||
| 189 | file or a set of kernel configuration files that, when taken | ||
| 190 | together, define the kernel configuration for your BSP. | ||
| 191 | You can accomplish this definition by putting the configurations | ||
| 192 | in a file or a set of files inside a directory located at the | ||
| 193 | same level as your kernel's append file and having the same | ||
| 194 | name as the kernel's main recipe file. | ||
| 195 | With all these conditions met, simply reference those files in the | ||
| 196 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> | ||
| 197 | statement in the append file. | ||
| 198 | </para> | ||
| 199 | |||
| 200 | <para> | ||
| 201 | For example, suppose you had some configuration options | ||
| 202 | in a file called <filename>network_configs.cfg</filename>. | ||
| 203 | You can place that file inside a directory named | ||
| 204 | <filename>linux-yocto</filename> and then add | ||
| 205 | a <filename>SRC_URI</filename> statement such as the | ||
| 206 | following to the append file. | ||
| 207 | When the OpenEmbedded build system builds the kernel, the | ||
| 208 | configuration options are picked up and applied. | ||
| 209 | <literallayout class='monospaced'> | ||
| 210 | SRC_URI += "file://network_configs.cfg" | ||
| 211 | </literallayout> | ||
| 212 | </para> | ||
| 213 | |||
| 214 | <para> | ||
| 215 | To group related configurations into multiple files, you | ||
| 216 | perform a similar procedure. | ||
| 217 | Here is an example that groups separate configurations | ||
| 218 | specifically for Ethernet and graphics into their own | ||
| 219 | files and adds the configurations by using a | ||
| 220 | <filename>SRC_URI</filename> statement like the following | ||
| 221 | in your append file: | ||
| 222 | <literallayout class='monospaced'> | ||
| 223 | SRC_URI += "file://myconfig.cfg \ | ||
| 224 | file://eth.cfg \ | ||
| 225 | file://gfx.cfg" | ||
| 226 | </literallayout> | ||
| 227 | </para> | ||
| 228 | |||
| 229 | <para> | ||
| 230 | Another variable you can use in your kernel recipe append | ||
| 231 | file is the | ||
| 232 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESEXTRAPATHS'><filename>FILESEXTRAPATHS</filename></ulink> | ||
| 233 | variable. | ||
| 234 | When you use this statement, you are extending the locations | ||
| 235 | used by the OpenEmbedded system to look for files and | ||
| 236 | patches as the recipe is processed. | ||
| 237 | </para> | ||
| 238 | |||
| 239 | <note> | ||
| 240 | <para> | ||
| 241 | Other methods exist to accomplish grouping and defining configuration options. | ||
| 242 | For example, if you are working with a local clone of the kernel repository, | ||
| 243 | you could checkout the kernel's <filename>meta</filename> branch, make your changes, | ||
| 244 | and then push the changes to the local bare clone of the kernel. | ||
| 245 | The result is that you directly add configuration options to the | ||
| 246 | <filename>meta</filename> branch for your BSP. | ||
| 247 | The configuration options will likely end up in that location anyway if the BSP gets | ||
| 248 | added to the Yocto Project. | ||
| 249 | </para> | ||
| 250 | |||
| 251 | <para> | ||
| 252 | In general, however, the Yocto Project maintainers take care of moving the | ||
| 253 | <filename>SRC_URI</filename>-specified | ||
| 254 | configuration options to the kernel's <filename>meta</filename> branch. | ||
| 255 | Not only is it easier for BSP developers to not have to worry about putting those | ||
| 256 | configurations in the branch, but having the maintainers do it allows them to apply | ||
| 257 | 'global' knowledge about the kinds of common configuration options multiple BSPs in | ||
| 258 | the tree are typically using. | ||
| 259 | This allows for promotion of common configurations into common features. | ||
| 260 | </para> | ||
| 261 | </note> | ||
| 117 | </section> | 262 | </section> |
| 118 | 263 | ||
| 119 | <section id='applying-patches'> | 264 | <section id='applying-patches'> |
