|Lesson 8||Configuring the kernel |
|Objective||Configure Linux Kernel Options before Compilation |
Configure Linux Kernel Options before Compilation
Configuring your kernel correctly is crucial. Not only must you decide what kernel options to include, you must also decide if they are modular or built into the kernel. Linux makes it easy to set kernel options, but you must make sure you choose your options wisely.
Question: How do configure Linux Kernel options before compilation when using Red Hat Linux?
To configure Linux Kernel options before compilation when using Red Hat Linux, you can use the menuconfig tool, which is a graphical user interface (GUI) that allows you to select and configure kernel options.
Here are the steps to use menuconfig to configure kernel options before compilation:
- Download the kernel source code from the Red Hat website or via a package manager.
- Extract the kernel source code to a directory on your system.
- Open a terminal window and navigate to the directory containing the kernel source code.
- Run the following command to start menuconfig:
This will open the menuconfig GUI, which displays a list of kernel options that can be configured.
- Use the arrow keys to navigate through the list of options and the spacebar to select or deselect options.
- Use the Enter key to enter submenus and configure specific options within each submenu.
- Once you have finished configuring the kernel options, select the "Save" option to save your changes.
- Exit the menuconfig GUI and run the following command to start the kernel compilation process:
This will compile the kernel with the options that you have configured.
- Once the compilation process is complete, install the new kernel using your package manager or by manually copying the compiled kernel image to the appropriate location.
By configuring kernel options before compilation using menuconfig, you can customize the kernel to meet your specific needs and requirements. This can include enabling or disabling certain features, optimizing performance, and improving security.
When choosing kernel options, consider the specific hardware on your system and your need for protocols and services. Here are some general guidelines to follow.
- Under Code Maturity Level Options, check Prompt for development and/or incomplete code/drivers. If you do not check this option, certain essential services (most notably
rpc.nfsd) may not work correctly.
- Optimize for your computer's processor family.
- Turn off math emulation when your system has a dedicated math coprocessor. Intel 386 and 486 systems with a coprocessor, Pentiums, and Alphas all have on-processor math coprocessors.
- Turn off SMP (Symmetric Multi-Processor) support when your system only has a single CPU.
- Modularize as much hardware support as possible.
- Turn off ISDN  IrDA, and old CD-ROM drivers support, unless you have these capabilities or devices.
- Don't change the default sound configuration.
Configuring the kernel
To configure the kernel, follow the following four steps.
- Change to the
make mrproper to restore the sources to a clean state.
- Copy one of Red Hat's default configuration files from the
configs/ directory to
arch/i386/defconfig. Red Hat provides these default configurations for a variety of hardware platforms. The settings inside of each make configuring the kernel easier.
make oldconfig to create a starting Linux kernel configuration file from the default configuration copied in the previous step.
- Create the kernel configuration file using one of the standard configuration utilities:
make xconfig, make menuconfig, or make config.
- Update the
EXTRAVERSION= line in
make dep to create the source dependencies and propagate configuration information to all makefiles in the development tree.
make clean to remove old object files.
Pre Compilation Kernel
- Step one: change into the /usr/src/linux directory. All subsequent commands will run relative to this directory.
- Step two: type make mrproper to restore the kernel sources to a clean state.
- Step three: copy a default configuration file to the arch/i386/defconfig file
- Step four: create a starting Linux kernel configuration file by typing make oldconfig.
- Step five: create the kernel configuration file using one of the standard configuration utilities: make xconfig, make menuconfig, or make config.
- The colorized menu interface for make menuconfig is very useful. You can use the arrow keys to move up and down, and the Enter key to move into submenus.
- Save your changes before you exit the configuration program.
- Once you are outside of make menuconfig, you see that it prompts you for the next steps.
- Step six: update the EXTRAVERSION variable in the Linux kernel configuration makefile.
- Step seven: type make dep to create the source dependencies and propagate configuration information to all makefiles in the development tree.
- Step eight: type make clean to remove old object files.
If you build the kernel in the future and use the same configuration, you do not need to perform steps two, three, and four.
You need to do these steps only the first time you are rebuilding a Red Hat Linux kernel. The next lesson presents the kernel and modules build and install procedures.
An acronym for Integrated Services Digital Network, ISDN is a standards specification for data transmission over telephone wires and other land-based media.
An acronym for Infrared Data Association, IrDA is an international standards body that plans the hardware and software requirements for wireless, infrared data communication.