5.10.2. Creating a  defconfig File

A defconfig file is simply a .config renamed to "defconfig". You can use a defconfig file to retain a known set of kernel configurations from which the OpenEmbedded build system can draw to create the final .config file.

Note

Out-of-the-box, the Yocto Project never ships a defconfig or .config file. The OpenEmbedded build system creates the final .config file used to configure the kernel.

To create a defconfig, start with a complete, working Linux kernel .config file. Copy that file to the appropriate ${PN} directory in your layer's recipes-kernel/linux directory, and rename the copied file to "defconfig". Then, add the following lines to the linux-yocto .bbappend file in your layer:

     FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
     SRC_URI += "file://defconfig"
                

The SRC_URI tells the build system how to search for the file, while the FILESEXTRAPATHS extends the FILESPATH variable (search directories) to include the ${PN} directory you created to hold the configuration changes.

Note

The build system applies the configurations from the defconfig file before applying any subsequent configuration fragments. The final kernel configuration is a combination of the configurations in the defconfig file and any configuration fragments you provide. You need to realize that if you have any configuration fragments, the build system applies these on top of and after applying the existing defconfig file configurations.

For more information on configuring the kernel, see the "Changing the Configuration" and "Generating Configuration Files" sections, both in the Yocto Project Linux Kernel Development Manual.