TipsAndTricks/QuickAndDirtyKernelConfig

From Yocto Project
Revision as of 01:09, 1 November 2016 by Bavery (talk | contribs) (Created page with "= How to Quickly Set Some Options in the Kernel = == The Real Way == The best in depth explanation/tutorial for working with the kernel in Yocto is located here: https://www...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

How to Quickly Set Some Options in the Kernel

The Real Way

The best in depth explanation/tutorial for working with the kernel in Yocto is located here: https://www.yoctoproject.org/training/kernel-lab. It has a pdf, and supporting layers/metadata to allow you to follow along. If you are going to do a lot with the kernel or are planning to ship it in a product/project, I'd strongly recommend going through the lab.

The Quick and Dirty Way

But, sometimes, you really just want to be able to set an option. How can you do this?

Menuconfig

bitbake linux-yocto -c menuconfig 

Will put you into hte standard ncurses menuconfig screen and you can select options as normal and then rebuild your kernel with:

bitbake linux-yocto 

This will modify the .config file that linux-yocto uses

tmp/work/<machine>-common-poky-linux/linux-yocto/<version>/linux-<machine>-common-standard-build/.config 

in the version I am working off of it looks like this for a machine=intel-corei7-64 and a linux-yocto near the time of Morty's (YP 2.2) release.

tmp/work/corei7-64-intel-common-poky-linux/linux-yocto/4.8+gitAUTOINC+552a83790b_67813e7efa-r0/linux-corei7-64-intel-common-standard-build/.config

The good news is that that was pretty easy. The bad news, is that

  • if I remove tmp, as I tend to do, then my .config will go away.
  • if I want to share my additions with someone else, I need to give them a whole .config file and tell them to read the above referenced lab for how to use it.

Just the Configs I want, nothing more

Suppose I know that I just want to set

CONFIG_DMA_API_DEBUG=y

and nothing else. What can I do then? With the standard settings, we get:

 
$grep DMA_API_DEBUG tmp/work/.../.config
# CONFIG_DMA_API_DEBUG is not set

So, the Quick & Dirty approach is to add the following to the end of my conf/local.conf file:

 
 FILESEXTRAPATHS_prepend_pn-linux-yocto := "/my/absolute/path/build/conf:"
 SRC_URI_append_pn-linux-yocto = " file://myKernelConfigs.cfg "

The file myKernelConfigs.cfg is in my conf directory. I could have put it anywhere I wanted, even into a separate git repo in ~/kernelconfigsrepo, for example. myKernelConfigs.cfg contains the kernel configs I want to set. In this example it's pretty simple:

 
# yes, comments are ok
CONFIG_DMA_API_DEBUG=y

If I delete the tmp folder and rerun bitbake linux-yocto I can then see the following:


$grep DMA_API_DEBUG tmp/work/.../.config