From 082dcd01632b1e0c1b3080d377972882b37b0834 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Mon, 11 Sep 2017 15:45:56 -0700 Subject: kernel-dev: Updates to the kernel flow procedures (From yocto-docs rev: b8baf67ece6e80884fa198ddd51715c329822f28) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/kernel-dev/kernel-dev-common.xml | 149 ++++++++++++++++++------- 1 file changed, 109 insertions(+), 40 deletions(-) (limited to 'documentation/kernel-dev/kernel-dev-common.xml') 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 @@ Source Directory. Be sure you check out the appropriate development branch or - by tag to get the version of Yocto Project you want. + you create your local branch by checking out a specific tag + to get the desired version of Yocto Project. See the "Checking Out by Branch in Poky" and @@ -120,14 +121,14 @@ as follows: $ cd ~/poky - $ yocto-layer create my-kernel -o ../meta-my-kernel + $ yocto-layer create mylayer -o ../meta-mylayer Please enter the layer priority you'd like to use for the layer: [default: 6] Would you like to have an example recipe created? (y/n) [default: n] Would you like to have an example bbappend file created? (y/n) [default: n] - New layer created in ../meta-my-kernel. + New layer created in ../meta-mylayer. - Don't forget to add it to your BBLAYERS (for details see ../meta-my-kernel/README). + Don't forget to add it to your BBLAYERS (for details see ../meta-mylayer/README). @@ -140,7 +141,7 @@ as follows: $ cd ~/poky/build - $ bitbake-layers add-layer ../../meta-my-kernel + $ bitbake-layers add-layer ../../meta-mylayer @@ -274,9 +275,15 @@ build environment script (i.e. oe-init-build-env or - oe-init-build-env-memres): + oe-init-build-env-memres). + Also, for this example, be sure that the local branch + you have checked out for poky is + the Yocto Project &DISTRO_NAME; branch: $ cd ~/poky + $ git branch + master + * &DISTRO_NAME; $ source oe-init-build-env @@ -322,14 +329,14 @@ as follows: $ cd ~/poky - $ yocto-layer create my-kernel -o ../meta-my-kernel + $ yocto-layer create mylayer -o ../meta-mylayer Please enter the layer priority you'd like to use for the layer: [default: 6] Would you like to have an example recipe created? (y/n) [default: n] Would you like to have an example bbappend file created? (y/n) [default: n] - New layer created in ../meta-my-kernel. + New layer created in ../meta-mylayer. - Don't forget to add it to your BBLAYERS (for details see ../meta-my-kernel/README). + Don't forget to add it to your BBLAYERS (for details see ../meta-mylayer/README). @@ -342,7 +349,7 @@ as follows: $ cd ~/poky/build - $ bitbake-layers add-layer ../../meta-my-kernel + $ bitbake-layers add-layer ../../meta-mylayer @@ -359,14 +366,25 @@ copy of the kernel Git repository outside of the Source Directory, which is usually named poky. + Also, be sure you are in the + standard/base branch. The following commands show how to create a local copy - of the linux-yocto-4.12 kernel: + of the linux-yocto-4.12 kernel and + be in the standard/base branch. + + The linux-yocto-4.12 kernel + can be used with the Yocto Project 2.4 release + and forward. + You cannot use the + linux-yocto-4.12 kernel with + releases prior to Yocto Project 2.4: + $ cd ~ - $ git clone git://git.yoctoproject.org/linux-yocto-4.12 linux-yocto-4.12 + $ git clone git://git.yoctoproject.org/linux-yocto-4.12 --branch standard/base Cloning into 'linux-yocto-4.12'... remote: Counting objects: 6097195, done. remote: Compressing objects: 100% (901026/901026), done. @@ -377,6 +395,33 @@ Checking out files: 100% (59846/59846), done. + + Create a Local Copy of the Kernel Cache Git + Repository: + For simplicity, it is recommended that you create your + copy of the kernel cache Git repository outside of the + Source Directory, + which is usually named poky. + Also, for this example, be sure you are in the + yocto-4.12 branch. + + + + The following commands show how to create a local copy + of the yocto-kernel-cache and + be in the yocto-4.12 branch: + + $ cd ~ + $ git clone git://git.yoctoproject.org/yocto-kernel-cache --branch yocto-4.12 + Cloning into 'yocto-kernel-cache'... + remote: Counting objects: 22639, done. + remote: Compressing objects: 100% (9761/9761), done. + remote: Total 22639 (delta 12400), reused 22586 (delta 12347) + Receiving objects: 100% (22639/22639), 22.34 MiB | 6.27 MiB/s, done. + Resolving deltas: 100% (12400/12400), done. + Checking connectivity... done. + + @@ -1076,18 +1121,18 @@ command in the terminal used to work with the extensible SDK. This example uses the previously established layer named - meta-my-kernel. + meta-mylayer. See Step 3 of the "Getting Ready to Develop using devtool" section for information on setting up this layer. - $ devtool finish linux-yocto /path/to/meta-my-kernel + $ devtool finish linux-yocto /path/to/meta-mylayer Once the command finishes, the patches and the .bbappend file are located in the - ~/meta-my-kernel/recipes-kernel/linux + ~/meta-mylayer/recipes-kernel/linux directory. @@ -1162,24 +1207,13 @@ section. - Know What Branch is Checked Out In Your Local - Kernel Git Repository: + Edit the Source Files Prior to this step, you should have used Git to create a local copy of the repository for your kernel. Assuming you created the repository as directed in the "Getting Ready for Traditional Kernel Development" - section, use the following commands to check out the - standard/base branch of the - Linux Yocto 4.12 kernel: - - $ cd ~/linux-yocto-4.12 - $ git checkout -b standard/base origin/standard/base - - - - Edit the Source Files - Follow these steps to make some simple changes to the source - files: + section, use the following commands to edit the + calibrate.c file: Change the working directory: @@ -1228,27 +1262,38 @@ Build System will not pick up the changes. - Update Your local.conf File to Point to Your Source Files: + Update Your local.conf File + to Point to Your Source Files: In addition to your local.conf file - specifying to use "kernel-modules" and the "qemux86" machine, - it must also point to the updated kernel source files. - Add the following commands to your + specifying to use "kernel-modules" and the "qemux86" + machine, it must also point to the updated kernel source + files. + Add + SRC_URI + and + SRCREV + statements similar to the following to your local.conf: $ cd ~/poky/build/conf Add the following to the local.conf: - SRC_URI_pn-linux-yocto = "git:///$HOME/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ - git:///home/scottrif/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" + SRC_URI_pn-linux-yocto = "git:///path-to/linux-yocto-4.12;protocol=file;name=machine;branch=standard/base; \ + git:///path-to/yocto-kernel-cache;protocol=file;type=kmeta;name=meta;branch=yocto-4.12;destsuffix=${KMETA}" SRCREV_meta_qemux86 = "${AUTOREV}" SRCREV_machine_qemux86 = "${AUTOREV}" - You must be sure to specify the correct branch and machine - types. - For this example, the branch is - standard/base and the machine is - "qemux86". + + Be sure to replace + path-to with the pathname + to your local Git repositories. + Also, you must be sure to specify the correct branch + and machine types. + For this example, the branch is + standard/base and the machine is + "qemux86". + Build the Image: @@ -1268,6 +1313,7 @@ When prompted to login to the QEMU console, use "root" with no password: + $ cd ~/poky/build $ runqemu qemux86 @@ -1284,6 +1330,29 @@ as part of the output when you scroll down the console window. + + Generate the Patch File: + Once you are sure that your patch works correctly, you + can generate a *.patch file in the + kernel source repository: + + $ cd ~/linux-yocto-4.12/init + $ git format-patch -1 + 0001-calibrate.c-Added-some-printk-statements.patch + + + + Prepare Your Layer for Subsequent Builds: + In order for subsequent builds to pick up patches, the + patches need to be stored in a layer. + This example created the layer + meta-mylayer earlier but left it + pretty much empty. + To get it ready for subsequent builds that automatically + apply patches, follow the steps in the + "Creating and Preparing a Layer" + section. + -- cgit v1.2.3-54-g00ecf