/[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.52 - (show annotations) (download) (as text)
Wed Sep 25 17:31:18 2013 UTC (4 years ago) by swift
Branch: MAIN
Changes since 1.51: +4 -4 lines
File MIME type: application/xml
Fix bug #485370 - genkernel uses --lvm, not --lvm2

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

  ViewVC Help
Powered by ViewVC 1.1.20