2.2.3. Changing the Configuration

You can make wholesale or incremental changes to the Linux kernel .config file by including a defconfig or by specifying configuration fragments in the SRC_URI.

If you have a complete Linux kernel .config file you want to use, copy it to a directory named files, which must be in your layer's recipes-kernel/linux directory, and name the file "defconfig". Then, add the following lines to your linux-yocto .bbappend file in your layer:

     FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
     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 files directory you created for the configuration changes.

Generally speaking, the preferred approach is to determine the incremental change you want to make and add that as a configuration fragment. For example, if you want to add support for a basic serial console, create a file named 8250.cfg in the files directory with the following content (without indentation):

     CONFIG_SERIAL_8250=y
     CONFIG_SERIAL_8250_CONSOLE=y
     CONFIG_SERIAL_8250_PCI=y
     CONFIG_SERIAL_8250_NR_UARTS=4
     CONFIG_SERIAL_8250_RUNTIME_UARTS=4
     CONFIG_SERIAL_CORE=y
     CONFIG_SERIAL_CORE_CONSOLE=y
                

Next, include this configuration fragment and extend the FILESPATH variable in your .bbappend file:

     FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
     SRC_URI += "file://8250.cfg"
                

The next time you run BitBake to build the Linux kernel, BitBake detects the change in the recipe and fetches and applies the new configuration before building the kernel.

For a detailed example showing how to configure the kernel, see the "Configuring the Kernel" section in the Yocto Project Development Manual.