Configure the kernel
The Linux kernel is highly configurable. Advanced users might want to modify the default configuration to customise it to their needs, such as enabling a new or experimental network protocol, or enabling support for new hardware.
Configuration is most commonly done through the make menuconfig interface. Alternatively, you can modify your .config file manually, but this can be more difficult.
Prepare to configure
The menuconfig tool requires the ncurses development headers to compile properly. To install these headers, run the following command:
$ sudo apt install libncurses5-dev
Next, download your kernel sources. In particular, ensure you have installed the default native configuration or default cross-compilation configuration.
menuconfig
After you set everything up, you can compile and run the menuconfig utility as follows:
$ make menuconfig
To cross-compile a 64-bit kernel:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
To cross-compile a 32-bit kernel:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
To navigate the menuconfig utility, use your keyboard:
-
to navigate directionally, use the arrow keys
-
to enter a submenu (indicated by
--->), press the Enter key -
to go up a level or exit, press Escape twice
-
to toggle the state of a binary option, press the space bar
-
to select the state of a multiple choice option, press Enter to open a submenu, the arrow keys to navigate the submenu, and press Enter again to select a state
-
to get help with an option or menu, press the H key
After a brief compilation, menuconfig presents a list of submenus containing all the options you can configure. There are many options, so take your time to read through them. Resist the temptation to enable or disable a lot of things on your first attempt; it’s relatively easy to break your configuration, so start small and get comfortable with the configuration and build process.
Save your changes
When you finish making changes, press Escape until you’re prompted to save your new configuration. By default, this saves to the .config file. You can save and load configurations by copying this file.
After customising, you should now be ready to build the kernel.