How to do it...

The kernel kbuild system reads its configuration at build time from a .config text file in the kernel root directory. This is referred to as the kernel configuration file. It is a text file where each line contains a single configuration variable that starts with the CONFIG_ prefix.

There are multiple ways to modify a kernel configuration file:

  1. Manually editing the .config file, although this is not recommended.
  2. Using one of the user interfaces the kernel offers (type the make help command for other options):
    • menuconfig: An ncurses menu-based interface (make menuconfig)
    • xconfig: A Qt-based interface (make xconfig)
    • gconfig: A GTK-based interface (make gconfig)
  1. Automatically, via a build system such as Yocto.
Note that to build and use these interfaces, your Linux host needs to have the appropriate dependencies.
  1. Each machine also defines a default configuration in the kernel tree. For ARM platforms, these are stored in the arch/arm/configs directory. To configure an ARM kernel, that is, to produce a .config file from a default configuration, run the following:
$ make ARCH=arm <platform>_defconfig          

For example, we can build a default configuration for NXP's i.MX6 processors by running the following:

$ make ARCH=arm imx_v6_v7_defconfig          

By specifying the ARCH=arm configuration parameter, you instruct the kbuild system to look for the specified defconfig on the ARM configuration files directory. If you omit it, the kernel will default to the x86 configuration.