Kernel configuration
How to configure, compile and install a Linux kernel
1. Selecting kernel
Recommended kernel these days is 2.4.23 from http://www.kernel.org/ . The original kernel suits most people.
Use >= 2.4.23 or make sure your kernel has the latest security patches.
There are numerous patchsets of the stable vanilla kernel, the most popular are:
2.4
- ARM/Linux kernel
- ck-sources Con Kolivas's high performance patchset of the stock Linux kernel
- compaq-sources from the Compaq Distribution of Red Hat Linux (ALPHA).
- gaming-sources The Gentoo Linux gaming-optimized kernel
- gentoo-sources The Gentoo Linux stock kernel
- grsec-sources Grsecurity is a major security enhanced patchset for the vanilla kernel
- hardened-sources Special Security Hardened Gentoo Linux Kernel
- sys-kernel/usermode-sources the User Mode Linux kernel "User-Mode Linux is a safe, secure way of running Linux versions and Linux processes. Run buggy software, experiment with new Linux kernels or distributions, and poke around in the internals of Linux, all without risking your main Linux setup."
- sys-kernel/wolk-sources "Working Overloaded Linux Kernel"
2. Installing the kernel
Unpack a nice kernel into /usr/src. Grab one from http://www.kernel.org/.
Then make (or edit) two symlinks to the kernel:
ln -s /usr/src/your-kernel /usr/src/linux ln -s /usr/src/your-kernel /usr/src/linux-2.4
Now 'prepare' kernel (you only have to do this once. Note: This will delete configuration files, if you have any):
cd /usr/src/linux make mrproper
3. Configuring the 2.4.xx kernel
You must configure the kernel for your system if you want optimal performance.
You can use any of these ways of configuring the kernel:
| make oldconfig | Use when upgrading kernel, only asks if new options |
| make menuconfig | Console-type configuator |
| make xconfig | XFree kernel configurator |
It is generally a good idea to compile more than less modules. Entering 'm' does not mean that the module is enabled, only compiled.
Important Settings include:
3.1. USB
USB USB support ---> USB verbose debug messages USB-to-USB Networking cable device support (EXPERIMENTAL)
3.2. Sound Card support
Sound Sound ---> Sound card support
ALSA: Turn everything else in this section off (N) to use the alsa drivers .
OSS: y or m for any sound cards you have and may want.
3.3. Hardware sensors (lm-sensors) support
To be able to compile and use the hardware sensors monitoring program lm_sensors (shows your CPU and chipset temperature) you will need
Character devices ---> I2C support --->
And in this menu you must select the following as modules
<M> I2C support <M> I2C device interface <M> I2C /proc interface (required for hardware sensors)
The lm_sensors will not build if you compile this into your kernel by selecting Y.
//Common problems: If you compiled your kernel wrong and compiled the i2c package required by lm-sensors you must re-install this package before installing lm-sensors//
3.4. Make sure you actually save your config..
Remember: Do SAVE your config! You can even edit your kernel using KDEs kcontrol . It is wise to back up your kernel configuration from time to time:
mkdir Config-backups cp .config Config-backups/current-config
4. Compiling the kernel
To compile your kernel, run:
make dep && make clean bzImage modules modules_install
Your new kernel is now placed in /usr/src/linux/arch/i386/boot/bzImage. Copy this to your /boot partation.
Gentoo notice: /boot is not mounted by default. You must mount it yourself before copying the new kernel image.
cp /usr/src/linux/arch/i386/boot/bzImage /boot
It's a good idea to backup your old kernel image with
mv /boot/bzImage /boot/bzImage.old
and have both images available in your boot-loader.