If you are going to be modifying kernel recipes, it is recommended
that you create and prepare your own layer in which to do your
work.
Your layer contains its own
BitBake
append files (.bbappend
) and provides a
convenient mechanism to create your own recipe files
(.bb
) as well as store and use kernel
patch files.
For background information on working with layers, see the
"Understanding and Creating Layers"
section in the Yocto Project Development Tasks Manual.
bitbake-layers create-layer
command, which simplifies creating a new layer.
See the
"Creating a General Layer Using the bitbake-layers
Script"
section in the Yocto Project Development Tasks Manual for
information on how to use this script.
To better understand the layer you create for kernel development,
the following section describes how to create a layer
without the aid of tools.
These steps assume creation of a layer named
mylayer
in your home directory:
Create Structure: Create the layer's structure:
$ cd $HOME $ mkdir meta-mylayer $ mkdir meta-mylayer/conf $ mkdir meta-mylayer/recipes-kernel $ mkdir meta-mylayer/recipes-kernel/linux $ mkdir meta-mylayer/recipes-kernel/linux/linux-yocto
The conf
directory holds your
configuration files, while the
recipes-kernel
directory holds your
append file and eventual patch files.
Create the Layer Configuration File:
Move to the meta-mylayer/conf
directory and create the layer.conf
file as follows:
# We have a conf and classes directory, add to BBPATH BBPATH .= ":${LAYERDIR}" # We have recipes-* directories, add to BBFILES BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "mylayer" BBFILE_PATTERN_mylayer = "^${LAYERDIR}/" BBFILE_PRIORITY_mylayer = "5"
Notice mylayer
as part of the last
three statements.
Create the Kernel Recipe Append File:
Move to the
meta-mylayer/recipes-kernel/linux
directory and create the kernel's append file.
This example uses the
linux-yocto-4.12
kernel.
Thus, the name of the append file is
linux-yocto_4.12.bbappend
:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI_append += "file://patch-file-one
" SRC_URI_append += "file://patch-file-two
" SRC_URI_append += "file://patch-file-three
"
The
FILESEXTRAPATHS
and
SRC_URI
statements enable the OpenEmbedded build system to find
patch files.
For more information on using append files, see the
"Using .bbappend Files in Your Layer"
section in the Yocto Project Development Tasks Manual.