diff options
author | Scott Rifenbark <srifenbark@gmail.com> | 2017-09-07 16:43:49 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-13 18:00:19 +0100 |
commit | f2d4f77afb9095d84d56ae067c513b80b73962e0 (patch) | |
tree | adc68d66cb1e1c8351df9d7b72f134d6684b5d13 /documentation/kernel-dev/kernel-dev-common.xml | |
parent | db3c4c8557366e5ac374e474ac1ce535d89c5982 (diff) | |
download | poky-f2d4f77afb9095d84d56ae067c513b80b73962e0.tar.gz |
kernel-dev: Updates to the kernel patch examples.
Switching to kernel version 4.12. Pulled some old commented
stuff out.
(From yocto-docs rev: c0a5c886256d3477ddaf670df4939bec1c73152e)
Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/kernel-dev/kernel-dev-common.xml')
-rw-r--r-- | documentation/kernel-dev/kernel-dev-common.xml | 133 |
1 files changed, 22 insertions, 111 deletions
diff --git a/documentation/kernel-dev/kernel-dev-common.xml b/documentation/kernel-dev/kernel-dev-common.xml index 3af52eb352..eaf0146153 100644 --- a/documentation/kernel-dev/kernel-dev-common.xml +++ b/documentation/kernel-dev/kernel-dev-common.xml | |||
@@ -362,25 +362,26 @@ | |||
362 | </para> | 362 | </para> |
363 | 363 | ||
364 | <para> | 364 | <para> |
365 | The following command shows how to create a local copy | 365 | The following commands show how to create a local copy |
366 | of the <filename>linux-yocto-4.9</filename> kernel: | 366 | of the <filename>linux-yocto-4.12</filename> kernel: |
367 | <literallayout class='monospaced'> | 367 | <literallayout class='monospaced'> |
368 | $ git clone git://git.yoctoproject.org/linux-yocto-4.9 linux-yocto-4.9.git | 368 | $ cd ~ |
369 | Cloning into 'linux-yocto-4.9.git'... | 369 | $ git clone git://git.yoctoproject.org/linux-yocto-4.12 linux-yocto-4.12 |
370 | remote: Counting objects: 5094108, done. | 370 | Cloning into 'linux-yocto-4.12'... |
371 | remote: Compressing objects: 100% (765113/765113), done. | 371 | remote: Counting objects: 6097195, done. |
372 | remote: Total 5094108 (delta 4294009), reused 5088388 (delta 4288312) | 372 | remote: Compressing objects: 100% (901026/901026), done. |
373 | Receiving objects: 100% (5094108/5094108), 1.02 GiB | 7.82 MiB/s, done. | 373 | remote: Total 6097195 (delta 5152604), reused 6096847 (delta 5152256) |
374 | Resolving deltas: 100% (4294009/4294009), done. | 374 | Receiving objects: 100% (6097195/6097195), 1.24 GiB | 7.81 MiB/s, done. |
375 | Resolving deltas: 100% (5152604/5152604), done. | ||
375 | Checking connectivity... done. | 376 | Checking connectivity... done. |
376 | Checking out files: 100% (56233/56233), done. | 377 | Checking out files: 100% (59846/59846), done. |
377 | </literallayout> | 378 | </literallayout> |
378 | </para></listitem> | 379 | </para></listitem> |
379 | </orderedlist> | 380 | </orderedlist> |
380 | </para> | 381 | </para> |
381 | 382 | ||
382 | <para> | 383 | <para> |
383 | At this point you have set up to start making modifications to | 384 | At this point, you are ready to start making modifications to |
384 | the kernel using traditional kernel development steps. | 385 | the kernel using traditional kernel development steps. |
385 | For a continued example, see the | 386 | For a continued example, see the |
386 | "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>" | 387 | "<link linkend='using-traditional-kernel-development-to-patch-the-kernel'>Using Traditional Kernel Development to Patch the Kernel</link>" |
@@ -1010,97 +1011,6 @@ | |||
1010 | $ devtool build linux-yocto | 1011 | $ devtool build linux-yocto |
1011 | </literallayout> | 1012 | </literallayout> |
1012 | </para></listitem> | 1013 | </para></listitem> |
1013 | <!-- | ||
1014 | <listitem><para> | ||
1015 | |||
1016 | NOTE: This stuff is how it would have been if a *.wic file was created | ||
1017 | when the image was built earlier. That is the method used by the | ||
1018 | example in the wiki (https://wiki.yoctoproject.org/wiki/TipsAndTricks/KernelDevelopmentWithEsdk). | ||
1019 | I am leaving it here for now. | ||
1020 | |||
1021 | <emphasis>Create the Image With the New Kernel:</emphasis> | ||
1022 | Normally, you would create a new image using the | ||
1023 | <filename>devtool build-image</filename> command. | ||
1024 | However, this method can take some time and alters the | ||
1025 | kernel source folder. | ||
1026 | A faster option is to use | ||
1027 | <ulink url='https://linux.die.net/man/8/kpartx'><filename>kpartx</filename></ulink> | ||
1028 | to splice the new kernel into the image you have already built. | ||
1029 | <note> | ||
1030 | You might have to install <filename>kpartx</filename> | ||
1031 | onto your build host. | ||
1032 | </note> | ||
1033 | Follow these steps to create the image with the new kernel: | ||
1034 | <orderedlist> | ||
1035 | <listitem><para> | ||
1036 | <emphasis>Make a Copy of Your Wic File:</emphasis> | ||
1037 | Create a copy of your Wic from into the | ||
1038 | <filename>/tmp</filename> directory: | ||
1039 | <literallayout class='monospaced'> | ||
1040 | $ cp tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic /tmp | ||
1041 | </literallayout> | ||
1042 | </para></listitem> | ||
1043 | <listitem><para> | ||
1044 | <emphasis>Create Loopback Devices for Partitions:</emphasis> | ||
1045 | Next, create loopback devices for each partition in | ||
1046 | the Wic file. | ||
1047 | <note> | ||
1048 | The first unused loopback device is automatically | ||
1049 | allocated. | ||
1050 | </note> | ||
1051 | In this example, the command's output uses a variable | ||
1052 | "<replaceable>X</replaceable>" to indicate the loopback | ||
1053 | device. | ||
1054 | The actual output you get when you run the command lists | ||
1055 | the actual loopback devices (e.g. "loop0p1", "loop0p2", | ||
1056 | and "loop0p3"): | ||
1057 | <literallayout class='monospaced'> | ||
1058 | $ sudo kpartx -v -a /tmp/core-image-minimal-qemux86.wic | ||
1059 | add map loop<replaceable>X</replaceable>p1 (253:6): 0 47446 linear /dev/loopX 2048 | ||
1060 | add map loop<replaceable>X</replaceable>p2 (253:7): 0 119356 linear /dev/loopX 51200 | ||
1061 | add map loop<replaceable>X</replaceable>p3 (253:8): 0 90112 linear /dev/loopX 170556 | ||
1062 | </literallayout> | ||
1063 | </para></listitem> | ||
1064 | <listitem><para> | ||
1065 | <emphasis>Mount the First Device:</emphasis> | ||
1066 | The kernel is in the first device, so mount | ||
1067 | <filename>/dev/mapper/loop</filename><replaceable>X</replaceable><filename>p1</filename>: | ||
1068 | <note> | ||
1069 | Be sure to replace the "<replaceable>X</replaceable>" | ||
1070 | in "loop<replaceable>X</replaceable>p1" with the | ||
1071 | automatically allocated loopback device | ||
1072 | (e.g loop0p1). | ||
1073 | </note> | ||
1074 | <literallayout class='monospaced'> | ||
1075 | $ sudo mkdir /mnt/wic-p1 | ||
1076 | $ sudo mount /dev/mapper/loop<replaceable>X</replaceable>p1 /mnt/wic-p1 | ||
1077 | </literallayout> | ||
1078 | </para></listitem> | ||
1079 | <listitem><para> | ||
1080 | <emphasis>Copy Over the New Kernel:</emphasis> | ||
1081 | Now copy over new kernel using the following: | ||
1082 | <literallayout class='monospaced'> | ||
1083 | $ sudo cp workspace/sources/linux-yocto/arch/x86/boot/bzImage /mnt/wic-p1 | ||
1084 | </literallayout> | ||
1085 | </para></listitem> | ||
1086 | <listitem><para> | ||
1087 | Finally, unmount the device and use | ||
1088 | <filename>kpartx</filename> to delete the partition | ||
1089 | mappings: | ||
1090 | <note> | ||
1091 | Replace the "<replaceable>X</replaceable>" in | ||
1092 | "loop<replaceable>X</replaceable>" with the | ||
1093 | automatically allocated loopback device from | ||
1094 | earlier (e.g "loop0"). | ||
1095 | </note> | ||
1096 | <literallayout class='monospaced'> | ||
1097 | $ sudo umount /mnt/wic-p1 | ||
1098 | $ sudo kpartx -d /dev/loop<replaceable>X</replaceable> | ||
1099 | </literallayout> | ||
1100 | </para></listitem> | ||
1101 | </orderedlist> | ||
1102 | </para></listitem> | ||
1103 | --> | ||
1104 | <listitem><para> | 1014 | <listitem><para> |
1105 | <emphasis>Create the Image With the New Kernel:</emphasis> | 1015 | <emphasis>Create the Image With the New Kernel:</emphasis> |
1106 | Use the <filename>devtool build-image</filename> command | 1016 | Use the <filename>devtool build-image</filename> command |
@@ -1260,9 +1170,9 @@ NOTE: This stuff is how it would have been if a *.wic file was created | |||
1260 | "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>" | 1170 | "<link linkend='getting-ready-for-traditional-kernel-development'>Getting Ready for Traditional Kernel Development</link>" |
1261 | section, use the following commands to check out the | 1171 | section, use the following commands to check out the |
1262 | <filename>standard/base</filename> branch of the | 1172 | <filename>standard/base</filename> branch of the |
1263 | Linux Yocto 4.9 kernel: | 1173 | Linux Yocto 4.12 kernel: |
1264 | <literallayout class='monospaced'> | 1174 | <literallayout class='monospaced'> |
1265 | $ cd ~/linux-yocto-4.9 | 1175 | $ cd ~/linux-yocto-4.12 |
1266 | $ git checkout -b standard/base origin/standard/base | 1176 | $ git checkout -b standard/base origin/standard/base |
1267 | </literallayout> | 1177 | </literallayout> |
1268 | </para></listitem> | 1178 | </para></listitem> |
@@ -1278,7 +1188,7 @@ NOTE: This stuff is how it would have been if a *.wic file was created | |||
1278 | Change to where the kernel source code is before making | 1188 | Change to where the kernel source code is before making |
1279 | your edits to the <filename>calibrate.c</filename> file: | 1189 | your edits to the <filename>calibrate.c</filename> file: |
1280 | <literallayout class='monospaced'> | 1190 | <literallayout class='monospaced'> |
1281 | $ cd ~/linux-yocto-4.9/init | 1191 | $ cd ~/linux-yocto-4.12/init |
1282 | </literallayout> | 1192 | </literallayout> |
1283 | </para></listitem> | 1193 | </para></listitem> |
1284 | <listitem><para> | 1194 | <listitem><para> |
@@ -1326,12 +1236,13 @@ NOTE: This stuff is how it would have been if a *.wic file was created | |||
1326 | <filename>local.conf</filename>: | 1236 | <filename>local.conf</filename>: |
1327 | <literallayout class='monospaced'> | 1237 | <literallayout class='monospaced'> |
1328 | $ cd ~/poky/build/conf | 1238 | $ cd ~/poky/build/conf |
1329 | <replaceable>Add the following:</replaceable> | 1239 | </literallayout> |
1330 | 1240 | Add the following to the <filename>local.conf</filename>: | |
1331 | SRC_URI_pn-linux-yocto = "git:///$HOME/linux-yocto-4.9;protocol=file;name=machine;branch=standard/base; \ | 1241 | <literallayout class='monospaced'> |
1332 | git:///home/scottrif/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.9;destsuffix=${KMETA}" | 1242 | SRC_URI_pn-linux-yocto = "git:///$HOME/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ |
1333 | SRCREV_meta_qemux86 = "${AUTOREV}" | 1243 | git:///home/scottrif/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" |
1334 | SRCREV_machine_qemux86 = "${AUTOREV}" | 1244 | SRCREV_meta_qemux86 = "${AUTOREV}" |
1245 | SRCREV_machine_qemux86 = "${AUTOREV}" | ||
1335 | </literallayout> | 1246 | </literallayout> |
1336 | You must be sure to specify the correct branch and machine | 1247 | You must be sure to specify the correct branch and machine |
1337 | types. | 1248 | types. |