Modify the linux kernel with configuration fragments in Yocto

From KoanSoftware Wiki
Revision as of 09:10, 20 December 2021 by Koan (talk | contribs)

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.



Examples

This is an example of the files involved in this operation

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


Content of linux-intel_%.bbappend

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


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

CONFIG_SOUND=y
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_MIDI_GADGET 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.



NOTE

In case you are courious...

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

tmp/work-shared/YOURKERNELNAME/kernel-build-artifacts