diff options
-rw-r--r-- | documentation/kernel-dev/kernel-dev-common.xml | 301 |
1 files changed, 147 insertions, 154 deletions
diff --git a/documentation/kernel-dev/kernel-dev-common.xml b/documentation/kernel-dev/kernel-dev-common.xml index 0f5e09cd47..28bedd1785 100644 --- a/documentation/kernel-dev/kernel-dev-common.xml +++ b/documentation/kernel-dev/kernel-dev-common.xml | |||
@@ -70,7 +70,7 @@ | |||
70 | <listitem><para> | 70 | <listitem><para> |
71 | <emphasis>Initialize the BitBake Environment:</emphasis> | 71 | <emphasis>Initialize the BitBake Environment:</emphasis> |
72 | Before building an extensible SDK, you need to | 72 | Before building an extensible SDK, you need to |
73 | initialize the BitBake build environment by sourcing a | 73 | initialize the BitBake build environment by sourcing the |
74 | build environment script | 74 | build environment script |
75 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink>): | 75 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink>): |
76 | <literallayout class='monospaced'> | 76 | <literallayout class='monospaced'> |
@@ -155,8 +155,8 @@ | |||
155 | </para></listitem> | 155 | </para></listitem> |
156 | <listitem><para> | 156 | <listitem><para> |
157 | <emphasis>Build the Extensible SDK:</emphasis> | 157 | <emphasis>Build the Extensible SDK:</emphasis> |
158 | Use BitBake to build the extensible SDK specifically for | 158 | Use BitBake to build the extensible SDK specifically |
159 | the Minnowboard: | 159 | for use with images to be run using QEMU: |
160 | <literallayout class='monospaced'> | 160 | <literallayout class='monospaced'> |
161 | $ cd ~/poky/build | 161 | $ cd ~/poky/build |
162 | $ bitbake core-image-minimal -c populate_sdk_ext | 162 | $ bitbake core-image-minimal -c populate_sdk_ext |
@@ -280,7 +280,7 @@ | |||
280 | <listitem><para> | 280 | <listitem><para> |
281 | <emphasis>Initialize the BitBake Environment:</emphasis> | 281 | <emphasis>Initialize the BitBake Environment:</emphasis> |
282 | Before you can do anything using BitBake, you need to | 282 | Before you can do anything using BitBake, you need to |
283 | initialize the BitBake build environment by sourcing a | 283 | initialize the BitBake build environment by sourcing the |
284 | build environment script | 284 | build environment script |
285 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink>). | 285 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink>). |
286 | Also, for this example, be sure that the local branch | 286 | Also, for this example, be sure that the local branch |
@@ -1009,66 +1009,58 @@ | |||
1009 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using <filename>devtool</filename></link>" | 1009 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using <filename>devtool</filename></link>" |
1010 | Section. | 1010 | Section. |
1011 | </note> | 1011 | </note> |
1012 | </para> | 1012 | <orderedlist> |
1013 | 1013 | <listitem><para> | |
1014 | <para> | 1014 | <emphasis>Check Out the Kernel Source Files:</emphasis> |
1015 | Also, for more information on patching the kernel, see the | 1015 | First you must use <filename>devtool</filename> to checkout |
1016 | "<link linkend='applying-patches'>Applying Patches</link>" | 1016 | the kernel source code in its workspace. |
1017 | section. | 1017 | Be sure you are in the terminal set up to do work |
1018 | </para> | 1018 | with the extensible SDK. |
1019 | 1019 | <note> | |
1020 | <orderedlist> | 1020 | See this |
1021 | <listitem><para> | 1021 | <link linkend='setting-up-the-esdk-terminal'>step</link> |
1022 | <emphasis>Check Out the Kernel Source Files:</emphasis> | 1022 | in the |
1023 | First you must use <filename>devtool</filename> to checkout | 1023 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop Using <filename>devtool</filename></link>" |
1024 | the kernel source code in its workspace. | 1024 | section for more information. |
1025 | Be sure you are in the terminal set up to do work | 1025 | </note> |
1026 | with the extensible SDK. | 1026 | Use the following <filename>devtool</filename> command |
1027 | <note> | 1027 | to check out the code: |
1028 | See this | ||
1029 | <link linkend='setting-up-the-esdk-terminal'>step</link> | ||
1030 | in the | ||
1031 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop Using <filename>devtool</filename></link>" | ||
1032 | section for more information. | ||
1033 | </note> | ||
1034 | Use the following <filename>devtool</filename> command | ||
1035 | to check out the code: | ||
1036 | <literallayout class='monospaced'> | ||
1037 | $ devtool modify linux-yocto | ||
1038 | </literallayout> | ||
1039 | <note> | ||
1040 | During the checkout operation, a bug exists that could | ||
1041 | cause errors such as the following to appear: | ||
1042 | <literallayout class='monospaced'> | 1028 | <literallayout class='monospaced'> |
1029 | $ devtool modify linux-yocto | ||
1030 | </literallayout> | ||
1031 | <note> | ||
1032 | During the checkout operation, a bug exists that could | ||
1033 | cause errors such as the following to appear: | ||
1034 | <literallayout class='monospaced'> | ||
1043 | ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus | 1035 | ERROR: Taskhash mismatch 2c793438c2d9f8c3681fd5f7bc819efa versus |
1044 | be3a89ce7c47178880ba7bf6293d7404 for | 1036 | be3a89ce7c47178880ba7bf6293d7404 for |
1045 | /path/to/esdk/layers/poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb.do_unpack | 1037 | /path/to/esdk/layers/poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb.do_unpack |
1046 | </literallayout> | ||
1047 | You can safely ignore these messages. | ||
1048 | The source code is correctly checked out. | ||
1049 | </note> | ||
1050 | </para></listitem> | ||
1051 | <listitem><para> | ||
1052 | <emphasis>Edit the Source Files</emphasis> | ||
1053 | Follow these steps to make some simple changes to the source | ||
1054 | files: | ||
1055 | <orderedlist> | ||
1056 | <listitem><para> | ||
1057 | <emphasis>Change the working directory</emphasis>: | ||
1058 | In the previous step, the output noted where you can find | ||
1059 | the source files (e.g. | ||
1060 | <filename>~/poky_sdk/workspace/sources/linux-yocto</filename>). | ||
1061 | Change to where the kernel source code is before making | ||
1062 | your edits to the <filename>calibrate.c</filename> file: | ||
1063 | <literallayout class='monospaced'> | ||
1064 | $ cd ~/poky_sdk/workspace/sources/linux-yocto | ||
1065 | </literallayout> | 1038 | </literallayout> |
1066 | </para></listitem> | 1039 | You can safely ignore these messages. |
1067 | <listitem><para> | 1040 | The source code is correctly checked out. |
1068 | <emphasis>Edit the source file</emphasis>: | 1041 | </note> |
1069 | Edit the <filename>init/calibrate.c</filename> file to have | 1042 | </para></listitem> |
1070 | the following changes: | 1043 | <listitem><para> |
1071 | <literallayout class='monospaced'> | 1044 | <emphasis>Edit the Source Files</emphasis> |
1045 | Follow these steps to make some simple changes to the source | ||
1046 | files: | ||
1047 | <orderedlist> | ||
1048 | <listitem><para> | ||
1049 | <emphasis>Change the working directory</emphasis>: | ||
1050 | In the previous step, the output noted where you can find | ||
1051 | the source files (e.g. | ||
1052 | <filename>~/poky_sdk/workspace/sources/linux-yocto</filename>). | ||
1053 | Change to where the kernel source code is before making | ||
1054 | your edits to the <filename>calibrate.c</filename> file: | ||
1055 | <literallayout class='monospaced'> | ||
1056 | $ cd ~/poky_sdk/workspace/sources/linux-yocto | ||
1057 | </literallayout> | ||
1058 | </para></listitem> | ||
1059 | <listitem><para> | ||
1060 | <emphasis>Edit the source file</emphasis>: | ||
1061 | Edit the <filename>init/calibrate.c</filename> file to have | ||
1062 | the following changes: | ||
1063 | <literallayout class='monospaced'> | ||
1072 | void calibrate_delay(void) | 1064 | void calibrate_delay(void) |
1073 | { | 1065 | { |
1074 | unsigned long lpj; | 1066 | unsigned long lpj; |
@@ -1085,110 +1077,111 @@ | |||
1085 | . | 1077 | . |
1086 | . | 1078 | . |
1087 | . | 1079 | . |
1088 | </literallayout> | 1080 | </literallayout> |
1089 | </para></listitem> | 1081 | </para></listitem> |
1090 | </orderedlist> | 1082 | </orderedlist> |
1091 | </para></listitem> | 1083 | </para></listitem> |
1092 | <listitem><para> | 1084 | <listitem><para> |
1093 | <emphasis>Build the Updated Kernel Source:</emphasis> | 1085 | <emphasis>Build the Updated Kernel Source:</emphasis> |
1094 | To build the updated kernel source, use | 1086 | To build the updated kernel source, use |
1095 | <filename>devtool</filename>: | 1087 | <filename>devtool</filename>: |
1096 | <literallayout class='monospaced'> | 1088 | <literallayout class='monospaced'> |
1097 | $ devtool build linux-yocto | 1089 | $ devtool build linux-yocto |
1098 | </literallayout> | 1090 | </literallayout> |
1099 | </para></listitem> | 1091 | </para></listitem> |
1100 | <listitem><para> | 1092 | <listitem><para> |
1101 | <emphasis>Create the Image With the New Kernel:</emphasis> | 1093 | <emphasis>Create the Image With the New Kernel:</emphasis> |
1102 | Use the <filename>devtool build-image</filename> command | 1094 | Use the <filename>devtool build-image</filename> command |
1103 | to create a new image that has the new kernel. | 1095 | to create a new image that has the new kernel. |
1104 | <note> | 1096 | <note> |
1105 | If the image you originally created resulted in a Wic | 1097 | If the image you originally created resulted in a Wic |
1106 | file, you can use an alternate method to create the new | 1098 | file, you can use an alternate method to create the new |
1107 | image with the updated kernel. | 1099 | image with the updated kernel. |
1108 | For an example, see the steps in the | 1100 | For an example, see the steps in the |
1109 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/KernelDevelopmentWithEsdk'>TipsAndTricks/KernelDevelopmentWithEsdk</ulink> | 1101 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/KernelDevelopmentWithEsdk'>TipsAndTricks/KernelDevelopmentWithEsdk</ulink> |
1110 | Wiki Page. | 1102 | Wiki Page. |
1111 | </note> | 1103 | </note> |
1112 | <literallayout class='monospaced'> | 1104 | <literallayout class='monospaced'> |
1113 | $ cd ~ | 1105 | $ cd ~ |
1114 | $ devtool build-image core-image-minimal | 1106 | $ devtool build-image core-image-minimal |
1115 | </literallayout> | 1107 | </literallayout> |
1116 | </para></listitem> | 1108 | </para></listitem> |
1117 | <listitem><para> | 1109 | <listitem><para> |
1118 | <emphasis>Test the New Image:</emphasis> | 1110 | <emphasis>Test the New Image:</emphasis> |
1119 | For this example, you can run the new image using QEMU | 1111 | For this example, you can run the new image using QEMU |
1120 | to verify your changes: | 1112 | to verify your changes: |
1121 | <orderedlist> | 1113 | <orderedlist> |
1122 | <listitem><para> | 1114 | <listitem><para> |
1123 | <emphasis>Boot the image</emphasis>: | 1115 | <emphasis>Boot the image</emphasis>: |
1124 | Boot the modified image in the QEMU emulator | 1116 | Boot the modified image in the QEMU emulator |
1125 | using this command: | 1117 | using this command: |
1126 | <literallayout class='monospaced'> | 1118 | <literallayout class='monospaced'> |
1127 | $ runqemu qemux86 | 1119 | $ runqemu qemux86 |
1128 | </literallayout> | 1120 | </literallayout> |
1129 | </para></listitem> | 1121 | </para></listitem> |
1130 | <listitem><para> | 1122 | <listitem><para> |
1131 | <emphasis>Verify the changes</emphasis>: | 1123 | <emphasis>Verify the changes</emphasis>: |
1132 | Log into the machine using <filename>root</filename> | 1124 | Log into the machine using <filename>root</filename> |
1133 | with no password and then use the following shell | 1125 | with no password and then use the following shell |
1134 | command to scroll through the console's boot output. | 1126 | command to scroll through the console's boot output. |
1135 | <literallayout class='monospaced'> | 1127 | <literallayout class='monospaced'> |
1136 | # dmesg | less | 1128 | # dmesg | less |
1137 | </literallayout> | 1129 | </literallayout> |
1138 | You should see the results of your | 1130 | You should see the results of your |
1139 | <filename>printk</filename> statements | 1131 | <filename>printk</filename> statements |
1140 | as part of the output when you scroll down the | 1132 | as part of the output when you scroll down the |
1141 | console window. | 1133 | console window. |
1142 | </para></listitem> | 1134 | </para></listitem> |
1143 | </orderedlist> | 1135 | </orderedlist> |
1144 | </para></listitem> | 1136 | </para></listitem> |
1145 | <listitem><para> | 1137 | <listitem><para> |
1146 | <emphasis>Stage and commit your changes</emphasis>: | 1138 | <emphasis>Stage and commit your changes</emphasis>: |
1147 | Within your eSDK terminal, change your working directory to | 1139 | Within your eSDK terminal, change your working directory to |
1148 | where you modified the <filename>calibrate.c</filename> | 1140 | where you modified the <filename>calibrate.c</filename> |
1149 | file and use these Git commands to stage and commit your | 1141 | file and use these Git commands to stage and commit your |
1150 | changes: | 1142 | changes: |
1151 | <literallayout class='monospaced'> | 1143 | <literallayout class='monospaced'> |
1152 | $ cd ~/poky_sdk/workspace/sources/linux-yocto | 1144 | $ cd ~/poky_sdk/workspace/sources/linux-yocto |
1153 | $ git status | 1145 | $ git status |
1154 | $ git add init/calibrate.c | 1146 | $ git add init/calibrate.c |
1155 | $ git commit -m "calibrate: Add printk example" | 1147 | $ git commit -m "calibrate: Add printk example" |
1156 | </literallayout> | 1148 | </literallayout> |
1157 | </para></listitem> | 1149 | </para></listitem> |
1158 | <listitem><para> | 1150 | <listitem><para> |
1159 | <emphasis>Export the Patches and Create a <filename>.bbappend</filename>:</emphasis> | 1151 | <emphasis>Export the Patches and Create an Append File:</emphasis> |
1160 | To export your commits as patches and create a | 1152 | To export your commits as patches and create a |
1161 | <filename>.bbappend</filename> file, use the following | 1153 | <filename>.bbappend</filename> file, use the following |
1162 | command in the terminal used to work with the extensible | 1154 | command in the terminal used to work with the extensible |
1163 | SDK. | 1155 | SDK. |
1164 | This example uses the previously established layer named | 1156 | This example uses the previously established layer named |
1165 | <filename>meta-mylayer</filename>. | 1157 | <filename>meta-mylayer</filename>. |
1166 | <note> | 1158 | <note> |
1167 | See Step 3 of the | 1159 | See Step 3 of the |
1168 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using devtool</link>" | 1160 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using devtool</link>" |
1169 | section for information on setting up this layer. | 1161 | section for information on setting up this layer. |
1170 | </note> | 1162 | </note> |
1171 | <literallayout class='monospaced'> | 1163 | <literallayout class='monospaced'> |
1172 | $ devtool finish linux-yocto /path/to/meta-mylayer | 1164 | $ devtool finish linux-yocto ~/meta-mylayer |
1173 | </literallayout> | 1165 | </literallayout> |
1174 | Once the command finishes, the patches and the | 1166 | Once the command finishes, the patches and the |
1175 | <filename>.bbappend</filename> file are located in the | 1167 | <filename>.bbappend</filename> file are located in the |
1176 | <filename>~/meta-mylayer/recipes-kernel/linux</filename> | 1168 | <filename>~/meta-mylayer/recipes-kernel/linux</filename> |
1177 | directory. | 1169 | directory. |
1178 | </para></listitem> | 1170 | </para></listitem> |
1179 | <listitem><para> | 1171 | <listitem><para> |
1180 | <emphasis>Build the Image With Your Modified Kernel:</emphasis> | 1172 | <emphasis>Build the Image With Your Modified Kernel:</emphasis> |
1181 | You can now build an image that includes your kernel | 1173 | You can now build an image that includes your kernel |
1182 | patches. | 1174 | patches. |
1183 | Execute the following command from your | 1175 | Execute the following command from your |
1184 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> | 1176 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
1185 | in the terminal set up to run BitBake: | 1177 | in the terminal set up to run BitBake: |
1186 | <literallayout class='monospaced'> | 1178 | <literallayout class='monospaced'> |
1187 | $ cd ~/poky/build | 1179 | $ cd ~/poky/build |
1188 | $ bitbake core-image-minimal | 1180 | $ bitbake core-image-minimal |
1189 | </literallayout> | 1181 | </literallayout> |
1190 | </para></listitem> | 1182 | </para></listitem> |
1191 | </orderedlist> | 1183 | </orderedlist> |
1184 | </para> | ||
1192 | </section> | 1185 | </section> |
1193 | 1186 | ||
1194 | <section id="using-traditional-kernel-development-to-patch-the-kernel"> | 1187 | <section id="using-traditional-kernel-development-to-patch-the-kernel"> |
@@ -1441,8 +1434,8 @@ | |||
1441 | following sequence of commands: | 1434 | following sequence of commands: |
1442 | <literallayout class='monospaced'> | 1435 | <literallayout class='monospaced'> |
1443 | $ cd ~/poky/build | 1436 | $ cd ~/poky/build |
1444 | $ cd bitbake -c cleanall yocto-linux | 1437 | $ bitbake -c cleanall yocto-linux |
1445 | $ cd bitbake core-image-minimal -c cleanall | 1438 | $ bitbake core-image-minimal -c cleanall |
1446 | $ bitbake core-image-minimal | 1439 | $ bitbake core-image-minimal |
1447 | $ runqemu qemux86 | 1440 | $ runqemu qemux86 |
1448 | </literallayout> | 1441 | </literallayout> |