| 1 |
<?xml version='1.0' encoding='UTF-8'?>
|
| 2 |
<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
|
| 3 |
|
| 4 |
<!-- The content of this document is licensed under the CC-BY-SA license -->
|
| 5 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
|
| 6 |
|
| 7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-kernel.xml,v 1.24 2008/05/09 10:33:08 nightmorph Exp $ -->
|
| 8 |
|
| 9 |
<sections>
|
| 10 |
|
| 11 |
<abstract>
|
| 12 |
The Linux kernel is the core of every distribution. This chapter
|
| 13 |
explains how to configure your kernel.
|
| 14 |
</abstract>
|
| 15 |
|
| 16 |
<version>6.3</version>
|
| 17 |
<date>2008-05-19</date>
|
| 18 |
|
| 19 |
<section>
|
| 20 |
<title>Timezone</title>
|
| 21 |
<body>
|
| 22 |
|
| 23 |
<p>
|
| 24 |
You first need to select your timezone so that your system knows where it is
|
| 25 |
located. Look for your timezone in <path>/usr/share/zoneinfo</path>, then copy
|
| 26 |
it to <path>/etc/localtime</path>. Please avoid the
|
| 27 |
<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not
|
| 28 |
indicate the expected zones. For instance, <path>GMT-8</path> is in fact
|
| 29 |
GMT+8.
|
| 30 |
</p>
|
| 31 |
|
| 32 |
<pre caption="Setting the timezone information">
|
| 33 |
# <i>ls /usr/share/zoneinfo</i>
|
| 34 |
<comment>(Suppose you want to use GMT)</comment>
|
| 35 |
# <i>cp /usr/share/zoneinfo/GMT /etc/localtime</i>
|
| 36 |
</pre>
|
| 37 |
|
| 38 |
</body>
|
| 39 |
</section>
|
| 40 |
<section>
|
| 41 |
<title>Installing the Sources</title>
|
| 42 |
<subsection>
|
| 43 |
<title>Choosing a Kernel</title>
|
| 44 |
<body>
|
| 45 |
|
| 46 |
<p>
|
| 47 |
The core around which all distributions are built is the Linux kernel. It is the
|
| 48 |
layer between the user programs and your system hardware. Gentoo provides its
|
| 49 |
users several possible kernel sources. A full listing with description is
|
| 50 |
available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel
|
| 51 |
Guide</uri>.
|
| 52 |
</p>
|
| 53 |
|
| 54 |
<p>
|
| 55 |
For <keyval id="arch"/>-based systems we have <c>gentoo-sources</c>
|
| 56 |
(kernel source patched for extra features).
|
| 57 |
</p>
|
| 58 |
|
| 59 |
<p>
|
| 60 |
Choose your kernel source and install it using <c>emerge</c>.
|
| 61 |
</p>
|
| 62 |
|
| 63 |
<pre caption="Installing a kernel source">
|
| 64 |
# <i>emerge gentoo-sources</i>
|
| 65 |
</pre>
|
| 66 |
|
| 67 |
<p>
|
| 68 |
When you take a look in <path>/usr/src</path> you should see a symlink called
|
| 69 |
<path>linux</path> pointing to your kernel source. In this case, the installed
|
| 70 |
kernel source points to <c>gentoo-sources-<keyval id="kernel-version"/></c>.
|
| 71 |
Your version may be different, so keep this in mind.
|
| 72 |
</p>
|
| 73 |
|
| 74 |
<pre caption="Viewing the kernel source symlink">
|
| 75 |
# <i>ls -l /usr/src/linux</i>
|
| 76 |
lrwxrwxrwx 1 root root 12 Oct 13 11:04 /usr/src/linux -> linux-<keyval id="kernel-version"/>
|
| 77 |
</pre>
|
| 78 |
|
| 79 |
<p>
|
| 80 |
Now it is time to configure and compile your kernel source. You can use
|
| 81 |
<c>genkernel</c> for this, which will build a generic kernel as used by the
|
| 82 |
Installation CD. We explain the "manual" configuration first though, as it is
|
| 83 |
the best way to optimize your environment.
|
| 84 |
</p>
|
| 85 |
|
| 86 |
<p>
|
| 87 |
If you want to manually configure your kernel, continue now with <uri
|
| 88 |
link="#manual">Default: Manual Configuration</uri>. If you want to use
|
| 89 |
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using
|
| 90 |
genkernel</uri> instead.
|
| 91 |
</p>
|
| 92 |
|
| 93 |
</body>
|
| 94 |
</subsection>
|
| 95 |
</section>
|
| 96 |
<section id="manual">
|
| 97 |
<title>Default: Manual Configuration</title>
|
| 98 |
<subsection>
|
| 99 |
<title>Introduction</title>
|
| 100 |
<body>
|
| 101 |
|
| 102 |
<p>
|
| 103 |
Manually configuring a kernel is often seen as the most difficult procedure a
|
| 104 |
Linux user ever has to perform. Nothing is less true -- after configuring a
|
| 105 |
couple of kernels you don't even remember that it was difficult ;)
|
| 106 |
</p>
|
| 107 |
|
| 108 |
<p>
|
| 109 |
However, one thing <e>is</e> true: you must know your system when you start
|
| 110 |
configuring a kernel manually. Most information can be gathered by emerging
|
| 111 |
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now
|
| 112 |
be able to use <c>lspci</c> within the chrooted environment. You may safely
|
| 113 |
ignore any <e>pcilib</e> warnings (like pcilib: cannot open
|
| 114 |
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run
|
| 115 |
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same.
|
| 116 |
You can also run <c>lsmod</c> to see what kernel modules the Installation CD
|
| 117 |
uses (it might provide you with a nice hint on what to enable).
|
| 118 |
</p>
|
| 119 |
|
| 120 |
<p>
|
| 121 |
Now go to your kernel source directory and execute <c>make menuconfig</c>. This
|
| 122 |
will fire up an ncurses-based configuration menu.
|
| 123 |
</p>
|
| 124 |
|
| 125 |
<pre caption="Invoking menuconfig">
|
| 126 |
# <i>cd /usr/src/linux</i>
|
| 127 |
# <i>make menuconfig</i>
|
| 128 |
</pre>
|
| 129 |
|
| 130 |
<p>
|
| 131 |
You will be greeted with several configuration sections. We'll first list some
|
| 132 |
options you must activate (otherwise Gentoo will not function, or not function
|
| 133 |
properly without additional tweaks).
|
| 134 |
</p>
|
| 135 |
|
| 136 |
</body>
|
| 137 |
</subsection>
|
| 138 |
<subsection>
|
| 139 |
<title>Activating Required Options</title>
|
| 140 |
<body>
|
| 141 |
|
| 142 |
<p>
|
| 143 |
Make sure that every driver that is vital to the booting of your system (such as
|
| 144 |
SCSI controller, ...) is compiled <e>in</e> the kernel and not as a module,
|
| 145 |
otherwise your system will not be able to boot completely.
|
| 146 |
</p>
|
| 147 |
|
| 148 |
</body>
|
| 149 |
<body test="func:keyval('arch')='AMD64'">
|
| 150 |
|
| 151 |
<p>
|
| 152 |
We shall then select the exact processor type. The x86_64 kernel maintainer
|
| 153 |
strongly recommends users enable MCE features so that they are able to be
|
| 154 |
notified of any hardware problems. On x86_64, these errors are not printed to
|
| 155 |
<c>dmesg</c> like on other architectures, but to <path>/dev/mcelog</path>. This
|
| 156 |
requires the <c>app-admin/mcelog</c> package. Make sure you select IA32
|
| 157 |
Emulation if you want to be able to run 32-bit programs. Gentoo will install a
|
| 158 |
multilib system (mixed 32-bit/64-bit computing) by default, so you probably
|
| 159 |
want this option.
|
| 160 |
</p>
|
| 161 |
|
| 162 |
<pre caption="Selecting processor type and features">
|
| 163 |
Processor type and features --->
|
| 164 |
[ ] Intel MCE Features
|
| 165 |
[ ] AMD MCE Features
|
| 166 |
Processor family (AMD-Opteron/Athlon64) --->
|
| 167 |
( ) AMD-Opteron/Athlon64
|
| 168 |
( ) Intel EM64T
|
| 169 |
( ) Generic-x86-64
|
| 170 |
Executable file formats / Emulations --->
|
| 171 |
[*] IA32 Emulation
|
| 172 |
</pre>
|
| 173 |
|
| 174 |
</body>
|
| 175 |
<body test="func:keyval('arch')='x86'">
|
| 176 |
|
| 177 |
<p>
|
| 178 |
Now select the correct processor family:
|
| 179 |
</p>
|
| 180 |
|
| 181 |
<pre caption="Selecting correct processor family">
|
| 182 |
Processor type and features --->
|
| 183 |
<comment>(Change according to your system)</comment>
|
| 184 |
(<i>Athlon/Duron/K7</i>) Processor family
|
| 185 |
</pre>
|
| 186 |
|
| 187 |
</body>
|
| 188 |
<body>
|
| 189 |
|
| 190 |
<p>
|
| 191 |
Now go to <c>File Systems</c> and select support for the filesystems you use.
|
| 192 |
<e>Don't</e> compile them as modules, otherwise your Gentoo system will not be
|
| 193 |
able to mount your partitions. Also select <c>Virtual memory</c> and <c>/proc
|
| 194 |
file system</c>.
|
| 195 |
</p>
|
| 196 |
|
| 197 |
<pre caption="Selecting necessary file systems">
|
| 198 |
File systems --->
|
| 199 |
Pseudo Filesystems --->
|
| 200 |
[*] /proc file system support
|
| 201 |
[*] Virtual memory file system support (former shm fs)
|
| 202 |
|
| 203 |
<comment>(Select one or more of the following options as needed by your system)</comment>
|
| 204 |
<*> Reiserfs support
|
| 205 |
<*> Ext3 journalling file system support
|
| 206 |
<*> JFS filesystem support
|
| 207 |
<*> Second extended fs support
|
| 208 |
<*> XFS filesystem support
|
| 209 |
</pre>
|
| 210 |
|
| 211 |
<p>
|
| 212 |
If you are using PPPoE to connect to the Internet or you are using a dial-up
|
| 213 |
modem, you will need the following options in the kernel:
|
| 214 |
</p>
|
| 215 |
|
| 216 |
<pre caption="Selecting PPPoE necessary drivers">
|
| 217 |
Device Drivers --->
|
| 218 |
Networking Support --->
|
| 219 |
<*> PPP (point-to-point protocol) support
|
| 220 |
<*> PPP support for async serial ports
|
| 221 |
<*> PPP support for sync tty ports
|
| 222 |
</pre>
|
| 223 |
|
| 224 |
<p>
|
| 225 |
The two compression options won't harm but are not definitely needed, neither
|
| 226 |
does the <c>PPP over Ethernet</c> option, that might only be used by <c>ppp</c>
|
| 227 |
when configured to do kernel mode PPPoE.
|
| 228 |
</p>
|
| 229 |
|
| 230 |
<p>
|
| 231 |
If you require it, don't forget to include support in the kernel for your
|
| 232 |
ethernet card.
|
| 233 |
</p>
|
| 234 |
|
| 235 |
<p test="func:keyval('arch')='x86'">
|
| 236 |
If you have an Intel CPU that supports HyperThreading (tm), or you have a
|
| 237 |
multi-CPU system, you should activate "Symmetric multi-processing support":
|
| 238 |
</p>
|
| 239 |
|
| 240 |
<p test="func:keyval('arch')='AMD64'">
|
| 241 |
If you have a multi-CPU Opteron or a multi-core (e.g. AMD64 X2) system, you
|
| 242 |
should activate "Symmetric multi-processing support":
|
| 243 |
</p>
|
| 244 |
|
| 245 |
<pre caption="Activating SMP support">
|
| 246 |
Processor type and features --->
|
| 247 |
[*] Symmetric multi-processing support
|
| 248 |
</pre>
|
| 249 |
|
| 250 |
<note>
|
| 251 |
In multi-core systems, each core counts as one processor.
|
| 252 |
</note>
|
| 253 |
|
| 254 |
<p test="func:keyval('arch')='x86'">
|
| 255 |
If you have more than 4GB of RAM, you need to enable "High Memory Support
|
| 256 |
(64G)".
|
| 257 |
</p>
|
| 258 |
|
| 259 |
<p>
|
| 260 |
If you use USB Input Devices (like Keyboard or Mouse) don't forget to enable
|
| 261 |
those as well:
|
| 262 |
</p>
|
| 263 |
|
| 264 |
<pre caption="Activating USB Support for Input Devices">
|
| 265 |
Device Drivers --->
|
| 266 |
USB Support --->
|
| 267 |
<*> USB Human Interface Device (full HID) support
|
| 268 |
</pre>
|
| 269 |
|
| 270 |
</body>
|
| 271 |
<body test="func:keyval('arch')='x86'">
|
| 272 |
|
| 273 |
<p>
|
| 274 |
If you want PCMCIA support for your laptop, don't forget to enable
|
| 275 |
support for the PCMCIA card bridge present in your system:
|
| 276 |
</p>
|
| 277 |
|
| 278 |
<pre caption="Enabling PCMCIA support">
|
| 279 |
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
|
| 280 |
PCCARD (PCMCIA/CardBus) support --->
|
| 281 |
<*> PCCard (PCMCIA/CardBus) support
|
| 282 |
<comment>(select 16 bit if you need support for older PCMCIA cards. Most people want this.)</comment>
|
| 283 |
<*> 16-bit PCMCIA support
|
| 284 |
[*] 32-bit CardBus support
|
| 285 |
<comment>(select the relevant bridges below)</comment>
|
| 286 |
--- PC-card bridges
|
| 287 |
<*> CardBus yenta-compatible bridge support (NEW)
|
| 288 |
<*> Cirrus PD6729 compatible bridge support (NEW)
|
| 289 |
<*> i82092 compatible bridge support (NEW)
|
| 290 |
<*> i82365 compatible bridge support (NEW)
|
| 291 |
<*> Databook TCIC host bridge support (NEW)
|
| 292 |
</pre>
|
| 293 |
|
| 294 |
<p>
|
| 295 |
When you've finished configuring the kernel, continue with <uri
|
| 296 |
link="#compiling">Compiling and Installing</uri>.
|
| 297 |
</p>
|
| 298 |
|
| 299 |
</body>
|
| 300 |
</subsection>
|
| 301 |
<subsection id="compiling">
|
| 302 |
<title>Compiling and Installing</title>
|
| 303 |
<body>
|
| 304 |
|
| 305 |
<p>
|
| 306 |
Now that your kernel is configured, it is time to compile and install it. Exit
|
| 307 |
the configuration and start the compilation process:
|
| 308 |
</p>
|
| 309 |
|
| 310 |
<pre caption="Compiling the kernel">
|
| 311 |
# <i>make && make modules_install</i>
|
| 312 |
</pre>
|
| 313 |
|
| 314 |
<p>
|
| 315 |
When the kernel has finished compiling, copy the kernel image to
|
| 316 |
<path>/boot</path>. Use whatever name you feel is appropriate for your kernel
|
| 317 |
choice and remember it as you will need it later on when you configure your
|
| 318 |
bootloader. Remember to replace <c><keyval id="kernel-name"/></c> with the
|
| 319 |
name and version of your kernel.
|
| 320 |
</p>
|
| 321 |
|
| 322 |
<pre caption="Installing the kernel">
|
| 323 |
# <i>cp arch/<keyval id="arch-sub"/>/boot/bzImage /boot/<keyval id="kernel-name"/></i>
|
| 324 |
</pre>
|
| 325 |
|
| 326 |
<p>
|
| 327 |
Now continue with <uri link="#kernel_modules">Kernel Modules</uri>.
|
| 328 |
</p>
|
| 329 |
|
| 330 |
</body>
|
| 331 |
</subsection>
|
| 332 |
</section>
|
| 333 |
<section id="genkernel">
|
| 334 |
<title>Alternative: Using genkernel</title>
|
| 335 |
<body>
|
| 336 |
|
| 337 |
<p>
|
| 338 |
If you are reading this section, you have chosen to use our <c>genkernel</c>
|
| 339 |
script to configure your kernel for you.
|
| 340 |
</p>
|
| 341 |
|
| 342 |
<p>
|
| 343 |
Now that your kernel source tree is installed, it's now time to compile your
|
| 344 |
kernel by using our <c>genkernel</c> script to automatically build a kernel for
|
| 345 |
you. <c>genkernel</c> works by configuring a kernel nearly identically to the
|
| 346 |
way our Installation CD kernel is configured. This means that when you use
|
| 347 |
<c>genkernel</c> to build your kernel, your system will generally detect all
|
| 348 |
your hardware at boot-time, just like our Installation CD does. Because
|
| 349 |
genkernel doesn't require any manual kernel configuration, it is an ideal
|
| 350 |
solution for those users who may not be comfortable compiling their own kernels.
|
| 351 |
</p>
|
| 352 |
|
| 353 |
<p>
|
| 354 |
Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
|
| 355 |
</p>
|
| 356 |
|
| 357 |
<pre caption="Emerging genkernel">
|
| 358 |
# <i>emerge genkernel</i>
|
| 359 |
</pre>
|
| 360 |
|
| 361 |
</body>
|
| 362 |
<body test="func:keyval('arch')='x86'">
|
| 363 |
|
| 364 |
<p>
|
| 365 |
Next, copy over the kernel configuration used by the Installation CD to the
|
| 366 |
location where genkernel looks for the default kernel configuration:
|
| 367 |
</p>
|
| 368 |
|
| 369 |
<pre caption="Copying over the Installation CD kernel config">
|
| 370 |
# <i>zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6</i>
|
| 371 |
</pre>
|
| 372 |
|
| 373 |
</body>
|
| 374 |
<body>
|
| 375 |
|
| 376 |
<p>
|
| 377 |
Now, compile your kernel sources by running <c>genkernel all</c>. Be aware
|
| 378 |
though, as <c>genkernel</c> compiles a kernel that supports almost all
|
| 379 |
hardware, this compilation will take quite a while to finish!
|
| 380 |
</p>
|
| 381 |
|
| 382 |
<p>
|
| 383 |
Note that, if your boot partition doesn't use ext2 or ext3 as filesystem you
|
| 384 |
might need to manually configure your kernel using <c>genkernel --menuconfig
|
| 385 |
all</c> and add support for your filesystem <e>in</e> the kernel (i.e.
|
| 386 |
<e>not</e> as a module). Users of EVMS2 or LVM2 will probably want to add
|
| 387 |
<c>--evms2</c> or <c>--lvm2</c> as argument as well.
|
| 388 |
</p>
|
| 389 |
|
| 390 |
<pre caption="Running genkernel">
|
| 391 |
# <i>genkernel all</i>
|
| 392 |
</pre>
|
| 393 |
|
| 394 |
<p>
|
| 395 |
Once <c>genkernel</c> completes, a kernel, full set of modules and
|
| 396 |
<e>initial root disk</e> (initrd) will be created. We will use the kernel
|
| 397 |
and initrd when configuring a boot loader later in this document. Write
|
| 398 |
down the names of the kernel and initrd as you will need it when writing
|
| 399 |
the bootloader configuration file. The initrd will be started immediately after
|
| 400 |
booting to perform hardware autodetection (just like on the Installation CD)
|
| 401 |
before your "real" system starts up.
|
| 402 |
</p>
|
| 403 |
|
| 404 |
<pre caption="Checking the created kernel image name and initrd">
|
| 405 |
# <i>ls /boot/kernel* /boot/initramfs*</i>
|
| 406 |
</pre>
|
| 407 |
|
| 408 |
</body>
|
| 409 |
</section>
|
| 410 |
<section id="kernel_modules">
|
| 411 |
<title>Kernel Modules</title>
|
| 412 |
|
| 413 |
<subsection>
|
| 414 |
<include href="hb-install-kernelmodules.xml"/>
|
| 415 |
</subsection>
|
| 416 |
|
| 417 |
</section>
|
| 418 |
</sections>
|