/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-bootloader.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-x86+amd64-bootloader.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.32 - (show annotations) (download) (as text)
Mon Sep 23 17:34:28 2013 UTC (9 months, 2 weeks ago) by swift
Branch: MAIN
Changes since 1.31: +5 -5 lines
File MIME type: application/xml
Fix bug #485684 - Use grub:0 for legacy, and add sys-boot category to emerge commands

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-bootloader.xml,v 1.31 2013/09/20 06:47:50 swift Exp $ -->
8
9 <sections>
10
11 <version>16</version>
12 <date>2013-09-23</date>
13
14 <section>
15 <title>Making your Choice</title>
16 <subsection>
17 <title>Introduction</title>
18 <body>
19
20 <p>
21 Now that your kernel is configured and compiled and the necessary system
22 configuration files are filled in correctly, it is time to install a
23 program that will fire up your kernel when you start the system. Such a
24 program is called a <e>bootloader</e>.
25 </p>
26
27 </body>
28 <body test="contains('AMD64 x86', func:keyval('arch'))">
29 <p>
30 For <keyval id="arch"/>, Gentoo Linux provides <uri
31 link="#grub">GRUB</uri>, <uri link="#grub2">GRUB2</uri> and
32 <uri link="#lilo">LILO</uri>.
33 </p>
34
35 <note>
36 GRUB2 might not be stabilized at the moment of reading this. However,
37 stabilization is due very soon so we temporarily document both GRUB and GRUB2
38 and will remove the GRUB instructions after stabilization of GRUB2.
39 </note>
40
41 </body>
42 <body>
43 <p>
44 But before we install the bootloader, we inform you how to configure
45 framebuffer (assuming you want it of course). With framebuffer you can run the
46 Linux command line with (limited) graphical features (such as using the nice
47 bootsplash image Gentoo provides).
48 </p>
49
50 </body>
51 </subsection>
52 <subsection>
53 <title>Optional: Framebuffer</title>
54 <body>
55
56 <p>
57 <e>If</e> you have configured your kernel with framebuffer support (or you used
58 <c>genkernel</c> default kernel configuration), you can activate it by adding a
59 a <c>video</c> statement to your bootloader configuration file.
60 </p>
61
62 <p>
63 First of all, you need to know your framebuffer device. You should have used
64 <c>uvesafb</c> as the <e>VESA driver</e>.
65 </p>
66
67 <p>
68 The <c>video</c> statement controls framebuffer display options. It needs to be
69 given the framebuffer driver followed by the control statements you wish to
70 enable. All variables are listed in
71 <path>/usr/src/linux/Documentation/fb/uvesafb.txt</path>. The most-used options
72 are:
73 </p>
74
75 <table>
76 <tr>
77 <th>Control</th>
78 <th>Description</th>
79 </tr>
80 <tr>
81 <ti>ywrap</ti>
82 <ti>
83 Assume that the graphical card can wrap around its memory (i.e. continue at
84 the beginning when it has approached the end)
85 </ti>
86 </tr>
87 <tr>
88 <ti>mtrr:<c>n</c></ti>
89 <ti>
90 Setup MTRR registers. <c>n</c> can be:<br/>
91 0 - disabled<br/>
92 1 - uncachable<br/>
93 2 - write-back<br/>
94 3 - write-combining<br/>
95 4 - write-through
96 </ti>
97 </tr>
98 <tr>
99 <ti><c>mode</c></ti>
100 <ti>
101 Set up the resolution, color depth and refresh rate. For instance,
102 <c>1024x768-32@85</c> for a resolution of 1024x768, 32 bit color depth and a
103 refresh rate of 85 Hz.
104 </ti>
105 </tr>
106 </table>
107
108 <p>
109 The result could be something like
110 <c>video=uvesafb:mtrr:3,ywrap,1024x768-32@85</c>. Write this setting down; you
111 will need it shortly.
112 </p>
113
114 <p test="func:keyval('arch')='IA64'">
115 Now, you should install the <uri link="#elilo">elilo bootloader</uri>.
116 </p>
117
118 <p test="not(func:keyval('arch')='IA64')">
119 Now continue by installing <uri link="#grub">GRUB</uri>, <uri
120 link="#grub2">GRUB2</uri> <e>or</e> <uri
121 link="#lilo">LILO</uri>.
122 </p>
123
124 </body>
125 </subsection>
126 </section>
127 <section id="grub" test="contains('AMD64 x86',func:keyval('arch'))">
128 <title>Default: Using GRUB Legacy</title>
129 <subsection>
130 <title>What is Legacy?</title>
131 <body>
132
133 <p>
134 GRUB has been reworked and a new release dubbed GRUB2 is made available. The new
135 GRUB2 codebase is quite different from the current GRUB, which is why this GRUB
136 version is now dubbed as "GRUB Legacy".
137 </p>
138
139 <p>
140 We recommend to start with GRUB2 as soon as it is available. The migration of
141 GRUB to GRUB2 is <uri link="/doc/en/grub2-migration.xml">documented
142 online</uri>. The instructions in this section relate to "GRUB Legacy" and will
143 disappear from the book soon after the stabilization of <uri
144 link="#grub2">GRUB2</uri>.
145 </p>
146
147 </body>
148 </subsection>
149 <subsection>
150 <title>Understanding GRUB's terminology</title>
151 <body>
152
153 <p>
154 The most critical part of understanding GRUB is getting comfortable with how
155 GRUB refers to hard drives and partitions. Your Linux partition
156 <path>/dev/sda1</path> will most likely be called <path>(hd0,0)</path> under
157 GRUB. Notice the parentheses around the <path>hd0,0</path> - they are
158 required.
159 </p>
160
161 <p>
162 Hard drives count from zero rather than "a" and partitions start at zero
163 rather than one. Be aware too that with the hd devices, only hard drives are
164 counted, not atapi-ide devices such as cdrom players and burners. Also, the
165 same construct is used with SCSI drives. (Normally they get higher numbers
166 than IDE drives except when the BIOS is configured to boot from SCSI devices.)
167 When you ask the BIOS to boot from a different hard disk (for instance your
168 primary slave), <e>that</e> harddisk is seen as <path>hd0</path>.
169 </p>
170
171 <p>
172 Assuming you have a hard drive on <path>/dev/sda</path> and two more on
173 <path>/dev/sdb</path> and <path>/dev/sdc</path>, <path>/dev/sdb7</path> gets
174 translated to <path>(hd1,6)</path>. It might sound tricky and tricky it is
175 indeed, but as we will see, GRUB offers a tab completion mechanism that comes
176 handy for those of you having a lot of hard drives and partitions and who are a
177 little lost in the GRUB numbering scheme.
178 </p>
179
180 <p>
181 Having gotten the feel for that, it is time to install GRUB.
182 </p>
183
184 </body>
185 </subsection>
186 <subsection>
187 <title>Installing GRUB</title>
188 <body>
189
190 <p>
191 To install GRUB, let's first emerge it:
192 </p>
193
194 <impo test="func:keyval('arch')='AMD64'">
195 If you are using a non-multilib <uri
196 link="?part=1&amp;chap=6#doc_chap2">profile</uri>, you should <b>not</b> emerge
197 <c>grub</c>, but instead you should emerge <c>grub-static</c>. If you plan to
198 use a non-multilib profile <e>and</e> you have <b>disabled</b> IA-32 emulation
199 in your kernel, then you should use <c>lilo</c>.
200 </impo>
201
202 <pre caption="Installing GRUB">
203 # <i>emerge sys-boot/grub:0</i>
204 </pre>
205
206 <p>
207 Although GRUB is now installed, we still need to write up a
208 configuration file for it and place GRUB in our MBR so that GRUB automatically
209 boots your newly created kernel. Create <path>/boot/grub/grub.conf</path> with
210 <c>nano</c> (or, if applicable, another editor):
211 </p>
212
213 <pre caption="Creating /boot/grub/grub.conf">
214 # <i>nano -w /boot/grub/grub.conf</i>
215 </pre>
216
217 <p>
218 Now we are going to write up a <path>grub.conf</path>. Make
219 sure you use <e>your</e> kernel image filename and, if appropriate, <e>your</e>
220 initrd image filename.
221 </p>
222
223 <note>
224 Grub assigns device designations from the BIOS. If you change your BIOS
225 settings, your device letters and numbers may change, too. For example, if you
226 change your device boot order, you may need to change your grub configuration.
227 </note>
228
229 <note>
230 If your root filesystem is JFS, you <e>must</e> add " ro" to the <c>kernel</c>
231 line since JFS needs to replay its log before it allows read-write mounting.
232 </note>
233
234 <pre caption="Example grub.conf">
235 <comment># Which listing to boot as default. 0 is the first, 1 the second etc.</comment>
236 default 0
237 <comment># How many seconds to wait before the default listing is booted.</comment>
238 timeout 30
239 <comment># Nice, fat splash-image to spice things up :)
240 # Comment out if you don't have a graphics card installed</comment>
241 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
242
243 title Gentoo Linux <keyval id="kernel-version"/>
244 <comment># Partition where the kernel image (or operating system) is located</comment>
245 root (hd0,0)
246 kernel /boot/<keyval id="kernel-name"/> root=/dev/sda3
247
248 title Gentoo Linux <keyval id="kernel-version"/> (rescue)
249 <comment># Partition where the kernel image (or operating system) is located</comment>
250 root (hd0,0)
251 kernel /boot/<keyval id="kernel-name"/> root=/dev/sda3 init=/bin/bb
252
253 <comment># The next four lines are only if you dualboot with a Windows system.</comment>
254 <comment># In this case, Windows is hosted on /dev/sda6.</comment>
255 title Windows XP
256 rootnoverify (hd0,5)
257 makeactive
258 chainloader +1
259 </pre>
260
261 <p>
262 If, while building the Linux kernel, you opted to include an initramfs to boot
263 from, then you will need to change the configuration by referring to this
264 initramfs file and telling the initramfs where your real root device is at:
265 </p>
266
267 <pre caption="GRUB snippet for initramfs-enabled kernel builds">
268 title Gentoo Linux <keyval id="kernel-version"/>
269 root (hd0,0)
270 kernel /boot/<keyval id="kernel-version"/> <i>real_</i>root=/dev/sda3
271 <i>initrd /boot/<keyval id="genkernel-initrd"/></i>
272 </pre>
273
274 <p>
275 If you used a different partitioning scheme and/or kernel image, adjust
276 accordingly. However, make sure that anything that follows a GRUB-device (such
277 as <path>(hd0,0)</path>) is relative to the mountpoint, not the root. In other
278 words, <path>(hd0,0)/grub/splash.xpm.gz</path> is in reality
279 <path>/boot/grub/splash.xpm.gz</path> since <path>(hd0,0)</path> is
280 <path>/boot</path>.
281 </p>
282
283 <p>
284 Besides, if you chose to use a different partitioning scheme and did not put
285 <path>/boot</path> in a separate partition, the <path>/boot</path> prefix used
286 in the above code samples is really <e>required</e>. If you followed our
287 suggested partitioning plan, the <path>/boot</path> prefix it not required, but
288 a <path>boot</path> symlink makes it work. In short, the above examples should
289 work whether you defined a separate <path>/boot</path> partition or not.
290 </p>
291
292 <p>
293 If you need to pass any additional options to the kernel, simply add them to the
294 end of the kernel command. We're already passing one option
295 (<c>root=/dev/sda3</c> or <c>real_root=/dev/sda3</c>), but you can pass others
296 as well, such as the <c>video</c> statement for framebuffer as we discussed
297 previously.
298 </p>
299
300 <p>
301 If your bootloader configuration file contains the real_root parameter, use the
302 real_rootflags parameter to set root filesystem mount options.
303 </p>
304
305 <p>
306 If you're using a 2.6.7 or higher kernel and you jumpered your harddrive
307 because the BIOS can't handle large harddrives you'll need to append
308 <c>sda=stroke</c>. Replace sda with the device that requires this option.
309 </p>
310
311 <p>
312 <c>genkernel</c> users should know that their kernels use the same boot options
313 as is used for the Installation CD. For instance, if you have SCSI devices, you
314 should add <c>doscsi</c> as kernel option.
315 </p>
316
317 <p>
318 Now save the <path>grub.conf</path> file and exit. You still need to install
319 GRUB in the MBR (Master Boot Record) so that GRUB is automatically executed when
320 you boot your system.
321 </p>
322
323 <p>
324 The GRUB developers recommend the use of <c>grub-install</c>. However, if for
325 some reason <c>grub-install</c> fails to work correctly you still have the
326 option to manually install GRUB.
327 </p>
328
329 <p>
330 Continue with <uri link="#grub-install-auto">Default: Setting up GRUB using
331 grub-install</uri> or <uri link="#grub-install-manual">Alternative: Setting up
332 GRUB using manual instructions</uri>.
333 </p>
334
335 </body>
336 </subsection>
337 <subsection id="grub-install-auto">
338 <title>Default: Setting up GRUB using grub-install</title>
339 <body>
340
341 <p>
342 To install GRUB you will need to issue the <c>grub-install</c> command.
343 However, <c>grub-install</c> won't work off-the-shelf since we are inside a
344 chrooted environment. We need to create <path>/etc/mtab</path> which lists all
345 mounted filesystems. Fortunately, there is an easy way to accomplish this -
346 just copy over <path>/proc/mounts</path> to <path>/etc/mtab</path>, excluding
347 the <c>rootfs</c> line if you haven't created a separate boot partition. The
348 following command will work in both cases:
349 </p>
350
351 <pre caption="Creating /etc/mtab">
352 # <i>grep -v rootfs /proc/mounts &gt; /etc/mtab</i>
353 </pre>
354
355 <p>
356 When using Linux virtio disks, we need to tell grub where to find the disks as
357 the <c>grub-install</c> command will otherwise fail. This is done by adding the
358 device definition to the <path>device.map</path> file:
359 </p>
360
361 <pre caption="Adding the virtio disk to the device map table">
362 # <i>echo "(hd0) /dev/vda" >> /boot/grub/device.map</i>
363 </pre>
364
365 <p>
366 Now we can install GRUB using <c>grub-install</c>:
367 </p>
368
369 <pre caption="Running grub-install">
370 # <i>grub-install --no-floppy /dev/sda</i>
371 </pre>
372
373 <p>
374 If you have more questions regarding GRUB, please consult the <uri
375 link="http://www.gnu.org/software/grub/grub-faq.html">GRUB FAQ</uri>, the <uri
376 link="http://grub.enbug.org/GrubLegacy">GRUB Wiki</uri>, or read <c>info
377 grub</c> in your terminal.
378 </p>
379
380 <p>
381 Continue with <uri link="#reboot">Rebooting the System</uri>.
382 </p>
383
384 </body>
385 </subsection>
386 <subsection id="grub-install-manual">
387 <title>Alternative: Setting up GRUB using manual instructions</title>
388 <body>
389
390 <p>
391 To start configuring GRUB, you type in <c>grub</c>. You'll be presented
392 with the <path>grub&gt;</path> grub command-line prompt. Now, you need to type
393 in the right commands to install the GRUB boot record onto your hard drive.
394 </p>
395
396 <pre caption="Starting the GRUB shell">
397 # <i>grub --no-floppy</i>
398 </pre>
399
400 <note>
401 If your system does not have any floppy drives, add the <c>--no-floppy</c>
402 option to the above command to prevent grub from probing the (non-existing)
403 floppy drives.
404 </note>
405
406 <p>
407 In the example configuration we want to install GRUB so that it reads its
408 information from the boot partition <path><keyval id="/boot"/></path>, and
409 installs the GRUB boot record on the hard drive's MBR (master boot record) so
410 that the first thing we see when we turn on the computer is the GRUB prompt. Of
411 course, if you haven't followed the example configuration during the
412 installation, change the commands accordingly.
413 </p>
414
415 <p>
416 The tab completion mechanism of GRUB can be used from within GRUB.
417 For instance, if you type in "<c>root (</c>" followed by a TAB, you will
418 be presented with a list of devices (such as <path>hd0</path>). If you
419 type in "<c>root (hd0,</c>" followed by a TAB, you will receive a list
420 of available partitions to choose from (such as <path>hd0,0</path>).
421 </p>
422
423 <p>
424 By using the tab completion, setting up GRUB should be not that hard.
425 Now go on, configure GRUB, shall we? :-)
426 </p>
427
428 <pre caption="Installing GRUB in the MBR">
429 grub&gt; <i>root (hd0,0)</i> <comment>(Specify where your /boot partition resides)</comment>
430 grub&gt; <i>setup (hd0)</i> <comment>(Install GRUB in the MBR)</comment>
431 grub&gt; <i>quit</i> <comment>(Exit the GRUB shell)</comment>
432 </pre>
433
434 <note>
435 If you want to install GRUB in a certain partition instead of the MBR,
436 you have to alter the <c>setup</c> command so it points to the right
437 partition. For instance, if you want GRUB installed in
438 <path>/dev/sda3</path>, then the command becomes <c>setup (hd0,2)</c>.
439 Few users however want to do this.
440 </note>
441
442 <p>
443 If you have more questions regarding GRUB, please consult the <uri
444 link="http://www.gnu.org/software/grub/grub-faq.html">GRUB FAQ</uri>, the <uri
445 link="http://grub.enbug.org/GrubLegacy">GRUB Wiki</uri>, or read <c>info
446 grub</c> in your terminal.
447 </p>
448
449 <p>
450 Continue with <uri link="#reboot">Rebooting the System</uri>.
451 </p>
452
453 </body>
454 </subsection>
455 </section>
456 <section id="lilo" test="contains('AMD64 x86', func:keyval('arch'))">
457 <title>Alternative: Using LILO</title>
458 <subsection>
459 <title>Installing LILO</title>
460 <body>
461
462 <p>
463 LILO, the LInuxLOader, is the tried and true workhorse of Linux
464 bootloaders. However, it lacks some features that GRUB has (which is
465 also the reason why GRUB is currently gaining popularity). The reason
466 why LILO is still used is that, on some systems, GRUB doesn't work and
467 LILO does. Of course, it is also used because some people know LILO and
468 want to stick with it. Either way, Gentoo supports both, and apparently
469 you have chosen to use LILO.
470 </p>
471
472 <p>
473 Installing LILO is a breeze; just use <c>emerge</c>.
474 </p>
475
476 <pre caption="Installing LILO">
477 # <i>emerge lilo</i>
478 </pre>
479
480 </body>
481 </subsection>
482 <subsection>
483 <title>Configuring LILO</title>
484 <body>
485
486 <p>
487 To configure LILO, you must create <path>/etc/lilo.conf</path>. Fire up
488 your favorite editor (in this handbook we use <c>nano</c> for
489 consistency) and create the file.
490 </p>
491
492 <pre caption="Creating /etc/lilo.conf">
493 # <i>nano -w /etc/lilo.conf</i>
494 </pre>
495
496 <p>
497 Some sections ago we have asked you to remember the kernel-image name
498 you have created. In the next example <path>lilo.conf</path> we use the
499 example partitioning scheme.
500 </p>
501
502 <p>
503 Make sure you use <e>your</e> kernel image filename and, if appropriate,
504 <e>your</e> initrd image filename.
505 </p>
506
507 <note>
508 If your root filesystem is JFS, you <e>must</e> add a <c>append="ro"</c>
509 line after each boot item since JFS needs to replay its log before it allows
510 read-write mounting.
511 </note>
512
513 <pre caption="Example /etc/lilo.conf">
514 boot=/dev/sda <comment># Install LILO in the MBR</comment>
515 prompt <comment># Give the user the chance to select another section</comment>
516 timeout=50 <comment># Wait 5 (five) seconds before booting the default section</comment>
517 default=gentoo <comment># When the timeout has passed, boot the "gentoo" section</comment>
518
519 image=/boot/<keyval id="kernel-name"/>
520 label=gentoo <comment># Name we give to this section</comment>
521 read-only <comment># Start with a read-only root. Do not alter!</comment>
522 root=/dev/sda3 <comment># Location of the root filesystem</comment>
523
524 image=/boot/<keyval id="kernel-name"/>
525 label=gentoo.rescue <comment># Name we give to this section</comment>
526 read-only <comment># Start with a read-only root. Do not alter!</comment>
527 root=/dev/sda3 <comment># Location of the root filesystem</comment>
528 append="init=/bin/bb" <comment># Launch the Gentoo static rescue shell</comment>
529
530 <comment># The next two lines are only if you dualboot with a Windows system.</comment>
531 <comment># In this case, Windows is hosted on /dev/sda6.</comment>
532 other=/dev/sda6
533 label=windows
534 </pre>
535
536 <note>
537 If you use a different partitioning scheme and/or kernel image, adjust
538 accordingly.
539 </note>
540
541 <p>
542 If, while building the Linux kernel, you opted to include an initramfs to boot
543 from, then you will need to change the configuration by referring to this
544 initramfs file and telling the initramfs where your real root device is at:
545 </p>
546
547 <pre caption="LILO snippet for initramfs-enabled kernel builds">
548 image=/boot/<keyval id="kernel-name"/>
549 label=gentoo
550 read-only
551 <i>append="real_root=/dev/sda3"</i>
552 <i>initrd=/boot/<keyval id="genkernel-initrd" /></i>
553 </pre>
554
555 <p>
556 If you need to pass any additional options to the kernel, add an
557 <c>append</c> statement to the section. As an example, we add the
558 <c>video</c> statement to enable framebuffer:
559 </p>
560
561 <pre caption="Using append to add kernel options">
562 image=/boot/<keyval id="kernel-name"/>
563 label=gentoo
564 read-only
565 root=/dev/sda3
566 <i>append="video=uvesafb:mtrr,ywrap,1024x768-32@85"</i>
567 </pre>
568
569 <p>
570 If you're using a 2.6.7 or higher kernel and you jumpered your harddrive
571 because the BIOS can't handle large harddrives you'll need to append
572 <c>sda=stroke</c>. Replace sda with the device that requires this option.
573 </p>
574
575 <p>
576 <c>genkernel</c> users should know that their kernels use the same boot options
577 as is used for the Installation CD. For instance, if you have SCSI devices, you
578 should add <c>doscsi</c> as kernel option.
579 </p>
580
581 <p>
582 Now save the file and exit. To finish up, you have to run <c>/sbin/lilo</c> so
583 LILO can apply the <path>/etc/lilo.conf</path> to your system (i.e. install
584 itself on the disk). Keep in mind that you'll also have to run
585 <c>/sbin/lilo</c> every time you install a new kernel or make any changes to
586 the menu.
587 </p>
588
589 <pre caption="Finishing the LILO installation">
590 # <i>/sbin/lilo</i>
591 </pre>
592
593 <p>
594 If you have more questions regarding LILO, please consult its <uri
595 link="http://en.wikipedia.org/wiki/LILO_(boot_loader)">wikipedia page</uri>.
596 </p>
597
598 <p>
599 You can now continue with <uri link="#reboot">Rebooting the System</uri>.
600 </p>
601
602 </body>
603 </subsection>
604 </section>
605 <section id="grub2" test="contains('AMD64 x86', func:keyval('arch'))">
606 <title>Alternative: Using GRUB2</title>
607 <subsection>
608 <title>Installing GRUB2</title>
609 <body>
610
611 <p>
612 GRUB2 is provided through the <c>sys-boot/grub</c> package. To deploy GRUB2, use
613 the <e>SLOT</e> notation to tell Portage to install GRUB2. SLOTs are a feature
614 of Gentoo Linux where multiple versions of the same package can be deployed
615 simultaneously on a system. In our case, this means that GRUB Legacy and GRUB2
616 can be installed on a system (software-wise) at the same time.
617 </p>
618
619 <note>
620 GRUB2 might still be marked as ~<keyval id="arch" />. If that is the case, you
621 can either wait and use <uri link="#grub">GRUB Legacy</uri> or unmask the
622 package. This is explained in <uri
623 link="handbook-amd64.xml?part=3&amp;chap=3#doc_chap2">Mixing Stable with
624 Testing</uri>. Once GRUB2 is stabilized, the SLOT operator also is no longer
625 mandatory.
626 </note>
627
628 <pre caption="Installing GRUB2">
629 # <i>emerge sys-boot/grub:2</i>
630 </pre>
631
632 <p>
633 The GRUB2 software is now installed on the system, but not activated yet.
634 </p>
635
636 </body>
637 </subsection>
638 <subsection>
639 <title>Configuring GRUB2</title>
640 <body>
641
642 <p>
643 First, let us install the necessary GRUB2 files in <path>/boot/grub</path>.
644 Assuming the first disk (the one where the system boots from) is
645 <path>/dev/sda</path>, the following command will do this for us:
646 </p>
647
648 <pre caption="Installing the GRUB2 files in /boot/grub">
649 # <i>grub2-install /dev/sda</i>
650 </pre>
651
652 <p>
653 Next, we can generate the GRUB2 configuration based on the user configuration
654 specified in the <path>/etc/default/grub</path> file and
655 <path>/etc/grub.d</path> scripts. In most cases, no configuration is needed
656 by users as GRUB2 will automatically detect which kernel to boot (the highest
657 one available in <path>/boot</path>) and what the root file system is.
658 </p>
659
660 <p>
661 To generate the final GRUB2 configuration, run the <c>grub2-mkconfig</c>
662 command:
663 </p>
664
665 <pre caption="Generating GRUB2 configuration">
666 # <i>grub2-mkconfig -o /boot/grub/grub.cfg</i>
667 Generating grub.cfg ...
668 Found linux image: /boot/<keyval id="kernel-name" />
669 Found initrd image: /boot/<keyval id="genkernel-initrd" />
670 done
671 </pre>
672
673 <p>
674 The output of the command <e>must</e> mention that at least one Linux image is
675 found, as those are needed to boot the system. If you use initramfs or used
676 <c>genkernel</c> to build the kernel, the correct initrd image should be
677 detected as well. If this is not the case, go to <path>/boot</path> and check
678 the contents using the <c>ls</c> command. If the files are indeed missing, go
679 back to the kernel configuration and installation instructions.
680 </p>
681
682 </body>
683 </subsection>
684 </section>
685 <section id="elilo" test="func:keyval('arch')='IA64'">
686 <title>Default: Installing elilo</title>
687 <body>
688
689 <p>
690 On the IA64 platform, the boot loader is called <c>elilo</c>. You may need to
691 emerge it on your machine first.
692 </p>
693
694 <pre caption="Installing elilo">
695 # <i>emerge elilo</i>
696 </pre>
697
698 <p>
699 You can find the configuration file at <path>/etc/elilo.conf</path> and a
700 sample file in the typical docs dir
701 <path>/usr/share/doc/elilo-&lt;ver&gt;/</path>. Here is another sample
702 configuration:
703 </p>
704
705 <pre caption="/etc/elilo.conf example">
706 boot=/dev/sda1
707 delay=30
708 timeout=50
709 default=Gentoo
710 append="console=ttyS0,9600"
711 prompt
712
713 image=/vmlinuz
714 label=Gentoo
715 root=/dev/sda2
716 read-only
717
718 image=/vmlinuz.old
719 label=Gentoo.old
720 root=/dev/sda2
721 read-only
722 </pre>
723
724 <p>
725 The <c>boot</c> line tells elilo the location of the boot partition (in this
726 case, <path>/dev/sda1</path>). The <c>delay</c> line sets the number of
727 10<sup>th</sup> of seconds before automatically booting the default when in
728 non-interactive mode. The <c>timeout</c> line is just like the delay line but
729 for interactive mode. The <c>default</c> line sets the default kernel entry
730 (which is defined below). The <c>append</c> line adds extra options to the
731 kernel command line. The <c>prompt</c> sets the default elilo behavior to
732 interactive.
733 </p>
734
735 <p>
736 The sections that start with <c>image</c> define different bootable images.
737 Each image has a nice <c>label</c>, a <c>root</c> filesystem, and will only
738 mount the root filesystem <c>read-only</c>.
739 </p>
740
741 <p>
742 If, while building the Linux kernel, you opted to include an initramfs to boot
743 from, then you will need to change the configuration by referring to this
744 initramfs file and telling the initramfs where your real root device is at:
745 </p>
746
747 <pre caption="ELILO snippet for initramfs-enabled kernel-builds">
748 image=/vmlinuz
749 label=Gentoo
750 <i>initrd=/<keyval id="genkernel-initrd"/></i>
751 <i>append = "initrd=<keyval id="genkernel-initrd"/> real_root=/dev/sda2 console=ttyS0,9600"</i>
752 read-only
753 </pre>
754
755 <p>
756 When configuration is done, just run <c>elilo --efiboot</c>. The
757 <c>--efiboot</c> option adds a menu entry for Gentoo Linux to the EFI Boot
758 Manager.
759 </p>
760
761 <pre caption="Applying the elilo configuration">
762 # <i>elilo --efiboot</i>
763 </pre>
764
765 <p>
766 Now continue with <uri link="#reboot">Rebooting the System</uri>.
767 </p>
768
769 </body>
770 </section>
771 <section id="reboot">
772 <title>Rebooting the System</title>
773 <subsection>
774 <body>
775
776 <p>
777 Exit the chrooted environment and unmount all mounted partitions. Then type in
778 that one magical command you have been waiting for: <c>reboot</c>.
779 </p>
780
781 <pre caption="Unmounting all partitions and rebooting" test="func:keyval('arch')='IA64'">
782 # <i>exit</i>
783 cdimage ~# <i>cd</i>
784 cdimage ~# <i>umount -l /mnt/gentoo/dev{/pts,/shm,}</i>
785 cdimage ~# <i>umount -l /mnt/gentoo{/boot,/sys,/proc,}</i>
786 cdimage ~# <i>reboot</i>
787 </pre>
788
789 <pre caption="Unmounting all partitions and rebooting" test="not(func:keyval('arch')='IA64')">
790 # <i>exit</i>
791 cdimage ~# <i>cd</i>
792 cdimage ~# <i>umount -l /mnt/gentoo/dev{/shm,/pts,}</i>
793 cdimage ~# <i>umount -l /mnt/gentoo{/boot,/proc,}</i>
794 cdimage ~# <i>reboot</i>
795 </pre>
796
797 <p>
798 Of course, don't forget to remove the bootable CD, otherwise the CD will be
799 booted again instead of your new Gentoo system.
800 </p>
801
802 <p test="func:keyval('arch')='IA64'">
803 When you reboot you should see a new Gentoo Linux menu option in the EFI Boot
804 Manager which will boot Gentoo.
805 </p>
806
807 <p>
808 Once rebooted in your Gentoo installation, finish up with <uri
809 link="?part=1&amp;chap=11">Finalizing your Gentoo Installation</uri>.
810 </p>
811
812 </body>
813 </subsection>
814 </section>
815 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20