| 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 |
neysx |
1.7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-bootloader.xml,v 1.6 2006/11/02 07:27:24 nightmorph Exp $ --> |
| 8 |
neysx |
1.1 |
|
| 9 |
|
|
<sections> |
| 10 |
|
|
|
| 11 |
neysx |
1.7 |
<version>4.3</version> |
| 12 |
|
|
<date>2007-03-12</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 |
|
|
<p test="func:keyval('arch')='x86'"> |
| 28 |
|
|
For x86, Gentoo Linux provides <uri |
| 29 |
|
|
link="#grub">GRUB</uri> and <uri link="#lilo">LILO</uri>. |
| 30 |
|
|
</p> |
| 31 |
|
|
|
| 32 |
|
|
<p> |
| 33 |
|
|
But before we install the bootloader, we inform you how to configure |
| 34 |
|
|
framebuffer (assuming you want it of course). With framebuffer you can run the |
| 35 |
|
|
Linux command line with (limited) graphical features (such as using the nice |
| 36 |
|
|
bootsplash image Gentoo provides). |
| 37 |
neysx |
1.1 |
</p> |
| 38 |
|
|
|
| 39 |
|
|
</body> |
| 40 |
|
|
</subsection> |
| 41 |
|
|
<subsection> |
| 42 |
|
|
<title>Optional: Framebuffer</title> |
| 43 |
|
|
<body> |
| 44 |
|
|
|
| 45 |
|
|
<p> |
| 46 |
|
|
<e>If</e> you have configured your kernel with framebuffer support (or you used |
| 47 |
neysx |
1.2 |
<c>genkernel</c> default kernel configuration), you can activate it by adding a |
| 48 |
|
|
<c>vga</c> and/or a <c>video</c> statement to your bootloader configuration |
| 49 |
neysx |
1.1 |
file. |
| 50 |
|
|
</p> |
| 51 |
|
|
|
| 52 |
neysx |
1.2 |
<p test="func:keyval('arch')='x86'"> |
| 53 |
|
|
First of all, you need to know what type of framebuffer device you're using. If |
| 54 |
neysx |
1.1 |
you use a Gentoo patched kernel tree (such as <c>gentoo-sources</c>) you will |
| 55 |
|
|
have had the possibility of selecting <c>vesafb-tng</c> as the <e>VESA driver |
| 56 |
|
|
type</e> (which is default for these kernel sources). If this is the case, you |
| 57 |
neysx |
1.2 |
are using <c>vesafb-tng</c> and <e>do not need</e> to set a <c>vga</c> |
| 58 |
|
|
statement. Otherwise you are using the <c>vesafb</c> driver and <e>need</e> to |
| 59 |
|
|
set the <c>vga</c> statement. |
| 60 |
|
|
</p> |
| 61 |
|
|
|
| 62 |
|
|
<p test="func:keyval('arch')='AMD64'"> |
| 63 |
|
|
64-bit systems must use the the <c>vesafb</c> driver, and need the <c>vga</c> |
| 64 |
neysx |
1.1 |
statement. |
| 65 |
|
|
</p> |
| 66 |
|
|
|
| 67 |
|
|
<p> |
| 68 |
|
|
The <c>vga</c> statement controls the resolution and color depth of your |
| 69 |
|
|
framebuffer screen for <c>vesafb</c>. As stated in |
| 70 |
|
|
<path>/usr/src/linux/Documentation/fb/vesafb.txt</path> (which gets installed |
| 71 |
neysx |
1.2 |
when you install a kernel source package), you need to pass the VESA number |
| 72 |
neysx |
1.1 |
corresponding to the requested resolution and color depth to it. |
| 73 |
|
|
</p> |
| 74 |
|
|
|
| 75 |
|
|
<p> |
| 76 |
neysx |
1.2 |
The following table lists the available resolutions and color depths and |
| 77 |
|
|
matches those against the value that you need to pass on to the <c>vga</c> |
| 78 |
|
|
statement. |
| 79 |
neysx |
1.1 |
</p> |
| 80 |
|
|
|
| 81 |
|
|
<table> |
| 82 |
|
|
<tr> |
| 83 |
|
|
<ti></ti> |
| 84 |
|
|
<th>640x480</th> |
| 85 |
|
|
<th>800x600</th> |
| 86 |
|
|
<th>1024x768</th> |
| 87 |
|
|
<th>1280x1024</th> |
| 88 |
|
|
</tr> |
| 89 |
|
|
<tr> |
| 90 |
|
|
<th>256</th> |
| 91 |
|
|
<ti>0x301</ti> |
| 92 |
|
|
<ti>0x303</ti> |
| 93 |
|
|
<ti>0x305</ti> |
| 94 |
|
|
<ti>0x307</ti> |
| 95 |
|
|
</tr> |
| 96 |
|
|
<tr> |
| 97 |
|
|
<th>32k</th> |
| 98 |
|
|
<ti>0x310</ti> |
| 99 |
|
|
<ti>0x313</ti> |
| 100 |
|
|
<ti>0x316</ti> |
| 101 |
|
|
<ti>0x319</ti> |
| 102 |
|
|
</tr> |
| 103 |
|
|
<tr> |
| 104 |
|
|
<th>64k</th> |
| 105 |
|
|
<ti>0x311</ti> |
| 106 |
|
|
<ti>0x314</ti> |
| 107 |
|
|
<ti>0x317</ti> |
| 108 |
|
|
<ti>0x31A</ti> |
| 109 |
|
|
</tr> |
| 110 |
|
|
<tr> |
| 111 |
|
|
<th>16M</th> |
| 112 |
|
|
<ti>0x312</ti> |
| 113 |
|
|
<ti>0x315</ti> |
| 114 |
|
|
<ti>0x318</ti> |
| 115 |
|
|
<ti>0x31B</ti> |
| 116 |
|
|
</tr> |
| 117 |
|
|
</table> |
| 118 |
|
|
|
| 119 |
|
|
<p> |
| 120 |
|
|
The <c>video</c> statement controls framebuffer display options. It needs to be |
| 121 |
|
|
given the framebuffer driver (<c>vesafb</c> for 2.6 kernels, or <c>vesa</c> for |
| 122 |
|
|
2.4 kernels) followed by the control statements you wish to enable. All |
| 123 |
neysx |
1.2 |
variables are listed in |
| 124 |
|
|
<path>/usr/src/linux/Documentation/fb/vesafb.txt</path>. The most-used options |
| 125 |
|
|
are: |
| 126 |
neysx |
1.1 |
</p> |
| 127 |
|
|
|
| 128 |
|
|
<table> |
| 129 |
|
|
<tr> |
| 130 |
|
|
<th>Control</th> |
| 131 |
|
|
<th>Description</th> |
| 132 |
|
|
</tr> |
| 133 |
|
|
<tr> |
| 134 |
|
|
<ti>ywrap</ti> |
| 135 |
|
|
<ti> |
| 136 |
|
|
Assume that the graphical card can wrap around its memory (i.e. continue at |
| 137 |
|
|
the beginning when it has approached the end) |
| 138 |
|
|
</ti> |
| 139 |
|
|
</tr> |
| 140 |
|
|
<tr> |
| 141 |
|
|
<ti>mtrr:n</ti> |
| 142 |
|
|
<ti> |
| 143 |
neysx |
1.2 |
Setup MTRR registers. <c>n</c> can be:<br/> |
| 144 |
|
|
0 - disabled<br/> |
| 145 |
|
|
1 - uncachable<br/> |
| 146 |
|
|
2 - write-back<br/> |
| 147 |
|
|
3 - write-combining<br/> |
| 148 |
neysx |
1.1 |
4 - write-through |
| 149 |
|
|
</ti> |
| 150 |
|
|
</tr> |
| 151 |
neysx |
1.2 |
<tr test="func:keyval('arch')='x86'"> |
| 152 |
neysx |
1.1 |
<ti><c>mode</c></ti> |
| 153 |
|
|
<ti> |
| 154 |
|
|
(<c>vesafb-tng</c> only)<br/> |
| 155 |
|
|
Set up the resolution, color depth and refresh rate. For instance, |
| 156 |
|
|
<c>1024x768-32@85</c> for a resolution of 1024x768, 32 bit color depth and a |
| 157 |
|
|
refresh rate of 85 Hz. |
| 158 |
|
|
</ti> |
| 159 |
|
|
</tr> |
| 160 |
|
|
</table> |
| 161 |
|
|
|
| 162 |
neysx |
1.2 |
</body> |
| 163 |
|
|
<body test="func:keyval('arch')='AMD64'"> |
| 164 |
|
|
|
| 165 |
|
|
<p> |
| 166 |
|
|
The result of those two statements could be something like <c>vga=0x318 |
| 167 |
|
|
video=vesafb:mtrr:3,ywrap</c>. Write this setting down; you will need it |
| 168 |
|
|
shortly. |
| 169 |
|
|
</p> |
| 170 |
|
|
|
| 171 |
|
|
<p> |
| 172 |
|
|
While LILO does work on AMD64, Gentoo only supports using GRUB. Now continue by |
| 173 |
|
|
its <uri link="#grub">installation</uri>. |
| 174 |
|
|
</p> |
| 175 |
|
|
|
| 176 |
|
|
</body> |
| 177 |
|
|
<body test="func:keyval('arch')='x86'"> |
| 178 |
|
|
|
| 179 |
neysx |
1.1 |
<p> |
| 180 |
|
|
The result of those two statements could be something like <c>vga=0x318 |
| 181 |
|
|
video=vesafb:mtrr:3,ywrap</c> or |
| 182 |
neysx |
1.2 |
<c>video=vesafb:mtrr:3,ywrap,1024x768-32@85</c>. Write this setting down; you |
| 183 |
|
|
will need it shortly. |
| 184 |
neysx |
1.1 |
</p> |
| 185 |
|
|
|
| 186 |
|
|
<p> |
| 187 |
|
|
Now continue by installing <uri link="#grub">GRUB</uri> <e>or</e> <uri |
| 188 |
|
|
link="#lilo">LILO</uri>. |
| 189 |
|
|
</p> |
| 190 |
|
|
|
| 191 |
|
|
</body> |
| 192 |
|
|
</subsection> |
| 193 |
|
|
</section> |
| 194 |
|
|
<section id="grub"> |
| 195 |
|
|
<title>Default: Using GRUB</title> |
| 196 |
|
|
<subsection> |
| 197 |
|
|
<title>Understanding GRUB's terminology</title> |
| 198 |
|
|
<body> |
| 199 |
|
|
|
| 200 |
|
|
<p> |
| 201 |
|
|
The most critical part of understanding GRUB is getting comfortable with how |
| 202 |
|
|
GRUB refers to hard drives and partitions. Your Linux partition |
| 203 |
|
|
<path>/dev/hda1</path> (for IDE drives) or <path>/dev/sda1</path> (for |
| 204 |
|
|
SATA/SCSI drives) will most likely be called <path>(hd0,0)</path> under GRUB. |
| 205 |
neysx |
1.2 |
Notice the parentheses around the <path>hd0,0</path> - they are required. |
| 206 |
neysx |
1.1 |
</p> |
| 207 |
|
|
|
| 208 |
|
|
<p> |
| 209 |
neysx |
1.2 |
Hard drives count from zero rather than "a" and partitions start at zero |
| 210 |
|
|
rather than one. Be aware too that with the hd devices, only hard drives are |
| 211 |
|
|
counted, not atapi-ide devices such as cdrom players and burners. Also, the |
| 212 |
|
|
same construct is used with SCSI drives. (Normally they get higher numbers |
| 213 |
neysx |
1.1 |
than IDE drives except when the BIOS is configured to boot from SCSI devices.) |
| 214 |
|
|
When you ask the BIOS to boot from a different hard disk (for instance your |
| 215 |
|
|
primary slave), <e>that</e> harddisk is seen as <path>hd0</path>. |
| 216 |
|
|
</p> |
| 217 |
|
|
|
| 218 |
|
|
<p> |
| 219 |
neysx |
1.2 |
Assuming you have a hard drive on <path>/dev/hda</path>, a cdrom player on |
| 220 |
|
|
<path>/dev/hdb</path>, a burner on <path>/dev/hdc</path>, a second hard drive |
| 221 |
|
|
on <path>/dev/hdd</path> and no SCSI hard drive, <path>/dev/hdd7</path> gets |
| 222 |
|
|
translated to <path>(hd1,6)</path>. It might sound tricky and tricky it is |
| 223 |
neysx |
1.1 |
indeed, but as we will see, GRUB offers a tab completion mechanism |
| 224 |
|
|
that comes handy for those of you having a lot of hard drives and |
| 225 |
|
|
partitions and who are a little lost in the GRUB numbering scheme. |
| 226 |
|
|
</p> |
| 227 |
|
|
|
| 228 |
|
|
<p> |
| 229 |
|
|
Having gotten the feel for that, it is time to install GRUB. |
| 230 |
|
|
</p> |
| 231 |
|
|
|
| 232 |
|
|
</body> |
| 233 |
|
|
</subsection> |
| 234 |
|
|
<subsection> |
| 235 |
|
|
<title>Installing GRUB</title> |
| 236 |
|
|
<body> |
| 237 |
|
|
|
| 238 |
|
|
<p> |
| 239 |
|
|
To install GRUB, let's first emerge it: |
| 240 |
|
|
</p> |
| 241 |
|
|
|
| 242 |
nightmorph |
1.6 |
<impo test="func:keyval('arch')='AMD64'"> |
| 243 |
|
|
If you are using a non-multilib <uri |
| 244 |
|
|
link="?part=1&chap=6#doc_chap2">profile</uri>, you should <b>not</b> emerge |
| 245 |
|
|
grub, but instead you should emerge <c>grub-static</c>. |
| 246 |
|
|
</impo> |
| 247 |
|
|
|
| 248 |
neysx |
1.1 |
<pre caption="Installing GRUB"> |
| 249 |
|
|
# <i>emerge grub</i> |
| 250 |
|
|
</pre> |
| 251 |
|
|
|
| 252 |
|
|
<p> |
| 253 |
|
|
Although GRUB is now installed, we still need to write up a |
| 254 |
neysx |
1.2 |
configuration file for it and place GRUB in our MBR so that GRUB automatically |
| 255 |
neysx |
1.1 |
boots your newly created kernel. Create <path>/boot/grub/grub.conf</path> with |
| 256 |
|
|
<c>nano</c> (or, if applicable, another editor): |
| 257 |
|
|
</p> |
| 258 |
|
|
|
| 259 |
|
|
<pre caption="Creating /boot/grub/grub.conf"> |
| 260 |
|
|
# <i>nano -w /boot/grub/grub.conf</i> |
| 261 |
|
|
</pre> |
| 262 |
|
|
|
| 263 |
|
|
<p> |
| 264 |
neysx |
1.2 |
Now we are going to write up a <path>grub.conf</path>. Below you'll find two |
| 265 |
|
|
possible <path>grub.conf</path> for the partitioning example we use in this |
| 266 |
|
|
guide. We've only extensively commented the first <path>grub.conf</path>. Make |
| 267 |
|
|
sure you use <e>your</e> kernel image filename and, if appropriate, <e>your</e> |
| 268 |
|
|
initrd image filename. |
| 269 |
neysx |
1.1 |
</p> |
| 270 |
|
|
|
| 271 |
|
|
<ul> |
| 272 |
|
|
<li> |
| 273 |
neysx |
1.2 |
The first <path>grub.conf</path> is for people who have not used |
| 274 |
neysx |
1.1 |
<c>genkernel</c> to build their kernel |
| 275 |
|
|
</li> |
| 276 |
|
|
<li> |
| 277 |
|
|
The second <path>grub.conf</path> is for people who have used |
| 278 |
|
|
<c>genkernel</c> to build their kernel |
| 279 |
|
|
</li> |
| 280 |
|
|
</ul> |
| 281 |
|
|
|
| 282 |
|
|
<note> |
| 283 |
|
|
If your root filesystem is JFS, you <e>must</e> add " ro" to the <c>kernel</c> |
| 284 |
|
|
line since JFS needs to replay its log before it allows read-write mounting. |
| 285 |
|
|
</note> |
| 286 |
|
|
|
| 287 |
|
|
<pre caption="grub.conf for non-genkernel users"> |
| 288 |
|
|
<comment># Which listing to boot as default. 0 is the first, 1 the second etc.</comment> |
| 289 |
|
|
default 0 |
| 290 |
|
|
<comment># How many seconds to wait before the default listing is booted.</comment> |
| 291 |
|
|
timeout 30 |
| 292 |
|
|
<comment># Nice, fat splash-image to spice things up :) |
| 293 |
|
|
# Comment out if you don't have a graphics card installed</comment> |
| 294 |
|
|
splashimage=(hd0,0)/boot/grub/splash.xpm.gz |
| 295 |
|
|
|
| 296 |
neysx |
1.2 |
title=Gentoo Linux <keyval id="kernel-version"/> |
| 297 |
neysx |
1.1 |
<comment># Partition where the kernel image (or operating system) is located</comment> |
| 298 |
|
|
root (hd0,0) |
| 299 |
neysx |
1.2 |
kernel /boot/<keyval id="kernel-name"/> root=/dev/hda3 |
| 300 |
neysx |
1.1 |
|
| 301 |
vapier |
1.4 |
title=Gentoo Linux <keyval id="kernel-version"/> (rescue) |
| 302 |
|
|
<comment># Partition where the kernel image (or operating system) is located</comment> |
| 303 |
|
|
root (hd0,0) |
| 304 |
|
|
kernel /boot/<keyval id="kernel-name"/> root=/dev/hda3 init=/bin/bb |
| 305 |
|
|
|
| 306 |
neysx |
1.1 |
<comment># The next four lines are only if you dualboot with a Windows system.</comment> |
| 307 |
|
|
<comment># In this case, Windows is hosted on /dev/hda6.</comment> |
| 308 |
|
|
title=Windows XP |
| 309 |
|
|
rootnoverify (hd0,5) |
| 310 |
|
|
makeactive |
| 311 |
|
|
chainloader +1 |
| 312 |
|
|
</pre> |
| 313 |
|
|
|
| 314 |
|
|
<pre caption="grub.conf for genkernel users"> |
| 315 |
|
|
default 0 |
| 316 |
|
|
timeout 30 |
| 317 |
|
|
splashimage=(hd0,0)/boot/grub/splash.xpm.gz |
| 318 |
|
|
|
| 319 |
neysx |
1.2 |
title=Gentoo Linux <keyval id="kernel-version"/> |
| 320 |
neysx |
1.1 |
root (hd0,0) |
| 321 |
neysx |
1.2 |
kernel /boot/<keyval id="genkernel-name"/> root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev |
| 322 |
|
|
initrd /boot/<keyval id="genkernel-initrd"/> |
| 323 |
neysx |
1.1 |
|
| 324 |
|
|
<comment># Only in case you want to dual-boot</comment> |
| 325 |
|
|
title=Windows XP |
| 326 |
|
|
rootnoverify (hd0,5) |
| 327 |
|
|
makeactive |
| 328 |
|
|
chainloader +1 |
| 329 |
|
|
</pre> |
| 330 |
|
|
|
| 331 |
|
|
<note> |
| 332 |
|
|
The <c>udev</c> mentioned at the end of the kernel line is needed to work around |
| 333 |
|
|
a bug in some genkernel versions <e>if</e> you use udev in the first place |
| 334 |
|
|
(which is the default behaviour). |
| 335 |
|
|
</note> |
| 336 |
|
|
|
| 337 |
|
|
<p> |
| 338 |
|
|
If you used a different partitioning scheme and/or kernel image, adjust |
| 339 |
|
|
accordingly. However, make sure that anything that follows a GRUB-device (such |
| 340 |
|
|
as <path>(hd0,0)</path>) is relative to the mountpoint, not the root. In other |
| 341 |
|
|
words, <path>(hd0,0)/grub/splash.xpm.gz</path> is in reality |
| 342 |
|
|
<path>/boot/grub/splash.xpm.gz</path> since <path>(hd0,0)</path> is |
| 343 |
|
|
<path>/boot</path>. |
| 344 |
|
|
</p> |
| 345 |
|
|
|
| 346 |
|
|
<p> |
| 347 |
|
|
Besides, if you chose to use a different partitioning scheme and did not put |
| 348 |
|
|
<path>/boot</path> in a separate partition, the <path>/boot</path> prefix used |
| 349 |
|
|
in the above code samples is really <e>required</e>. If you followed our |
| 350 |
|
|
suggested partitioning plan, the <path>/boot</path> prefix it not required, but |
| 351 |
|
|
a <path>boot</path> symlink makes it work. In short, the above examples should |
| 352 |
|
|
work whether you defined a separate <path>/boot</path> partition or not. |
| 353 |
|
|
</p> |
| 354 |
|
|
|
| 355 |
|
|
<p> |
| 356 |
|
|
If you need to pass any additional options to the kernel, simply add |
| 357 |
|
|
them to the end of the kernel command. We're already passing one option |
| 358 |
neysx |
1.2 |
(<c>root=/dev/hda3</c> or <c>real_root=/dev/hda3</c>), but you can pass others |
| 359 |
|
|
as well, such as the <c>video</c> and/or <c>vga</c> statements for framebuffer |
| 360 |
neysx |
1.1 |
as we discussed previously. |
| 361 |
|
|
</p> |
| 362 |
|
|
|
| 363 |
|
|
<p> |
| 364 |
|
|
If you're using a 2.6.7 or higher kernel and you jumpered your harddrive |
| 365 |
|
|
because the BIOS can't handle large harddrives you'll need to append |
| 366 |
|
|
<c>hdx=stroke</c>. |
| 367 |
|
|
</p> |
| 368 |
|
|
|
| 369 |
|
|
<p> |
| 370 |
|
|
<c>genkernel</c> users should know that their kernels use the same boot options |
| 371 |
|
|
as is used for the Installation CD. For instance, if you have SCSI devices, you |
| 372 |
|
|
should add <c>doscsi</c> as kernel option. |
| 373 |
|
|
</p> |
| 374 |
|
|
|
| 375 |
|
|
<p> |
| 376 |
neysx |
1.2 |
Now save the <path>grub.conf</path> file and exit. You still need to install |
| 377 |
neysx |
1.1 |
GRUB in the MBR (Master Boot Record) so that GRUB is automatically executed when |
| 378 |
|
|
you boot your system. |
| 379 |
|
|
</p> |
| 380 |
|
|
|
| 381 |
|
|
<p> |
| 382 |
|
|
The GRUB developers recommend the use of <c>grub-install</c>. However, if for |
| 383 |
|
|
some reason <c>grub-install</c> fails to work correctly you still have the |
| 384 |
|
|
option to manually install GRUB. |
| 385 |
|
|
</p> |
| 386 |
|
|
|
| 387 |
|
|
<p> |
| 388 |
|
|
Continue with <uri link="#grub-install-auto">Default: Setting up GRUB using |
| 389 |
|
|
grub-install</uri> or <uri link="#grub-install-manual">Alternative: Setting up |
| 390 |
|
|
GRUB using manual instructions</uri>. |
| 391 |
|
|
</p> |
| 392 |
|
|
|
| 393 |
|
|
</body> |
| 394 |
|
|
</subsection> |
| 395 |
|
|
<subsection id="grub-install-auto"> |
| 396 |
|
|
<title>Default: Setting up GRUB using grub-install</title> |
| 397 |
|
|
<body> |
| 398 |
|
|
|
| 399 |
|
|
<p> |
| 400 |
|
|
To install GRUB you will need to issue the <c>grub-install</c> command. |
| 401 |
|
|
However, <c>grub-install</c> won't work off-the-shelf since we are inside a |
| 402 |
|
|
chrooted environment. We need to create <path>/etc/mtab</path> which lists all |
| 403 |
|
|
mounted filesystems. Fortunately, there is an easy way to accomplish this - |
| 404 |
|
|
just copy over <path>/proc/mounts</path> to <path>/etc/mtab</path>, excluding |
| 405 |
|
|
the <c>rootfs</c> line if you haven't created a separate boot partition. The |
| 406 |
|
|
following command will work in both cases: |
| 407 |
|
|
</p> |
| 408 |
|
|
|
| 409 |
|
|
<pre caption="Creating /etc/mtab"> |
| 410 |
|
|
# <i>grep -v rootfs /proc/mounts > /etc/mtab</i> |
| 411 |
|
|
</pre> |
| 412 |
|
|
|
| 413 |
|
|
<p> |
| 414 |
|
|
Now we can install GRUB using <c>grub-install</c>: |
| 415 |
|
|
</p> |
| 416 |
|
|
|
| 417 |
|
|
<pre caption="Running grub-install"> |
| 418 |
neysx |
1.7 |
# <i>grub-install --no-floppy /dev/hda</i> |
| 419 |
neysx |
1.1 |
</pre> |
| 420 |
|
|
|
| 421 |
|
|
<p> |
| 422 |
|
|
If you have more questions regarding GRUB, please consult the <uri |
| 423 |
neysx |
1.2 |
link="http://www.gnu.org/software/grub/grub-faq.html">GRUB FAQ</uri> or the |
| 424 |
|
|
<uri link="http://www.gnu.org/software/grub/manual/">GRUB Manual</uri>. |
| 425 |
neysx |
1.1 |
</p> |
| 426 |
|
|
|
| 427 |
|
|
<p> |
| 428 |
|
|
Continue with <uri link="#reboot">Rebooting the System</uri>. |
| 429 |
|
|
</p> |
| 430 |
|
|
|
| 431 |
|
|
</body> |
| 432 |
|
|
</subsection> |
| 433 |
|
|
<subsection id="grub-install-manual"> |
| 434 |
|
|
<title>Alternative: Setting up GRUB using manual instructions</title> |
| 435 |
|
|
<body> |
| 436 |
|
|
|
| 437 |
|
|
<p> |
| 438 |
|
|
To start configuring GRUB, you type in <c>grub</c>. You'll be presented |
| 439 |
neysx |
1.2 |
with the <path>grub></path> grub command-line prompt. Now, you need to type |
| 440 |
neysx |
1.1 |
in the right commands to install the GRUB boot record onto your hard drive. |
| 441 |
|
|
</p> |
| 442 |
|
|
|
| 443 |
|
|
<pre caption="Starting the GRUB shell"> |
| 444 |
neysx |
1.7 |
# <i>grub --no-floppy</i> |
| 445 |
neysx |
1.1 |
</pre> |
| 446 |
|
|
|
| 447 |
|
|
<note> |
| 448 |
|
|
If your system does not have any floppy drives, add the <c>--no-floppy</c> |
| 449 |
neysx |
1.2 |
option to the above command to prevent grub from probing the (non-existing) |
| 450 |
neysx |
1.1 |
floppy drives. |
| 451 |
|
|
</note> |
| 452 |
|
|
|
| 453 |
|
|
<p> |
| 454 |
neysx |
1.2 |
In the example configuration we want to install GRUB so that it reads its |
| 455 |
|
|
information from the boot partition <path><keyval id="/boot"/></path>, and |
| 456 |
|
|
installs the GRUB boot record on the hard drive's MBR (master boot record) so |
| 457 |
|
|
that the first thing we see when we turn on the computer is the GRUB prompt. Of |
| 458 |
|
|
course, if you haven't followed the example configuration during the |
| 459 |
|
|
installation, change the commands accordingly. |
| 460 |
neysx |
1.1 |
</p> |
| 461 |
|
|
|
| 462 |
|
|
<p> |
| 463 |
|
|
The tab completion mechanism of GRUB can be used from within GRUB. |
| 464 |
|
|
For instance, if you type in "<c>root (</c>" followed by a TAB, you will |
| 465 |
|
|
be presented with a list of devices (such as <path>hd0</path>). If you |
| 466 |
|
|
type in "<c>root (hd0,</c>" followed by a TAB, you will receive a list |
| 467 |
|
|
of available partitions to choose from (such as <path>hd0,0</path>). |
| 468 |
|
|
</p> |
| 469 |
|
|
|
| 470 |
|
|
<p> |
| 471 |
|
|
By using the tab completion, setting up GRUB should be not that hard. |
| 472 |
|
|
Now go on, configure GRUB, shall we? :-) |
| 473 |
|
|
</p> |
| 474 |
|
|
|
| 475 |
|
|
<pre caption="Installing GRUB in the MBR"> |
| 476 |
neysx |
1.2 |
grub> <i>root (hd0,0)</i> <comment>(Specify where your /boot partition resides)</comment> |
| 477 |
|
|
grub> <i>setup (hd0)</i> <comment>(Install GRUB in the MBR)</comment> |
| 478 |
|
|
grub> <i>quit</i> <comment>(Exit the GRUB shell)</comment> |
| 479 |
neysx |
1.1 |
</pre> |
| 480 |
|
|
|
| 481 |
|
|
<note> |
| 482 |
|
|
If you want to install GRUB in a certain partition instead of the MBR, |
| 483 |
|
|
you have to alter the <c>setup</c> command so it points to the right |
| 484 |
|
|
partition. For instance, if you want GRUB installed in |
| 485 |
|
|
<path>/dev/hda3</path>, then the command becomes <c>setup (hd0,2)</c>. |
| 486 |
|
|
Few users however want to do this. |
| 487 |
|
|
</note> |
| 488 |
|
|
|
| 489 |
|
|
<p> |
| 490 |
|
|
If you have more questions regarding GRUB, please consult the <uri |
| 491 |
|
|
link="http://www.gnu.org/software/grub/grub-faq.html">GRUB FAQ</uri> or the <uri |
| 492 |
|
|
link="http://www.gnu.org/software/grub/manual/">GRUB Manual</uri>. |
| 493 |
|
|
</p> |
| 494 |
|
|
|
| 495 |
|
|
<p> |
| 496 |
|
|
Continue with <uri link="#reboot">Rebooting the System</uri>. |
| 497 |
|
|
</p> |
| 498 |
|
|
|
| 499 |
|
|
</body> |
| 500 |
|
|
</subsection> |
| 501 |
|
|
</section> |
| 502 |
neysx |
1.2 |
<section id="lilo" test="func:keyval('arch')='x86'"> |
| 503 |
neysx |
1.1 |
<title>Alternative: Using LILO</title> |
| 504 |
|
|
<subsection> |
| 505 |
|
|
<title>Installing LILO</title> |
| 506 |
|
|
<body> |
| 507 |
|
|
|
| 508 |
|
|
<p> |
| 509 |
|
|
LILO, the LInuxLOader, is the tried and true workhorse of Linux |
| 510 |
|
|
bootloaders. However, it lacks some features that GRUB has (which is |
| 511 |
|
|
also the reason why GRUB is currently gaining popularity). The reason |
| 512 |
|
|
why LILO is still used is that, on some systems, GRUB doesn't work and |
| 513 |
|
|
LILO does. Of course, it is also used because some people know LILO and |
| 514 |
|
|
want to stick with it. Either way, Gentoo supports both, and apparently |
| 515 |
|
|
you have chosen to use LILO. |
| 516 |
|
|
</p> |
| 517 |
|
|
|
| 518 |
|
|
<p> |
| 519 |
|
|
Installing LILO is a breeze; just use <c>emerge</c>. |
| 520 |
|
|
</p> |
| 521 |
|
|
|
| 522 |
neysx |
1.2 |
<pre caption="Installing LILO"> |
| 523 |
neysx |
1.1 |
# <i>emerge lilo</i> |
| 524 |
|
|
</pre> |
| 525 |
|
|
|
| 526 |
|
|
</body> |
| 527 |
|
|
</subsection> |
| 528 |
|
|
<subsection> |
| 529 |
|
|
<title>Configuring LILO</title> |
| 530 |
|
|
<body> |
| 531 |
|
|
|
| 532 |
|
|
<p> |
| 533 |
|
|
To configure LILO, you must create <path>/etc/lilo.conf</path>. Fire up |
| 534 |
|
|
your favorite editor (in this handbook we use <c>nano</c> for |
| 535 |
|
|
consistency) and create the file. |
| 536 |
|
|
</p> |
| 537 |
|
|
|
| 538 |
neysx |
1.2 |
<pre caption="Creating /etc/lilo.conf"> |
| 539 |
neysx |
1.1 |
# <i>nano -w /etc/lilo.conf</i> |
| 540 |
|
|
</pre> |
| 541 |
|
|
|
| 542 |
|
|
<p> |
| 543 |
|
|
Some sections ago we have asked you to remember the kernel-image name |
| 544 |
|
|
you have created. In the next example <path>lilo.conf</path> we use the |
| 545 |
neysx |
1.2 |
example partitioning scheme. There are two separate parts: |
| 546 |
neysx |
1.1 |
</p> |
| 547 |
|
|
|
| 548 |
|
|
<ul> |
| 549 |
|
|
<li> |
| 550 |
|
|
One for those who have not used <c>genkernel</c> to build their kernel |
| 551 |
|
|
</li> |
| 552 |
|
|
<li> |
| 553 |
|
|
One for those who have used <c>genkernel</c> to build their kernel |
| 554 |
|
|
</li> |
| 555 |
|
|
</ul> |
| 556 |
|
|
|
| 557 |
|
|
<p> |
| 558 |
|
|
Make sure you use <e>your</e> kernel image filename and, if appropriate, |
| 559 |
|
|
<e>your</e> initrd image filename. |
| 560 |
|
|
</p> |
| 561 |
|
|
|
| 562 |
|
|
<note> |
| 563 |
|
|
If your root filesystem is JFS, you <e>must</e> add a <c>append="ro"</c> |
| 564 |
neysx |
1.2 |
line after each boot item since JFS needs to replay its log before it allows |
| 565 |
neysx |
1.1 |
read-write mounting. |
| 566 |
|
|
</note> |
| 567 |
|
|
|
| 568 |
neysx |
1.2 |
<pre caption="Example /etc/lilo.conf"> |
| 569 |
neysx |
1.1 |
boot=/dev/hda <comment># Install LILO in the MBR</comment> |
| 570 |
|
|
prompt <comment># Give the user the chance to select another section</comment> |
| 571 |
|
|
timeout=50 <comment># Wait 5 (five) seconds before booting the default section</comment> |
| 572 |
|
|
default=gentoo <comment># When the timeout has passed, boot the "gentoo" section</comment> |
| 573 |
|
|
|
| 574 |
|
|
<comment># For non-genkernel users</comment> |
| 575 |
neysx |
1.2 |
image=/boot/<keyval id="kernel-name"/> |
| 576 |
neysx |
1.1 |
label=gentoo <comment># Name we give to this section</comment> |
| 577 |
|
|
read-only <comment># Start with a read-only root. Do not alter!</comment> |
| 578 |
|
|
root=/dev/hda3 <comment># Location of the root filesystem</comment> |
| 579 |
|
|
|
| 580 |
vapier |
1.5 |
image=/boot/<keyval id="kernel-name"/> |
| 581 |
|
|
label=gentoo.rescue <comment># Name we give to this section</comment> |
| 582 |
|
|
read-only <comment># Start with a read-only root. Do not alter!</comment> |
| 583 |
|
|
root=/dev/hda3 <comment># Location of the root filesystem</comment> |
| 584 |
|
|
append="init=/bin/bb" <comment># Launch the Gentoo static rescue shell</comment> |
| 585 |
|
|
|
| 586 |
neysx |
1.1 |
<comment># For genkernel users</comment> |
| 587 |
neysx |
1.2 |
image=/boot/<keyval id="genkernel-name"/> |
| 588 |
neysx |
1.1 |
label=gentoo |
| 589 |
|
|
read-only |
| 590 |
|
|
root=/dev/ram0 |
| 591 |
|
|
append="init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev" |
| 592 |
neysx |
1.2 |
initrd=/boot/<keyval id="genkernel-initrd"/> |
| 593 |
neysx |
1.1 |
|
| 594 |
|
|
<comment># The next two lines are only if you dualboot with a Windows system.</comment> |
| 595 |
|
|
<comment># In this case, Windows is hosted on /dev/hda6.</comment> |
| 596 |
|
|
other=/dev/hda6 |
| 597 |
|
|
label=windows |
| 598 |
|
|
</pre> |
| 599 |
|
|
|
| 600 |
|
|
<note> |
| 601 |
|
|
The <c>udev</c> mentioned at the end of the append line is needed to work around |
| 602 |
|
|
a bug in some genkernel versions <e>if</e> you use udev in the first place |
| 603 |
|
|
(which is the default behaviour). |
| 604 |
|
|
</note> |
| 605 |
|
|
|
| 606 |
|
|
<note> |
| 607 |
|
|
If you use a different partitioning scheme and/or kernel image, adjust |
| 608 |
|
|
accordingly. |
| 609 |
|
|
</note> |
| 610 |
|
|
|
| 611 |
|
|
<p> |
| 612 |
|
|
If you need to pass any additional options to the kernel, add an |
| 613 |
|
|
<c>append</c> statement to the section. As an example, we add the |
| 614 |
|
|
<c>video</c> statement to enable framebuffer: |
| 615 |
|
|
</p> |
| 616 |
|
|
|
| 617 |
neysx |
1.2 |
<pre caption="Using append to add kernel options"> |
| 618 |
|
|
image=/boot/<keyval id="kernel-name"/> |
| 619 |
neysx |
1.1 |
label=gentoo |
| 620 |
|
|
read-only |
| 621 |
|
|
root=/dev/hda3 |
| 622 |
|
|
<i>append="video=vesafb:mtrr,ywrap,1024x768-32@85"</i> |
| 623 |
|
|
</pre> |
| 624 |
|
|
|
| 625 |
|
|
<p> |
| 626 |
|
|
If you're using a 2.6.7 or higher kernel and you jumpered your harddrive |
| 627 |
|
|
because the BIOS can't handle large harddrives you'll need to append |
| 628 |
|
|
<c>hdx=stroke</c>. |
| 629 |
|
|
</p> |
| 630 |
|
|
|
| 631 |
|
|
<p> |
| 632 |
|
|
<c>genkernel</c> users should know that their kernels use the same boot options |
| 633 |
|
|
as is used for the Installation CD. For instance, if you have SCSI devices, you |
| 634 |
|
|
should add <c>doscsi</c> as kernel option. |
| 635 |
|
|
</p> |
| 636 |
|
|
|
| 637 |
|
|
<p> |
| 638 |
|
|
Now save the file and exit. To finish up, you have to run <c>/sbin/lilo</c> so |
| 639 |
|
|
LILO can apply the <path>/etc/lilo.conf</path> to your system (i.e. install |
| 640 |
neysx |
1.2 |
itself on the disk). Keep in mind that you'll also have to run |
| 641 |
neysx |
1.1 |
<c>/sbin/lilo</c> every time you install a new kernel or make any changes to |
| 642 |
|
|
the menu. |
| 643 |
|
|
</p> |
| 644 |
|
|
|
| 645 |
neysx |
1.2 |
<pre caption="Finishing the LILO installation"> |
| 646 |
neysx |
1.1 |
# <i>/sbin/lilo</i> |
| 647 |
|
|
</pre> |
| 648 |
|
|
|
| 649 |
neysx |
1.2 |
<p> |
| 650 |
|
|
If you have more questions regarding LILO, please consult its <uri |
| 651 |
|
|
link="http://en.wikipedia.org/wiki/LILO_(boot_loader)">wikipedia page</uri>. |
| 652 |
|
|
</p> |
| 653 |
neysx |
1.1 |
|
| 654 |
|
|
<p> |
| 655 |
|
|
You can now continue with <uri link="#reboot">Rebooting the System</uri>. |
| 656 |
|
|
</p> |
| 657 |
|
|
|
| 658 |
|
|
</body> |
| 659 |
|
|
</subsection> |
| 660 |
|
|
</section> |
| 661 |
|
|
<section id="reboot"> |
| 662 |
|
|
<title>Rebooting the System</title> |
| 663 |
|
|
<subsection> |
| 664 |
|
|
<body> |
| 665 |
|
|
|
| 666 |
|
|
<p> |
| 667 |
neysx |
1.2 |
Exit the chrooted environment and unmount all mounted partitions. Then type in |
| 668 |
neysx |
1.1 |
that one magical command you have been waiting for: <c>reboot</c>. |
| 669 |
|
|
</p> |
| 670 |
|
|
|
| 671 |
|
|
<pre caption="Unmounting all partitions and rebooting"> |
| 672 |
|
|
# <i>exit</i> |
| 673 |
|
|
cdimage ~# <i>cd</i> |
| 674 |
|
|
cdimage ~# <i>umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo</i> |
| 675 |
|
|
cdimage ~# <i>reboot</i> |
| 676 |
|
|
</pre> |
| 677 |
|
|
|
| 678 |
|
|
<p> |
| 679 |
|
|
Of course, don't forget to remove the bootable CD, otherwise the CD will be |
| 680 |
|
|
booted again instead of your new Gentoo system. |
| 681 |
|
|
</p> |
| 682 |
|
|
|
| 683 |
|
|
<p> |
| 684 |
|
|
Once rebooted in your Gentoo installation, finish up with <uri |
| 685 |
|
|
link="?part=1&chap=11">Finalizing your Gentoo Installation</uri>. |
| 686 |
|
|
</p> |
| 687 |
|
|
|
| 688 |
|
|
</body> |
| 689 |
|
|
</subsection> |
| 690 |
|
|
</section> |
| 691 |
|
|
</sections> |