/[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.11 - (show annotations) (download) (as text)
Tue May 15 13:07:41 2007 UTC (7 years, 4 months ago) by neysx
Branch: MAIN
Changes since 1.10: +8 -8 lines
File MIME type: application/xml
#178179 cp timezone file to /etc/localtime to prevent warning until next emerge of sys-libs/timezone-data

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

  ViewVC Help
Powered by ViewVC 1.1.20