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 hardware-specific
feature enablements.
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 (e.g. "routerstationpro" or "fri2").
Multiple BSPs can reuse the same KMACHINE
name if they are built using the same BSP description.
The "fri2" and "fri2-noemgd" BSP combination
in the meta-intel
layer is a good example of two BSPs using the same
KMACHINE
value (i.e. "fri2").
See the BSP Descriptions section
for more information.
The linux-yocto style recipes can optionally define the following variables:
KBRANCH KERNEL_FEATURES KBRANCH_DEFAULT LINUX_KERNEL_TYPE
KBRANCH_DEFAULT
defines the Linux kernel source
repository's default branch to use to build the Linux kernel.
The value is used as the default for KBRANCH
, which
can define an alternate branch typically with a machine override as
follows:
KBRANCH_fri2 = "standard/fri2"
Unless you specify otherwise, KBRANCH_DEFAULT
initializes to "master".
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/fri2-broken/hdw_frags.txt and meta/cfg/broken/fri2-broken/required_frags.txt in directory: meta/cfg/broken/fri2-broken
In this example, KMACHINE
was set to "fri2-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.scc",
specify:
KERNEL_FEATURES += "features/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
linux-yocto-3.4
repository where "features"
and "cfg" are subdirectories within the
meta/cfg/kernel-cache
directory.
For more information, see the
"Kernel Metadata Syntax" section.