/[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.19 - (show annotations) (download) (as text)
Fri Nov 2 23:07:21 2007 UTC (7 years, 1 month ago) by nightmorph
Branch: MAIN
Changes since 1.18: +9 -4 lines
File MIME type: application/xml
added ia32 emulation to kernel config, bug 196914

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

  ViewVC Help
Powered by ViewVC 1.1.20