The Yocto build system can also be used to configure the Linux kernel. This is useful for quick configuration changes while developing applications:
- To create a .config file from the machine defconfig file, execute the following command:
$ cd /opt/yocto/fsl-community-bsp/ $ source setup-environment wandboard $ bitbake -c configure virtual/kernel
This will also run the old config kernel make target to validate the configuration against the Linux source.
- We can then configure the Linux kernel from the BitBake command line using the following:
$ bitbake -c menuconfig virtual/kernel
In order to use the menuconfig interface you will need to have the ncurses development libraries installed. If you get build errors, do the following:
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install libncurses5-dev
The menuconfig user interface, as well as other kernel configuration user interfaces, has a search functionality that allows you to locate configuration variables by name. Have a look at the following screenshot:
Linux kernel ncurses-based configuration interface search window
In the following chapters, we will mention specific kernel configuration variables, such as CONFIG_PRINTK, without specifying the whole path to the configuration variable. The search interface of the different UIs can be used to locate the configuration variable path.
- When you save your changes, a new .config file is created in the kernel's build directory, which you can find using the following command:
$ bitbake -e virtual/kernel | grep ^B=B"/opt/yocto/fsl-community-bsp/wandboard/tmp/work/wandboard-poky-linux-gnueabi/linux-wandboard/4.1-2.0.x-r0/build"
The ncurses-based menuconfig interface is the only one that can be invoked by BitBake.