Having Linux kernel source code allow us to open possibility to customize / configure the kernel as you wish. Main kernel image is built as a static image, and some part of linux kernel image is also built as loadable modules (device driver). The image is always resident in memory while some services are added to the kernel at runtime in the form of modules. Complete kernel image constitute static kernel image plus run-time loadable modules. Linux kernel configuration allows you to decide , which feature you want to include in linux kernel image , which feature you do not want to include or which service you want to make as a loadable kernel module etc.
This article will try to cover all important ones for configuring Linux kernel.
Text Based Configuration
1. Interactive Configuration
Kernel has provide an interactive text based kernel configuration utility using Makefile. If you use ‘make config’, it will configure itself. In fact, it is useful for quite experienced kernel developers and not for the beginners. The result of this command is shown below:
# make config scripts/kconfig/conf arch/x86/Kconfig * * Linux Kernel Configuration * * * General setup * Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [N/y/?] y Local version – append to kernel release (LOCALVERSION)  y Automatically append version information to the version string (LOCALVERSION_AUTO) [N/y/?] y Kernel compression mode > 1. Gzip (KERNEL_GZIP) 2. Bzip2 (KERNEL_BZIP2) 3. LZMA (KERNEL_LZMA) 4. LZO (KERNEL_LZO) choice[1-4?]: 1 Support for paging of anonymous memory (swap) (SWAP) [N/y/?] y System V IPC (SYSVIPC) [N/y/?] y BSD Process Accounting (BSD_PROCESS_ACCT) [N/y/?] y BSD Process Accounting version 3 file format (BSD_PROCESS_ACCT_V3) [N/y/?] (NEW) y * * RCU Subsystem * RCU Implementation > 1. Tree-based hierarchical RCU (TREE_RCU) 2. UP-only small-memory-footprint RCU (TINY_RCU) choice[1-2]: 1 Enable tracing for RCU (RCU_TRACE) [N/y/?] y Tree-based hierarchical RCU fanout value (RCU_FANOUT) 
This command starts an interactive kernel configuration script. Once invoked, it will continuously prompts for user input at every step . User can enter any one of the four options:
- Yes – For building the particular feature with kernel’s static image.
- No – For not including the feature at all in the kernel image
- Module – For build this feature as loadable kernel module.
- ? – For help, gives brief description on the feature.
Script prompts for each and every option and expects the input for each of the options. There are so many options available so it is very tedious and time consuming way. Now you can guess the reason why it not a preferred way to configure linux kernel.
2. Predefined Configuration Target
Tell the Makefile to use predefined configuration target. There are some predefined configuration, which are: defconfig, oldconfig, randconfig, allmodconfig, allyesconfig, allnoconfig.
Use default configuration to configure kernel.
It’s easy and you would not expecting much other than default parts.
This utility generates default configuration for linux kernel. This default configuration is based on the configuration options preferred and used by linux kernel maintainers on their own machines. Once the task done, you can view and modify the configuration as you wish.
Technically speaking, it updates the current kernel configuration by using the current .config file and prompting for any new options that have been added to the kernel.
If you think your old configuration is fit to your condition, you can always use this. Like defconfig, you can view and modify the configuration once the configuration finished.
There is also a variant to this, silentoldconfig, which prints nothing to screen except a question.
Generates a new kernel configuration with random answers to all of the different option.
Generates a new kernel configuration in which modules are enabled whenever possible.
Generates a new kernel configuration with all options set to yes.
enerates a new kernel configuration with all options set to no.
Console Based Configuration
The very popular way of configuring kernel. Still using command line interface, but it’s at least graphically on terminal (using ncurses).
It will opens a graphical console in which all kernel configuration options are arranged into categories. These categories are further categorized into subcategories. Just browse through and keep on selecting options until you reach the specific configuration option you need to modify.
This method is easier than the methods we have covered so far.
If you think you have it enough, you can select < Exit > to exit the configuration. You can also exit without doing any modification. A configuration, .config file, will be created / updated.
GUI Based Configuration
1. X11 Based Configuration
Using help of X window system.
Make xconfig is X11-based graphical configuration utility. It arranges all the configuration options into left and right pane. You can easily browse through and select different options easily.
2. GTK Based Configuration
Using GTK+ based system. Make sure you have GTK libraries installed.
Other method to configure kernel. It doesn’t use Makefile like other methods we have discussed, but instead we directly modify the configuration file. Configuration is saved as a file “.config” without quote.
The configuration file is located in the root of the kernel source tree. It consists of some lines, usually in the format VARIABLE=value
The variable are the kernel options where the value can be y, n and other value defined for that options.kernel, linux