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)
Here is what is returned. The specific module / driver information we need is in bold.
8086d131 Intel Corporation Core Processor DMI 8086d138 Intel Corporation Core Processor PCI Express Root Port 1 8086d155 Intel Corporation Core Processor System Management Registers 8086d156 Intel Corporation Core Processor Semaphore and Scratchpad Registers 8086d157 Intel Corporation Core Processor System Control and Status Registers 8086d158 Intel Corporation Core Processor Miscellaneous Registers 8086d150 Intel Corporation Core Processor QPI Link 8086d151 Intel Corporation Core Processor QPI Routing and Protocol Registers 80863b3c Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller 80863b56 Yes Intel Corporation 5 Series/3400 Series Chipset High Definition Audio snd-hda-intel v2.6.27- 80863b42 Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 80863b4a Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 80863b4c Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 80863b4e Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 7 80863b50 Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 8 80863b34 Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller 8086244e Yes Intel Corporation 82801 PCI Bridge i810_rng 80863b02 Yes Intel Corporation 5 Series Chipset LPC Interface Controller iTCO_wdt v2.6.33- 80863b20 Yes Intel Corporation 5 Series/3400 Series Chipset 4 port SATA IDE Controller ata_piix v2.6.27- 80863b30 Yes Intel Corporation 5 Series/3400 Series Chipset SMBus Controller i2c-i801 v2.6.28- 80863b26 Yes Intel Corporation 5 Series/3400 Series Chipset 2 port SATA IDE Controller ata_piix v2.6.27- 10de05e2 nVidia Corporation GT200 [GeForce GTX 260] 10ec8168 Yes Realtek Semiconductor RTL8111/8168B PCI Express Gigabit Ethernet controller r8169 v2.6.25- 197b2363 Yes JMicron Technology Corp JMB362/JMB363 Serial ATA Controller jmicron 197b2363 Yes JMicron Technology Corp JMB362/JMB363 Serial ATA Controller jmicron 168c0013 Yes Atheros Communications Atheros AR5001X+ Wireless Network Adapter ath5k v2.6.25- 11063044 Yes VIA Technologies, Inc. VT6306/7/8 [Fire II(M)] IEEE 1394 OHCI Controller ohci1394
Setting kernel values using menuconfig
Note: I have not yet found a way to easily translate the module names into what they relate to in the kernel .config files! Doing so would drastically simplify the driver configuration portion of the kernel config. If anyone knows how to do this, please let me know.
We're now ready to use the menu configuration editor to set up the kernel.
# make menuconfig
Use the arrow keys to navigate through the options. To enable the drivers for your hardware, go down to the Device Drivers section. The first item in the table above is snd-hda-intel. We can see that this is an Intel Corporation 5 Series/3400 Series Chipset High Definition Audio device. The relevant section in the kernel configuration would be
Device Drivers --->
<*> Sound card support --->
<*> Advanced Linux Sound Architecture --->
[*] PCI sound devices --->
<*> Intel HD Audio --->
...
This isn't the best example to start with, since the driver is actually nested under the Advanced Linux Sound Architecture (ALSA) section, and chances are you don't know what ALSA or OSS are yet. This is explained in greater detail later in the Configure sound section. For now, we will continue with the next item, i810_rng.