2.6.5. Fine-Tuning the Kernel Configuration File

You can make sure the .config file is as lean or efficient as possible by reading the output of the kernel configuration fragment audit, noting any issues, making changes to correct the issues, and then repeating.

As part of the kernel build process, the do_kernel_configcheck task runs. This task validates the kernel configuration by checking the final .config file against the input files. During the check, the task produces warning messages for the following issues:

Note

The do_kernel_configcheck task can also optionally report if an option is overridden during processing.

For each output warning, a message points to the file that contains a list of the options and a pointer to the configuration fragment that defines them. Collectively, the files are the key to streamlining the configuration.

To streamline the configuration, do the following:

  1. Use a Working Configuration: Start with a full configuration that you know works. Be sure the configuration builds and boots successfully. Use this configuration file as your baseline.

  2. Run Configure and Check Tasks: Separately run the do_kernel_configme and do_kernel_configcheck tasks:

         $ bitbake linux-yocto -c kernel_configme -f
         $ bitbake linux-yocto -c kernel_configcheck -f
                            

  3. Process the Results: Take the resulting list of files from the do_kernel_configcheck task warnings and do the following:

    • Drop values that are redefined in the fragment but do not change the final .config file.

    • Analyze and potentially drop values from the .config file that override required configurations.

    • Analyze and potentially remove non-board specific options.

    • Remove repeated and invalid options.

  4. Re-Run Configure and Check Tasks: After you have worked through the output of the kernel configuration audit, you can re-run the do_kernel_configme and do_kernel_configcheck tasks to see the results of your changes. If you have more issues, you can deal with them as described in the previous step.

Iteratively working through steps two through four eventually yields a minimal, streamlined configuration file. Once you have the best .config, you can build the Linux Yocto kernel.