/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-kernel.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-x86+amd64-kernel.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download) (as text)
Tue Mar 13 00:30:09 2007 UTC (7 years, 9 months ago) by nightmorph
Branch: MAIN
Changes since 1.8: +3 -21 lines
File MIME type: application/xml
Remove all references to coldplug, bug 170679

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.8 2007/02/26 08:54:53 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>4.3</version>
17 <date>2007-03-12</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 GMT+8.
29 </p>
30
31 <pre caption="Setting the timezone information">
32 # <i>ls /usr/share/zoneinfo</i>
33 <comment>(Suppose you want to use GMT)</comment>
34 # <i>cp /usr/share/zoneinfo/GMT /etc/localtime</i>
35 </pre>
36
37 </body>
38 </section>
39 <section>
40 <title>Installing the Sources</title>
41 <subsection>
42 <title>Choosing a Kernel</title>
43 <body>
44
45 <p>
46 The core around which all distributions are built is the Linux kernel. It is the
47 layer between the user programs and your system hardware. Gentoo provides its
48 users several possible kernel sources. A full listing with description is
49 available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel
50 Guide</uri>.
51 </p>
52
53 <p test="func:keyval('arch')='x86'">
54 For x86-based systems we have, amongst other kernels, <c>gentoo-sources</c>
55 (kernel source patched with performance-enhancing features).
56 </p>
57
58 <p test="func:keyval('arch')='AMD64'">
59 For AMD64-based systems we have <c>gentoo-sources</c> (kernel v2.6 source
60 patched with amd64 specific fixes for stability, performance and hardware
61 support).
62 </p>
63
64 <p>
65 Choose your kernel source and install it using <c>emerge</c>.
66 </p>
67
68 <pre caption="Installing a kernel source">
69 # <i>emerge gentoo-sources</i>
70 </pre>
71
72 <p>
73 When you take a look in <path>/usr/src</path> you should see a symlink called
74 <path>linux</path> pointing to your kernel source. In this case, the installed
75 kernel source points to <c>gentoo-sources-<keyval id="kernel-version"/></c>.
76 Your version may be different, so keep this in mind.
77 </p>
78
79 <pre caption="Viewing the kernel source symlink">
80 # <i>ls -l /usr/src/linux</i>
81 lrwxrwxrwx 1 root root 12 Oct 13 11:04 /usr/src/linux -&gt; linux-<keyval id="kernel-version"/>
82 </pre>
83
84 <p>
85 Now it is time to configure and compile your kernel source. You can use
86 <c>genkernel</c> for this, which will build a generic kernel as used by the
87 Installation CD. We explain the "manual" configuration first though, as it is
88 the best way to optimize your environment.
89 </p>
90
91 <p>
92 If you want to manually configure your kernel, continue now with <uri
93 link="#manual">Default: Manual Configuration</uri>. If you want to use
94 <c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using
95 genkernel</uri> instead.
96 </p>
97
98 </body>
99 </subsection>
100 </section>
101 <section id="manual">
102 <title>Default: Manual Configuration</title>
103 <subsection>
104 <title>Introduction</title>
105 <body>
106
107 <p>
108 Manually configuring a kernel is often seen as the most difficult procedure a
109 Linux user ever has to perform. Nothing is less true -- after configuring a
110 couple of kernels you don't even remember that it was difficult ;)
111 </p>
112
113 <p>
114 However, one thing <e>is</e> true: you must know your system when you start
115 configuring a kernel manually. Most information can be gathered by emerging
116 pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now
117 be able to use <c>lspci</c> within the chrooted environment. You may safely
118 ignore any <e>pcilib</e> warnings (like pcilib: cannot open
119 /sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run
120 <c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same.
121 You can also run <c>lsmod</c> to see what kernel modules the Installation CD
122 uses (it might provide you with a nice hint on what to enable).
123 </p>
124
125 <p>
126 Now go to your kernel source directory and execute <c>make menuconfig</c>. This
127 will fire up an ncurses-based configuration menu.
128 </p>
129
130 <pre caption="Invoking menuconfig">
131 # <i>cd /usr/src/linux</i>
132 # <i>make menuconfig</i>
133 </pre>
134
135 <p>
136 You will be greeted with several configuration sections. We'll first list some
137 options you must activate (otherwise Gentoo will not function, or not function
138 properly without additional tweaks).
139 </p>
140
141 </body>
142 </subsection>
143 <subsection>
144 <title>Activating Required Options</title>
145 <body>
146
147 <p>
148 First of all, activate the use of development and experimental code/drivers.
149 You need this, otherwise some very important code/drivers won't show up:
150 </p>
151
152 <pre caption="Selecting experimental code/drivers">
153 Code maturity level options ---&gt;
154 [*] Prompt for development and/or incomplete code/drivers
155 </pre>
156
157 <p>
158 Make sure that every driver that is vital to the booting of your system (such as
159 SCSI controller, ...) is compiled <e>in</e> the kernel and not as a module,
160 otherwise your system will not be able to boot completely.
161 </p>
162
163 </body>
164 <body test="func:keyval('arch')='AMD64'">
165
166 <p>
167 We shall then select the exact processor type. The x86_64 kernel maintainer
168 strongly recommends users enable MCE features so that they are able to be
169 notified of any hardware problems. On x86_64, these errors are not printed to
170 <c>dmesg</c> like on other architectures, but to <path>/dev/mcelog</path>. This
171 requires the <c>app-admin/mcelog</c> package.
172 </p>
173
174 <pre caption="Selecting processor type and features">
175 Processor type and features --->
176 [ ] Intel MCE Features
177 [ ] AMD MCE Features
178 Processor family (AMD-Opteron/Athlon64) --->
179 ( ) AMD-Opteron/Athlon64
180 ( ) Intel EM64T
181 ( ) Generic-x86-64
182 </pre>
183
184 </body>
185 <body test="func:keyval('arch')='x86'">
186
187 <p>
188 Now select the correct processor family:
189 </p>
190
191 <pre caption="Selecting correct processor family">
192 Processor type and features ---&gt;
193 <comment>(Change according to your system)</comment>
194 (<i>Athlon/Duron/K7</i>) Processor family
195 </pre>
196
197 </body>
198 <body>
199
200 <p>
201 Now go to <c>File Systems</c> and select support for the filesystems you use.
202 <e>Don't</e> compile them as modules, otherwise your Gentoo system will not be
203 able to mount your partitions. Also select <c>Virtual memory</c> and <c>/proc
204 file system</c>.
205 </p>
206
207 </body>
208 <body test="func:keyval('arch')='x86'">
209
210 <p>
211 If you are using a 2.4 kernel, you need to select <c>/dev file
212 system</c> as 2.4 kernels do not support <c>udev</c>.
213 </p>
214
215 <pre caption="Selecting necessary file systems">
216 <comment>(With a 2.4.x kernel)</comment>
217 File systems ---&gt;
218 [*] Virtual memory file system support (former shm fs)
219 [*] /proc file system support
220 [*] /dev file system support (EXPERIMENTAL)
221 [*] automatically mount /dev at boot
222 [ ] /dev/pts file system for Unix98 PTYs
223
224 <comment>(With a 2.6.x kernel)</comment>
225 File systems ---&gt;
226 Pseudo Filesystems ---&gt;
227 [*] /proc file system support
228 [*] Virtual memory file system support (former shm fs)
229
230 <comment>(Select one or more of the following options as needed by your system)</comment>
231 &lt;*&gt; Reiserfs support
232 &lt;*&gt; Ext3 journalling file system support
233 &lt;*&gt; JFS filesystem support
234 &lt;*&gt; Second extended fs support
235 &lt;*&gt; XFS filesystem support
236 </pre>
237
238 <p>
239 If your BIOS can't handle large hard drives and you jumpered the hard drive to
240 report a limited size you have to enable the following option to gain access to
241 your whole hard drive:
242 </p>
243
244 <pre caption="Selecting autogeometry resizing support">
245 <comment>(2.4.x kernel only)</comment>
246 ATA/IDE/MFM/RLL support ---&gt;
247 IDE, ATA and ATAPI Block devices ---&gt;
248 &lt;*&gt; Include IDE/ATA-2 DISK support
249 [ ] Use multi-mode by default
250 [*] Auto-Geometry Resizing support
251 </pre>
252
253 </body>
254 <body test="func:keyval('arch')='AMD64'">
255
256 <pre caption="Selecting necessary file systems">
257 File systems ---&gt;
258 Pseudo Filesystems ---&gt;
259 [*] /proc file system support
260 [*] Virtual memory file system support (former shm fs)
261
262 <comment>(Select one or more of the following options as needed by your system)</comment>
263 &lt;*&gt; Reiserfs support
264 &lt;*&gt; Ext3 journalling file system support
265 &lt;*&gt; JFS filesystem support
266 &lt;*&gt; Second extended fs support
267 &lt;*&gt; XFS filesystem support
268 </pre>
269
270 </body>
271 <body>
272
273 <p>
274 Do not forget to enable DMA for your drives:
275 </p>
276
277 <pre caption="Activating DMA">
278 Device Drivers ---&gt;
279 ATA/ATAPI/MFM/RLL support ---&gt;
280 [*] Generic PCI bus-master DMA support
281 [*] Use PCI DMA by default when available
282 </pre>
283
284 <p>
285 If you are using PPPoE to connect to the Internet or you are using a dial-up
286 modem, you will need the following options in the kernel:
287 </p>
288
289 <pre caption="Selecting PPPoE necessary drivers" test="func:keyval('arch')='AMD64'">
290 Device Drivers ---&gt;
291 Networking Support ---&gt;
292 &lt;*&gt; PPP (point-to-point protocol) support
293 &lt;*&gt; PPP support for async serial ports
294 &lt;*&gt; PPP support for sync tty ports
295 </pre>
296
297 <pre caption="Selecting PPPoE necessary drivers" test="func:keyval('arch')='x86'">
298 <comment>(With a 2.4.x kernel)</comment>
299 Network device support ---&gt;
300 &lt;*&gt; PPP (point-to-point protocol) support
301 &lt;*&gt; PPP support for async serial ports
302 &lt;*&gt; PPP support for sync tty ports
303
304 <comment>(With a 2.6.x kernel)</comment>
305 Device Drivers ---&gt;
306 Networking support ---&gt;
307 &lt;*&gt; PPP (point-to-point protocol) support
308 &lt;*&gt; PPP support for async serial ports
309 &lt;*&gt; PPP support for sync tty ports
310 </pre>
311
312 <p>
313 The two compression options won't harm but are not definitely needed, neither
314 does the <c>PPP over Ethernet</c> option, that might only be used by
315 <c>rp-pppoe</c> when configured to do kernel mode PPPoE.
316 </p>
317
318 <p>
319 If you require it, don't forget to include support in the kernel for your
320 ethernet card.
321 </p>
322
323 <p test="func:keyval('arch')='x86'">
324 If you have an Intel CPU that supports HyperThreading (tm), or you have a
325 multi-CPU system, you should activate "Symmetric multi-processing support":
326 </p>
327
328 <p test="func:keyval('arch')='AMD64'">
329 If you have a multi-CPU Opteron or a multi-core (e.g. AMD64 X2) system, you
330 should activate "Symmetric multi-processing support":
331 </p>
332
333 <pre caption="Activating SMP support">
334 Processor type and features ---&gt;
335 [*] Symmetric multi-processing support
336 </pre>
337
338 <note>
339 In multi-core systems, each core counts as one processor.
340 </note>
341
342 <p>
343 If you use USB Input Devices (like Keyboard or Mouse) don't forget to enable
344 those as well:
345 </p>
346
347 <pre caption="Activating USB Support for Input Devices">
348 Device Drivers ---&gt;
349 USB Support ---&gt;
350 &lt;*&gt; USB Human Interface Device (full HID) support
351 </pre>
352
353 </body>
354 <body test="func:keyval('arch')='x86'">
355
356 <p>
357 Laptop-users who want PCMCIA support should <e>not</e> use the PCMCIA drivers if
358 they choose to use a 2.4 kernel. More recent drivers are available through the
359 <c>pcmcia-cs</c> package which will be installed later on. 2.6-kernel users
360 however should use the PCMCIA drivers from the kernel.
361 </p>
362
363 <p>
364 Besides compiling in PCMCIA support in the 2.6 kernel, don't forget to enable
365 support for the PCMCIA card bridge present in your system:
366 </p>
367
368 <pre caption="Enabling PCMCIA support for 2.6 kernels">
369 Bus options (PCI, PCMCIA, EISA, MCA, ISA) ---&gt;
370 PCCARD (PCMCIA/CardBus) support ---&gt;
371 &lt;*&gt; PCCard (PCMCIA/CardBus) support
372 <comment>(select 16 bit if you need support for older PCMCIA cards. Most people want this.)</comment>
373 &lt;*&gt; 16-bit PCMCIA support
374 [*] 32-bit CardBus support
375 <comment>(select the relevant bridges below)</comment>
376 --- PC-card bridges
377 &lt;*&gt; CardBus yenta-compatible bridge support (NEW)
378 &lt;*&gt; Cirrus PD6729 compatible bridge support (NEW)
379 &lt;*&gt; i82092 compatible bridge support (NEW)
380 &lt;*&gt; i82365 compatible bridge support (NEW)
381 &lt;*&gt; Databook TCIC host bridge support (NEW)
382 </pre>
383
384 <p>
385 When you've finished configuring the kernel, continue with <uri
386 link="#compiling">Compiling and Installing</uri>.
387 </p>
388
389 </body>
390 </subsection>
391 <subsection id="compiling">
392 <title>Compiling and Installing</title>
393 <body>
394
395 <p>
396 Now that your kernel is configured, it is time to compile and install it. Exit
397 the configuration and start the compilation process:
398 </p>
399
400 <pre caption="Compiling the kernel" test="func:keyval('arch')='x86'">
401 <comment>(For 2.4 kernel)</comment>
402 # <i>make dep &amp;&amp; make bzImage modules modules_install</i>
403
404 <comment>(For 2.6 kernel)</comment>
405 # <i>make &amp;&amp; make modules_install</i>
406 </pre>
407
408 <pre caption="Compiling the kernel" test="func:keyval('arch')='AMD64'">
409 # <i>make &amp;&amp; make modules_install</i>
410 </pre>
411
412 <p>
413 When the kernel has finished compiling, copy the kernel image to
414 <path>/boot</path>. Use whatever name you feel is appropriate for your kernel
415 choice and remember it as you will need it later on when you configure your
416 bootloader. Remember to replace <c><keyval id="kernel-name"/></c> with the
417 name and version of your kernel.
418 </p>
419
420 <pre caption="Installing the kernel">
421 # <i>cp arch/<keyval id="arch-sub"/>/boot/bzImage /boot/<keyval id="kernel-name"/></i>
422 </pre>
423
424 <p>
425 Now continue with <uri link="#kernel_modules">Kernel Modules</uri>.
426 </p>
427
428 </body>
429 </subsection>
430 </section>
431 <section id="genkernel">
432 <title>Alternative: Using genkernel</title>
433 <body>
434
435 <p>
436 If you are reading this section, you have chosen to use our <c>genkernel</c>
437 script to configure your kernel for you.
438 </p>
439
440 <p>
441 Now that your kernel source tree is installed, it's now time to compile your
442 kernel by using our <c>genkernel</c> script to automatically build a kernel for
443 you. <c>genkernel</c> works by configuring a kernel nearly identically to the
444 way our Installation CD kernel is configured. This means that when you use
445 <c>genkernel</c> to build your kernel, your system will generally detect all
446 your hardware at boot-time, just like our Installation CD does. Because
447 genkernel doesn't require any manual kernel configuration, it is an ideal
448 solution for those users who may not be comfortable compiling their own kernels.
449 </p>
450
451 <p>
452 Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
453 </p>
454
455 <pre caption="Emerging genkernel">
456 # <i>emerge genkernel</i>
457 </pre>
458
459 </body>
460 <body test="func:keyval('arch')='x86'">
461
462 <p>
463 Next, if you are going to configure a 2.6 kernel, copy over the kernel
464 configuration used by the Installation CD to the location where genkernel
465 looks for the default kernel configuration:
466 </p>
467
468 <pre caption="Copying over the Installation CD kernel config">
469 <comment>(Only do this if you are going to configure a 2.6 kernel)</comment>
470 # <i>zcat /proc/config.gz &gt; /usr/share/genkernel/x86/kernel-config-2.6</i>
471 </pre>
472
473 </body>
474 <body>
475
476 <p>
477 Now, compile your kernel sources by running <c>genkernel all</c>. Be aware
478 though, as <c>genkernel</c> compiles a kernel that supports almost all
479 hardware, this compilation will take quite a while to finish!
480 </p>
481
482 <p>
483 Note that, if your boot partition doesn't use ext2 or ext3 as filesystem you
484 might need to manually configure your kernel using <c>genkernel --menuconfig
485 all</c> and add support for your filesystem <e>in</e> the kernel (i.e.
486 <e>not</e> as a module). Users of EVMS2 or LVM2 will probably want to add
487 <c>--evms2</c> or <c>--lvm2</c> as argument as well.
488 </p>
489
490 <pre caption="Running genkernel">
491 # <i>genkernel all</i>
492 </pre>
493
494 <p>
495 Once <c>genkernel</c> completes, a kernel, full set of modules and
496 <e>initial root disk</e> (initrd) will be created. We will use the kernel
497 and initrd when configuring a boot loader later in this document. Write
498 down the names of the kernel and initrd as you will need it when writing
499 the bootloader configuration file. The initrd will be started immediately after
500 booting to perform hardware autodetection (just like on the Installation CD)
501 before your "real" system starts up.
502 </p>
503
504 <pre caption="Checking the created kernel image name and initrd">
505 # <i>ls /boot/kernel* /boot/initramfs*</i>
506 </pre>
507
508 </body>
509 </section>
510 <section id="kernel_modules">
511 <title>Kernel Modules</title>
512 <subsection>
513 <title>Configuring the Modules</title>
514 <body>
515
516 <note test="func:keyval('arch')='x86'">
517 If you chose a kernel 2.4, replace occurrences of <c>2.6</c> with <c>2.4</c> in
518 this section.
519 </note>
520
521 <p>
522 You should list the modules you want automatically loaded in
523 <path>/etc/modules.autoload.d/kernel-2.6</path>. You can add extra options to
524 the modules too if you want.
525 </p>
526
527 <p>
528 To view all available modules, run the following <c>find</c> command. Don't
529 forget to substitute <c><keyval id="kernel-version"/></c> with the version of
530 the kernel you just compiled:
531 </p>
532
533 <pre caption="Viewing all available modules">
534 # <i>find /lib/modules/<keyval id="kernel-version"/>/ -type f -iname '*.o' -or -iname '*.ko'</i>
535 </pre>
536
537 <p>
538 For instance, to automatically load the <c>3c59x.o</c> module, edit the
539 <path>kernel-2.6</path> file and enter the module name in it.
540 </p>
541
542 <pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
543 # <i>nano -w /etc/modules.autoload.d/kernel-2.6</i>
544 </pre>
545
546 <pre caption="/etc/modules.autoload.d/kernel-2.6">
547 3c59x
548 </pre>
549
550 <p>
551 Continue the installation with <uri link="?part=1&amp;chap=8">Configuring
552 your System</uri>.
553 </p>
554
555 </body>
556 </subsection>
557 </section>
558 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20