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