The kernel sources in the Yocto Project contain kernel Metadata, which
is located in the meta
branches of the kernel
source Git repositories.
This Metadata defines Board Support Packages (BSPs) that
correspond to definitions in linux-yocto recipes for the same BSPs.
A BSP consists of an aggregation of kernel policy and enabled
hardware-specific features.
The BSP can be influenced from within the linux-yocto recipe.
linux-yocto.inc
include file is said to be a
"linux-yocto style" recipe.
Every linux-yocto style recipe must define the
KMACHINE
variable.
This variable is typically set to the same value as the
MACHINE
variable, which is used by
BitBake.
However, in some cases, the variable might instead refer to the
underlying platform of the MACHINE
.
Multiple BSPs can reuse the same KMACHINE
name if they are built using the same BSP description.
The "ep108-zynqmp" and "qemuzynqmp" BSP combination
in the meta-xilinx
layer is a good example of two BSPs using the same
KMACHINE
value (i.e. "zynqmp").
See the BSP Descriptions section
for more information.
Every linux-yocto style recipe must also indicate the Linux kernel
source repository branch used to build the Linux kernel.
The KBRANCH
variable must be set to indicate the branch.
KBRANCH
value to define an
alternate branch typically with a machine override as shown here
from the meta-emenlow
layer:
KBRANCH_emenlow-noemgd = "standard/base"
The linux-yocto style recipes can optionally define the following variables:
KERNEL_FEATURES LINUX_KERNEL_TYPE
LINUX_KERNEL_TYPE
defines the kernel type to be
used in assembling the configuration.
If you do not specify a LINUX_KERNEL_TYPE
,
it defaults to "standard".
Together with
KMACHINE
,
LINUX_KERNEL_TYPE
defines the search
arguments used by the kernel tools to find the
appropriate description within the kernel Metadata with which to
build out the sources and configuration.
The linux-yocto recipes define "standard", "tiny", and "preempt-rt"
kernel types.
See the "Kernel Types" section
for more information on kernel types.
During the build, the kern-tools search for the BSP description
file that most closely matches the KMACHINE
and LINUX_KERNEL_TYPE
variables passed in from the
recipe.
The tools use the first BSP description it finds that match
both variables.
If the tools cannot find a match, they issue a warning such as
the following:
WARNING: Can't find any BSP hardware or required configuration fragments. WARNING: Looked at meta/cfg/broken/emenlow-broken/hdw_frags.txt and meta/cfg/broken/emenlow-broken/required_frags.txt in directory: meta/cfg/broken/emenlow-broken
In this example, KMACHINE
was set to "emenlow-broken"
and LINUX_KERNEL_TYPE
was set to "broken".
The tools first search for the KMACHINE
and
then for the LINUX_KERNEL_TYPE
.
If the tools cannot find a partial match, they will use the
sources from the KBRANCH
and any configuration
specified in the
SRC_URI
.
You can use the
KERNEL_FEATURES
variable
to include features (configuration fragments, patches, or both) that
are not already included by the KMACHINE
and
LINUX_KERNEL_TYPE
variable combination.
For example, to include a feature specified as
"features/netfilter/netfilter.scc",
specify:
KERNEL_FEATURES += "features/netfilter/netfilter.scc"
To include a feature called "cfg/sound.scc" just for the
qemux86
machine, specify:
KERNEL_FEATURES_append_qemux86 = " cfg/sound.scc"
The value of the entries in KERNEL_FEATURES
are dependent on their location within the kernel Metadata itself.
The examples here are taken from the meta
branch of the linux-yocto-3.19
repository.
Within that branch, "features" and "cfg" are subdirectories of the
meta/cfg/kernel-cache
directory.
For more information, see the
"Kernel Metadata Syntax" section.