2.3.2. Generating Configuration Files

You can manipulate the .config file used to build a linux-yocto recipe with the menuconfig command as follows:

     $ bitbake linux-yocto -c menuconfig
                

This command starts the Linux kernel configuration tool, which allows you to prepare a new .config file for the build. When you exit the tool, be sure to save your changes at the prompt.

The resulting .config file is located in ${WORKDIR} under the linux-${MACHINE}-${KTYPE}-build directory. You can use the entire .config file as the defconfig file as described in the "Changing the Configuration" section.

A better method is to create a configuration fragment using the differences between two configuration files: one previously created and saved, and one freshly created using the menuconfig tool.

To create a configuration fragment using this method, follow these steps:

  1. Complete a build at least through the kernel configuration task as follows:

         $ bitbake linux-yocto -c kernel_configme -f
                            
  2. Run the menuconfig command:

         $ bitbake linux-yocto -c menuconfig
                            
  3. Run the diffconfig command to prepare a configuration fragment. The resulting file fragment.cfg will be placed in the ${WORKDIR} directory:

         $ bitbake linux-yocto -c diffconfig
                            

The diffconfig command creates a file that is a list of Linux kernel CONFIG_ assignments. See the "Changing the Configuration" section for information on how to use the output as a configuration fragment.

Note

You can also use this method to create configuration fragments for a BSP. See the "BSP Descriptions" section for more information.

The kernel tools also provide configuration validation. You can use these tools to produce warnings for when a requested configuration does not appear in the final .config file or when you override a policy configuration in a hardware configuration fragment. Here is an example with some sample output of the command that runs these tools:

     $ bitbake linux-yocto -c kernel_configcheck -f

     ...

     NOTE: validating kernel configuration
     This BSP sets 3 invalid/obsolete kernel options.
     These config options are not offered anywhere within this kernel.
     The full list can be found in your kernel src dir at:
     meta/cfg/standard/mybsp/invalid.cfg

     This BSP sets 21 kernel options that are possibly non-hardware related.
     The full list can be found in your kernel src dir at:
     meta/cfg/standard/mybsp/specified_non_hdw.cfg

     WARNING: There were 2 hardware options requested that do not
              have a corresponding value present in the final ".config" file.
              This probably means you are not't getting the config you wanted.
              The full list can be found in your kernel src dir at:
              meta/cfg/standard/mybsp/mismatch.cfg
                

The output describes the various problems that you can encounter along with where to find the offending configuration items. You can use the information in the logs to adjust your configuration files and then repeat the kernel_configme and kernel_configcheck commands until they produce no warnings.

For more information on how to use the menuconfig tool, see the "Using menuconfig" section in the Yocto Project Development Manual.