The easiest way to define kernel configurations is to set them through the
menuconfig
tool.
This tool provides an interactive method with which
to set kernel configurations.
For general information on menuconfig
, see
http://en.wikipedia.org/wiki/Menuconfig.
To use the menuconfig
tool in the Yocto Project development
environment, you must build the tool using BitBake.
Thus, the environment must be set up using the
oe-init-build-env
or
oe-init-build-env-memres
script found in the
Build Directory.
The following commands build and invoke menuconfig
assuming the
Source Directory
top-level folder is ~/poky
:
$ cd ~/poky $ source oe-init-build-env $ bitbake linux-yocto -c menuconfig
Once menuconfig
comes up, its standard interface allows you to
interactively examine and configure all the kernel configuration parameters.
After making your changes, simply exit the tool and save your changes to
create an updated version of the .config
configuration file.
Consider an example that configures the linux-yocto-3.4
kernel.
The OpenEmbedded build system recognizes this kernel as
linux-yocto
.
Thus, the following commands from the shell in which you previously sourced the
environment initialization script cleans the shared state cache and the
WORKDIR
directory and then builds and launches menuconfig
:
$ bitbake linux-yocto -c menuconfig
Once menuconfig
launches, use the interface
to navigate through the selections to find the configuration settings in
which you are interested.
For example, consider the CONFIG_SMP
configuration setting.
You can find it at Processor Type and Features
under
the configuration selection Symmetric Multi-processing Support
.
After highlighting the selection, use the arrow keys to select or deselect
the setting.
When you are finished with all your selections, exit out and save them.
Saving the selections updates the .config
configuration file.
This is the file that the OpenEmbedded build system uses to configure the
kernel during the build.
You can find and examine this file in the Build Directory in
tmp/work/
.
The actual .config
is located in the area where the
specific kernel is built.
For example, if you were building a Linux Yocto kernel based on the
Linux 3.4 kernel and you were building a QEMU image targeted for
x86
architecture, the
.config
file would be located here:
~/poky/build/tmp/work/qemux86-poky-linux/linux-yocto-3.4.11+git1+84f... ...656ed30-r1/linux-qemux86-standard-build
linux-yocto-3.4...
might differ.
Within the .config
file, you can see the kernel settings.
For example, the following entry shows that symmetric multi-processor support
is not set:
# CONFIG_SMP is not set
A good method to isolate changed configurations is to use a combination of the
menuconfig
tool and simple shell commands.
Before changing configurations with menuconfig
, copy the
existing .config
and rename it to something else,
use menuconfig
to make
as many changes an you want and save them, then compare the renamed configuration
file against the newly created file.
You can use the resulting differences as your base to create configuration fragments
to permanently save in your kernel layer.
.config
and don't just
rename it.
The build system needs an existing .config
from which to work.