1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-system-grub" role="wrap">
<?dbhtml filename="grub.html"?>
<sect1info condition="script">
<productname>grub</productname>
<productnumber>&grub-version;</productnumber>
<address>&grub-url;</address>
</sect1info>
<title>GRUB-&grub-version;</title>
<indexterm zone="ch-system-grub">
<primary sortas="a-Grub">GRUB</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The GRUB package contains the GRand Unified Bootloader.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&grub-fin-sbu;</seg>
<seg>&grub-fin-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of GRUB</title>
<note>
<para>
On LoongArch systems, the following instruction builds GRUB for UEFI.
But the built GRUB lacks some features because a few optional
dependencies of GRUB for UEFI is beyond the scope of LFS and not
installed yet.
</para>
<para>
If your system firmware does not support UEFI, you need to skip the
content of this page and try to figure out how to boot your system.
</para>
<para>
If your system firmware supports UEFI and you want a fully
functional GRUB, you can skip the content of this page,
and install GRUB with UEFI support (and its dependencies) following
<ulink url="&blfs-book;postlfs/grub-efi.html">the BLFS page</ulink>
(with <parameter>--target=x86_64</parameter> removed) at the end of
this chapter.
</para>
</note>
<warning>
<para>Unset any environment variables which may affect the build:</para>
<screen><userinput remap='pre'>unset {C,CPP,CXX,LD}FLAGS</userinput></screen>
<para>Don't try <quote>tuning</quote> this package with custom
compilation flags. This package is a bootloader. The low-level
operations in the source code may be broken by
aggressive optimization.</para>
</warning>
<para>Prepare GRUB for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-efiemu \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--disable-werror</parameter></term>
<listitem>
<para>This allows the build to complete with warnings introduced
by more recent versions of Flex.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-efiemu</parameter></term>
<listitem>
<para>This option minimizes what is built by disabling a feature and
eliminating some test programs not needed for LFS.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>The test suite for this packages is not recommended. Most of
the tests depend on packages that are not available in the limited
LFS environment. To run the tests anyway, run <command>make check</command>.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install
mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
<para>Making your LFS system bootable with GRUB will be discussed in
<xref linkend="ch-bootable-grub"/>.</para>
</sect2>
<sect2 id="contents-gRUB" role="content">
<title>Contents of GRUB</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>grub-bios-setup, grub-editenv, grub-file, grub-fstest,
grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless,
grub-menulst2cfg, grub-mkconfig,
grub-mkimage, grub-mklayout, grub-mknetdir,
grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone,
grub-ofpathname, grub-probe, grub-reboot, grub-render-label,
grub-script-check,
grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg</seg>
<seg>/usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install
is first run)</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="grub-bios-setup">
<term><command>grub-bios-setup</command></term>
<listitem>
<para>Is a helper program for <command>grub-install</command></para>
<indexterm zone="ch-system-grub grub-bios-setup">
<primary sortas="b-grub-bios-setup">grub-bios-setup</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-editenv">
<term><command>grub-editenv</command></term>
<listitem>
<para>Is a tool to edit the environment block</para>
<indexterm zone="ch-system-grub grub-editenv">
<primary sortas="b-grub-editenv">grub-editenv</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-file">
<term><command>grub-file</command></term>
<listitem>
<para>Checks to see if the given file is of the specified type</para>
<indexterm zone="ch-system-grub grub-file">
<primary sortas="b-grub-file">grub-file</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-fstest">
<term><command>grub-fstest</command></term>
<listitem>
<para>Is a tool to debug the filesystem driver</para>
<indexterm zone="ch-system-grub grub-fstest">
<primary sortas="b-grub-fstest">grub-fstest</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-glue-efi">
<term><command>grub-glue-efi</command></term>
<listitem>
<para>Glues 32-bit and 64-bit binaries into a single file (for Apple machines)</para>
<indexterm zone="ch-system-grub grub-glue-efi">
<primary sortas="b-grub-glue-efi">grub-glue-efi</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-install">
<term><command>grub-install</command></term>
<listitem>
<para>Installs GRUB on your drive</para>
<indexterm zone="ch-system-grub grub-install">
<primary sortas="b-grub-install">grub-install</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-kbdcomp">
<term><command>grub-kbdcomp</command></term>
<listitem>
<para>Is a script that converts an xkb layout into one recognized by
GRUB</para>
<indexterm zone="ch-system-grub grub-kbdcomp">
<primary sortas="b-grub-kbdcomp">grub-kbdcomp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-macbless">
<term><command>grub-macbless</command></term>
<listitem>
<para>Is the Mac-style bless for HFS or HFS+ file systems (<command>bless</command>
is peculiar to Apple machines; it makes a device bootable)</para>
<indexterm zone="ch-system-grub grub-macbless">
<primary sortas="b-grub-macbless">grub-macbless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-menulst2cfg">
<term><command>grub-menulst2cfg</command></term>
<listitem>
<para>Converts a GRUB Legacy <filename>menu.lst</filename>
into a <filename>grub.cfg</filename> for use with GRUB 2</para>
<indexterm zone="ch-system-grub grub-menulst2cfg">
<primary sortas="b-grub-menulst2cfg">grub-menulst2cfg</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkconfig">
<term><command>grub-mkconfig</command></term>
<listitem>
<para>Generates a <filename>grub.cfg</filename> file</para>
<indexterm zone="ch-system-grub grub-mkconfig">
<primary sortas="b-grub-mkconfig">grub-mkconfig</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkimage">
<term><command>grub-mkimage</command></term>
<listitem>
<para>Makes a bootable image of GRUB</para>
<indexterm zone="ch-system-grub grub-mkimage">
<primary sortas="b-grub-mkimage">grub-mkimage</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mklayout">
<term><command>grub-mklayout</command></term>
<listitem>
<para>Generates a GRUB keyboard layout file</para>
<indexterm zone="ch-system-grub grub-mklayout">
<primary sortas="b-grub-mklayout">grub-mklayout</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mknetdir">
<term><command>grub-mknetdir</command></term>
<listitem>
<para>Prepares a GRUB netboot directory</para>
<indexterm zone="ch-system-grub grub-mknetdir">
<primary sortas="b-grub-mknetdir">grub-mknetdir</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkpasswd-pbkdf2">
<term><command>grub-mkpasswd-pbkdf2</command></term>
<listitem>
<para>Generates an encrypted PBKDF2 password for use in the boot
menu</para>
<indexterm zone="ch-system-grub grub-mkpasswd-pbkdf2">
<primary sortas="b-grub-mkpasswd-pbkdf2">grub-mkpasswd-pbkdf2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkrelpath">
<term><command>grub-mkrelpath</command></term>
<listitem>
<para>Makes a system pathname relative to its root</para>
<indexterm zone="ch-system-grub grub-mkrelpath">
<primary sortas="b-grub-mkrelpath">grub-mkrelpath</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkrescue">
<term><command>grub-mkrescue</command></term>
<listitem>
<para>Makes a bootable image of GRUB suitable for a floppy disk,
CDROM/DVD, or a USB drive</para>
<indexterm zone="ch-system-grub grub-mkrescue">
<primary sortas="b-grub-mkrescue">grub-mkrescue</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkstandalone">
<term><command>grub-mkstandalone</command></term>
<listitem>
<para>Generates a standalone image</para>
<indexterm zone="ch-system-grub grub-mkstandalone">
<primary sortas="b-grub-mkstandalone">grub-mkstandalone</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-ofpathname">
<term><command>grub-ofpathname</command></term>
<listitem>
<para>Is a helper program that prints the path to a GRUB device</para>
<indexterm zone="ch-system-grub grub-ofpathname">
<primary sortas="b-grub-ofpathname">grub-ofpathname</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-probe">
<term><command>grub-probe</command></term>
<listitem>
<para>Probes device information for a given path or device</para>
<indexterm zone="ch-system-grub grub-probe">
<primary sortas="b-grub-probe">grub-probe</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-reboot">
<term><command>grub-reboot</command></term>
<listitem>
<para>Sets the default boot entry for GRUB for the next boot only</para>
<indexterm zone="ch-system-grub grub-reboot">
<primary sortas="b-grub-reboot">grub-reboot</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-render-label">
<term><command>grub-render-label</command></term>
<listitem>
<para>Renders Apple .disk_label for Apple Macs</para>
<indexterm zone="ch-system-grub grub-render-label">
<primary sortas="b-grub-render-label">grub-render-label</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-script-check">
<term><command>grub-script-check</command></term>
<listitem>
<para>Checks the GRUB configuration script for syntax errors</para>
<indexterm zone="ch-system-grub grub-script-check">
<primary sortas="b-grub-script-check">grub-script-check</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-set-default">
<term><command>grub-set-default</command></term>
<listitem>
<para>Sets the default boot entry for GRUB</para>
<indexterm zone="ch-system-grub grub-set-default">
<primary sortas="b-grub-set-default">grub-set-default</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-sparc64-setup">
<term><command>grub-sparc64-setup</command></term>
<listitem>
<para>Is a helper program for grub-setup</para>
<indexterm zone="ch-system-grub grub-sparc64-setup">
<primary sortas="b-grub-sparc64-setup">grub-setup</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-syslinux2cfg">
<term><command>grub-syslinux2cfg</command></term>
<listitem>
<para>Transforms a syslinux config file into grub.cfg format</para>
<indexterm zone="ch-system-grub grub-syslinux2cfg">
<primary sortas="b-grub-syslinux2cfg">grub-syslinux2cfg</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>
|