summaryrefslogtreecommitdiffstats
path: root/documentation/kernel-dev/common.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/kernel-dev/common.rst')
-rw-r--r--documentation/kernel-dev/common.rst225
1 files changed, 75 insertions, 150 deletions
diff --git a/documentation/kernel-dev/common.rst b/documentation/kernel-dev/common.rst
index 56217b9d38..3f35d8412f 100644
--- a/documentation/kernel-dev/common.rst
+++ b/documentation/kernel-dev/common.rst
@@ -54,8 +54,7 @@ section:
54 54
551. *Initialize the BitBake Environment:* Before building an extensible 551. *Initialize the BitBake Environment:* Before building an extensible
56 SDK, you need to initialize the BitBake build environment by sourcing 56 SDK, you need to initialize the BitBake build environment by sourcing
57 the build environment script (i.e. :ref:`structure-core-script`): 57 the build environment script (i.e. :ref:`structure-core-script`)::
58 ::
59 58
60 $ cd poky 59 $ cd poky
61 $ source oe-init-build-env 60 $ source oe-init-build-env
@@ -83,16 +82,14 @@ section:
83 82
84 In this example we wish to build for qemux86 so we must set the 83 In this example we wish to build for qemux86 so we must set the
85 ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". 84 ``MACHINE`` variable to "qemux86" and also add the "kernel-modules".
86 As described we do this by appending to ``conf/local.conf``: 85 As described we do this by appending to ``conf/local.conf``::
87 ::
88 86
89 MACHINE = "qemux86" 87 MACHINE = "qemux86"
90 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" 88 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules"
91 89
923. *Create a Layer for Patches:* You need to create a layer to hold 903. *Create a Layer for Patches:* You need to create a layer to hold
93 patches created for the kernel image. You can use the 91 patches created for the kernel image. You can use the
94 ``bitbake-layers create-layer`` command as follows: 92 ``bitbake-layers create-layer`` command as follows::
95 ::
96 93
97 $ cd poky/build 94 $ cd poky/build
98 $ bitbake-layers create-layer ../../meta-mylayer 95 $ bitbake-layers create-layer ../../meta-mylayer
@@ -116,8 +113,7 @@ section:
1164. *Inform the BitBake Build Environment About Your Layer:* As directed 1134. *Inform the BitBake Build Environment About Your Layer:* As directed
117 when you created your layer, you need to add the layer to the 114 when you created your layer, you need to add the layer to the
118 :term:`BBLAYERS` variable in the 115 :term:`BBLAYERS` variable in the
119 ``bblayers.conf`` file as follows: 116 ``bblayers.conf`` file as follows::
120 ::
121 117
122 $ cd poky/build 118 $ cd poky/build
123 $ bitbake-layers add-layer ../../meta-mylayer 119 $ bitbake-layers add-layer ../../meta-mylayer
@@ -125,16 +121,14 @@ section:
125 $ 121 $
126 122
1275. *Build the Extensible SDK:* Use BitBake to build the extensible SDK 1235. *Build the Extensible SDK:* Use BitBake to build the extensible SDK
128 specifically for use with images to be run using QEMU: 124 specifically for use with images to be run using QEMU::
129 ::
130 125
131 $ cd poky/build 126 $ cd poky/build
132 $ bitbake core-image-minimal -c populate_sdk_ext 127 $ bitbake core-image-minimal -c populate_sdk_ext
133 128
134 Once 129 Once
135 the build finishes, you can find the SDK installer file (i.e. 130 the build finishes, you can find the SDK installer file (i.e.
136 ``*.sh`` file) in the following directory: 131 ``*.sh`` file) in the following directory::
137 ::
138 132
139 poky/build/tmp/deploy/sdk 133 poky/build/tmp/deploy/sdk
140 134
@@ -143,8 +137,7 @@ section:
143 137
1446. *Install the Extensible SDK:* Use the following command to install 1386. *Install the Extensible SDK:* Use the following command to install
145 the SDK. For this example, install the SDK in the default 139 the SDK. For this example, install the SDK in the default
146 ``poky_sdk`` directory: 140 ``poky_sdk`` directory::
147 ::
148 141
149 $ cd poky/build/tmp/deploy/sdk 142 $ cd poky/build/tmp/deploy/sdk
150 $ ./poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-&DISTRO;.sh 143 $ ./poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-&DISTRO;.sh
@@ -172,8 +165,7 @@ section:
172 BitBake shell used to build the installer. 165 BitBake shell used to build the installer.
173 166
174 After opening a new shell, run the SDK environment setup script as 167 After opening a new shell, run the SDK environment setup script as
175 directed by the output from installing the SDK: 168 directed by the output from installing the SDK::
176 ::
177 169
178 $ source poky_sdk/environment-setup-i586-poky-linux 170 $ source poky_sdk/environment-setup-i586-poky-linux
179 "SDK environment now set up; additionally you may now run devtool to perform development tasks. 171 "SDK environment now set up; additionally you may now run devtool to perform development tasks.
@@ -186,8 +178,7 @@ section:
186 178
1878. *Build the Clean Image:* The final step in preparing to work on the 1798. *Build the Clean Image:* The final step in preparing to work on the
188 kernel is to build an initial image using ``devtool`` in the new 180 kernel is to build an initial image using ``devtool`` in the new
189 terminal you just set up and initialized for SDK work: 181 terminal you just set up and initialized for SDK work::
190 ::
191 182
192 $ devtool build-image 183 $ devtool build-image
193 Parsing recipes: 100% |##########################################| Time: 0:00:05 184 Parsing recipes: 100% |##########################################| Time: 0:00:05
@@ -269,16 +260,14 @@ section:
269 260
270 In this example we wish to build for qemux86 so we must set the 261 In this example we wish to build for qemux86 so we must set the
271 ``MACHINE`` variable to "qemux86" and also add the "kernel-modules". 262 ``MACHINE`` variable to "qemux86" and also add the "kernel-modules".
272 As described we do this by appending to ``conf/local.conf``: 263 As described we do this by appending to ``conf/local.conf``::
273 ::
274 264
275 MACHINE = "qemux86" 265 MACHINE = "qemux86"
276 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" 266 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules"
277 267
2783. *Create a Layer for Patches:* You need to create a layer to hold 2683. *Create a Layer for Patches:* You need to create a layer to hold
279 patches created for the kernel image. You can use the 269 patches created for the kernel image. You can use the
280 ``bitbake-layers create-layer`` command as follows: 270 ``bitbake-layers create-layer`` command as follows::
281 ::
282 271
283 $ cd poky/build 272 $ cd poky/build
284 $ bitbake-layers create-layer ../../meta-mylayer 273 $ bitbake-layers create-layer ../../meta-mylayer
@@ -301,8 +290,7 @@ section:
3014. *Inform the BitBake Build Environment About Your Layer:* As directed 2904. *Inform the BitBake Build Environment About Your Layer:* As directed
302 when you created your layer, you need to add the layer to the 291 when you created your layer, you need to add the layer to the
303 :term:`BBLAYERS` variable in the 292 :term:`BBLAYERS` variable in the
304 ``bblayers.conf`` file as follows: 293 ``bblayers.conf`` file as follows::
305 ::
306 294
307 $ cd poky/build 295 $ cd poky/build
308 $ bitbake-layers add-layer ../../meta-mylayer 296 $ bitbake-layers add-layer ../../meta-mylayer
@@ -350,8 +338,7 @@ section:
350 the ``yocto-4.12`` branch. 338 the ``yocto-4.12`` branch.
351 339
352 The following commands show how to create a local copy of the 340 The following commands show how to create a local copy of the
353 ``yocto-kernel-cache`` and be in the ``yocto-4.12`` branch: 341 ``yocto-kernel-cache`` and be in the ``yocto-4.12`` branch::
354 ::
355 342
356 $ cd ~ 343 $ cd ~
357 $ git clone git://git.yoctoproject.org/yocto-kernel-cache --branch yocto-4.12 344 $ git clone git://git.yoctoproject.org/yocto-kernel-cache --branch yocto-4.12
@@ -394,8 +381,7 @@ following section describes how to create a layer without the aid of
394tools. These steps assume creation of a layer named ``mylayer`` in your 381tools. These steps assume creation of a layer named ``mylayer`` in your
395home directory: 382home directory:
396 383
3971. *Create Structure*: Create the layer's structure: 3841. *Create Structure*: Create the layer's structure::
398 ::
399 385
400 $ mkdir meta-mylayer 386 $ mkdir meta-mylayer
401 $ mkdir meta-mylayer/conf 387 $ mkdir meta-mylayer/conf
@@ -409,8 +395,7 @@ home directory:
409 395
4102. *Create the Layer Configuration File*: Move to the 3962. *Create the Layer Configuration File*: Move to the
411 ``meta-mylayer/conf`` directory and create the ``layer.conf`` file as 397 ``meta-mylayer/conf`` directory and create the ``layer.conf`` file as
412 follows: 398 follows::
413 ::
414 399
415 # We have a conf and classes directory, add to BBPATH 400 # We have a conf and classes directory, add to BBPATH
416 BBPATH .= ":${LAYERDIR}" 401 BBPATH .= ":${LAYERDIR}"
@@ -429,8 +414,7 @@ home directory:
429 ``meta-mylayer/recipes-kernel/linux`` directory and create the 414 ``meta-mylayer/recipes-kernel/linux`` directory and create the
430 kernel's append file. This example uses the ``linux-yocto-4.12`` 415 kernel's append file. This example uses the ``linux-yocto-4.12``
431 kernel. Thus, the name of the append file is 416 kernel. Thus, the name of the append file is
432 ``linux-yocto_4.12.bbappend``: 417 ``linux-yocto_4.12.bbappend``::
433 ::
434 418
435 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 419 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
436 420
@@ -483,8 +467,7 @@ The append file should initially extend the
483:term:`FILESPATH` search path by 467:term:`FILESPATH` search path by
484prepending the directory that contains your files to the 468prepending the directory that contains your files to the
485:term:`FILESEXTRAPATHS` 469:term:`FILESEXTRAPATHS`
486variable as follows: 470variable as follows::
487::
488 471
489 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 472 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
490 473
@@ -492,8 +475,7 @@ The path ``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``
492expands to "linux-yocto" in the current directory for this example. If 475expands to "linux-yocto" in the current directory for this example. If
493you add any new files that modify the kernel recipe and you have 476you add any new files that modify the kernel recipe and you have
494extended ``FILESPATH`` as described above, you must place the files in 477extended ``FILESPATH`` as described above, you must place the files in
495your layer in the following area: 478your layer in the following area::
496::
497 479
498 your-layer/recipes-kernel/linux/linux-yocto/ 480 your-layer/recipes-kernel/linux/linux-yocto/
499 481
@@ -582,8 +564,7 @@ To group related configurations into multiple files, you perform a
582similar procedure. Here is an example that groups separate 564similar procedure. Here is an example that groups separate
583configurations specifically for Ethernet and graphics into their own 565configurations specifically for Ethernet and graphics into their own
584files and adds the configurations by using a ``SRC_URI`` statement like 566files and adds the configurations by using a ``SRC_URI`` statement like
585the following in your append file: 567the following in your append file::
586::
587 568
588 SRC_URI += "file://myconfig.cfg \ 569 SRC_URI += "file://myconfig.cfg \
589 file://eth.cfg \ 570 file://eth.cfg \
@@ -627,8 +608,7 @@ reference them in :term:`SRC_URI`
627statements. 608statements.
628 609
629For example, you can apply a three-patch series by adding the following 610For example, you can apply a three-patch series by adding the following
630lines to your linux-yocto ``.bbappend`` file in your layer: 611lines to your linux-yocto ``.bbappend`` file in your layer::
631::
632 612
633 SRC_URI += "file://0001-first-change.patch" 613 SRC_URI += "file://0001-first-change.patch"
634 SRC_URI += "file://0002-second-change.patch" 614 SRC_URI += "file://0002-second-change.patch"
@@ -658,8 +638,7 @@ If you have a complete, working Linux kernel ``.config`` file you want
658to use for the configuration, as before, copy that file to the 638to use for the configuration, as before, copy that file to the
659appropriate ``${PN}`` directory in your layer's ``recipes-kernel/linux`` 639appropriate ``${PN}`` directory in your layer's ``recipes-kernel/linux``
660directory, and rename the copied file to "defconfig". Then, add the 640directory, and rename the copied file to "defconfig". Then, add the
661following lines to the linux-yocto ``.bbappend`` file in your layer: 641following lines to the linux-yocto ``.bbappend`` file in your layer::
662::
663 642
664 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 643 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
665 SRC_URI += "file://defconfig" 644 SRC_URI += "file://defconfig"
@@ -685,8 +664,7 @@ Generally speaking, the preferred approach is to determine the
685incremental change you want to make and add that as a configuration 664incremental change you want to make and add that as a configuration
686fragment. For example, if you want to add support for a basic serial 665fragment. For example, if you want to add support for a basic serial
687console, create a file named ``8250.cfg`` in the ``${PN}`` directory 666console, create a file named ``8250.cfg`` in the ``${PN}`` directory
688with the following content (without indentation): 667with the following content (without indentation)::
689::
690 668
691 CONFIG_SERIAL_8250=y 669 CONFIG_SERIAL_8250=y
692 CONFIG_SERIAL_8250_CONSOLE=y 670 CONFIG_SERIAL_8250_CONSOLE=y
@@ -698,8 +676,7 @@ with the following content (without indentation):
698 676
699Next, include this 677Next, include this
700configuration fragment and extend the ``FILESPATH`` variable in your 678configuration fragment and extend the ``FILESPATH`` variable in your
701``.bbappend`` file: 679``.bbappend`` file::
702::
703 680
704 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 681 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
705 SRC_URI += "file://8250.cfg" 682 SRC_URI += "file://8250.cfg"
@@ -718,8 +695,7 @@ It might be desirable to have kernel configuration fragment support
718through a ``defconfig`` file that is pulled from the kernel source tree 695through a ``defconfig`` file that is pulled from the kernel source tree
719for the configured machine. By default, the OpenEmbedded build system 696for the configured machine. By default, the OpenEmbedded build system
720looks for ``defconfig`` files in the layer used for Metadata, which is 697looks for ``defconfig`` files in the layer used for Metadata, which is
721"out-of-tree", and then configures them using the following: 698"out-of-tree", and then configures them using the following::
722::
723 699
724 SRC_URI += "file://defconfig" 700 SRC_URI += "file://defconfig"
725 701
@@ -732,16 +708,14 @@ append files, you can direct the OpenEmbedded build system to use a
732``defconfig`` file that is "in-tree". 708``defconfig`` file that is "in-tree".
733 709
734To specify an "in-tree" ``defconfig`` file, use the following statement 710To specify an "in-tree" ``defconfig`` file, use the following statement
735form: 711form::
736::
737 712
738 KBUILD_DEFCONFIG_KMACHINE ?= "defconfig_file" 713 KBUILD_DEFCONFIG_KMACHINE ?= "defconfig_file"
739 714
740Here is an example 715Here is an example
741that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2" 716that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2"
742and provides the path to the "in-tree" ``defconfig`` file to be used for 717and provides the path to the "in-tree" ``defconfig`` file to be used for
743a Raspberry Pi 2, which is based on the Broadcom 2708/2709 chipset: 718a Raspberry Pi 2, which is based on the Broadcom 2708/2709 chipset::
744::
745 719
746 KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig" 720 KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"
747 721
@@ -792,8 +766,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
792 ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" 766 ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``"
793 section for more information. 767 section for more information.
794 768
795 Use the following ``devtool`` command to check out the code: 769 Use the following ``devtool`` command to check out the code::
796 ::
797 770
798 $ devtool modify linux-yocto 771 $ devtool modify linux-yocto
799 772
@@ -819,14 +792,12 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
819 noted where you can find the source files (e.g. 792 noted where you can find the source files (e.g.
820 ``poky_sdk/workspace/sources/linux-yocto``). Change to where the 793 ``poky_sdk/workspace/sources/linux-yocto``). Change to where the
821 kernel source code is before making your edits to the 794 kernel source code is before making your edits to the
822 ``calibrate.c`` file: 795 ``calibrate.c`` file::
823 ::
824 796
825 $ cd poky_sdk/workspace/sources/linux-yocto 797 $ cd poky_sdk/workspace/sources/linux-yocto
826 798
827 2. *Edit the source file*: Edit the ``init/calibrate.c`` file to have 799 2. *Edit the source file*: Edit the ``init/calibrate.c`` file to have
828 the following changes: 800 the following changes::
829 ::
830 801
831 void calibrate_delay(void) 802 void calibrate_delay(void)
832 { 803 {
@@ -846,8 +817,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
846 . 817 .
847 818
8483. *Build the Updated Kernel Source:* To build the updated kernel 8193. *Build the Updated Kernel Source:* To build the updated kernel
849 source, use ``devtool``: 820 source, use ``devtool``::
850 ::
851 821
852 $ devtool build linux-yocto 822 $ devtool build linux-yocto
853 823
@@ -872,8 +842,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
872 using QEMU to verify your changes: 842 using QEMU to verify your changes:
873 843
874 1. *Boot the image*: Boot the modified image in the QEMU emulator 844 1. *Boot the image*: Boot the modified image in the QEMU emulator
875 using this command: 845 using this command::
876 ::
877 846
878 $ runqemu qemux86 847 $ runqemu qemux86
879 848
@@ -891,8 +860,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
891 860
8926. *Stage and commit your changes*: Within your eSDK terminal, change 8616. *Stage and commit your changes*: Within your eSDK terminal, change
893 your working directory to where you modified the ``calibrate.c`` file 862 your working directory to where you modified the ``calibrate.c`` file
894 and use these Git commands to stage and commit your changes: 863 and use these Git commands to stage and commit your changes::
895 ::
896 864
897 $ cd poky_sdk/workspace/sources/linux-yocto 865 $ cd poky_sdk/workspace/sources/linux-yocto
898 $ git status 866 $ git status
@@ -921,8 +889,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se
921 image that includes your kernel patches. Execute the following 889 image that includes your kernel patches. Execute the following
922 command from your 890 command from your
923 :term:`Build Directory` in the terminal 891 :term:`Build Directory` in the terminal
924 set up to run BitBake: 892 set up to run BitBake::
925 ::
926 893
927 $ cd poky/build 894 $ cd poky/build
928 $ bitbake core-image-minimal 895 $ bitbake core-image-minimal
@@ -966,14 +933,12 @@ Section.
966 1. *Change the working directory*: You need to locate the source 933 1. *Change the working directory*: You need to locate the source
967 files in the local copy of the kernel Git repository. Change to 934 files in the local copy of the kernel Git repository. Change to
968 where the kernel source code is before making your edits to the 935 where the kernel source code is before making your edits to the
969 ``calibrate.c`` file: 936 ``calibrate.c`` file::
970 ::
971 937
972 $ cd ~/linux-yocto-4.12/init 938 $ cd ~/linux-yocto-4.12/init
973 939
974 2. *Edit the source file*: Edit the ``calibrate.c`` file to have the 940 2. *Edit the source file*: Edit the ``calibrate.c`` file to have the
975 following changes: 941 following changes::
976 ::
977 942
978 void calibrate_delay(void) 943 void calibrate_delay(void)
979 { 944 {
@@ -993,8 +958,7 @@ Section.
993 . 958 .
994 959
9952. *Stage and Commit Your Changes:* Use standard Git commands to stage 9602. *Stage and Commit Your Changes:* Use standard Git commands to stage
996 and commit the changes you just made: 961 and commit the changes you just made::
997 ::
998 962
999 $ git add calibrate.c 963 $ git add calibrate.c
1000 $ git commit -m "calibrate.c - Added some printk statements" 964 $ git commit -m "calibrate.c - Added some printk statements"
@@ -1009,13 +973,11 @@ Section.
1009 updated kernel source files. Add 973 updated kernel source files. Add
1010 :term:`SRC_URI` and 974 :term:`SRC_URI` and
1011 :term:`SRCREV` statements similar 975 :term:`SRCREV` statements similar
1012 to the following to your ``local.conf``: 976 to the following to your ``local.conf``::
1013 ::
1014 977
1015 $ cd poky/build/conf 978 $ cd poky/build/conf
1016 979
1017 Add the following to the ``local.conf``: 980 Add the following to the ``local.conf``::
1018 ::
1019 981
1020 SRC_URI_pn-linux-yocto = "git:///path-to/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ 982 SRC_URI_pn-linux-yocto = "git:///path-to/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \
1021 git:///path-to/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" 983 git:///path-to/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}"
@@ -1031,16 +993,14 @@ Section.
1031 993
10324. *Build the Image:* With the source modified, your changes staged and 9944. *Build the Image:* With the source modified, your changes staged and
1033 committed, and the ``local.conf`` file pointing to the kernel files, 995 committed, and the ``local.conf`` file pointing to the kernel files,
1034 you can now use BitBake to build the image: 996 you can now use BitBake to build the image::
1035 ::
1036 997
1037 $ cd poky/build 998 $ cd poky/build
1038 $ bitbake core-image-minimal 999 $ bitbake core-image-minimal
1039 1000
10405. *Boot the image*: Boot the modified image in the QEMU emulator using 10015. *Boot the image*: Boot the modified image in the QEMU emulator using
1041 this command. When prompted to login to the QEMU console, use "root" 1002 this command. When prompted to login to the QEMU console, use "root"
1042 with no password: 1003 with no password::
1043 ::
1044 1004
1045 $ cd poky/build 1005 $ cd poky/build
1046 $ runqemu qemux86 1006 $ runqemu qemux86
@@ -1059,8 +1019,7 @@ Section.
1059 1019
10607. *Generate the Patch File:* Once you are sure that your patch works 10207. *Generate the Patch File:* Once you are sure that your patch works
1061 correctly, you can generate a ``*.patch`` file in the kernel source 1021 correctly, you can generate a ``*.patch`` file in the kernel source
1062 repository: 1022 repository::
1063 ::
1064 1023
1065 $ cd ~/linux-yocto-4.12/init 1024 $ cd ~/linux-yocto-4.12/init
1066 $ git format-patch -1 1025 $ git format-patch -1
@@ -1073,8 +1032,7 @@ Section.
1073 ``meta-mylayer``. When the layer was created using the 1032 ``meta-mylayer``. When the layer was created using the
1074 ``yocto-create`` script, no additional hierarchy was created to 1033 ``yocto-create`` script, no additional hierarchy was created to
1075 support patches. Before moving the patch file, you need to add 1034 support patches. Before moving the patch file, you need to add
1076 additional structure to your layer using the following commands: 1035 additional structure to your layer using the following commands::
1077 ::
1078 1036
1079 $ cd ~/meta-mylayer 1037 $ cd ~/meta-mylayer
1080 $ mkdir recipes-kernel 1038 $ mkdir recipes-kernel
@@ -1083,8 +1041,7 @@ Section.
1083 1041
1084 Once you have created this 1042 Once you have created this
1085 hierarchy in your layer, you can move the patch file using the 1043 hierarchy in your layer, you can move the patch file using the
1086 following command: 1044 following command::
1087 ::
1088 1045
1089 $ mv ~/linux-yocto-4.12/init/0001-calibrate.c-Added-some-printk-statements.patch ~/meta-mylayer/recipes-kernel/linux/linux-yocto 1046 $ mv ~/linux-yocto-4.12/init/0001-calibrate.c-Added-some-printk-statements.patch ~/meta-mylayer/recipes-kernel/linux/linux-yocto
1090 1047
@@ -1093,8 +1050,7 @@ Section.
1093 the OpenEmbedded build system to find the patch. The append file 1050 the OpenEmbedded build system to find the patch. The append file
1094 needs to be in your layer's ``recipes-kernel/linux`` directory and it 1051 needs to be in your layer's ``recipes-kernel/linux`` directory and it
1095 must be named ``linux-yocto_4.12.bbappend`` and have the following 1052 must be named ``linux-yocto_4.12.bbappend`` and have the following
1096 contents: 1053 contents::
1097 ::
1098 1054
1099 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1055 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
1100 SRC_URI_append = "file://0001-calibrate.c-Added-some-printk-statements.patch" 1056 SRC_URI_append = "file://0001-calibrate.c-Added-some-printk-statements.patch"
@@ -1113,8 +1069,7 @@ Section.
1113 To build ``core-image-minimal`` again and see the effects of your patch, 1069 To build ``core-image-minimal`` again and see the effects of your patch,
1114 you can essentially eliminate the temporary source files saved in 1070 you can essentially eliminate the temporary source files saved in
1115 ``poky/build/tmp/work/...`` and residual effects of the build by entering 1071 ``poky/build/tmp/work/...`` and residual effects of the build by entering
1116 the following sequence of commands: 1072 the following sequence of commands::
1117 ::
1118 1073
1119 $ cd poky/build 1074 $ cd poky/build
1120 $ bitbake -c cleanall yocto-linux 1075 $ bitbake -c cleanall yocto-linux
@@ -1160,8 +1115,7 @@ environment, you must do the following:
1160- You must be sure of the state of your build's configuration in the 1115- You must be sure of the state of your build's configuration in the
1161 :term:`Source Directory`. 1116 :term:`Source Directory`.
1162 1117
1163- Your build host must have the following two packages installed: 1118- Your build host must have the following two packages installed::
1164 ::
1165 1119
1166 libncurses5-dev 1120 libncurses5-dev
1167 libtinfo-dev 1121 libtinfo-dev
@@ -1169,8 +1123,7 @@ environment, you must do the following:
1169The following commands initialize the BitBake environment, run the 1123The following commands initialize the BitBake environment, run the
1170:ref:`ref-tasks-kernel_configme` 1124:ref:`ref-tasks-kernel_configme`
1171task, and launch ``menuconfig``. These commands assume the Source 1125task, and launch ``menuconfig``. These commands assume the Source
1172Directory's top-level folder is ``poky``: 1126Directory's top-level folder is ``poky``::
1173::
1174 1127
1175 $ cd poky 1128 $ cd poky
1176 $ source oe-init-build-env 1129 $ source oe-init-build-env
@@ -1232,8 +1185,7 @@ the ``.config`` file would be:
1232 1185
1233Within the ``.config`` file, you can see the kernel settings. For 1186Within the ``.config`` file, you can see the kernel settings. For
1234example, the following entry shows that symmetric multi-processor 1187example, the following entry shows that symmetric multi-processor
1235support is not set: 1188support is not set::
1236::
1237 1189
1238 # CONFIG_SMP is not set 1190 # CONFIG_SMP is not set
1239 1191
@@ -1274,8 +1226,7 @@ your layer's ``recipes-kernel/linux`` directory, and rename the copied
1274file to "defconfig" (e.g. 1226file to "defconfig" (e.g.
1275``~/meta-mylayer/recipes-kernel/linux/linux-yocto/defconfig``). Then, 1227``~/meta-mylayer/recipes-kernel/linux/linux-yocto/defconfig``). Then,
1276add the following lines to the linux-yocto ``.bbappend`` file in your 1228add the following lines to the linux-yocto ``.bbappend`` file in your
1277layer: 1229layer::
1278::
1279 1230
1280 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1231 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
1281 SRC_URI += "file://defconfig" 1232 SRC_URI += "file://defconfig"
@@ -1323,8 +1274,7 @@ appear in the ``.config`` file, which is in the :term:`Build Directory`.
1323It is simple to create a configuration fragment. One method is to use 1274It is simple to create a configuration fragment. One method is to use
1324shell commands. For example, issuing the following from the shell 1275shell commands. For example, issuing the following from the shell
1325creates a configuration fragment file named ``my_smp.cfg`` that enables 1276creates a configuration fragment file named ``my_smp.cfg`` that enables
1326multi-processor support within the kernel: 1277multi-processor support within the kernel::
1327::
1328 1278
1329 $ echo "CONFIG_SMP=y" >> my_smp.cfg 1279 $ echo "CONFIG_SMP=y" >> my_smp.cfg
1330 1280
@@ -1342,8 +1292,7 @@ To create a configuration fragment using this method, follow these
1342steps: 1292steps:
1343 1293
13441. *Complete a Build Through Kernel Configuration:* Complete a build at 12941. *Complete a Build Through Kernel Configuration:* Complete a build at
1345 least through the kernel configuration task as follows: 1295 least through the kernel configuration task as follows::
1346 ::
1347 1296
1348 $ bitbake linux-yocto -c kernel_configme -f 1297 $ bitbake linux-yocto -c kernel_configme -f
1349 1298
@@ -1352,8 +1301,7 @@ steps:
1352 your build state might become unknown, it is best to run this task 1301 your build state might become unknown, it is best to run this task
1353 prior to starting ``menuconfig``. 1302 prior to starting ``menuconfig``.
1354 1303
13552. *Launch menuconfig:* Run the ``menuconfig`` command: 13042. *Launch menuconfig:* Run the ``menuconfig`` command::
1356 ::
1357 1305
1358 $ bitbake linux-yocto -c menuconfig 1306 $ bitbake linux-yocto -c menuconfig
1359 1307
@@ -1361,8 +1309,7 @@ steps:
1361 to prepare a configuration fragment. The resulting file 1309 to prepare a configuration fragment. The resulting file
1362 ``fragment.cfg`` is placed in the 1310 ``fragment.cfg`` is placed in the
1363 ``${``\ :term:`WORKDIR`\ ``}`` 1311 ``${``\ :term:`WORKDIR`\ ``}``
1364 directory: 1312 directory::
1365 ::
1366 1313
1367 $ bitbake linux-yocto -c diffconfig 1314 $ bitbake linux-yocto -c diffconfig
1368 1315
@@ -1387,8 +1334,7 @@ options in a file called ``myconfig.cfg``. If you put that file inside a
1387directory named ``linux-yocto`` that resides in the same directory as 1334directory named ``linux-yocto`` that resides in the same directory as
1388the kernel's append file within your layer and then add the following 1335the kernel's append file within your layer and then add the following
1389statements to the kernel's append file, those configuration options will 1336statements to the kernel's append file, those configuration options will
1390be picked up and applied when the kernel is built: 1337be picked up and applied when the kernel is built::
1391::
1392 1338
1393 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1339 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
1394 SRC_URI += "file://myconfig.cfg" 1340 SRC_URI += "file://myconfig.cfg"
@@ -1397,8 +1343,7 @@ As mentioned earlier, you can group related configurations into multiple
1397files and name them all in the ``SRC_URI`` statement as well. For 1343files and name them all in the ``SRC_URI`` statement as well. For
1398example, you could group separate configurations specifically for 1344example, you could group separate configurations specifically for
1399Ethernet and graphics into their own files and add those by using a 1345Ethernet and graphics into their own files and add those by using a
1400``SRC_URI`` statement like the following in your append file: 1346``SRC_URI`` statement like the following in your append file::
1401::
1402 1347
1403 SRC_URI += "file://myconfig.cfg \ 1348 SRC_URI += "file://myconfig.cfg \
1404 file://eth.cfg \ 1349 file://eth.cfg \
@@ -1409,8 +1354,7 @@ Validating Configuration
1409 1354
1410You can use the 1355You can use the
1411:ref:`ref-tasks-kernel_configcheck` 1356:ref:`ref-tasks-kernel_configcheck`
1412task to provide configuration validation: 1357task to provide configuration validation::
1413::
1414 1358
1415 $ bitbake linux-yocto -c kernel_configcheck -f 1359 $ bitbake linux-yocto -c kernel_configcheck -f
1416 1360
@@ -1537,8 +1481,7 @@ To streamline the configuration, do the following:
1537 successfully. Use this configuration file as your baseline. 1481 successfully. Use this configuration file as your baseline.
1538 1482
15392. *Run Configure and Check Tasks:* Separately run the 14832. *Run Configure and Check Tasks:* Separately run the
1540 ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks: 1484 ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks::
1541 ::
1542 1485
1543 $ bitbake linux-yocto -c kernel_configme -f 1486 $ bitbake linux-yocto -c kernel_configme -f
1544 $ bitbake linux-yocto -c kernel_configcheck -f 1487 $ bitbake linux-yocto -c kernel_configcheck -f
@@ -1572,8 +1515,7 @@ Expanding Variables
1572Sometimes it is helpful to determine what a variable expands to during a 1515Sometimes it is helpful to determine what a variable expands to during a
1573build. You can examine the values of variables by examining the 1516build. You can examine the values of variables by examining the
1574output of the ``bitbake -e`` command. The output is long and is more 1517output of the ``bitbake -e`` command. The output is long and is more
1575easily managed in a text file, which allows for easy searches: 1518easily managed in a text file, which allows for easy searches::
1576::
1577 1519
1578 $ bitbake -e virtual/kernel > some_text_file 1520 $ bitbake -e virtual/kernel > some_text_file
1579 1521
@@ -1590,15 +1532,13 @@ source directory. Follow these steps to clean up the version string:
1590 1532
15911. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned 15331. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned
1592 Git repository (source directory) and use the following Git command 1534 Git repository (source directory) and use the following Git command
1593 to list the files that have been changed, added, or removed: 1535 to list the files that have been changed, added, or removed::
1594 ::
1595 1536
1596 $ git status 1537 $ git status
1597 1538
15982. *Commit the Changes:* You should commit those changes to the kernel 15392. *Commit the Changes:* You should commit those changes to the kernel
1599 source tree regardless of whether or not you will save, export, or 1540 source tree regardless of whether or not you will save, export, or
1600 use the changes: 1541 use the changes::
1601 ::
1602 1542
1603 $ git add 1543 $ git add
1604 $ git commit -s -a -m "getting rid of -dirty" 1544 $ git commit -s -a -m "getting rid of -dirty"
@@ -1633,8 +1573,7 @@ linux-yocto custom recipe (``linux-yocto-custom.bb``) that uses
1633``kernel.org`` sources and the Yocto Project Linux kernel tools for 1573``kernel.org`` sources and the Yocto Project Linux kernel tools for
1634managing kernel Metadata. You can find this recipe in the ``poky`` Git 1574managing kernel Metadata. You can find this recipe in the ``poky`` Git
1635repository of the Yocto Project :yocto_git:`Source Repository <>` 1575repository of the Yocto Project :yocto_git:`Source Repository <>`
1636at: 1576at::
1637::
1638 1577
1639 poky/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb 1578 poky/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb
1640 1579
@@ -1655,8 +1594,7 @@ Here are some basic steps you can use to work with your own sources:
1655 ``defconfig`` file or configuration fragment files in your layer. 1594 ``defconfig`` file or configuration fragment files in your layer.
1656 When you use the ``linux-yocto-custom.bb`` recipe, you must specify a 1595 When you use the ``linux-yocto-custom.bb`` recipe, you must specify a
1657 configuration. If you do not have a ``defconfig`` file, you can run 1596 configuration. If you do not have a ``defconfig`` file, you can run
1658 the following: 1597 the following::
1659 ::
1660 1598
1661 $ make defconfig 1599 $ make defconfig
1662 1600
@@ -1708,8 +1646,7 @@ Here are some basic steps you can use to work with your own sources:
1708 ``LINUX_VERSION`` with the Source Control Manager (SCM) revision 1646 ``LINUX_VERSION`` with the Source Control Manager (SCM) revision
1709 as derived from the :term:`SRCPV` 1647 as derived from the :term:`SRCPV`
1710 variable. The combined results are a string with the following 1648 variable. The combined results are a string with the following
1711 form: 1649 form::
1712 ::
1713 1650
1714 3.19.11+git1+68a635bf8dfb64b02263c1ac80c948647cc76d5f_1+218bd8d2022b9852c60d32f0d770931e3cf343e2 1651 3.19.11+git1+68a635bf8dfb64b02263c1ac80c948647cc76d5f_1+218bd8d2022b9852c60d32f0d770931e3cf343e2
1715 1652
@@ -1723,8 +1660,7 @@ Here are some basic steps you can use to work with your own sources:
1723 triggers an explicit build failure. You must change it to match a 1660 triggers an explicit build failure. You must change it to match a
1724 list of the machines that your new recipe supports. For example, 1661 list of the machines that your new recipe supports. For example,
1725 to support the ``qemux86`` and ``qemux86-64`` machines, use the 1662 to support the ``qemux86`` and ``qemux86-64`` machines, use the
1726 following form: 1663 following form::
1727 ::
1728 1664
1729 COMPATIBLE_MACHINE = "qemux86|qemux86-64" 1665 COMPATIBLE_MACHINE = "qemux86|qemux86-64"
1730 1666
@@ -1807,8 +1743,7 @@ Typically, you will need to set the following variables:
1807 1743
1808Depending on the build system used by the module sources, you might need 1744Depending on the build system used by the module sources, you might need
1809to make some adjustments. For example, a typical module ``Makefile`` 1745to make some adjustments. For example, a typical module ``Makefile``
1810looks much like the one provided with the ``hello-mod`` template: 1746looks much like the one provided with the ``hello-mod`` template::
1811::
1812 1747
1813 obj-m := hello.o 1748 obj-m := hello.o
1814 1749
@@ -1845,8 +1780,7 @@ them appropriately for your machine configuration file:
1845- :term:`MACHINE_EXTRA_RRECOMMENDS` 1780- :term:`MACHINE_EXTRA_RRECOMMENDS`
1846 1781
1847Modules are often not required for boot and can be excluded from certain 1782Modules are often not required for boot and can be excluded from certain
1848build configurations. The following allows for the most flexibility: 1783build configurations. The following allows for the most flexibility::
1849::
1850 1784
1851 MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule" 1785 MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule"
1852 1786
@@ -1895,26 +1829,22 @@ branch.
1895 1829
1896 $ git whatchanged origin/standard/base..origin/standard/emenlow 1830 $ git whatchanged origin/standard/base..origin/standard/emenlow
1897 1831
1898To see short, one line summaries of changes use the ``git log`` command: 1832To see short, one line summaries of changes use the ``git log`` command::
1899::
1900 1833
1901 $ git log --oneline origin/standard/base..origin/standard/emenlow 1834 $ git log --oneline origin/standard/base..origin/standard/emenlow
1902 1835
1903Use this command to see code differences for the changes: 1836Use this command to see code differences for the changes::
1904::
1905 1837
1906 $ git diff origin/standard/base..origin/standard/emenlow 1838 $ git diff origin/standard/base..origin/standard/emenlow
1907 1839
1908Use this command to see the commit log messages and the text 1840Use this command to see the commit log messages and the text
1909differences: 1841differences::
1910::
1911 1842
1912 $ git show origin/standard/base..origin/standard/emenlow 1843 $ git show origin/standard/base..origin/standard/emenlow
1913 1844
1914Use this command to create individual patches for each change. Here is 1845Use this command to create individual patches for each change. Here is
1915an example that creates patch files for each commit and places them 1846an example that creates patch files for each commit and places them
1916in your ``Documents`` directory: 1847in your ``Documents`` directory::
1917::
1918 1848
1919 $ git format-patch -o $HOME/Documents origin/standard/base..origin/standard/emenlow 1849 $ git format-patch -o $HOME/Documents origin/standard/base..origin/standard/emenlow
1920 1850
@@ -1923,15 +1853,13 @@ Showing a Particular Feature or Branch Change
1923 1853
1924Tags in the Yocto Project kernel tree divide changes for significant 1854Tags in the Yocto Project kernel tree divide changes for significant
1925features or branches. The ``git show`` tag command shows changes based 1855features or branches. The ``git show`` tag command shows changes based
1926on a tag. Here is an example that shows ``systemtap`` changes: 1856on a tag. Here is an example that shows ``systemtap`` changes::
1927::
1928 1857
1929 $ git show systemtap 1858 $ git show systemtap
1930 1859
1931You can use the ``git branch --contains`` tag command to 1860You can use the ``git branch --contains`` tag command to
1932show the branches that contain a particular feature. This command shows 1861show the branches that contain a particular feature. This command shows
1933the branches that contain the ``systemtap`` feature: 1862the branches that contain the ``systemtap`` feature::
1934::
1935 1863
1936 $ git branch --contains systemtap 1864 $ git branch --contains systemtap
1937 1865
@@ -1986,8 +1914,7 @@ build.
1986 searched during the build as potential feature directories. 1914 searched during the build as potential feature directories.
1987 1915
1988 Continuing with the example, suppose the "test.scc" feature you are 1916 Continuing with the example, suppose the "test.scc" feature you are
1989 adding has a ``test.scc`` file in the following directory: 1917 adding has a ``test.scc`` file in the following directory::
1990 ::
1991 1918
1992 my_recipe 1919 my_recipe
1993 | 1920 |
@@ -2001,8 +1928,7 @@ build.
2001 a similarly named configuration fragment file ``test.cfg``. 1928 a similarly named configuration fragment file ``test.cfg``.
2002 1929
20032. *Add the Feature File to SRC_URI:* Add the ``.scc`` file to the 19302. *Add the Feature File to SRC_URI:* Add the ``.scc`` file to the
2004 recipe's ``SRC_URI`` statement: 1931 recipe's ``SRC_URI`` statement::
2005 ::
2006 1932
2007 SRC_URI_append = " file://test.scc" 1933 SRC_URI_append = " file://test.scc"
2008 1934
@@ -2011,8 +1937,7 @@ build.
2011 1937
20123. *Specify the Feature as a Kernel Feature:* Use the 19383. *Specify the Feature as a Kernel Feature:* Use the
2013 ``KERNEL_FEATURES`` statement to specify the feature as a kernel 1939 ``KERNEL_FEATURES`` statement to specify the feature as a kernel
2014 feature: 1940 feature::
2015 ::
2016 1941
2017 KERNEL_FEATURES_append = " test.scc" 1942 KERNEL_FEATURES_append = " test.scc"
2018 1943