Modify the linux kernel with configuration fragments in Yocto

From KoanSoftware Wiki
Jump to: navigation, search

Modify the linux kernel with configuration fragments in Yocto

Modifying the kernel configuration in Yocto may be different depending on the original conditions.

In general would be convenient to adopt configuration fragments that can be generated directly with the bitbake command executing the following steps:

1. Prepare for the kernel configuration (take a snapshot)

bitbake -c kernel_configme virtual/kernel

2. Edit the configuration (do your modifications)

bitbake -c menuconfig virtual/kernel

3. Save the configuration differences (extract the differences)

bitbake -c diffconfig virtual/kernel

The differences will be saved in $WORKDIR/fragment.cfg

You have to copy the $WORKDIR/fragment.cfg in your layer directory and in the recipe (bbappend) as in the example below.


This is an example of the files involved in this operation

└── recipes-kernel
    └── linux
        ├── linux-intel
        │   └── koan-modified-configuration.cfg
        └── linux-intel_%.bbappend

Content of linux-intel_%.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:"
SRC_URI += "file://koan-modified-configuration.cfg"

Content of linux-intel/koan-modified-configuration.cfg

# CONFIG_USB_AUDIO is not set

Note: After integrating configuration fragments into the appended recipe, you can check everything is fine by running.

bitbake -c kernel_configcheck -f virtual/kernel

However this is automatically called by bitbake when rebuilding the kernel.


In case you are courious...

Where do you find the .config file after having run bitbake -c menuconfig virtual/kernel ?