Configuration fragments are simply kernel options that
appear in a file placed where the OpenEmbedded build system
can find and apply them.
The build system applies configuration fragments after
applying configurations from a defconfig
file.
Thus, the final kernel configuration is a combination of the
configurations in the defconfig
file and then any configuration fragments you provide.
The build system applies fragments on top of and
after applying the existing defconfig file configurations.
Syntactically, the configuration statement is identical to
what would appear in the .config
file,
which is in the
Build Directory.
.config
file is located, see the
example in the
"Using menuconfig
"
section.
It is simple to create a configuration fragment.
One method is to use shell commands.
For example, issuing the following from the shell creates a
configuration fragment file named
my_smp.cfg
that enables multi-processor
support within the kernel:
$ echo "CONFIG_SMP=y" >> my_smp.cfg
.cfg
extension in order for the
OpenEmbedded build system to recognize them as a
configuration fragment.
Another method is to create a configuration fragment using the
differences between two configuration files: one previously
created and saved, and one freshly created using the
menuconfig
tool.
To create a configuration fragment using this method, follow these steps:
Complete a Build Through Kernel Configuration: Complete a build at least through the kernel configuration task as follows:
$ bitbake linux-yocto -c kernel_configme -f
This step ensures that you create a
.config
file from a known state.
Because situations exist where your build state might
become unknown, it is best to run this task prior
to starting menuconfig
.
Launch menuconfig
:
Run the menuconfig
command:
$ bitbake linux-yocto -c menuconfig
Create the Configuration Fragment:
Run the diffconfig
command to prepare a configuration fragment.
The resulting file fragment.cfg
is placed in the
${
WORKDIR
}
directory:
$ bitbake linux-yocto -c diffconfig
The diffconfig
command creates a file
that is a list of Linux kernel CONFIG_
assignments.
See the "Changing the Configuration"
section for additional information on how to use the output
as a configuration fragment.
Where do you put your configuration fragment files?
You can place these files in an area pointed to by
SRC_URI
as directed by your bblayers.conf
file,
which is located in your layer.
The OpenEmbedded build system picks up the configuration and
adds it to the kernel's configuration.
For example, suppose you had a set of configuration options
in a file called myconfig.cfg
.
If you put that file inside a directory named
linux-yocto
that resides in the same
directory as the kernel's append file within your layer
and then add the following statements to the kernel's append
file, those configuration options will be picked up and applied
when the kernel is built:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://myconfig.cfg"
As mentioned earlier, you can group related configurations
into multiple files and name them all in the
SRC_URI
statement as well.
For example, you could group separate configurations
specifically for Ethernet and graphics into their own files
and add those by using a SRC_URI
statement
like the following in your append file:
SRC_URI += "file://myconfig.cfg \ file://eth.cfg \ file://gfx.cfg"