2.6.1. Using  menuconfig

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 do the following:

The following commands initialize the BitBake environment, run the do_kernel_configme task, and launch menuconfig. These commands assume the Source Directory's top-level folder is ~/poky:

     $ cd poky
     $ source oe-init-build-env
     $ bitbake linux-yocto -c kernel_configme -f
     $ 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.

Note

You can use the entire .config file as the defconfig file. For information on defconfig files, see the "Changing the Configuration", "Using an In-Tree defconfig File, and "Creating a defconfig File" sections.

Consider an example that configures the "CONFIG_SMP" setting for the linux-yocto-4.12 kernel.

Note

The OpenEmbedded build system recognizes this kernel as linux-yocto through Metadata (e.g. PREFERRED_VERSION_linux-yocto ?= "12.4%").

Once menuconfig launches, use the interface to navigate through the selections to find the configuration settings in which you are interested. For this example, you deselect "CONFIG_SMP" by clearing the "Symmetric Multi-Processing Support" option. Using the interface, you can find the option under "Processor Type and Features". To deselect "CONFIG_SMP", use the arrow keys to highlight "Symmetric Multi-Processing Support" and enter "N" to clear the asterisk. When you are finished, exit out and save the change.

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-yocto-4.12 kernel and you were building a QEMU image targeted for x86 architecture, the .config file would be:

     poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+gitAUTOINC+eda4d18...
     ...967-r0/linux-qemux86-standard-build/.config
                

Note

The previous example directory is artificially split and many of the characters in the actual filename are omitted in order to make it more readable. Also, depending on the kernel you are using, the exact pathname 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 as 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.

Note

Be sure to make a copy of the .config file and do not just rename it. The build system needs an existing .config file from which to work.