/[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.16 - (show annotations) (download) (as text)
Fri Aug 3 10:48:04 2007 UTC (7 years, 3 months ago) by nightmorph
Branch: MAIN
Changes since 1.15: +2 -2 lines
File MIME type: application/xml
2.6 kernels use .ko; 2.4 kernels (which are unsupported) use .o; fixed for all handbooks. no revbump either as it's basically a typo fix at this point.

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.15 2007/07/29 22:48:00 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>5.3</version>
17 <date>2007-07-29</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 test="func:keyval('arch')='x86'">
55 For x86-based systems we have, amongst other kernels, <c>gentoo-sources</c>
56 (kernel source patched with performance-enhancing features).
57 </p>
58
59 <p test="func:keyval('arch')='AMD64'">
60 For AMD64-based systems we have <c>gentoo-sources</c> (kernel source patched
61 with amd64 specific fixes for stability, performance and hardware 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 <pre caption="Selecting necessary file systems">
211 File systems ---&gt;
212 Pseudo Filesystems ---&gt;
213 [*] /proc file system support
214 [*] Virtual memory file system support (former shm fs)
215
216 <comment>(Select one or more of the following options as needed by your system)</comment>
217 &lt;*&gt; Reiserfs support
218 &lt;*&gt; Ext3 journalling file system support
219 &lt;*&gt; JFS filesystem support
220 &lt;*&gt; Second extended fs support
221 &lt;*&gt; XFS filesystem support
222 </pre>
223
224 </body>
225 <body test="func:keyval('arch')='AMD64'">
226
227 <pre caption="Selecting necessary file systems">
228 File systems ---&gt;
229 Pseudo Filesystems ---&gt;
230 [*] /proc file system support
231 [*] Virtual memory file system support (former shm fs)
232
233 <comment>(Select one or more of the following options as needed by your system)</comment>
234 &lt;*&gt; Reiserfs support
235 &lt;*&gt; Ext3 journalling file system support
236 &lt;*&gt; JFS filesystem support
237 &lt;*&gt; Second extended fs support
238 &lt;*&gt; XFS filesystem support
239 </pre>
240
241 </body>
242 <body>
243
244 <p>
245 Do not forget to enable DMA for your drives:
246 </p>
247
248 <pre caption="Activating DMA">
249 Device Drivers ---&gt;
250 ATA/ATAPI/MFM/RLL support ---&gt;
251 [*] Generic PCI bus-master DMA support
252 </pre>
253
254 <p>
255 If you are using PPPoE to connect to the Internet or you are using a dial-up
256 modem, you will need the following options in the kernel:
257 </p>
258
259 <pre caption="Selecting PPPoE necessary drivers" test="func:keyval('arch')='AMD64'">
260 Device Drivers ---&gt;
261 Networking Support ---&gt;
262 &lt;*&gt; PPP (point-to-point protocol) support
263 &lt;*&gt; PPP support for async serial ports
264 &lt;*&gt; PPP support for sync tty ports
265 </pre>
266
267 <pre caption="Selecting PPPoE necessary drivers" test="func:keyval('arch')='x86'">
268 Device Drivers ---&gt;
269 Networking support ---&gt;
270 &lt;*&gt; PPP (point-to-point protocol) support
271 &lt;*&gt; PPP support for async serial ports
272 &lt;*&gt; PPP support for sync tty ports
273 </pre>
274
275 <p>
276 The two compression options won't harm but are not definitely needed, neither
277 does the <c>PPP over Ethernet</c> option, that might only be used by <c>ppp</c>
278 when configured to do kernel mode PPPoE.
279 </p>
280
281 <p>
282 If you require it, don't forget to include support in the kernel for your
283 ethernet card.
284 </p>
285
286 <p test="func:keyval('arch')='x86'">
287 If you have an Intel CPU that supports HyperThreading (tm), or you have a
288 multi-CPU system, you should activate "Symmetric multi-processing support":
289 </p>
290
291 <p test="func:keyval('arch')='AMD64'">
292 If you have a multi-CPU Opteron or a multi-core (e.g. AMD64 X2) system, you
293 should activate "Symmetric multi-processing support":
294 </p>
295
296 <pre caption="Activating SMP support">
297 Processor type and features ---&gt;
298 [*] Symmetric multi-processing support
299 </pre>
300
301 <note>
302 In multi-core systems, each core counts as one processor.
303 </note>
304
305 <p>
306 If you use USB Input Devices (like Keyboard or Mouse) don't forget to enable
307 those as well:
308 </p>
309
310 <pre caption="Activating USB Support for Input Devices">
311 Device Drivers ---&gt;
312 USB Support ---&gt;
313 &lt;*&gt; USB Human Interface Device (full HID) support
314 </pre>
315
316 </body>
317 <body test="func:keyval('arch')='x86'">
318
319 <p>
320 If you want PCMCIA support for your laptop, don't forget to enable
321 support for the PCMCIA card bridge present in your system:
322 </p>
323
324 <pre caption="Enabling PCMCIA support">
325 Bus options (PCI, PCMCIA, EISA, MCA, ISA) ---&gt;
326 PCCARD (PCMCIA/CardBus) support ---&gt;
327 &lt;*&gt; PCCard (PCMCIA/CardBus) support
328 <comment>(select 16 bit if you need support for older PCMCIA cards. Most people want this.)</comment>
329 &lt;*&gt; 16-bit PCMCIA support
330 [*] 32-bit CardBus support
331 <comment>(select the relevant bridges below)</comment>
332 --- PC-card bridges
333 &lt;*&gt; CardBus yenta-compatible bridge support (NEW)
334 &lt;*&gt; Cirrus PD6729 compatible bridge support (NEW)
335 &lt;*&gt; i82092 compatible bridge support (NEW)
336 &lt;*&gt; i82365 compatible bridge support (NEW)
337 &lt;*&gt; Databook TCIC host bridge support (NEW)
338 </pre>
339
340 <p>
341 When you've finished configuring the kernel, continue with <uri
342 link="#compiling">Compiling and Installing</uri>.
343 </p>
344
345 </body>
346 </subsection>
347 <subsection id="compiling">
348 <title>Compiling and Installing</title>
349 <body>
350
351 <p>
352 Now that your kernel is configured, it is time to compile and install it. Exit
353 the configuration and start the compilation process:
354 </p>
355
356 <pre caption="Compiling the kernel">
357 # <i>make &amp;&amp; make modules_install</i>
358 </pre>
359
360 <p>
361 When the kernel has finished compiling, copy the kernel image to
362 <path>/boot</path>. Use whatever name you feel is appropriate for your kernel
363 choice and remember it as you will need it later on when you configure your
364 bootloader. Remember to replace <c><keyval id="kernel-name"/></c> with the
365 name and version of your kernel.
366 </p>
367
368 <pre caption="Installing the kernel">
369 # <i>cp arch/<keyval id="arch-sub"/>/boot/bzImage /boot/<keyval id="kernel-name"/></i>
370 </pre>
371
372 <p>
373 Now continue with <uri link="#kernel_modules">Kernel Modules</uri>.
374 </p>
375
376 </body>
377 </subsection>
378 </section>
379 <section id="genkernel">
380 <title>Alternative: Using genkernel</title>
381 <body>
382
383 <p>
384 If you are reading this section, you have chosen to use our <c>genkernel</c>
385 script to configure your kernel for you.
386 </p>
387
388 <p>
389 Now that your kernel source tree is installed, it's now time to compile your
390 kernel by using our <c>genkernel</c> script to automatically build a kernel for
391 you. <c>genkernel</c> works by configuring a kernel nearly identically to the
392 way our Installation CD kernel is configured. This means that when you use
393 <c>genkernel</c> to build your kernel, your system will generally detect all
394 your hardware at boot-time, just like our Installation CD does. Because
395 genkernel doesn't require any manual kernel configuration, it is an ideal
396 solution for those users who may not be comfortable compiling their own kernels.
397 </p>
398
399 <p>
400 Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
401 </p>
402
403 <pre caption="Emerging genkernel">
404 # <i>emerge genkernel</i>
405 </pre>
406
407 </body>
408 <body test="func:keyval('arch')='x86'">
409
410 <p>
411 Next, copy over the kernel configuration used by the Installation CD to the
412 location where genkernel looks for the default kernel configuration:
413 </p>
414
415 <pre caption="Copying over the Installation CD kernel config">
416 # <i>zcat /proc/config.gz &gt; /usr/share/genkernel/x86/kernel-config-2.6</i>
417 </pre>
418
419 </body>
420 <body>
421
422 <p>
423 Now, compile your kernel sources by running <c>genkernel all</c>. Be aware
424 though, as <c>genkernel</c> compiles a kernel that supports almost all
425 hardware, this compilation will take quite a while to finish!
426 </p>
427
428 <p>
429 Note that, if your boot partition doesn't use ext2 or ext3 as filesystem you
430 might need to manually configure your kernel using <c>genkernel --menuconfig
431 all</c> and add support for your filesystem <e>in</e> the kernel (i.e.
432 <e>not</e> as a module). Users of EVMS2 or LVM2 will probably want to add
433 <c>--evms2</c> or <c>--lvm2</c> as argument as well.
434 </p>
435
436 <pre caption="Running genkernel">
437 # <i>genkernel all</i>
438 </pre>
439
440 <p>
441 Once <c>genkernel</c> completes, a kernel, full set of modules and
442 <e>initial root disk</e> (initrd) will be created. We will use the kernel
443 and initrd when configuring a boot loader later in this document. Write
444 down the names of the kernel and initrd as you will need it when writing
445 the bootloader configuration file. The initrd will be started immediately after
446 booting to perform hardware autodetection (just like on the Installation CD)
447 before your "real" system starts up.
448 </p>
449
450 <pre caption="Checking the created kernel image name and initrd">
451 # <i>ls /boot/kernel* /boot/initramfs*</i>
452 </pre>
453
454 </body>
455 </section>
456 <section id="kernel_modules">
457 <title>Kernel Modules</title>
458 <subsection>
459 <title>Configuring the Modules</title>
460 <body>
461
462 <p>
463 You should list the modules you want automatically loaded in
464 <path>/etc/modules.autoload.d/kernel-2.6</path>. You can add extra options to
465 the modules too if you want.
466 </p>
467
468 <p>
469 To view all available modules, run the following command:
470 </p>
471
472 <pre caption="Viewing all available modules">
473 # <i>modprobe -l</i>
474 </pre>
475
476 <p>
477 For instance, to automatically load the <c>3c59x.ko</c> module, edit the
478 <path>kernel-2.6</path> file and enter the module name in it.
479 </p>
480
481 <pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
482 # <i>nano -w /etc/modules.autoload.d/kernel-2.6</i>
483 </pre>
484
485 <pre caption="/etc/modules.autoload.d/kernel-2.6">
486 3c59x
487 </pre>
488
489 <p>
490 Continue the installation with <uri link="?part=1&amp;chap=8">Configuring
491 your System</uri>.
492 </p>
493
494 </body>
495 </subsection>
496 </section>
497 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20