summaryrefslogtreecommitdiffstats
path: root/documentation/kernel-dev/kernel-dev-common.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/kernel-dev/kernel-dev-common.rst')
-rw-r--r--documentation/kernel-dev/kernel-dev-common.rst333
1 files changed, 143 insertions, 190 deletions
diff --git a/documentation/kernel-dev/kernel-dev-common.rst b/documentation/kernel-dev/kernel-dev-common.rst
index 64235f3803..370acf1388 100644
--- a/documentation/kernel-dev/kernel-dev-common.rst
+++ b/documentation/kernel-dev/kernel-dev-common.rst
@@ -33,12 +33,10 @@ Source Directory.
33 33
34 Be sure you check out the appropriate development branch or you 34 Be sure you check out the appropriate development branch or you
35 create your local branch by checking out a specific tag to get the 35 create your local branch by checking out a specific tag to get the
36 desired version of Yocto Project. See the " 36 desired version of Yocto Project. See the
37 Checking Out by Branch in Poky 37 ":ref:`dev-manual/dev-manual-start:checking out by branch in poky`" and
38 " and " 38 ":ref:`dev-manual/dev-manual-start:checking out by tag in poky`"
39 Checking Out by Tag in Poky 39 sections in the Yocto Project Development Tasks Manual for more information.
40 " sections in the Yocto Project Development Tasks Manual for more
41 information.
42 40
43Kernel development is best accomplished using 41Kernel development is best accomplished using
44:ref:`devtool <sdk-manual/sdk-extensible:using \`\`devtool\`\` in your sdk workflow>` 42:ref:`devtool <sdk-manual/sdk-extensible:using \`\`devtool\`\` in your sdk workflow>`
@@ -50,8 +48,8 @@ Getting Ready to Develop Using ``devtool``
50 48
51Follow these steps to prepare to update the kernel image using 49Follow these steps to prepare to update the kernel image using
52``devtool``. Completing this procedure leaves you with a clean kernel 50``devtool``. Completing this procedure leaves you with a clean kernel
53image and ready to make modifications as described in the " 51image and ready to make modifications as described in the
54:ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`" 52":ref:`kernel-dev/kernel-dev-common:using \`\`devtool\`\` to patch the kernel`"
55section: 53section:
56 54
571. *Initialize the BitBake Environment:* Before building an extensible 551. *Initialize the BitBake Environment:* Before building an extensible
@@ -65,10 +63,8 @@ section:
65 .. note:: 63 .. note::
66 64
67 The previous commands assume the 65 The previous commands assume the
68 Source Repositories 66 :ref:`overview-manual/overview-manual-development-environment:yocto project source repositories`
69 (i.e. 67 (i.e. ``poky``) have been cloned using Git and the local repository is named
70 poky
71 ) have been cloned using Git and the local repository is named
72 "poky". 68 "poky".
73 69
742. *Prepare Your local.conf File:* By default, the 702. *Prepare Your local.conf File:* By default, the
@@ -107,18 +103,15 @@ section:
107 .. note:: 103 .. note::
108 104
109 For background information on working with common and BSP layers, 105 For background information on working with common and BSP layers,
110 see the " 106 see the
111 Understanding and Creating Layers 107 ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`"
112 " section in the Yocto Project Development Tasks Manual and the " 108 section in the Yocto Project Development Tasks Manual and the
113 BSP Layers 109 ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto Project Board
114 " section in the Yocto Project Board Support (BSP) Developer's 110 Support (BSP) Developer's Guide, respectively. For information on how to
115 Guide, respectively. For information on how to use the 111 use the ``bitbake-layers create-layer`` command to quickly set up a layer,
116 bitbake-layers create-layer 112 see the
117 command to quickly set up a layer, see the " 113 ":ref:`dev-manual/dev-manual-common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`"
118 Creating a General Layer Using the 114 section in the Yocto Project Development Tasks Manual.
119 bitbake-layers
120 Script
121 " section in the Yocto Project Development Tasks Manual.
122 115
1234. *Inform the BitBake Build Environment About Your Layer:* As directed 1164. *Inform the BitBake Build Environment About Your Layer:* As directed
124 when you created your layer, you need to add the layer to the 117 when you created your layer, you need to add the layer to the
@@ -141,9 +134,12 @@ section:
141 Once 134 Once
142 the build finishes, you can find the SDK installer file (i.e. 135 the build finishes, you can find the SDK installer file (i.e.
143 ``*.sh`` file) in the following directory: 136 ``*.sh`` file) in the following directory:
144 ~/poky/build/tmp/deploy/sdk For this example, the installer file is 137 ::
145 named 138
146 ``poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-DISTRO.sh`` 139 ~/poky/build/tmp/deploy/sdk
140
141 For this example, the installer file is named
142 ``poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-DISTRO.sh``.
147 143
1486. *Install the Extensible SDK:* Use the following command to install 1446. *Install the Extensible SDK:* Use the following command to install
149 the SDK. For this example, install the SDK in the default 145 the SDK. For this example, install the SDK in the default
@@ -211,7 +207,7 @@ section:
211 building for actual hardware and not for emulation, you could flash 207 building for actual hardware and not for emulation, you could flash
212 the image to a USB stick on ``/dev/sdd`` and boot your device. For an 208 the image to a USB stick on ``/dev/sdd`` and boot your device. For an
213 example that uses a Minnowboard, see the 209 example that uses a Minnowboard, see the
214 `TipsAndTricks/KernelDevelopmentWithEsdk <https://wiki.yoctoproject.org/wiki/TipsAndTricks/KernelDevelopmentWithEsdk>`__ 210 :yocto_wiki:`TipsAndTricks/KernelDevelopmentWithEsdk </wiki/TipsAndTricks/KernelDevelopmentWithEsdk>`
215 Wiki page. 211 Wiki page.
216 212
217At this point you have set up to start making modifications to the 213At this point you have set up to start making modifications to the
@@ -247,16 +243,14 @@ section:
247 $ cd ~/poky 243 $ cd ~/poky
248 $ git branch 244 $ git branch
249 master 245 master
250 * &DISTRO_NAME; 246 * &DISTRO_NAME_NO_CAP;
251 $ source oe-init-build-env 247 $ source oe-init-build-env
252 248
253 .. note:: 249 .. note::
254 250
255 The previous commands assume the 251 The previous commands assume the
256 Source Repositories 252 :ref:`overview-manual/overview-manual-development-environment:yocto project source repositories`
257 (i.e. 253 (i.e. ``poky``) have been cloned using Git and the local repository is named
258 poky
259 ) have been cloned using Git and the local repository is named
260 "poky". 254 "poky".
261 255
2622. *Prepare Your local.conf File:* By default, the 2562. *Prepare Your local.conf File:* By default, the
@@ -294,18 +288,15 @@ section:
294 .. note:: 288 .. note::
295 289
296 For background information on working with common and BSP layers, 290 For background information on working with common and BSP layers,
297 see the " 291 see the
298 Understanding and Creating Layers 292 ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`"
299 " section in the Yocto Project Development Tasks Manual and the " 293 section in the Yocto Project Development Tasks Manual and the
300 BSP Layers 294 ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto Project Board
301 " section in the Yocto Project Board Support (BSP) Developer's 295 Support (BSP) Developer's Guide, respectively. For information on how to
302 Guide, respectively. For information on how to use the 296 use the ``bitbake-layers create-layer`` command to quickly set up a layer,
303 bitbake-layers create-layer 297 see the
304 command to quickly set up a layer, see the " 298 ":ref:`dev-manual/dev-manual-common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`"
305 Creating a General Layer Using the 299 section in the Yocto Project Development Tasks Manual.
306 bitbake-layers
307 Script
308 " section in the Yocto Project Development Tasks Manual.
309 300
3104. *Inform the BitBake Build Environment About Your Layer:* As directed 3014. *Inform the BitBake Build Environment About Your Layer:* As directed
311 when you created your layer, you need to add the layer to the 302 when you created your layer, you need to add the layer to the
@@ -334,12 +325,10 @@ section:
334 325
335 .. note:: 326 .. note::
336 327
337 The 328 The ``linux-yocto-4.12`` kernel can be used with the Yocto Project 2.4
338 linux-yocto-4.12 329 release and forward.
339 kernel can be used with the Yocto Project 2.4 release and forward. 330 You cannot use the ``linux-yocto-4.12`` kernel with releases prior to
340 You cannot use the 331 Yocto Project 2.4.
341 linux-yocto-4.12
342 kernel with releases prior to Yocto Project 2.4:
343 332
344 :: 333 ::
345 334
@@ -351,7 +340,7 @@ section:
351 remote: Total 6097195 (delta 5152604), reused 6096847 (delta 5152256) 340 remote: Total 6097195 (delta 5152604), reused 6096847 (delta 5152256)
352 Receiving objects: 100% (6097195/6097195), 1.24 GiB | 7.81 MiB/s, done. 341 Receiving objects: 100% (6097195/6097195), 1.24 GiB | 7.81 MiB/s, done.
353 Resolving deltas: 100% (5152604/5152604), done. Checking connectivity... done. 342 Resolving deltas: 100% (5152604/5152604), done. Checking connectivity... done.
354 Checking out files: 100% (59846/59846), done. 343 Checking out files: 100% (59846/59846), done.
355 344
3566. *Create a Local Copy of the Kernel Cache Git Repository:* For 3456. *Create a Local Copy of the Kernel Cache Git Repository:* For
357 simplicity, it is recommended that you create your copy of the kernel 346 simplicity, it is recommended that you create your copy of the kernel
@@ -395,13 +384,10 @@ section in the Yocto Project Development Tasks Manual.
395.. note:: 384.. note::
396 385
397 The Yocto Project comes with many tools that simplify tasks you need 386 The Yocto Project comes with many tools that simplify tasks you need
398 to perform. One such tool is the 387 to perform. One such tool is the ``bitbake-layers create-layer``
399 bitbake-layers create-layer 388 command, which simplifies creating a new layer. See the
400 command, which simplifies creating a new layer. See the " 389 ":ref:`dev-manual/dev-manual-common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`"
401 Creating a General Layer Using the 390 section in the Yocto Project Development Tasks Manual for
402 bitbake-layers
403 Script
404 " section in the Yocto Project Development Tasks Manual for
405 information on how to use this script to quick set up a new layer. 391 information on how to use this script to quick set up a new layer.
406 392
407To better understand the layer you create for kernel development, the 393To better understand the layer you create for kernel development, the
@@ -471,11 +457,11 @@ the :term:`Source Directory` in
471 457
472Modifying an existing recipe can consist of the following: 458Modifying an existing recipe can consist of the following:
473 459
474- Creating the append file 460- :ref:`kernel-dev/kernel-dev-common:creating the append file`
475 461
476- Applying patches 462- :ref:`kernel-dev/kernel-dev-common:applying patches`
477 463
478- Changing the configuration 464- :ref:`kernel-dev/kernel-dev-common:changing the configuration`
479 465
480Before modifying an existing recipe, be sure that you have created a 466Before modifying an existing recipe, be sure that you have created a
481minimal, custom layer from which you can work. See the "`Creating and 467minimal, custom layer from which you can work. See the "`Creating and
@@ -490,7 +476,8 @@ based on the linux-yocto recipe you are using. For example, if you are
490modifying the ``meta/recipes-kernel/linux/linux-yocto_4.12.bb`` recipe, 476modifying the ``meta/recipes-kernel/linux/linux-yocto_4.12.bb`` recipe,
491the append file will typically be located as follows within your custom 477the append file will typically be located as follows within your custom
492layer: 478layer:
493:: 479
480.. code-block:: none
494 481
495 your-layer/recipes-kernel/linux/linux-yocto_4.12.bbappend 482 your-layer/recipes-kernel/linux/linux-yocto_4.12.bbappend
496 483
@@ -515,13 +502,12 @@ your layer in the following area:
515.. note:: 502.. note::
516 503
517 If you are working on a new machine Board Support Package (BSP), be 504 If you are working on a new machine Board Support Package (BSP), be
518 sure to refer to the 505 sure to refer to the :doc:`../bsp-guide/bsp-guide`.
519 Yocto Project Board Support Package (BSP) Developer's Guide
520 .
521 506
522As an example, consider the following append file used by the BSPs in 507As an example, consider the following append file used by the BSPs in
523``meta-yocto-bsp``: 508``meta-yocto-bsp``:
524:: 509
510.. code-block:: none
525 511
526 meta-yocto-bsp/recipes-kernel/linux/linux-yocto_4.12.bbappend 512 meta-yocto-bsp/recipes-kernel/linux/linux-yocto_4.12.bbappend
527 513
@@ -689,17 +675,13 @@ created to hold the configuration changes.
689 675
690.. note:: 676.. note::
691 677
692 The build system applies the configurations from the 678 The build system applies the configurations from the ``defconfig``
693 defconfig
694 file before applying any subsequent configuration fragments. The 679 file before applying any subsequent configuration fragments. The
695 final kernel configuration is a combination of the configurations in 680 final kernel configuration is a combination of the configurations in
696 the 681 the ``defconfig`` file and any configuration fragments you provide. You need
697 defconfig 682 to realize that if you have any configuration fragments, the build system
698 file and any configuration fragments you provide. You need to realize 683 applies these on top of and after applying the existing ``defconfig`` file
699 that if you have any configuration fragments, the build system 684 configurations.
700 applies these on top of and after applying the existing
701 defconfig
702 file configurations.
703 685
704Generally speaking, the preferred approach is to determine the 686Generally speaking, the preferred approach is to determine the
705incremental change you want to make and add that as a configuration 687incremental change you want to make and add that as a configuration
@@ -755,7 +737,7 @@ To specify an "in-tree" ``defconfig`` file, use the following statement
755form: 737form:
756:: 738::
757 739
758 KBUILD_DEFCONFIG_KMACHINE ?= defconfig_file 740 KBUILD_DEFCONFIG_KMACHINE ?= "defconfig_file"
759 741
760Here is an example 742Here is an example
761that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2" 743that assigns the ``KBUILD_DEFCONFIG`` variable based on "raspberrypi2"
@@ -768,7 +750,7 @@ a Raspberry Pi 2, which is based on the Broadcom 2708/2709 chipset:
768Aside from modifying your kernel recipe and providing your own 750Aside from modifying your kernel recipe and providing your own
769``defconfig`` file, you need to be sure no files or statements set 751``defconfig`` file, you need to be sure no files or statements set
770``SRC_URI`` to use a ``defconfig`` other than your "in-tree" file (e.g. 752``SRC_URI`` to use a ``defconfig`` other than your "in-tree" file (e.g.
771a kernel's ``linux-``\ machine\ ``.inc`` file). In other words, if the 753a kernel's ``linux-``\ `machine`\ ``.inc`` file). In other words, if the
772build system detects a statement that identifies an "out-of-tree" 754build system detects a statement that identifies an "out-of-tree"
773``defconfig`` file, that statement will override your 755``defconfig`` file, that statement will override your
774``KBUILD_DEFCONFIG`` variable. 756``KBUILD_DEFCONFIG`` variable.
@@ -786,10 +768,9 @@ the extensible SDK and ``devtool``.
786.. note:: 768.. note::
787 769
788 Before attempting this procedure, be sure you have performed the 770 Before attempting this procedure, be sure you have performed the
789 steps to get ready for updating the kernel as described in the " 771 steps to get ready for updating the kernel as described in the
790 Getting Ready to Develop Using 772 ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devtool\`\``"
791 devtool 773 section.
792 " section.
793 774
794Patching the kernel involves changing or adding configurations to an 775Patching the kernel involves changing or adding configurations to an
795existing kernel, changing or adding recipes to the kernel that are 776existing kernel, changing or adding recipes to the kernel that are
@@ -809,12 +790,9 @@ the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devto
809 790
810 .. note:: 791 .. note::
811 792
812 See this 793 See this step in the
813 step 794 ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devtool\`\``"
814 in the " 795 section for more information.
815 Getting Ready to Develop Using
816 devtool
817 " section for more information.
818 796
819 Use the following ``devtool`` command to check out the code: 797 Use the following ``devtool`` command to check out the code:
820 :: 798 ::
@@ -825,7 +803,8 @@ the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devto
825 803
826 During the checkout operation, a bug exists that could cause 804 During the checkout operation, a bug exists that could cause
827 errors such as the following to appear: 805 errors such as the following to appear:
828 :: 806
807 .. code-block:: none
829 808
830 ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus 809 ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus
831 be3a89ce7c47178880ba7bf6293d7404 for 810 be3a89ce7c47178880ba7bf6293d7404 for
@@ -883,7 +862,7 @@ the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devto
883 If the image you originally created resulted in a Wic file, you 862 If the image you originally created resulted in a Wic file, you
884 can use an alternate method to create the new image with the 863 can use an alternate method to create the new image with the
885 updated kernel. For an example, see the steps in the 864 updated kernel. For an example, see the steps in the
886 TipsAndTricks/KernelDevelopmentWithEsdk 865 :yocto_wiki:`TipsAndTricks/KernelDevelopmentWithEsdk </wiki/TipsAndTricks/KernelDevelopmentWithEsdk>`
887 Wiki Page. 866 Wiki Page.
888 867
889 :: 868 ::
@@ -903,7 +882,8 @@ the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devto
903 2. *Verify the changes*: Log into the machine using ``root`` with no 882 2. *Verify the changes*: Log into the machine using ``root`` with no
904 password and then use the following shell command to scroll 883 password and then use the following shell command to scroll
905 through the console's boot output. 884 through the console's boot output.
906 :: 885
886 .. code-block:: none
907 887
908 # dmesg | less 888 # dmesg | less
909 889
@@ -925,14 +905,15 @@ the ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devto
925 commits as patches and create a ``.bbappend`` file, use the following 905 commits as patches and create a ``.bbappend`` file, use the following
926 command in the terminal used to work with the extensible SDK. This 906 command in the terminal used to work with the extensible SDK. This
927 example uses the previously established layer named ``meta-mylayer``. 907 example uses the previously established layer named ``meta-mylayer``.
908 ::
928 909
929 .. note:: 910 $ devtool finish linux-yocto ~/meta-mylayer
930 911
931 See Step 3 of the " 912 .. note::
932 Getting Ready to Develop Using devtool
933 " section for information on setting up this layer.
934 913
935 $ devtool finish linux-yocto ~/meta-mylayer 914 See Step 3 of the
915 ":ref:`kernel-dev/kernel-dev-common:getting ready to develop using \`\`devtool\`\``"
916 section for information on setting up this layer.
936 917
937 Once the command 918 Once the command
938 finishes, the patches and the ``.bbappend`` file are located in the 919 finishes, the patches and the ``.bbappend`` file are located in the
@@ -960,9 +941,9 @@ section).
960.. note:: 941.. note::
961 942
962 Before attempting this procedure, be sure you have performed the 943 Before attempting this procedure, be sure you have performed the
963 steps to get ready for updating the kernel as described in the " 944 steps to get ready for updating the kernel as described in the
964 Getting Ready for Traditional Kernel Development 945 ":ref:`kernel-dev/kernel-dev-common:getting ready for traditional kernel development`"
965 " section. 946 section.
966 947
967Patching the kernel involves changing or adding configurations to an 948Patching the kernel involves changing or adding configurations to an
968existing kernel, changing or adding recipes to the kernel that are 949existing kernel, changing or adding recipes to the kernel that are
@@ -986,7 +967,7 @@ Section.
986 section, use the following commands to edit the ``calibrate.c`` file: 967 section, use the following commands to edit the ``calibrate.c`` file:
987 968
988 1. *Change the working directory*: You need to locate the source 969 1. *Change the working directory*: You need to locate the source
989 files in the local copy of the kernel Git repository: Change to 970 files in the local copy of the kernel Git repository. Change to
990 where the kernel source code is before making your edits to the 971 where the kernel source code is before making your edits to the
991 ``calibrate.c`` file: 972 ``calibrate.c`` file:
992 :: 973 ::
@@ -1046,13 +1027,10 @@ Section.
1046 1027
1047 .. note:: 1028 .. note::
1048 1029
1049 Be sure to replace 1030 Be sure to replace `path-to`
1050 path-to
1051 with the pathname to your local Git repositories. Also, you must 1031 with the pathname to your local Git repositories. Also, you must
1052 be sure to specify the correct branch and machine types. For this 1032 be sure to specify the correct branch and machine types. For this
1053 example, the branch is 1033 example, the branch is ``standard/base`` and the machine is ``qemux86``.
1054 standard/base
1055 and the machine is "qemux86".
1056 1034
10574. *Build the Image:* With the source modified, your changes staged and 10354. *Build the Image:* With the source modified, your changes staged and
1058 committed, and the ``local.conf`` file pointing to the kernel files, 1036 committed, and the ``local.conf`` file pointing to the kernel files,
@@ -1073,7 +1051,8 @@ Section.
10736. *Look for Your Changes:* As QEMU booted, you might have seen your 10516. *Look for Your Changes:* As QEMU booted, you might have seen your
1074 changes rapidly scroll by. If not, use these commands to see your 1052 changes rapidly scroll by. If not, use these commands to see your
1075 changes: 1053 changes:
1076 :: 1054
1055 .. code-block:: none
1077 1056
1078 # dmesg | less 1057 # dmesg | less
1079 1058
@@ -1134,13 +1113,10 @@ Section.
1134 1113
1135 .. note:: 1114 .. note::
1136 1115
1137 To build 1116 To build ``core-image-minimal`` again and see the effects of your patch,
1138 core-image-minimal 1117 you can essentially eliminate the temporary source files saved in
1139 again and see the effects of your patch, you can essentially 1118 ``poky/build/tmp/work/...`` and residual effects of the build by entering
1140 eliminate the temporary source files saved in 1119 the following sequence of commands:
1141 poky/build/tmp/work/...
1142 and residual effects of the build by entering the following
1143 sequence of commands:
1144 :: 1120 ::
1145 1121
1146 $ cd ~/poky/build 1122 $ cd ~/poky/build
@@ -1174,7 +1150,7 @@ Using  ``menuconfig``
1174The easiest way to define kernel configurations is to set them through 1150The easiest way to define kernel configurations is to set them through
1175the ``menuconfig`` tool. This tool provides an interactive method with 1151the ``menuconfig`` tool. This tool provides an interactive method with
1176which to set kernel configurations. For general information on 1152which to set kernel configurations. For general information on
1177``menuconfig``, see http://en.wikipedia.org/wiki/Menuconfig. 1153``menuconfig``, see https://en.wikipedia.org/wiki/Menuconfig.
1178 1154
1179To use the ``menuconfig`` tool in the Yocto Project development 1155To use the ``menuconfig`` tool in the Yocto Project development
1180environment, you must do the following: 1156environment, you must do the following:
@@ -1212,35 +1188,20 @@ the tool and save your changes to create an updated version of the
1212 1188
1213.. note:: 1189.. note::
1214 1190
1215 You can use the entire 1191 You can use the entire ``.config`` file as the ``defconfig`` file. For
1216 .config 1192 information on ``defconfig`` files, see the
1217 file as the 1193 ":ref:`kernel-dev/kernel-dev-common:changing the configuration`",
1218 defconfig 1194 ":ref:`kernel-dev/kernel-dev-common:using an "in-tree" \`\`defconfig\`\` file`",
1219 file. For information on 1195 and ":ref:`kernel-dev/kernel-dev-common:creating a \`\`defconfig\`\` file`"
1220 defconfig 1196 sections.
1221 files, see the "
1222 Changing the Configuration
1223 ", "
1224 Using an In-Tree
1225 defconfig
1226 File
1227 , and "
1228 Creating a
1229 defconfig
1230 File
1231 " sections.
1232 1197
1233Consider an example that configures the "CONFIG_SMP" setting for the 1198Consider an example that configures the "CONFIG_SMP" setting for the
1234``linux-yocto-4.12`` kernel. 1199``linux-yocto-4.12`` kernel.
1235 1200
1236.. note:: 1201.. note::
1237 1202
1238 The OpenEmbedded build system recognizes this kernel as 1203 The OpenEmbedded build system recognizes this kernel as ``linux-yocto``
1239 linux-yocto 1204 through Metadata (e.g. :term:`PREFERRED_VERSION`\ ``_linux-yocto ?= "12.4%"``).
1240 through Metadata (e.g.
1241 PREFERRED_VERSION
1242 \_linux-yocto ?= "12.4%"
1243 ).
1244 1205
1245Once ``menuconfig`` launches, use the interface to navigate through the 1206Once ``menuconfig`` launches, use the interface to navigate through the
1246selections to find the configuration settings in which you are 1207selections to find the configuration settings in which you are
@@ -1259,7 +1220,8 @@ area where the specific kernel is built. For example, if you were
1259building a Linux Yocto kernel based on the ``linux-yocto-4.12`` kernel 1220building a Linux Yocto kernel based on the ``linux-yocto-4.12`` kernel
1260and you were building a QEMU image targeted for ``x86`` architecture, 1221and you were building a QEMU image targeted for ``x86`` architecture,
1261the ``.config`` file would be: 1222the ``.config`` file would be:
1262:: 1223
1224.. code-block:: none
1263 1225
1264 poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18... 1226 poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18...
1265 ...967-r0/linux-qemux86-standard-build/.config 1227 ...967-r0/linux-qemux86-standard-build/.config
@@ -1289,11 +1251,8 @@ kernel layer.
1289 1251
1290.. note:: 1252.. note::
1291 1253
1292 Be sure to make a copy of the 1254 Be sure to make a copy of the ``.config`` file and do not just rename it.
1293 .config 1255 The build system needs an existing ``.config`` file from which to work.
1294 file and do not just rename it. The build system needs an existing
1295 .config
1296 file from which to work.
1297 1256
1298Creating a  ``defconfig`` File 1257Creating a  ``defconfig`` File
1299------------------------------ 1258------------------------------
@@ -1307,13 +1266,9 @@ which the OpenEmbedded build system can draw to create the final
1307 1266
1308.. note:: 1267.. note::
1309 1268
1310 Out-of-the-box, the Yocto Project never ships a 1269 Out-of-the-box, the Yocto Project never ships a ``defconfig`` or ``.config``
1311 defconfig 1270 file. The OpenEmbedded build system creates the final ``.config`` file used
1312 or 1271 to configure the kernel.
1313 .config
1314 file. The OpenEmbedded build system creates the final
1315 .config
1316 file used to configure the kernel.
1317 1272
1318To create a ``defconfig``, start with a complete, working Linux kernel 1273To create a ``defconfig``, start with a complete, working Linux kernel
1319``.config`` file. Copy that file to the appropriate 1274``.config`` file. Copy that file to the appropriate
@@ -1335,16 +1290,13 @@ created to hold the configuration changes.
1335 1290
1336.. note:: 1291.. note::
1337 1292
1338 The build system applies the configurations from the 1293 The build system applies the configurations from the ``defconfig``
1339 defconfig
1340 file before applying any subsequent configuration fragments. The 1294 file before applying any subsequent configuration fragments. The
1341 final kernel configuration is a combination of the configurations in 1295 final kernel configuration is a combination of the configurations in
1342 the 1296 the ``defconfig`` file and any configuration fragments you provide. You need
1343 defconfig 1297 to realize that if you have any configuration fragments, the build system
1344 file and any configuration fragments you provide. You need to realize 1298 applies these on top of and after applying the existing ``defconfig`` file
1345 that if you have any configuration fragments, the build system 1299 configurations.
1346 applies these on top of and after applying the existing defconfig
1347 file configurations.
1348 1300
1349For more information on configuring the kernel, see the "`Changing the 1301For more information on configuring the kernel, see the "`Changing the
1350Configuration <#changing-the-configuration>`__" section. 1302Configuration <#changing-the-configuration>`__" section.
@@ -1368,9 +1320,8 @@ appear in the ``.config`` file, which is in the :term:`Build Directory`.
1368 1320
1369.. note:: 1321.. note::
1370 1322
1371 For more information about where the 1323 For more information about where the ``.config`` file is located, see the
1372 .config 1324 example in the
1373 file is located, see the example in the
1374 ":ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\``" 1325 ":ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\``"
1375 section. 1326 section.
1376 1327
@@ -1384,10 +1335,9 @@ multi-processor support within the kernel:
1384 1335
1385.. note:: 1336.. note::
1386 1337
1387 All configuration fragment files must use the 1338 All configuration fragment files must use the ``.cfg`` extension in order
1388 .cfg 1339 for the OpenEmbedded build system to recognize them as a configuration
1389 extension in order for the OpenEmbedded build system to recognize 1340 fragment.
1390 them as a configuration fragment.
1391 1341
1392Another method is to create a configuration fragment using the 1342Another method is to create a configuration fragment using the
1393differences between two configuration files: one previously created and 1343differences between two configuration files: one previously created and
@@ -1429,9 +1379,8 @@ information on how to use the output as a configuration fragment.
1429.. note:: 1379.. note::
1430 1380
1431 You can also use this method to create configuration fragments for a 1381 You can also use this method to create configuration fragments for a
1432 BSP. See the " 1382 BSP. See the ":ref:`kernel-dev/kernel-dev-advanced:bsp descriptions`"
1433 BSP Descriptions 1383 section for more information.
1434 " section for more information.
1435 1384
1436Where do you put your configuration fragment files? You can place these 1385Where do you put your configuration fragment files? You can place these
1437files in an area pointed to by 1386files in an area pointed to by
@@ -1480,7 +1429,8 @@ See the ":ref:`kernel-dev/kernel-dev-common:using \`\`menuconfig\`\``" section f
1480information on how to create a configuration file. 1429information on how to create a configuration file.
1481 1430
1482Following is sample output from the ``do_kernel_configcheck`` task: 1431Following is sample output from the ``do_kernel_configcheck`` task:
1483:: 1432
1433.. code-block:: none
1484 1434
1485 Loading cache: 100% |########################################################| Time: 0:00:00 1435 Loading cache: 100% |########################################################| Time: 0:00:00
1486 Loaded 1275 entries from dependency cache. 1436 Loaded 1275 entries from dependency cache.
@@ -1577,10 +1527,8 @@ produces warning messages for the following issues:
1577 1527
1578.. note:: 1528.. note::
1579 1529
1580 The 1530 The :ref:`ref-tasks-kernel_configcheck` task can also optionally report if
1581 do_kernel_configcheck 1531 an option is overridden during processing.
1582 task can also optionally report if an option is overridden during
1583 processing.
1584 1532
1585For each output warning, a message points to the file that contains a 1533For each output warning, a message points to the file that contains a
1586list of the options and a pointer to the configuration fragment that 1534list of the options and a pointer to the configuration fragment that
@@ -1627,7 +1575,7 @@ Expanding Variables
1627=================== 1575===================
1628 1576
1629Sometimes it is helpful to determine what a variable expands to during a 1577Sometimes it is helpful to determine what a variable expands to during a
1630build. You can do examine the values of variables by examining the 1578build. You can examine the values of variables by examining the
1631output of the ``bitbake -e`` command. The output is long and is more 1579output of the ``bitbake -e`` command. The output is long and is more
1632easily managed in a text file, which allows for easy searches: 1580easily managed in a text file, which allows for easy searches:
1633:: 1581::
@@ -1767,7 +1715,10 @@ Here are some basic steps you can use to work with your own sources:
1767 as derived from the :term:`SRCPV` 1715 as derived from the :term:`SRCPV`
1768 variable. The combined results are a string with the following 1716 variable. The combined results are a string with the following
1769 form: 1717 form:
1770 3.19.11+git1+68a635bf8dfb64b02263c1ac80c948647cc76d5f_1+218bd8d2022b9852c60d32f0d770931e3cf343e2 1718 ::
1719
1720 3.19.11+git1+68a635bf8dfb64b02263c1ac80c948647cc76d5f_1+218bd8d2022b9852c60d32f0d770931e3cf343e2
1721
1771 While lengthy, the extra verbosity in ``PV`` helps ensure you are 1722 While lengthy, the extra verbosity in ``PV`` helps ensure you are
1772 using the exact sources from which you intend to build. 1723 using the exact sources from which you intend to build.
1773 1724
@@ -1778,7 +1729,10 @@ Here are some basic steps you can use to work with your own sources:
1778 triggers an explicit build failure. You must change it to match a 1729 triggers an explicit build failure. You must change it to match a
1779 list of the machines that your new recipe supports. For example, 1730 list of the machines that your new recipe supports. For example,
1780 to support the ``qemux86`` and ``qemux86-64`` machines, use the 1731 to support the ``qemux86`` and ``qemux86-64`` machines, use the
1781 following form: COMPATIBLE_MACHINE = "qemux86|qemux86-64" 1732 following form:
1733 ::
1734
1735 COMPATIBLE_MACHINE = "qemux86|qemux86-64"
1782 1736
17835. *Customize Your Recipe as Needed:* Provide further customizations to 17375. *Customize Your Recipe as Needed:* Provide further customizations to
1784 your recipe as needed just as you would customize an existing 1738 your recipe as needed just as you would customize an existing
@@ -1813,7 +1767,8 @@ is running that image.
1813Prior to attempting to build the out-of-tree modules, you need to be on 1767Prior to attempting to build the out-of-tree modules, you need to be on
1814the target as root and you need to change to the ``/usr/src/kernel`` 1768the target as root and you need to change to the ``/usr/src/kernel``
1815directory. Next, ``make`` the scripts: 1769directory. Next, ``make`` the scripts:
1816:: 1770
1771.. code-block:: none
1817 1772
1818 # cd /usr/src/kernel 1773 # cd /usr/src/kernel
1819 # make scripts 1774 # make scripts
@@ -1835,7 +1790,8 @@ create your own out-of-tree Linux kernel module recipe.
1835 1790
1836This template recipe is located in the ``poky`` Git repository of the 1791This template recipe is located in the ``poky`` Git repository of the
1837Yocto Project :yocto_git:`Source Repository <>` at: 1792Yocto Project :yocto_git:`Source Repository <>` at:
1838:: 1793
1794.. code-block:: none
1839 1795
1840 poky/meta-skeleton/recipes-kernel/hello-mod/hello-mod_0.1.bb 1796 poky/meta-skeleton/recipes-kernel/hello-mod/hello-mod_0.1.bb
1841 1797
@@ -1925,17 +1881,15 @@ changes.
1925 1881
1926.. note:: 1882.. note::
1927 1883
1928 In the following examples, unless you provide a commit range, 1884 In the following examples, unless you provide a commit range, ``kernel.org``
1929 kernel.org
1930 history is blended with Yocto Project kernel changes. You can form 1885 history is blended with Yocto Project kernel changes. You can form
1931 ranges by using branch names from the kernel tree as the upper and 1886 ranges by using branch names from the kernel tree as the upper and
1932 lower commit markers with the Git commands. You can see the branch 1887 lower commit markers with the Git commands. You can see the branch
1933 names through the web interface to the Yocto Project source 1888 names through the web interface to the Yocto Project source
1934 repositories at 1889 repositories at :yocto_git:`/`.
1935 .
1936 1890
1937To see a full range of the changes, use the ``git whatchanged`` command 1891To see a full range of the changes, use the ``git whatchanged`` command
1938and specify a commit range for the branch (commit\ ``..``\ commit). 1892and specify a commit range for the branch (`commit`\ ``..``\ `commit`).
1939 1893
1940Here is an example that looks at what has changed in the ``emenlow`` 1894Here is an example that looks at what has changed in the ``emenlow``
1941branch of the ``linux-yocto-3.19`` kernel. The lower commit range is the 1895branch of the ``linux-yocto-3.19`` kernel. The lower commit range is the
@@ -1990,8 +1944,8 @@ Adding Recipe-Space Kernel Features
1990=================================== 1944===================================
1991 1945
1992You can add kernel features in the 1946You can add kernel features in the
1993`recipe-space <#recipe-space-metadata>`__ by using the 1947:ref:`recipe-space <kernel-dev/kernel-dev-advanced:recipe-space metadata>`
1994:term:`KERNEL_FEATURES` 1948by using the :term:`KERNEL_FEATURES`
1995variable and by specifying the feature's ``.scc`` file path in the 1949variable and by specifying the feature's ``.scc`` file path in the
1996:term:`SRC_URI` statement. When you 1950:term:`SRC_URI` statement. When you
1997add features using this method, the OpenEmbedded build system checks to 1951add features using this method, the OpenEmbedded build system checks to
@@ -2008,9 +1962,9 @@ You add a kernel feature by providing the feature as part of the
2008OpenEmbedded build system searches all forms of kernel Metadata on the 1962OpenEmbedded build system searches all forms of kernel Metadata on the
2009``SRC_URI`` statement regardless of whether the Metadata is in the 1963``SRC_URI`` statement regardless of whether the Metadata is in the
2010"kernel-cache", system kernel Metadata, or a recipe-space Metadata (i.e. 1964"kernel-cache", system kernel Metadata, or a recipe-space Metadata (i.e.
2011part of the kernel recipe). See the "`Kernel Metadata 1965part of the kernel recipe). See the
2012Location <#kernel-metadata-location>`__" section for additional 1966":ref:`kernel-dev/kernel-dev-advanced:kernel metadata location`" section for
2013information. 1967additional information.
2014 1968
2015When you specify the feature's ``.scc`` file on the ``SRC_URI`` 1969When you specify the feature's ``.scc`` file on the ``SRC_URI``
2016statement, the OpenEmbedded build system adds the directory of that 1970statement, the OpenEmbedded build system adds the directory of that
@@ -2073,6 +2027,5 @@ build.
2073 .. note:: 2027 .. note::
2074 2028
2075 If other features are contained below "test.scc", then their 2029 If other features are contained below "test.scc", then their
2076 directories are relative to the directory containing the 2030 directories are relative to the directory containing the ``test.scc``
2077 test.scc
2078 file. 2031 file.