Getting ready for traditional kernel development using the Yocto Project involves many of the same steps as described in the previous section. However, you need to establish a local copy of the kernel source since you will be editing these files.
Follow these steps to prepare to update the kernel image using traditional kernel development flow with the Yocto Project. Completing this procedure leaves you ready to make modifications to the kernel source as described in the "Using Traditional Kernel Development to Patch the Kernel" section:
Initialize the BitBake Environment:
Before you can do anything using BitBake, you need to
initialize the BitBake build environment by sourcing the
build environment script
(i.e. oe-init-build-env
).
Also, for this example, be sure that the local branch
you have checked out for poky
is
the Yocto Project Rocko branch.
If you need to checkout out the Rocko branch,
see the
"Checking out by Branch in Poky"
section in the Yocto Project Development Manual.
$ cd ~/poky $ git branch master * Rocko $ source oe-init-build-env
poky
) have been cloned
using Git and the local repository is named
"poky".
Prepare Your local.conf
File:
By default, the
MACHINE
variable is set to "qemux86", which is fine if you are
building for the QEMU emulator in 32-bit mode.
However, if you are not, you need to set the
MACHINE
variable appropriately in
your conf/local.conf
file found
in the
Build Directory
(i.e. ~/poky/build
in this
example).
Also, since you are preparing to work on the
kernel image, you need to set the
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS
variable to include kernel modules.
This example uses the default "qemux86" for the
MACHINE
variable but needs to
add the "kernel-modules":
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules"
Create a Layer for Patches:
You need to create a layer to hold patches created
for the kernel image.
You can use the yocto-layer
command
as follows:
$ cd ~/poky $ 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-mylayer. Don't forget to add it to your BBLAYERS (for details see ../meta-mylayer/README).
yocto-layer
script, see the
"Creating a General Layer Using the yocto-layer Script"
section in the Yocto Project Development Manual.
Inform the BitBake Build Environment About
Your Layer:
As directed when you created your layer, you need to add
the layer to the
BBLAYERS
variable in the bblayers.conf
file
as follows:
$ cd ~/poky/build $ bitbake-layers add-layer ../../meta-mylayer
Create a Local Copy of the Kernel Git Repository: You can find Git repositories of supported Yocto Project kernels organized under "Yocto Linux Kernel" in the Yocto Project Source Repositories at http://git.yoctoproject.org/cgit.cgi.
For simplicity, it is recommended that you create your
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 and
be in the standard/base
branch.
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 --branch standard/base Cloning into 'linux-yocto-4.12'... remote: Counting objects: 6097195, done. remote: Compressing objects: 100% (901026/901026), done. remote: Total 6097195 (delta 5152604), reused 6096847 (delta 5152256) Receiving objects: 100% (6097195/6097195), 1.24 GiB | 7.81 MiB/s, done. Resolving deltas: 100% (5152604/5152604), done. Checking connectivity... done. 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.
At this point, you are ready to start making modifications to the kernel using traditional kernel development steps. For a continued example, see the "Using Traditional Kernel Development to Patch the Kernel" section.