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-ia64-kernel.xml,v 1.33 2013/12/17 10:38:05 swift Exp $ --> |
8 |
|
9 |
<sections> |
10 |
|
11 |
<version>24</version> |
12 |
<date>2014-05-11</date> |
13 |
|
14 |
<section> |
15 |
<title>Installing the Sources</title> |
16 |
<subsection> |
17 |
<title>Choosing a Kernel</title> |
18 |
<body> |
19 |
|
20 |
<p> |
21 |
The core around which all distributions are built is the Linux kernel. It is the |
22 |
layer between the user programs and your system hardware. Gentoo provides its |
23 |
users several possible kernel sources. A full listing with description is |
24 |
available at the <uri link="https://wiki.gentoo.org/wiki/Kernel/Overview">Gentoo Kernel |
25 |
Guide</uri>. |
26 |
</p> |
27 |
|
28 |
<p> |
29 |
For <keyval id="arch"/> systems, we will use <c>gentoo-sources</c> (contains |
30 |
additional patches for extra features). |
31 |
</p> |
32 |
|
33 |
<p> |
34 |
Now install it using <c>emerge</c>. |
35 |
</p> |
36 |
|
37 |
<pre caption="Installing a kernel source"> |
38 |
# <i>emerge gentoo-sources</i> |
39 |
</pre> |
40 |
|
41 |
<p> |
42 |
When you take a look in <path>/usr/src</path> you should see a symlink called |
43 |
<path>linux</path> pointing to your kernel source. In this case, the installed |
44 |
kernel source points to <c>gentoo-sources-<keyval id="kernel-version"/></c>. |
45 |
Your version may be different, so keep this in mind. |
46 |
</p> |
47 |
|
48 |
<pre caption="Viewing the kernel source symlink"> |
49 |
# <i>ls -l /usr/src/linux</i> |
50 |
lrwxrwxrwx 1 root root 12 Oct 13 11:04 /usr/src/linux -> linux-<keyval id="kernel-version"/> |
51 |
</pre> |
52 |
|
53 |
<p> |
54 |
Now it is time to configure and compile your kernel source. You can use |
55 |
<c>genkernel</c> for this, which will build a generic kernel as used by the |
56 |
Installation CD. We explain the "manual" configuration first though, as it is |
57 |
the best way to optimize your environment. |
58 |
</p> |
59 |
|
60 |
<p> |
61 |
If you want to manually configure your kernel, continue now with <uri |
62 |
link="#manual">Default: Manual Configuration</uri>. If you want to use |
63 |
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using |
64 |
genkernel</uri> instead. |
65 |
</p> |
66 |
|
67 |
</body> |
68 |
</subsection> |
69 |
</section> |
70 |
<section id="manual"> |
71 |
<title>Default: Manual Configuration</title> |
72 |
<subsection> |
73 |
<title>Introduction</title> |
74 |
<body> |
75 |
|
76 |
<p> |
77 |
Manually configuring a kernel is often seen as the most difficult procedure a |
78 |
Linux user ever has to perform. Nothing is less true -- after configuring a |
79 |
couple of kernels you don't even remember that it was difficult ;) |
80 |
</p> |
81 |
|
82 |
<p> |
83 |
However, one thing <e>is</e> true: you must know your system when you start |
84 |
configuring a kernel manually. Most information can be gathered by emerging |
85 |
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now |
86 |
be able to use <c>lspci</c> within the chrooted environment. You may safely |
87 |
ignore any <e>pcilib</e> warnings (like pcilib: cannot open |
88 |
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run |
89 |
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same. |
90 |
You can also run <c>lsmod</c> to see what kernel modules the Installation CD |
91 |
uses (it might provide you with a nice hint on what to enable). |
92 |
</p> |
93 |
|
94 |
<p> |
95 |
Now go to your kernel source directory and execute <c>make menuconfig</c>. This |
96 |
will fire up an ncurses-based configuration menu. |
97 |
</p> |
98 |
|
99 |
<pre caption="Invoking menuconfig"> |
100 |
# <i>cd /usr/src/linux</i> |
101 |
# <i>make menuconfig</i> |
102 |
</pre> |
103 |
|
104 |
<p> |
105 |
You will be greeted with several configuration sections. We'll first list some |
106 |
options you must activate (otherwise Gentoo will not function, or not function |
107 |
properly without additional tweaks). We also have a <uri |
108 |
link="https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide">Gentoo |
109 |
Kernel Configuration Guide</uri> on the Gentoo wiki that might help you further. |
110 |
</p> |
111 |
|
112 |
</body> |
113 |
</subsection> |
114 |
<subsection> |
115 |
<title>Activating Required Options</title> |
116 |
<body> |
117 |
|
118 |
<p> |
119 |
Make sure that every driver that is vital to the booting of your system (such as |
120 |
SCSI controller, ...) is compiled <e>in</e> the kernel and not as a module, |
121 |
otherwise your system will not be able to boot completely. |
122 |
</p> |
123 |
|
124 |
<p> |
125 |
Now select the correct system type and processor type. If you don't know what |
126 |
kind of IA64 system type you have, <c>DIG-compliant</c> is a good default |
127 |
choice. If you are installing on an SGI system make sure you select the |
128 |
SGI system type, your kernel may just lock up and refuse to boot otherwise. |
129 |
</p> |
130 |
|
131 |
<pre caption="Selecting correct system type"> |
132 |
System type ---> |
133 |
<comment>(Change according to your system)</comment> |
134 |
<i>DIG-compliant</i> |
135 |
Processor type ---> |
136 |
<comment>(Change according to your system)</comment> |
137 |
<i>Itanium 2</i> |
138 |
</pre> |
139 |
|
140 |
<p> |
141 |
Next select <e>Maintain a devtmpfs file system to mount at /dev</e> so that |
142 |
critical device files are already available early in the boot process. |
143 |
</p> |
144 |
|
145 |
<pre caption="Enabling devtmpfs support"> |
146 |
Device Drivers ---> |
147 |
Generic Driver Options ---> |
148 |
[*] Maintain a devtmpfs filesystem to mount at /dev |
149 |
[ ] Automount devtmpfs at /dev, after the kernel mounted the rootfs |
150 |
</pre> |
151 |
|
152 |
<p> |
153 |
Now go to <c>File Systems</c> and select support for the filesystems you use. |
154 |
<e>Don't</e> compile the file system you use for the root filesystem as module, |
155 |
otherwise your Gentoo system will not be able to mount your partition. Also |
156 |
select <c>Virtual memory</c> and <c>/proc file system</c>. |
157 |
</p> |
158 |
|
159 |
<pre caption="Selecting necessary file systems"> |
160 |
File systems ---> |
161 |
Pseudo Filesystems ---> |
162 |
[*] /proc file system support |
163 |
[*] Virtual memory file system support (former shm fs) |
164 |
|
165 |
<comment>(Select one or more of the following options as needed by your system)</comment> |
166 |
<*> Reiserfs support |
167 |
<*> Ext3 journalling file system support |
168 |
<*> JFS filesystem support |
169 |
<*> Second extended fs support |
170 |
<*> XFS filesystem support |
171 |
|
172 |
<comment>(Be sure to enable VFAT support for the EFI partition)</comment> |
173 |
DOS/FAT/NT Filesystems ---> |
174 |
<*> VFAT (Windows-95) fs support |
175 |
|
176 |
<comment>(Enable GPT partition label support if you used that previously</comment> |
177 |
-*- Enable the block layer ---> |
178 |
... |
179 |
Partition Types ---> |
180 |
[*] Advanced partition selection |
181 |
... |
182 |
[*] EFI GUID Partition support |
183 |
</pre> |
184 |
|
185 |
<p> |
186 |
If you are using PPPoE to connect to the Internet or you are using a dial-up |
187 |
modem, you will need the following options in the kernel: |
188 |
</p> |
189 |
|
190 |
<pre caption="Selecting PPPoE necessary drivers"> |
191 |
Device Drivers ---> |
192 |
Network device support ---> |
193 |
<*> PPP (point-to-point protocol) support |
194 |
<*> PPP support for async serial ports |
195 |
<*> PPP support for sync tty ports |
196 |
</pre> |
197 |
|
198 |
<p> |
199 |
The two compression options won't harm but are not definitely needed, neither |
200 |
does the <c>PPP over Ethernet</c> option, that might only be used by <c>ppp</c> |
201 |
when configured to do kernel mode PPPoE. |
202 |
</p> |
203 |
|
204 |
<p> |
205 |
If you require it, don't forget to include support in the kernel for your |
206 |
ethernet card. |
207 |
</p> |
208 |
|
209 |
<p> |
210 |
If you have an Intel CPU that supports HyperThreading (tm), or you have a |
211 |
multi-CPU system, you should activate "Symmetric multi-processing support": |
212 |
</p> |
213 |
|
214 |
<pre caption="Activating SMP support"> |
215 |
Processor type and features ---> |
216 |
[*] Symmetric multi-processing support |
217 |
</pre> |
218 |
|
219 |
<p> |
220 |
If you use USB Input Devices (like Keyboard or Mouse) don't forget to enable |
221 |
those as well: |
222 |
</p> |
223 |
|
224 |
<pre caption="Activating USB Support for Input Devices"> |
225 |
Device Drivers ---> |
226 |
[*] HID Devices ---> |
227 |
<*> USB Human Interface Device (full HID) support |
228 |
</pre> |
229 |
|
230 |
<p> |
231 |
When you've finished configuring the kernel, continue with <uri |
232 |
link="#compiling">Compiling and Installing</uri>. |
233 |
</p> |
234 |
|
235 |
</body> |
236 |
</subsection> |
237 |
<subsection id="compiling"> |
238 |
<title>Compiling and Installing</title> |
239 |
<body> |
240 |
|
241 |
<p> |
242 |
Now that your kernel is configured, it is time to compile and install it. Exit |
243 |
the configuration and start the compilation process: |
244 |
</p> |
245 |
|
246 |
<pre caption="Compiling the kernel"> |
247 |
# <i>make && make modules_install</i> |
248 |
</pre> |
249 |
|
250 |
<p> |
251 |
When the kernel has finished compiling, copy the kernel image to <path>/</path>. |
252 |
Use whatever name you feel is appropriate for your kernel choice and remember it |
253 |
as you will need it later on when you configure your bootloader. Remember to |
254 |
replace <c>vmlinuz</c> with the name and version of your kernel. |
255 |
</p> |
256 |
|
257 |
<pre caption="Installing the kernel"> |
258 |
# <i>cp vmlinux.gz /boot/vmlinuz</i> |
259 |
</pre> |
260 |
|
261 |
</body> |
262 |
</subsection> |
263 |
<subsection id="initramfs"> |
264 |
<title>(Optional) Building an Initramfs</title> |
265 |
<body> |
266 |
|
267 |
<p> |
268 |
If you use a specific partition layout where important file system locations |
269 |
(like <path>/usr</path> or <path>/var</path>) are on separate partitions, then |
270 |
you will need to setup an initramfs so that this partition can be mounted before |
271 |
it is needed. |
272 |
</p> |
273 |
|
274 |
<p> |
275 |
Without an initramfs, you risk that the system will not boot up properly as the |
276 |
tools that are responsible for mounting the file systems need information that |
277 |
resides on those file systems. An initramfs will pull in the necessary files |
278 |
into an archive which is used right after the kernel boots, but before the |
279 |
control is handed over to the <c>init</c> tool. Scripts on the initramfs will |
280 |
then make sure that the partitions are properly mounted before the system |
281 |
continues booting. |
282 |
</p> |
283 |
|
284 |
<p> |
285 |
To install an initramfs, install <c>genkernel</c> first, then have it |
286 |
generate an initramfs for you. |
287 |
</p> |
288 |
|
289 |
<pre caption="Building an initramfs"> |
290 |
# <i>emerge genkernel</i> |
291 |
# <i>genkernel --bootdir=/. --no-mountboot --install initramfs</i> |
292 |
</pre> |
293 |
|
294 |
<p> |
295 |
If you need specific support in the initramfs, such as lvm or raid, add in the |
296 |
appropriate options to genkernel. See <c>genkernel --help</c> for more |
297 |
information, or the next example which enables support for LVM and software raid |
298 |
(mdadm): |
299 |
</p> |
300 |
|
301 |
<pre caption="Building an initramfs with support for LVM and software raid"> |
302 |
# <i>genkernel --bootdir=/. --no-mountboot --lvm --mdadm --install initramfs</i> |
303 |
</pre> |
304 |
|
305 |
<p> |
306 |
The initramfs will be stored in <path>/</path>. You can find the file by simply |
307 |
listing the files starting with <path>initramfs</path>: |
308 |
</p> |
309 |
|
310 |
<pre caption="Checking the initramfs file name"> |
311 |
# <i>ls /initramfs*</i> |
312 |
</pre> |
313 |
|
314 |
<p> |
315 |
Now continue with <uri link="#kernel_modules">Kernel Modules</uri>. |
316 |
</p> |
317 |
|
318 |
</body> |
319 |
</subsection> |
320 |
</section> |
321 |
<section id="genkernel"> |
322 |
<title>Alternative: Using genkernel</title> |
323 |
<body> |
324 |
|
325 |
<p> |
326 |
If you are reading this section, you have chosen to use our <c>genkernel</c> |
327 |
script to configure your kernel for you. |
328 |
</p> |
329 |
|
330 |
<p> |
331 |
Now that your kernel source tree is installed, it's now time to compile your |
332 |
kernel by using our <c>genkernel</c> script to automatically build a kernel for |
333 |
you. <c>genkernel</c> works by configuring a kernel nearly identically to the |
334 |
way our Installation CD kernel is configured. This means that when you use |
335 |
<c>genkernel</c> to build your kernel, your system will generally detect all |
336 |
your hardware at boot-time, just like our Installation CD does. Because |
337 |
genkernel doesn't require any manual kernel configuration, it is an ideal |
338 |
solution for those users who may not be comfortable compiling their own kernels. |
339 |
</p> |
340 |
|
341 |
<p> |
342 |
Now, let's see how to use genkernel. First, emerge the genkernel ebuild: |
343 |
</p> |
344 |
|
345 |
<pre caption="Emerging genkernel"> |
346 |
# <i>emerge genkernel</i> |
347 |
</pre> |
348 |
|
349 |
<p> |
350 |
Now, compile your kernel sources by running <c>genkernel</c>. Be aware |
351 |
though, as <c>genkernel</c> compiles a kernel that supports almost all hardware, |
352 |
this compilation will take quite a while to finish! |
353 |
</p> |
354 |
|
355 |
<note> |
356 |
Users of LVM2 will probably want to add <c>--lvm</c> to the genkernel |
357 |
command-line. |
358 |
</note> |
359 |
|
360 |
<pre caption="Running genkernel"> |
361 |
# <i>genkernel --bootdir=/. --no-mountboot all</i> |
362 |
</pre> |
363 |
|
364 |
<p> |
365 |
Once <c>genkernel</c> completes, a kernel, full set of modules and |
366 |
<e>initial ram disk</e> (initramfs) will be created. We will use the kernel |
367 |
and initrd when configuring a boot loader later in this document. Write |
368 |
down the names of the kernel and initrd as you will need it when writing |
369 |
the bootloader configuration file. The initrd will be started immediately after |
370 |
booting to perform hardware autodetection (just like on the Installation CD) |
371 |
before your "real" system starts up. |
372 |
</p> |
373 |
|
374 |
<pre caption="Checking the created kernel image name and initrd"> |
375 |
# <i>ls /kernel* /initramfs*</i> |
376 |
</pre> |
377 |
|
378 |
</body> |
379 |
</section> |
380 |
<section id="kernel_modules"> |
381 |
<title>Kernel Modules</title> |
382 |
|
383 |
<subsection> |
384 |
<include href="hb-install-kernelmodules.xml"/> |
385 |
</subsection> |
386 |
|
387 |
</section> |
388 |
</sections> |