1 |
commit: 5abf098f57d8a974a663384c4c755cefbab290f2 |
2 |
Author: Tomas Chvatal <tchvatal <AT> suse <DOT> cz> |
3 |
AuthorDate: Fri Sep 30 12:12:41 2011 +0000 |
4 |
Commit: Tomas Chvatal <scarabeus <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 30 12:12:41 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/scarabeus.git;a=commit;h=5abf098f |
7 |
|
8 |
Add grub2 xml guide. |
9 |
|
10 |
--- |
11 |
docs/grub-2-guide.xml | 315 +++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
1 files changed, 315 insertions(+), 0 deletions(-) |
13 |
|
14 |
diff --git a/docs/grub-2-guide.xml b/docs/grub-2-guide.xml |
15 |
new file mode 100644 |
16 |
index 0000000..ca0bc89 |
17 |
--- /dev/null |
18 |
+++ b/docs/grub-2-guide.xml |
19 |
@@ -0,0 +1,315 @@ |
20 |
+<?xml version="1.0" encoding="UTF-8"?> |
21 |
+<!-- $Header: $ --> |
22 |
+ |
23 |
+<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
24 |
+ |
25 |
+<guide disclaimer="draft" link="/doc/en/grub-2-guide.xml" lang="en"> |
26 |
+<title>GRUB 2 Guide</title> |
27 |
+ |
28 |
+<author title="Author"> |
29 |
+ <mail link="matej@×××××.cz">Matěj Laitl</mail> |
30 |
+</author> |
31 |
+ |
32 |
+<author title="Author"> |
33 |
+ <mail link="scarabeus"/> |
34 |
+</author> |
35 |
+ |
36 |
+<abstract> |
37 |
+This guide shows you how to install and configure GRUB 2 bootloader. |
38 |
+</abstract> |
39 |
+ |
40 |
+<!-- The content of this document is licensed under the CC-BY-SA license --> |
41 |
+<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
42 |
+<license/> |
43 |
+ |
44 |
+<version>1</version> |
45 |
+<date>2011-08-26</date> |
46 |
+ |
47 |
+<chapter> |
48 |
+<title>About</title> |
49 |
+<section> |
50 |
+<body> |
51 |
+ |
52 |
+<p> |
53 |
+GRUB 2 is next generation bootloader that brings many long awaited features |
54 |
+that were not availible in Grub Legacy (0.9*). |
55 |
+</p> |
56 |
+ |
57 |
+<p> |
58 |
+Some examples of new features: |
59 |
+</p> |
60 |
+ |
61 |
+<ul> |
62 |
+<li>Booting from boot partition stored on LVM</li> |
63 |
+<li>Booting from encrypted boot partition</li> |
64 |
+<li>Booting from UEFI</li> |
65 |
+<li>Support for native screen resolution and theming</li> |
66 |
+</ul> |
67 |
+ |
68 |
+</body> |
69 |
+</section> |
70 |
+</chapter> |
71 |
+ |
72 |
+<chapter> |
73 |
+<title>Installation</title> |
74 |
+<section> |
75 |
+<title>Setting Useflags</title> |
76 |
+<body> |
77 |
+ |
78 |
+<p> |
79 |
+By default grub tries to detect the desired platform during configure from your |
80 |
+toolchain and CPU. If you want support for other platforms or just don't want |
81 |
+to use the autodetection you should use GRUB_PLATFORMS use expand. This variable |
82 |
+should be set in /etc/make.conf. |
83 |
+</p> |
84 |
+ |
85 |
+<p>Description of mostly used values for GRUB_PLATFORMS as of =sys-boot/grub-1.99:</p> |
86 |
+ |
87 |
+<ol> |
88 |
+<li>pc: normal BIOS pc</li> |
89 |
+<li>efi-64: EFI systems, their latest 64b version</li> |
90 |
+<li>coreboot: Coreboot replacement of BIOS</li> |
91 |
+<li>qemu: support for QEMU booting</li> |
92 |
+<li>yeelong: Support for MIPS loongson</li> |
93 |
+ |
94 |
+</ol> |
95 |
+ |
96 |
+<note> |
97 |
+Most users should just rely on platform detection or just use |
98 |
+GRUB_PLATFORMS="pc" |
99 |
+</note> |
100 |
+ |
101 |
+<warn> |
102 |
+One should be really carefull with custom-cflags IUSE, as some CFLAGS can |
103 |
+easily render your system impossible to boot. |
104 |
+</warn> |
105 |
+ |
106 |
+</body> |
107 |
+</section> |
108 |
+ |
109 |
+<section> |
110 |
+<title>Configuring GRUB</title> |
111 |
+<body> |
112 |
+ |
113 |
+<impo> |
114 |
+Gentoo installs grub renamed to grub2. So if you read any other guide you |
115 |
+should replace all grub mentions with grub2 <i>(grub-mkconfig -> grub2-mkconfig)</i>. |
116 |
+</impo> |
117 |
+ |
118 |
+<p> |
119 |
+Compared to grub-legacy current grub uses automatic generation to generate |
120 |
+all the required entries for you to boot. This is handled by <i>grub2-mkconfig</i> |
121 |
+command that probes your system for all the required data. Cooperating with |
122 |
+<i>sys-boot/os-prober</i> it detects even other OSes on all disks. |
123 |
+</p> |
124 |
+ |
125 |
+<impo> |
126 |
+If you updated from grub-legacy then your <path>/boot/grub/menu.lst</path> |
127 |
+Was converted to <path>/boot/grub2/grub.cfg</path> to ensure that your system |
128 |
+can boot even if you forget to generate the config. Never the less you should |
129 |
+take time and migrate the configuration to be automatically generated, because |
130 |
+next time grub2 is installed it will use automatic generation and ignore |
131 |
+grub-legacy files. |
132 |
+</impo> |
133 |
+ |
134 |
+<pre caption="Generating the grub2 config"> |
135 |
+grub2-mkconfig -o /boot/grub2/grub.cfg |
136 |
+</pre> |
137 |
+ |
138 |
+<p> |
139 |
+Tweaking the options is to be done in the <path>/etc/defaults/grub</path> file. |
140 |
+Simple text file configuration with description of some default values. |
141 |
+All the options are described in grub2 info pages. |
142 |
+</p> |
143 |
+ |
144 |
+<note> |
145 |
+This file is created by Gentoo and if you find interesting option not used |
146 |
+in there just open bugreport (possibly with a patch). |
147 |
+</note> |
148 |
+ |
149 |
+<p> |
150 |
+Sometimes if automatic detection of grub does not suffice the file <path> |
151 |
+/etc/grub.d/40_custom</path> should be used to store custom finder. Full |
152 |
+description how to configure such with example can be find in grub2 info |
153 |
+pages. |
154 |
+</p> |
155 |
+ |
156 |
+<pre caption="Custom menu entry"> |
157 |
+menuentry "My Shiny Gentoo Kernel" { |
158 |
+ set root=(hd0,1) |
159 |
+ search --no-floppy --fs-uuid --set <UUID> |
160 |
+ linux /boot/gentookernel-5.3.2-generic root=UUID=<UUID> |
161 |
+ initrd /boot/initrd.img-5.3.2 |
162 |
+} |
163 |
+</pre> |
164 |
+ |
165 |
+<warn> |
166 |
+Remember to replace the <i><UUID></i> with your device UUID. |
167 |
+</warn> |
168 |
+ |
169 |
+</body> |
170 |
+</section> |
171 |
+ |
172 |
+<section> |
173 |
+<title>Pre-Configuring GRUB to use EFI</title> |
174 |
+<body> |
175 |
+ |
176 |
+<p> |
177 |
+Some newer PCs (and all Intel Macs) come with |
178 |
+<uri link="http://en.wikipedia.org/wiki/Extensible_Firmware_Interface">EFI</uri> |
179 |
+(UEFI to be correct) as a replacement for lagacy |
180 |
+and aging BIOS firmware. EFI usually can emulate BIOS environment for OS, but |
181 |
+that also hides some unique features of EFI such as faster boot times, support |
182 |
+for GPT partition tables etc. EFI firmware comes in two flavours - 32bit and |
183 |
+64bit and unless you have early Intel-based Mac with 32bit processor, your |
184 |
+firmware will be likely 64bit. Please note that unlike in user-space, <b>64bit |
185 |
+EFI firmware cannot run 32bit EFI bootloader.</b> This section will guide you |
186 |
+through installing GRUB 2 on such EFI-capable boards; it assumes that your |
187 |
+firmware adheres to UEFI 2.0 standard or newer (virtually every PC with EFI |
188 |
+support; Intel Macs do not entirely conform to the specification and may need |
189 |
+special treatment in some places) |
190 |
+</p> |
191 |
+ |
192 |
+<p>First thing you need is EFI-enabled Linux kernel with |
193 |
+<c>CONFIG_EFI</c> and <c>CONFIG_EFI_PARTITION</c> options enabled, |
194 |
+<c>CONFIG_FB_EFI</c> and <c>CONFIG_EFI_VARS</c> being optional but recommended. |
195 |
+Some platforms (namely many boards designed for <e>Intel Sandy Bridge</e> |
196 |
+processor generation) have <uri link="https://lkml.org/lkml/2011/5/19/377"> |
197 |
+buggy EFI implementations</uri> and require at least kernel versions 2.6.39.1 |
198 |
+or 3.0 in order to successfully boot. |
199 |
+</p> |
200 |
+ |
201 |
+<p> |
202 |
+One big difference between BIOS and EFI is that EFI is able to read partition |
203 |
+table (both MBR and GPT formats should be supported) and to read from specially |
204 |
+labelled FAT32 partition called <b>EFI System Partition</b>. During bootup, EFI |
205 |
+fimrmware can execute <e>EFI applications</e> stored in files in EFI System |
206 |
+Partition. One special EFI application is a bootloader. You may use the EFI |
207 |
+System Partition as your <c>/boot</c> partition if you don't mind limitations |
208 |
+of FAT32 filesystem such as no support for symlinks and per-file owner and |
209 |
+permissions. The rest of this section assumes that you use <c>/boot</c> for |
210 |
+mounting EFI System Partition. |
211 |
+</p> |
212 |
+ |
213 |
+<p> |
214 |
+If you don't already have EFI System Partition, let's create one. The procedure is |
215 |
+different for GPT and MBR-formatted disks. The partition need not be the first |
216 |
+one on disk as in our examples. In case it is GPT-partitioned you'll need one |
217 |
+of the <c>gdisk</c> (CLI, sys-apps/gptfdisk), <c>parted</c> (CLI, |
218 |
+sys-block/parted) or <c>gparted</c> (GUI, sys-block/gparted) partitioning |
219 |
+tools; <c>fdisk</c>, <c>cfdisk</c> and <c>sfdisk</c> do not currently support |
220 |
+GPT. In the GPT case, create a partition at least 100 MiB in size with |
221 |
+<c>boot</c> flag (shown by (g)parted) or <c>EF00</c> Code (shown by gdisk). |
222 |
+</p> |
223 |
+ |
224 |
+<note> |
225 |
+Replace <c>/dev/sda</c> with disk you want to have EFI System Partition on and |
226 |
+<c>/dev/sda1</c> with partition designated for it in all following samples. |
227 |
+</note> |
228 |
+ |
229 |
+<pre caption="EFI System Partion on GPT disk as shown by gdisk"> |
230 |
+# <i>gdisk -l <keyword>/dev/sda</keyword></i> |
231 |
+<comment>(...)</comment> |
232 |
+ |
233 |
+Number Start (sector) End (sector) Size Code Name |
234 |
+<ident> 1 34 411647 201.0 MiB EF00 </ident> |
235 |
+</pre> |
236 |
+ |
237 |
+<pre caption="EFI System Partion on GPT disk as shown by parted"> |
238 |
+# <i>parted -l</i> |
239 |
+<comment>(...)</comment> |
240 |
+ |
241 |
+Number Start End Size File system Name Flags |
242 |
+<ident> 1 17.4kB 211MB 211MB fat32 boot</ident> <comment># you may have File system field empty</comment> |
243 |
+</pre> |
244 |
+ |
245 |
+<p> |
246 |
+In case the disk partition scheme is MBR (MS-DOS), EFI System Partition should |
247 |
+have type <c>EF</c>. Create or re-type it, again it should be at least 100 MiB |
248 |
+large. |
249 |
+</p> |
250 |
+ |
251 |
+<pre caption="EFI System Partion on MBR disk as shown by fdisk"> |
252 |
+# <i>fdisk -l <keyword>/dev/sda</keyword></i> |
253 |
+<comment>(...)</comment> |
254 |
+ |
255 |
+ Device Boot Start End Blocks Id System |
256 |
+<ident>/dev/sda1 2048 206847 102400 ef EFI (FAT-12/16/32)</ident> |
257 |
+</pre> |
258 |
+ |
259 |
+<p> |
260 |
+Next create FAT32 filesystem on it if you already haven't done so. From now on, |
261 |
+procedure is the same for both GPT and MBR-formatted disks. Program |
262 |
+<c>mkdosfs</c> is from package <c>sys-fs/dosfstools</c>. |
263 |
+</p> |
264 |
+ |
265 |
+<pre caption="Creating FAT32 filesystem on EFI System Partition"> |
266 |
+# <i>mkdosfs -F 32 -n efi-boot <keyword>/dev/sda1</keyword></i> |
267 |
+mkdosfs 3.0.9 (31 Jan 2010) |
268 |
+</pre> |
269 |
+ |
270 |
+<warn> |
271 |
+This command erases everything that previously was on <c>/dev/sda1</c>. |
272 |
+</warn> |
273 |
+ |
274 |
+<p> |
275 |
+The <c>-F 32</c> option tells mkdosfs to create FAT32 filesystem and <c>-n |
276 |
+efi-boot</c> option tells mkdosfs to set partition label to <c>efi-boot</c>. |
277 |
+You may use atrbitrary string up to 11 characters long for label or you may not |
278 |
+use it at all. |
279 |
+</p> |
280 |
+ |
281 |
+<p> |
282 |
+After you prepared your HDDs you can easily proceed with generating the |
283 |
+configuration. |
284 |
+</p> |
285 |
+ |
286 |
+</body> |
287 |
+</section> |
288 |
+ |
289 |
+<section> |
290 |
+<title>Configuring with LVM</title> |
291 |
+<body> |
292 |
+ |
293 |
+<p> |
294 |
+Grub2 itself detects the LVM correctly, with no aditional setup required. |
295 |
+</p> |
296 |
+ |
297 |
+<impo> |
298 |
+If you placed your root and boot partitions inside LVM make sure that disk |
299 |
+you plan to use as booting one has at least few MBs of space before first |
300 |
+partition, because grub2 needs more space to store lvm loader. In other |
301 |
+words if you install it with not enough space it will just break your |
302 |
+partition. |
303 |
+</impo> |
304 |
+ |
305 |
+</body> |
306 |
+</section> |
307 |
+</chapter> |
308 |
+ |
309 |
+<chapter> |
310 |
+<title>Installation of grub2</title> |
311 |
+<section> |
312 |
+<title>Installing on some MBR/GPT directly</title> |
313 |
+<body> |
314 |
+ |
315 |
+<p> |
316 |
+Installation of grub2 is similar to installation of grub-legacy. |
317 |
+</p> |
318 |
+ |
319 |
+<pre caption="Installing grub2 on /dev/sda"> |
320 |
+grub2-install --no-floppy /dev/sda |
321 |
+</pre> |
322 |
+ |
323 |
+<impo> |
324 |
+If you get ANY errors during this step do not reboot your computer, |
325 |
+but make sure it is fixed. Your computer won't boot if installation |
326 |
+fail. |
327 |
+</impo> |
328 |
+ |
329 |
+</body> |
330 |
+</section> |
331 |
+ |
332 |
+</chapter> |
333 |
+ |
334 |
+</guide> |