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.30 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-bootloader.xml,v 1.29 2013/08/15 08:14:10 swift Exp $ --> |
8 |
neysx |
1.1 |
|
9 |
|
|
<sections> |
10 |
|
|
|
11 |
swift |
1.30 |
<version>14</version> |
12 |
swift |
1.29 |
<date>2013-08-15</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 |
|
|
<p> |
30 |
|
|
For <keyval id="arch"/>, Gentoo Linux provides <uri |
31 |
swift |
1.30 |
link="#grub">GRUB</uri>, <uri link="#grub2">GRUB2</uri> and |
32 |
|
|
<uri link="#lilo">LILO</uri>. |
33 |
neysx |
1.2 |
</p> |
34 |
|
|
|
35 |
swift |
1.30 |
<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 |
neysx |
1.9 |
</body> |
42 |
|
|
<body> |
43 |
neysx |
1.2 |
<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 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
<c>genkernel</c> default kernel configuration), you can activate it by adding a |
59 |
nightmorph |
1.15 |
a <c>video</c> statement to your bootloader configuration file. |
60 |
neysx |
1.1 |
</p> |
61 |
|
|
|
62 |
nightmorph |
1.10 |
<p> |
63 |
nightmorph |
1.15 |
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 |
neysx |
1.1 |
</p> |
66 |
|
|
|
67 |
|
|
<p> |
68 |
|
|
The <c>video</c> statement controls framebuffer display options. It needs to be |
69 |
nightmorph |
1.10 |
given the framebuffer driver followed by the control statements you wish to |
70 |
|
|
enable. All variables are listed in |
71 |
nightmorph |
1.15 |
<path>/usr/src/linux/Documentation/fb/uvesafb.txt</path>. The most-used options |
72 |
neysx |
1.2 |
are: |
73 |
neysx |
1.1 |
</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 |
nightmorph |
1.10 |
<ti>mtrr:<c>n</c></ti> |
89 |
neysx |
1.1 |
<ti> |
90 |
neysx |
1.2 |
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 |
neysx |
1.1 |
4 - write-through |
96 |
|
|
</ti> |
97 |
|
|
</tr> |
98 |
nightmorph |
1.10 |
<tr> |
99 |
neysx |
1.1 |
<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 |
nightmorph |
1.10 |
<p> |
109 |
nightmorph |
1.15 |
The result could be something like |
110 |
nightmorph |
1.10 |
<c>video=uvesafb:mtrr:3,ywrap,1024x768-32@85</c>. Write this setting down; you |
111 |
neysx |
1.9 |
will need it shortly. |
112 |
neysx |
1.2 |
</p> |
113 |
|
|
|
114 |
nightmorph |
1.8 |
<p test="func:keyval('arch')='IA64'"> |
115 |
|
|
Now, you should install the <uri link="#elilo">elilo bootloader</uri>. |
116 |
|
|
</p> |
117 |
|
|
|
118 |
neysx |
1.9 |
<p test="not(func:keyval('arch')='IA64')"> |
119 |
swift |
1.30 |
Now continue by installing <uri link="#grub">GRUB</uri>, <uri |
120 |
|
|
link="#grub2">GRUB2</uri> <e>or</e> <uri |
121 |
neysx |
1.1 |
link="#lilo">LILO</uri>. |
122 |
|
|
</p> |
123 |
|
|
|
124 |
|
|
</body> |
125 |
|
|
</subsection> |
126 |
|
|
</section> |
127 |
nightmorph |
1.8 |
<section id="grub" test="contains('AMD64 x86',func:keyval('arch'))"> |
128 |
swift |
1.30 |
<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 |
neysx |
1.1 |
<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 |
nightmorph |
1.11 |
<path>/dev/sda1</path> will most likely be called <path>(hd0,0)</path> under |
157 |
nightmorph |
1.15 |
GRUB. Notice the parentheses around the <path>hd0,0</path> - they are |
158 |
nightmorph |
1.11 |
required. |
159 |
neysx |
1.1 |
</p> |
160 |
|
|
|
161 |
|
|
<p> |
162 |
neysx |
1.2 |
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 |
neysx |
1.1 |
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 |
nightmorph |
1.11 |
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 |
neysx |
1.2 |
translated to <path>(hd1,6)</path>. It might sound tricky and tricky it is |
175 |
nightmorph |
1.11 |
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 |
neysx |
1.1 |
</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 |
nightmorph |
1.6 |
<impo test="func:keyval('arch')='AMD64'"> |
195 |
|
|
If you are using a non-multilib <uri |
196 |
|
|
link="?part=1&chap=6#doc_chap2">profile</uri>, you should <b>not</b> emerge |
197 |
nightmorph |
1.20 |
<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 |
nightmorph |
1.6 |
</impo> |
201 |
|
|
|
202 |
neysx |
1.1 |
<pre caption="Installing GRUB"> |
203 |
|
|
# <i>emerge grub</i> |
204 |
|
|
</pre> |
205 |
|
|
|
206 |
|
|
<p> |
207 |
|
|
Although GRUB is now installed, we still need to write up a |
208 |
neysx |
1.2 |
configuration file for it and place GRUB in our MBR so that GRUB automatically |
209 |
neysx |
1.1 |
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 |
swift |
1.24 |
Now we are going to write up a <path>grub.conf</path>. Make |
219 |
neysx |
1.2 |
sure you use <e>your</e> kernel image filename and, if appropriate, <e>your</e> |
220 |
|
|
initrd image filename. |
221 |
neysx |
1.1 |
</p> |
222 |
|
|
|
223 |
|
|
<note> |
224 |
nightmorph |
1.12 |
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 |
neysx |
1.1 |
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 |
swift |
1.24 |
<pre caption="Example grub.conf"> |
235 |
neysx |
1.1 |
<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 |
nightmorph |
1.10 |
title Gentoo Linux <keyval id="kernel-version"/> |
244 |
neysx |
1.1 |
<comment># Partition where the kernel image (or operating system) is located</comment> |
245 |
|
|
root (hd0,0) |
246 |
nightmorph |
1.11 |
kernel /boot/<keyval id="kernel-name"/> root=/dev/sda3 |
247 |
neysx |
1.1 |
|
248 |
nightmorph |
1.10 |
title Gentoo Linux <keyval id="kernel-version"/> (rescue) |
249 |
vapier |
1.4 |
<comment># Partition where the kernel image (or operating system) is located</comment> |
250 |
|
|
root (hd0,0) |
251 |
nightmorph |
1.11 |
kernel /boot/<keyval id="kernel-name"/> root=/dev/sda3 init=/bin/bb |
252 |
vapier |
1.4 |
|
253 |
neysx |
1.1 |
<comment># The next four lines are only if you dualboot with a Windows system.</comment> |
254 |
nightmorph |
1.11 |
<comment># In this case, Windows is hosted on /dev/sda6.</comment> |
255 |
nightmorph |
1.10 |
title Windows XP |
256 |
neysx |
1.1 |
rootnoverify (hd0,5) |
257 |
|
|
makeactive |
258 |
|
|
chainloader +1 |
259 |
|
|
</pre> |
260 |
|
|
|
261 |
|
|
<p> |
262 |
swift |
1.25 |
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 |
swift |
1.26 |
<pre caption="GRUB snippet for initramfs-enabled kernel builds"> |
268 |
swift |
1.25 |
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 |
neysx |
1.1 |
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 |
nightmorph |
1.15 |
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 |
nightmorph |
1.11 |
(<c>root=/dev/sda3</c> or <c>real_root=/dev/sda3</c>), but you can pass others |
296 |
nightmorph |
1.18 |
as well, such as the <c>video</c> statement for framebuffer as we discussed |
297 |
nightmorph |
1.15 |
previously. |
298 |
neysx |
1.1 |
</p> |
299 |
|
|
|
300 |
|
|
<p> |
301 |
nightmorph |
1.16 |
If your bootloader configuration file contains the real_root parameter, use the |
302 |
|
|
real_rootflags parameter to set root filesystem mount options. |
303 |
nightmorph |
1.14 |
</p> |
304 |
|
|
|
305 |
|
|
<p> |
306 |
neysx |
1.1 |
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 |
nightmorph |
1.11 |
<c>sda=stroke</c>. Replace sda with the device that requires this option. |
309 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
Now save the <path>grub.conf</path> file and exit. You still need to install |
319 |
neysx |
1.1 |
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 > /etc/mtab</i> |
353 |
|
|
</pre> |
354 |
|
|
|
355 |
|
|
<p> |
356 |
swift |
1.29 |
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 |
neysx |
1.1 |
Now we can install GRUB using <c>grub-install</c>: |
367 |
|
|
</p> |
368 |
|
|
|
369 |
|
|
<pre caption="Running grub-install"> |
370 |
nightmorph |
1.11 |
# <i>grub-install --no-floppy /dev/sda</i> |
371 |
neysx |
1.1 |
</pre> |
372 |
|
|
|
373 |
|
|
<p> |
374 |
|
|
If you have more questions regarding GRUB, please consult the <uri |
375 |
nightmorph |
1.19 |
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 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
with the <path>grub></path> grub command-line prompt. Now, you need to type |
393 |
neysx |
1.1 |
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 |
neysx |
1.7 |
# <i>grub --no-floppy</i> |
398 |
neysx |
1.1 |
</pre> |
399 |
|
|
|
400 |
|
|
<note> |
401 |
|
|
If your system does not have any floppy drives, add the <c>--no-floppy</c> |
402 |
neysx |
1.2 |
option to the above command to prevent grub from probing the (non-existing) |
403 |
neysx |
1.1 |
floppy drives. |
404 |
|
|
</note> |
405 |
|
|
|
406 |
|
|
<p> |
407 |
neysx |
1.2 |
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 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
grub> <i>root (hd0,0)</i> <comment>(Specify where your /boot partition resides)</comment> |
430 |
|
|
grub> <i>setup (hd0)</i> <comment>(Install GRUB in the MBR)</comment> |
431 |
|
|
grub> <i>quit</i> <comment>(Exit the GRUB shell)</comment> |
432 |
neysx |
1.1 |
</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 |
nightmorph |
1.11 |
<path>/dev/sda3</path>, then the command becomes <c>setup (hd0,2)</c>. |
439 |
neysx |
1.1 |
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 |
nightmorph |
1.19 |
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 |
neysx |
1.1 |
</p> |
448 |
|
|
|
449 |
|
|
<p> |
450 |
|
|
Continue with <uri link="#reboot">Rebooting the System</uri>. |
451 |
|
|
</p> |
452 |
|
|
|
453 |
|
|
</body> |
454 |
|
|
</subsection> |
455 |
|
|
</section> |
456 |
neysx |
1.9 |
<section id="lilo" test="contains('AMD64 x86', func:keyval('arch'))"> |
457 |
neysx |
1.1 |
<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 |
neysx |
1.2 |
<pre caption="Installing LILO"> |
477 |
neysx |
1.1 |
# <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 |
neysx |
1.2 |
<pre caption="Creating /etc/lilo.conf"> |
493 |
neysx |
1.1 |
# <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 |
swift |
1.24 |
example partitioning scheme. |
500 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
line after each boot item since JFS needs to replay its log before it allows |
510 |
neysx |
1.1 |
read-write mounting. |
511 |
|
|
</note> |
512 |
|
|
|
513 |
neysx |
1.2 |
<pre caption="Example /etc/lilo.conf"> |
514 |
nightmorph |
1.11 |
boot=/dev/sda <comment># Install LILO in the MBR</comment> |
515 |
neysx |
1.1 |
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 |
neysx |
1.2 |
image=/boot/<keyval id="kernel-name"/> |
520 |
neysx |
1.1 |
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 |
nightmorph |
1.11 |
root=/dev/sda3 <comment># Location of the root filesystem</comment> |
523 |
neysx |
1.1 |
|
524 |
vapier |
1.5 |
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 |
nightmorph |
1.11 |
root=/dev/sda3 <comment># Location of the root filesystem</comment> |
528 |
vapier |
1.5 |
append="init=/bin/bb" <comment># Launch the Gentoo static rescue shell</comment> |
529 |
|
|
|
530 |
neysx |
1.1 |
<comment># The next two lines are only if you dualboot with a Windows system.</comment> |
531 |
nightmorph |
1.11 |
<comment># In this case, Windows is hosted on /dev/sda6.</comment> |
532 |
|
|
other=/dev/sda6 |
533 |
neysx |
1.1 |
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 |
swift |
1.25 |
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 |
nightmorph |
1.27 |
<i>append="real_root=/dev/sda3"</i> |
552 |
swift |
1.25 |
<i>initrd=/boot/<keyval id="genkernel-initrd" /></i> |
553 |
|
|
</pre> |
554 |
|
|
|
555 |
|
|
<p> |
556 |
neysx |
1.1 |
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 |
neysx |
1.2 |
<pre caption="Using append to add kernel options"> |
562 |
|
|
image=/boot/<keyval id="kernel-name"/> |
563 |
neysx |
1.1 |
label=gentoo |
564 |
|
|
read-only |
565 |
nightmorph |
1.11 |
root=/dev/sda3 |
566 |
nightmorph |
1.15 |
<i>append="video=uvesafb:mtrr,ywrap,1024x768-32@85"</i> |
567 |
neysx |
1.1 |
</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 |
nightmorph |
1.11 |
<c>sda=stroke</c>. Replace sda with the device that requires this option. |
573 |
neysx |
1.1 |
</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 |
neysx |
1.2 |
itself on the disk). Keep in mind that you'll also have to run |
585 |
neysx |
1.1 |
<c>/sbin/lilo</c> every time you install a new kernel or make any changes to |
586 |
|
|
the menu. |
587 |
|
|
</p> |
588 |
|
|
|
589 |
neysx |
1.2 |
<pre caption="Finishing the LILO installation"> |
590 |
neysx |
1.1 |
# <i>/sbin/lilo</i> |
591 |
|
|
</pre> |
592 |
|
|
|
593 |
neysx |
1.2 |
<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 |
neysx |
1.1 |
|
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 |
swift |
1.30 |
<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&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 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/grub2</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/grub2"> |
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/grub2/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 |
nightmorph |
1.8 |
<section id="elilo" test="func:keyval('arch')='IA64'"> |
686 |
|
|
<title>Default: Installing elilo</title> |
687 |
|
|
<body> |
688 |
|
|
|
689 |
|
|
<p> |
690 |
nightmorph |
1.21 |
On the IA64 platform, the boot loader is called <c>elilo</c>. You may need to |
691 |
|
|
emerge it on your machine first. |
692 |
nightmorph |
1.8 |
</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-<ver>/</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 |
nightmorph |
1.28 |
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 |
nightmorph |
1.8 |
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 |
neysx |
1.1 |
<section id="reboot"> |
772 |
|
|
<title>Rebooting the System</title> |
773 |
|
|
<subsection> |
774 |
|
|
<body> |
775 |
|
|
|
776 |
|
|
<p> |
777 |
neysx |
1.2 |
Exit the chrooted environment and unmount all mounted partitions. Then type in |
778 |
neysx |
1.1 |
that one magical command you have been waiting for: <c>reboot</c>. |
779 |
|
|
</p> |
780 |
|
|
|
781 |
nightmorph |
1.8 |
<pre caption="Unmounting all partitions and rebooting" test="func:keyval('arch')='IA64'"> |
782 |
|
|
# <i>exit</i> |
783 |
|
|
cdimage ~# <i>cd</i> |
784 |
nightmorph |
1.23 |
cdimage ~# <i>umount -l /mnt/gentoo/dev{/pts,/shm,}</i> |
785 |
|
|
cdimage ~# <i>umount -l /mnt/gentoo{/boot,/sys,/proc,}</i> |
786 |
nightmorph |
1.8 |
cdimage ~# <i>reboot</i> |
787 |
|
|
</pre> |
788 |
|
|
|
789 |
|
|
<pre caption="Unmounting all partitions and rebooting" test="not(func:keyval('arch')='IA64')"> |
790 |
neysx |
1.1 |
# <i>exit</i> |
791 |
|
|
cdimage ~# <i>cd</i> |
792 |
nightmorph |
1.23 |
cdimage ~# <i>umount -l /mnt/gentoo/dev{/shm,/pts,}</i> |
793 |
|
|
cdimage ~# <i>umount -l /mnt/gentoo{/boot,/proc,}</i> |
794 |
neysx |
1.1 |
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 |
nightmorph |
1.8 |
<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 |
neysx |
1.1 |
<p> |
808 |
|
|
Once rebooted in your Gentoo installation, finish up with <uri |
809 |
|
|
link="?part=1&chap=11">Finalizing your Gentoo Installation</uri>. |
810 |
|
|
</p> |
811 |
|
|
|
812 |
|
|
</body> |
813 |
|
|
</subsection> |
814 |
|
|
</section> |
815 |
|
|
</sections> |