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