Configure the Kernel
Installing Gentoo - Configure the Kernel
Configuring the Linux kernel is the most difficult part of performing a Gentoo installation.
The components of the Linux kernel can either be built-in or compiled as modules which can be loaded or unloaded. Most Linux distributions will provide you with a generic kernel image with most of the hardware drivers and other components available as modules. The advantage of this method is that another piece of software can probe the system, determine the hardware components, and load the appropriate modules at startup, much in the same way that your Gentoo installation CD did. The disadvantage is that certain parts of the kernel and most of the modules will never be used. Our goal is to create the smallest, fastest, most efficient kernel possible for your target environment.
Thankfully, most of the hard part has already been done for you. Some time ago, an advocate by the name of Pappy McFae blessed us with "kernel seeds" for a number of different architectures which are freely available at his website, kernel-seeds.org. His goal was to provide starting kernel configurations, geared towards everyday use, but with the unnecessary components removed. Using of of Pappy's kernel seeds, all you need do is add in the drivers for your specific hardware and any other components you may require. Personally, I noticed a performance of around 20% using one of Pappy's kernel seeds as compared to the default kernel configuration provided by the Gentoo devs.
Emerging the kernel source files
Our first step will be to emerge the kernel source files and determine what version of the kernel we'll be using.
# emerge -av gentoo-sources
Make a note of the version that is emerged, which will usually be in the format 2.6.x-gentoo-ry. Here x represents the kernel version, and y represents the Gentoo release version of that particular kernel version. In this example we'll use the 64-bit instance of 2.6.34-gentoo-r12 as our example.
Downloading a kernel seed
We'll start by determining the correct kernel seed config file for our architecture (x86_64 for 64-bit systems or x86 for 32-bit systems). Given the example chosen above, the path to the kernel seed configuration file for a 64-bit system using 2.6.34-gentoo-r12 is http://kernel-seeds.org/seeds/64_bit/gentoo/2.6.34-gentoo-r12-x86_64-07.config . We'll use wget to download the seed and use it as our starting configuration.
# cd /usr/src/linux # wget http://kernel-seeds.org/seeds/64_bit/gentoo/2.6.34-gentoo-r12-x86_64-07.config
The freshly downloaded file will have the same target file name as its source, so let's make a copy we'll use for our actual config while keeping the original file as a backup should we need to start over.
# cp 2.6.34-gentoo-r12-x86_64-07.config .config
Identifying hardware components
To identify the hardware components in our system, we'll use a tool called pciutils.
# emerge -av pciutils
After the emerge has completed, we can probe the hardware on the system.
# lspci -v | more
Previously, when configuring the kernel, you'd have to make note of each hardware device, and hunt through the "Device Drivers" section of the kernel to try to enable the necessary drivers for your hardware. Thanks to the work of Pappy and others, this process is easier now. As explained on the kernel-seeds website, you can use pciutils to return the numeric ID's for your hardware.
# lspci -n
Copy the results it's given you and paste them into the form at http://kmuto.jp/debian/hcl/ . It will return a table containing the kernel modules needed for your hardware. For example, here is the results of lspic -n for my system:
00:00.0 0600: 8086:d131 (rev 11) 00:03.0 0604: 8086:d138 (rev 11) 00:08.0 0880: 8086:d155 (rev 11) 00:08.1 0880: 8086:d156 (rev 11) 00:08.2 0880: 8086:d157 (rev 11) 00:08.3 0880: 8086:d158 (rev 11) 00:10.0 0880: 8086:d150 (rev 11) 00:10.1 0880: 8086:d151 (rev 11) 00:1a.0 0c03: 8086:3b3c (rev 05) 00:1b.0 0403: 8086:3b56 (rev 05) 00:1c.0 0604: 8086:3b42 (rev 05) 00:1c.4 0604: 8086:3b4a (rev 05) 00:1c.5 0604: 8086:3b4c (rev 05) 00:1c.6 0604: 8086:3b4e (rev 05) 00:1c.7 0604: 8086:3b50 (rev 05) 00:1d.0 0c03: 8086:3b34 (rev 05) 00:1e.0 0604: 8086:244e (rev a5) 00:1f.0 0601: 8086:3b02 (rev 05) 00:1f.2 0101: 8086:3b20 (rev 05) 00:1f.3 0c05: 8086:3b30 (rev 05) 00:1f.5 0101: 8086:3b26 (rev 05) 01:00.0 0300: 10de:05e2 (rev a1) 02:00.0 0200: 10ec:8168 (rev 03) 03:00.0 0106: 197b:2363 (rev 03) 03:00.1 0101: 197b:2363 (rev 03) 07:01.0 0200: 168c:0013 (rev 01) 07:03.0 0c00: 1106:3044 (rev c0)