diff options
Diffstat (limited to 'documentation/kernel-dev')
| -rw-r--r-- | documentation/kernel-dev/kernel-dev-common.xml | 149 |
1 files changed, 109 insertions, 40 deletions
diff --git a/documentation/kernel-dev/kernel-dev-common.xml b/documentation/kernel-dev/kernel-dev-common.xml index eaf0146153..c6d1bdaac1 100644 --- a/documentation/kernel-dev/kernel-dev-common.xml +++ b/documentation/kernel-dev/kernel-dev-common.xml | |||
| @@ -37,7 +37,8 @@ | |||
| 37 | Source Directory. | 37 | Source Directory. |
| 38 | <note> | 38 | <note> |
| 39 | Be sure you check out the appropriate development branch or | 39 | Be sure you check out the appropriate development branch or |
| 40 | by tag to get the version of Yocto Project you want. | 40 | you create your local branch by checking out a specific tag |
| 41 | to get the desired version of Yocto Project. | ||
| 41 | See the | 42 | See the |
| 42 | "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out by Branch in Poky</ulink>" | 43 | "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out by Branch in Poky</ulink>" |
| 43 | and | 44 | and |
| @@ -120,14 +121,14 @@ | |||
| 120 | as follows: | 121 | as follows: |
| 121 | <literallayout class='monospaced'> | 122 | <literallayout class='monospaced'> |
| 122 | $ cd ~/poky | 123 | $ cd ~/poky |
| 123 | $ yocto-layer create my-kernel -o ../meta-my-kernel | 124 | $ yocto-layer create mylayer -o ../meta-mylayer |
| 124 | Please enter the layer priority you'd like to use for the layer: [default: 6] | 125 | Please enter the layer priority you'd like to use for the layer: [default: 6] |
| 125 | Would you like to have an example recipe created? (y/n) [default: n] | 126 | Would you like to have an example recipe created? (y/n) [default: n] |
| 126 | Would you like to have an example bbappend file created? (y/n) [default: n] | 127 | Would you like to have an example bbappend file created? (y/n) [default: n] |
| 127 | 128 | ||
| 128 | New layer created in ../meta-my-kernel. | 129 | New layer created in ../meta-mylayer. |
| 129 | 130 | ||
| 130 | Don't forget to add it to your BBLAYERS (for details see ../meta-my-kernel/README). | 131 | Don't forget to add it to your BBLAYERS (for details see ../meta-mylayer/README). |
| 131 | </literallayout> | 132 | </literallayout> |
| 132 | </para></listitem> | 133 | </para></listitem> |
| 133 | <listitem><para> | 134 | <listitem><para> |
| @@ -140,7 +141,7 @@ | |||
| 140 | as follows: | 141 | as follows: |
| 141 | <literallayout class='monospaced'> | 142 | <literallayout class='monospaced'> |
| 142 | $ cd ~/poky/build | 143 | $ cd ~/poky/build |
| 143 | $ bitbake-layers add-layer ../../meta-my-kernel | 144 | $ bitbake-layers add-layer ../../meta-mylayer |
| 144 | </literallayout> | 145 | </literallayout> |
| 145 | </para></listitem> | 146 | </para></listitem> |
| 146 | <listitem><para> | 147 | <listitem><para> |
| @@ -274,9 +275,15 @@ | |||
| 274 | build environment script | 275 | build environment script |
| 275 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink> | 276 | (i.e. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>oe-init-build-env</filename></ulink> |
| 276 | or | 277 | or |
| 277 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>): | 278 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>). |
| 279 | Also, for this example, be sure that the local branch | ||
| 280 | you have checked out for <filename>poky</filename> is | ||
| 281 | the Yocto Project &DISTRO_NAME; branch: | ||
| 278 | <literallayout class='monospaced'> | 282 | <literallayout class='monospaced'> |
| 279 | $ cd ~/poky | 283 | $ cd ~/poky |
| 284 | $ git branch | ||
| 285 | master | ||
| 286 | * &DISTRO_NAME; | ||
| 280 | $ source oe-init-build-env | 287 | $ source oe-init-build-env |
| 281 | </literallayout> | 288 | </literallayout> |
| 282 | <note> | 289 | <note> |
| @@ -322,14 +329,14 @@ | |||
| 322 | as follows: | 329 | as follows: |
| 323 | <literallayout class='monospaced'> | 330 | <literallayout class='monospaced'> |
| 324 | $ cd ~/poky | 331 | $ cd ~/poky |
| 325 | $ yocto-layer create my-kernel -o ../meta-my-kernel | 332 | $ yocto-layer create mylayer -o ../meta-mylayer |
| 326 | Please enter the layer priority you'd like to use for the layer: [default: 6] | 333 | Please enter the layer priority you'd like to use for the layer: [default: 6] |
| 327 | Would you like to have an example recipe created? (y/n) [default: n] | 334 | Would you like to have an example recipe created? (y/n) [default: n] |
| 328 | Would you like to have an example bbappend file created? (y/n) [default: n] | 335 | Would you like to have an example bbappend file created? (y/n) [default: n] |
| 329 | 336 | ||
| 330 | New layer created in ../meta-my-kernel. | 337 | New layer created in ../meta-mylayer. |
| 331 | 338 | ||
| 332 | Don't forget to add it to your BBLAYERS (for details see ../meta-my-kernel/README). | 339 | Don't forget to add it to your BBLAYERS (for details see ../meta-mylayer/README). |
| 333 | </literallayout> | 340 | </literallayout> |
| 334 | </para></listitem> | 341 | </para></listitem> |
| 335 | <listitem><para> | 342 | <listitem><para> |
| @@ -342,7 +349,7 @@ | |||
| 342 | as follows: | 349 | as follows: |
| 343 | <literallayout class='monospaced'> | 350 | <literallayout class='monospaced'> |
| 344 | $ cd ~/poky/build | 351 | $ cd ~/poky/build |
| 345 | $ bitbake-layers add-layer ../../meta-my-kernel | 352 | $ bitbake-layers add-layer ../../meta-mylayer |
| 346 | </literallayout> | 353 | </literallayout> |
| 347 | </para></listitem> | 354 | </para></listitem> |
| 348 | <listitem><para> | 355 | <listitem><para> |
| @@ -359,14 +366,25 @@ | |||
| 359 | copy of the kernel Git repository outside of the | 366 | copy of the kernel Git repository outside of the |
| 360 | <ulink url='&YOCTO_DOCS_REF_URL;source-directory'>Source Directory</ulink>, | 367 | <ulink url='&YOCTO_DOCS_REF_URL;source-directory'>Source Directory</ulink>, |
| 361 | which is usually named <filename>poky</filename>. | 368 | which is usually named <filename>poky</filename>. |
| 369 | Also, be sure you are in the | ||
| 370 | <filename>standard/base</filename> branch. | ||
| 362 | </para> | 371 | </para> |
| 363 | 372 | ||
| 364 | <para> | 373 | <para> |
| 365 | The following commands show how to create a local copy | 374 | The following commands show how to create a local copy |
| 366 | of the <filename>linux-yocto-4.12</filename> kernel: | 375 | of the <filename>linux-yocto-4.12</filename> kernel and |
| 376 | be in the <filename>standard/base</filename> branch. | ||
| 377 | <note> | ||
| 378 | The <filename>linux-yocto-4.12</filename> kernel | ||
| 379 | can be used with the Yocto Project 2.4 release | ||
| 380 | and forward. | ||
| 381 | You cannot use the | ||
| 382 | <filename>linux-yocto-4.12</filename> kernel with | ||
| 383 | releases prior to Yocto Project 2.4: | ||
| 384 | </note> | ||
| 367 | <literallayout class='monospaced'> | 385 | <literallayout class='monospaced'> |
| 368 | $ cd ~ | 386 | $ cd ~ |
| 369 | $ git clone git://git.yoctoproject.org/linux-yocto-4.12 linux-yocto-4.12 | 387 | $ git clone git://git.yoctoproject.org/linux-yocto-4.12 --branch standard/base |
| 370 | Cloning into 'linux-yocto-4.12'... | 388 | Cloning into 'linux-yocto-4.12'... |
| 371 | remote: Counting objects: 6097195, done. | 389 | remote: Counting objects: 6097195, done. |
| 372 | remote: Compressing objects: 100% (901026/901026), done. | 390 | remote: Compressing objects: 100% (901026/901026), done. |
| @@ -377,6 +395,33 @@ | |||
| 377 | Checking out files: 100% (59846/59846), done. | 395 | Checking out files: 100% (59846/59846), done. |
| 378 | </literallayout> | 396 | </literallayout> |
| 379 | </para></listitem> | 397 | </para></listitem> |
| 398 | <listitem><para> | ||
| 399 | <emphasis>Create a Local Copy of the Kernel Cache Git | ||
| 400 | Repository:</emphasis> | ||
| 401 | For simplicity, it is recommended that you create your | ||
| 402 | copy of the kernel cache Git repository outside of the | ||
| 403 | <ulink url='&YOCTO_DOCS_REF_URL;source-directory'>Source Directory</ulink>, | ||
| 404 | which is usually named <filename>poky</filename>. | ||
| 405 | Also, for this example, be sure you are in the | ||
| 406 | <filename>yocto-4.12</filename> branch. | ||
| 407 | </para> | ||
| 408 | |||
| 409 | <para> | ||
| 410 | The following commands show how to create a local copy | ||
| 411 | of the <filename>yocto-kernel-cache</filename> and | ||
| 412 | be in the <filename>yocto-4.12</filename> branch: | ||
| 413 | <literallayout class='monospaced'> | ||
| 414 | $ cd ~ | ||
| 415 | $ git clone git://git.yoctoproject.org/yocto-kernel-cache --branch yocto-4.12 | ||
| 416 | Cloning into 'yocto-kernel-cache'... | ||
| 417 | remote: Counting objects: 22639, done. | ||
| 418 | remote: Compressing objects: 100% (9761/9761), done. | ||
| 419 | remote: Total 22639 (delta 12400), reused 22586 (delta 12347) | ||
| 420 | Receiving objects: 100% (22639/22639), 22.34 MiB | 6.27 MiB/s, done. | ||
| 421 | Resolving deltas: 100% (12400/12400), done. | ||
| 422 | Checking connectivity... done. | ||
| 423 | </literallayout> | ||
| 424 | </para></listitem> | ||
| 380 | </orderedlist> | 425 | </orderedlist> |
| 381 | </para> | 426 | </para> |
| 382 | 427 | ||
| @@ -1076,18 +1121,18 @@ | |||
| 1076 | command in the terminal used to work with the extensible | 1121 | command in the terminal used to work with the extensible |
| 1077 | SDK. | 1122 | SDK. |
| 1078 | This example uses the previously established layer named | 1123 | This example uses the previously established layer named |
| 1079 | <filename>meta-my-kernel</filename>. | 1124 | <filename>meta-mylayer</filename>. |
| 1080 | <note> | 1125 | <note> |
| 1081 | See Step 3 of the | 1126 | See Step 3 of the |
| 1082 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using devtool</link>" | 1127 | "<link linkend='getting-ready-to-develop-using-devtool'>Getting Ready to Develop using devtool</link>" |
| 1083 | section for information on setting up this layer. | 1128 | section for information on setting up this layer. |
| 1084 | </note> | 1129 | </note> |
| 1085 | <literallayout class='monospaced'> | 1130 | <literallayout class='monospaced'> |
| 1086 | $ devtool finish linux-yocto /path/to/meta-my-kernel | 1131 | $ devtool finish linux-yocto /path/to/meta-mylayer |
| 1087 | </literallayout> | 1132 | </literallayout> |
| 1088 | Once the command finishes, the patches and the | 1133 | Once the command finishes, the patches and the |
| 1089 | <filename>.bbappend</filename> file are located in the | 1134 | <filename>.bbappend</filename> file are located in the |
| 1090 | <filename>~/meta-my-kernel/recipes-kernel/linux</filename> | 1135 | <filename>~/meta-mylayer/recipes-kernel/linux</filename> |
| 1091 | directory. | 1136 | directory. |
| 1092 | </para></listitem> | 1137 | </para></listitem> |
| 1093 | <listitem><para> | 1138 | <listitem><para> |
| @@ -1162,24 +1207,13 @@ | |||
| 1162 | section. | 1207 | section. |
| 1163 | <orderedlist> | 1208 | <orderedlist> |
| 1164 | <listitem><para> | 1209 | <listitem><para> |
| 1165 | <emphasis>Know What Branch is Checked Out In Your Local | 1210 | <emphasis>Edit the Source Files</emphasis> |
| 1166 | Kernel Git Repository:</emphasis> | ||
| 1167 | Prior to this step, you should have used Git to create a | 1211 | Prior to this step, you should have used Git to create a |
| 1168 | local copy of the repository for your kernel. | 1212 | local copy of the repository for your kernel. |
| 1169 | Assuming you created the repository as directed in the | 1213 | Assuming you created the repository as directed in the |
| 1170 | "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>" | 1214 | "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>" |
| 1171 | section, use the following commands to check out the | 1215 | section, use the following commands to edit the |
| 1172 | <filename>standard/base</filename> branch of the | 1216 | <filename>calibrate.c</filename> file: |
| 1173 | Linux Yocto 4.12 kernel: | ||
| 1174 | <literallayout class='monospaced'> | ||
| 1175 | $ cd ~/linux-yocto-4.12 | ||
| 1176 | $ git checkout -b standard/base origin/standard/base | ||
| 1177 | </literallayout> | ||
| 1178 | </para></listitem> | ||
| 1179 | <listitem><para> | ||
| 1180 | <emphasis>Edit the Source Files</emphasis> | ||
| 1181 | Follow these steps to make some simple changes to the source | ||
| 1182 | files: | ||
| 1183 | <orderedlist> | 1217 | <orderedlist> |
| 1184 | <listitem><para> | 1218 | <listitem><para> |
| 1185 | <emphasis>Change the working directory</emphasis>: | 1219 | <emphasis>Change the working directory</emphasis>: |
| @@ -1228,27 +1262,38 @@ | |||
| 1228 | Build System will not pick up the changes. | 1262 | Build System will not pick up the changes. |
| 1229 | </para></listitem> | 1263 | </para></listitem> |
| 1230 | <listitem><para> | 1264 | <listitem><para> |
| 1231 | <emphasis>Update Your <filename>local.conf</filename> File to Point to Your Source Files:</emphasis> | 1265 | <emphasis>Update Your <filename>local.conf</filename> File |
| 1266 | to Point to Your Source Files:</emphasis> | ||
| 1232 | In addition to your <filename>local.conf</filename> file | 1267 | In addition to your <filename>local.conf</filename> file |
| 1233 | specifying to use "kernel-modules" and the "qemux86" machine, | 1268 | specifying to use "kernel-modules" and the "qemux86" |
| 1234 | it must also point to the updated kernel source files. | 1269 | machine, it must also point to the updated kernel source |
| 1235 | Add the following commands to your | 1270 | files. |
| 1271 | Add | ||
| 1272 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> | ||
| 1273 | and | ||
| 1274 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRCREV'><filename>SRCREV</filename></ulink> | ||
| 1275 | statements similar to the following to your | ||
| 1236 | <filename>local.conf</filename>: | 1276 | <filename>local.conf</filename>: |
| 1237 | <literallayout class='monospaced'> | 1277 | <literallayout class='monospaced'> |
| 1238 | $ cd ~/poky/build/conf | 1278 | $ cd ~/poky/build/conf |
| 1239 | </literallayout> | 1279 | </literallayout> |
| 1240 | Add the following to the <filename>local.conf</filename>: | 1280 | Add the following to the <filename>local.conf</filename>: |
| 1241 | <literallayout class='monospaced'> | 1281 | <literallayout class='monospaced'> |
| 1242 | SRC_URI_pn-linux-yocto = "git:///$HOME/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ | 1282 | SRC_URI_pn-linux-yocto = "git:///<replaceable>path-to</replaceable>/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ |
| 1243 | git:///home/scottrif/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" | 1283 | git:///<replaceable>path-to</replaceable>/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" |
| 1244 | SRCREV_meta_qemux86 = "${AUTOREV}" | 1284 | SRCREV_meta_qemux86 = "${AUTOREV}" |
| 1245 | SRCREV_machine_qemux86 = "${AUTOREV}" | 1285 | SRCREV_machine_qemux86 = "${AUTOREV}" |
| 1246 | </literallayout> | 1286 | </literallayout> |
| 1247 | You must be sure to specify the correct branch and machine | 1287 | <note> |
| 1248 | types. | 1288 | Be sure to replace |
| 1249 | For this example, the branch is | 1289 | <replaceable>path-to</replaceable> with the pathname |
| 1250 | <filename>standard/base</filename> and the machine is | 1290 | to your local Git repositories. |
| 1251 | "qemux86". | 1291 | Also, you must be sure to specify the correct branch |
| 1292 | and machine types. | ||
| 1293 | For this example, the branch is | ||
| 1294 | <filename>standard/base</filename> and the machine is | ||
| 1295 | "qemux86". | ||
| 1296 | </note> | ||
| 1252 | </para></listitem> | 1297 | </para></listitem> |
| 1253 | <listitem><para> | 1298 | <listitem><para> |
| 1254 | <emphasis>Build the Image:</emphasis> | 1299 | <emphasis>Build the Image:</emphasis> |
| @@ -1268,6 +1313,7 @@ | |||
| 1268 | When prompted to login to the QEMU console, use "root" | 1313 | When prompted to login to the QEMU console, use "root" |
| 1269 | with no password: | 1314 | with no password: |
| 1270 | <literallayout class='monospaced'> | 1315 | <literallayout class='monospaced'> |
| 1316 | $ cd ~/poky/build | ||
| 1271 | $ runqemu qemux86 | 1317 | $ runqemu qemux86 |
| 1272 | </literallayout> | 1318 | </literallayout> |
| 1273 | </para></listitem> | 1319 | </para></listitem> |
| @@ -1284,6 +1330,29 @@ | |||
| 1284 | as part of the output when you scroll down the | 1330 | as part of the output when you scroll down the |
| 1285 | console window. | 1331 | console window. |
| 1286 | </para></listitem> | 1332 | </para></listitem> |
| 1333 | <listitem><para> | ||
| 1334 | <emphasis>Generate the Patch File:</emphasis> | ||
| 1335 | Once you are sure that your patch works correctly, you | ||
| 1336 | can generate a <filename>*.patch</filename> file in the | ||
| 1337 | kernel source repository: | ||
| 1338 | <literallayout class='monospaced'> | ||
| 1339 | $ cd ~/linux-yocto-4.12/init | ||
| 1340 | $ git format-patch -1 | ||
| 1341 | 0001-calibrate.c-Added-some-printk-statements.patch | ||
| 1342 | </literallayout> | ||
| 1343 | </para></listitem> | ||
| 1344 | <listitem><para> | ||
| 1345 | <emphasis>Prepare Your Layer for Subsequent Builds:</emphasis> | ||
| 1346 | In order for subsequent builds to pick up patches, the | ||
| 1347 | patches need to be stored in a layer. | ||
| 1348 | This example created the layer | ||
| 1349 | <filename>meta-mylayer</filename> earlier but left it | ||
| 1350 | pretty much empty. | ||
| 1351 | To get it ready for subsequent builds that automatically | ||
| 1352 | apply patches, follow the steps in the | ||
| 1353 | "<link linkend='creating-and-preparing-a-layer'>Creating and Preparing a Layer</link>" | ||
| 1354 | section. | ||
| 1355 | </para></listitem> | ||
| 1287 | </orderedlist> | 1356 | </orderedlist> |
| 1288 | </para> | 1357 | </para> |
| 1289 | </section> | 1358 | </section> |
