1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY grub-efi-download-http "https://ftp.gnu.org/gnu/grub/grub-&grub-version;.tar.xz">
|
---|
8 | <!ENTITY grub-efi-download-ftp " ">
|
---|
9 | <!ENTITY grub-efi-md5sum "60c564b1bdc39d8e43b3aab4bc0fb140">
|
---|
10 | <!ENTITY grub-efi-size "6.4 MB">
|
---|
11 | <!ENTITY grub-efi-buildsize "183 MB">
|
---|
12 | <!ENTITY grub-efi-time "0.4 SBU (on 64-bit LFS, using parallelism=4)">
|
---|
13 |
|
---|
14 | <!ENTITY unifont-download-http "https://unifoundry.com/pub/unifont/unifont-&unifont-version;/font-builds/unifont-&unifont-version;.pcf.gz">
|
---|
15 | <!ENTITY unifont-md5sum "007ffa7aab47ed3f270caee84d12148b">
|
---|
16 | <!ENTITY unifont-size "1.3 MB">
|
---|
17 | ]>
|
---|
18 |
|
---|
19 | <sect1 id="grub-efi" xreflabel="GRUB-&grub-version; for EFI">
|
---|
20 | <?dbhtml filename="grub-efi.html"?>
|
---|
21 |
|
---|
22 |
|
---|
23 | <title>GRUB-&grub-version; for EFI</title>
|
---|
24 |
|
---|
25 | <indexterm zone="grub-efi">
|
---|
26 | <primary sortas="a-grub-efi">grub-efi</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to GRUB</title>
|
---|
31 |
|
---|
32 | <para>
|
---|
33 | The <application>GRUB</application> package provides GRand Unified
|
---|
34 | Bootloader. In this page it will be built with UEFI support, which
|
---|
35 | is not enabled for GRUB built in LFS.
|
---|
36 | </para>
|
---|
37 |
|
---|
38 | &lfs122_checked;
|
---|
39 |
|
---|
40 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
41 | <itemizedlist spacing="compact">
|
---|
42 | <listitem>
|
---|
43 | <para>
|
---|
44 | Download (HTTP): <ulink url="&grub-efi-download-http;"/>
|
---|
45 | </para>
|
---|
46 | </listitem>
|
---|
47 | <listitem>
|
---|
48 | <para>
|
---|
49 | Download (FTP): <ulink url="&grub-efi-download-ftp;"/>
|
---|
50 | </para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>
|
---|
54 | Download MD5 sum: &grub-efi-md5sum;
|
---|
55 | </para>
|
---|
56 | </listitem>
|
---|
57 | <listitem>
|
---|
58 | <para>
|
---|
59 | Download size: &grub-efi-size;
|
---|
60 | </para>
|
---|
61 | </listitem>
|
---|
62 | <listitem>
|
---|
63 | <para>
|
---|
64 | Estimated disk space required: &grub-efi-buildsize;
|
---|
65 | </para>
|
---|
66 | </listitem>
|
---|
67 | <listitem>
|
---|
68 | <para>
|
---|
69 | Estimated build time: &grub-efi-time;
|
---|
70 | </para>
|
---|
71 | </listitem>
|
---|
72 | </itemizedlist>
|
---|
73 |
|
---|
74 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
75 | <!--
|
---|
76 | <itemizedlist spacing="compact">
|
---|
77 | <listitem>
|
---|
78 | <para>
|
---|
79 | Required patch:
|
---|
80 | <ulink url="&patch-root;/grub-&grub-version;-upstream_fixes-1.patch"/>
|
---|
81 | </para>
|
---|
82 | </listitem>
|
---|
83 | </itemizedlist>
|
---|
84 | -->
|
---|
85 | <itemizedlist spacing="compact">
|
---|
86 | <title>Unicode font data used to display GRUB menu</title>
|
---|
87 | <listitem>
|
---|
88 | <para>
|
---|
89 | Download (HTTP): <ulink url="&unifont-download-http;"/>
|
---|
90 | </para>
|
---|
91 | </listitem>
|
---|
92 | <listitem>
|
---|
93 | <para>
|
---|
94 | Download MD5 sum: &unifont-md5sum;
|
---|
95 | </para>
|
---|
96 | </listitem>
|
---|
97 | <listitem>
|
---|
98 | <para>
|
---|
99 | Download size: &unifont-size;
|
---|
100 | </para>
|
---|
101 | </listitem>
|
---|
102 | </itemizedlist>
|
---|
103 |
|
---|
104 | <itemizedlist spacing="compact">
|
---|
105 | <title>GCC (only needed if building on 32-bit LFS)</title>
|
---|
106 | <listitem>
|
---|
107 | <para>
|
---|
108 | Refer to <xref linkend='gcc'/> page for download info.
|
---|
109 | </para>
|
---|
110 | </listitem>
|
---|
111 | </itemizedlist>
|
---|
112 |
|
---|
113 | <bridgehead renderas="sect3">GRUB Dependencies</bridgehead>
|
---|
114 |
|
---|
115 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
116 | <para role="recommended">
|
---|
117 | <xref role="runtime" linkend="efibootmgr"/> (runtime) and
|
---|
118 | <xref linkend="freetype2"/>
|
---|
119 | </para>
|
---|
120 |
|
---|
121 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
122 | <para role="optional">
|
---|
123 | <xref linkend="lvm2"/> and
|
---|
124 | <xref linkend="fuse3"/>
|
---|
125 | </para>
|
---|
126 | </sect2>
|
---|
127 |
|
---|
128 | <sect2 role="installation">
|
---|
129 | <title>Installation of GRUB</title>
|
---|
130 |
|
---|
131 | <para>
|
---|
132 | First, install font data as the
|
---|
133 | <systemitem class="username">root</systemitem> user:
|
---|
134 | </para>
|
---|
135 |
|
---|
136 | <screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &&
|
---|
137 | gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
|
---|
138 |
|
---|
139 | <warning>
|
---|
140 | <para>Unset any environment variables which may affect the build:</para>
|
---|
141 |
|
---|
142 | <screen><userinput>unset {C,CPP,CXX,LD}FLAGS</userinput></screen>
|
---|
143 |
|
---|
144 | <para>Don't try <quote>tuning</quote> this package with custom
|
---|
145 | compilation flags: this package is a bootloader, with low-level
|
---|
146 | operations in the source code which is likely to be broken by some
|
---|
147 | aggressive optimizations.</para>
|
---|
148 | </warning>
|
---|
149 |
|
---|
150 | <para>
|
---|
151 | Add a file missing from the release tarball:
|
---|
152 | </para>
|
---|
153 |
|
---|
154 | <screen><userinput>echo <literal>depends bli part_gpt</literal> > grub-core/extra_deps.lst</userinput></screen>
|
---|
155 |
|
---|
156 | <para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
|
---|
157 |
|
---|
158 | <!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
|
---|
159 | <screen><userinput>case $(uname -m) in i?86 )
|
---|
160 | <literal>tar xf ../gcc-&gcc-version;.tar.xz
|
---|
161 | mkdir gcc-&gcc-version;/build
|
---|
162 | pushd gcc-&gcc-version;/build
|
---|
163 | ../configure --prefix=$PWD/../../x86_64-gcc \
|
---|
164 | --target=x86_64-linux-gnu \
|
---|
165 | --with-system-zlib \
|
---|
166 | --enable-languages=c,c++ \
|
---|
167 | --with-ld=/usr/bin/ld
|
---|
168 | make all-gcc
|
---|
169 | make install-gcc
|
---|
170 | popd
|
---|
171 | export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
|
---|
172 | esac</userinput></screen>
|
---|
173 |
|
---|
174 | <para>
|
---|
175 | Build <application>GRUB</application> with the following commands:
|
---|
176 | </para>
|
---|
177 |
|
---|
178 | <screen><userinput>./configure --prefix=/usr \
|
---|
179 | --sysconfdir=/etc \
|
---|
180 | --disable-efiemu \
|
---|
181 | --enable-grub-mkfont \
|
---|
182 | --with-platform=efi \
|
---|
183 | --target=x86_64 \
|
---|
184 | --disable-werror &&
|
---|
185 | unset TARGET_CC &&
|
---|
186 | make</userinput></screen>
|
---|
187 |
|
---|
188 | <para>
|
---|
189 | This package does not have a test suite providing meaningful results.
|
---|
190 | </para>
|
---|
191 |
|
---|
192 | <para>
|
---|
193 | Now, if you've skipped the LFS GRUB package, as the
|
---|
194 | <systemitem class="username">root</systemitem> user:
|
---|
195 | </para>
|
---|
196 |
|
---|
197 | <screen role="nodump"><userinput>make install &&
|
---|
198 | mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
|
---|
199 |
|
---|
200 | <para>
|
---|
201 | If you've not skipped LFS GRUB package, as the &root; user, only install
|
---|
202 | the components not installed from the LFS GRUB package instead:
|
---|
203 | </para>
|
---|
204 |
|
---|
205 | <screen role="root"><userinput>make DESTDIR=$PWD/dest install
|
---|
206 | cp -av dest/usr/lib/grub/x86_64-efi -T /usr/lib/grub/x86_64-efi
|
---|
207 | cp -av dest/usr/share/grub/*.{pf2,h} /usr/share/grub
|
---|
208 | cp -av dest/usr/bin/grub-mkfont /usr/bin</userinput></screen>
|
---|
209 |
|
---|
210 | <para>
|
---|
211 | If the optional dependencies are installed, also install the
|
---|
212 | <command>grub-mount</command> program:
|
---|
213 | </para>
|
---|
214 |
|
---|
215 | <screen role="nodump"><userinput>cp -av dest/usr/bin/grub-mount /usr/bin</userinput></screen>
|
---|
216 |
|
---|
217 | </sect2>
|
---|
218 |
|
---|
219 | <sect2 role="commands">
|
---|
220 | <title>Command Explanations</title>
|
---|
221 |
|
---|
222 | <para>
|
---|
223 | <parameter>--enable-grub-mkfont</parameter>: Build the tool named
|
---|
224 | <command>grub-mkfont</command> to generate the font file for the boot
|
---|
225 | loader from the font data we've installed.
|
---|
226 | </para>
|
---|
227 |
|
---|
228 | <warning>
|
---|
229 | <para>If the recommended dependency <xref linkend="freetype2"/> is not
|
---|
230 | installed, it is possible to omit this option and build GRUB. However,
|
---|
231 | if <command>grub-mkfont</command> is not built, or the unicode font
|
---|
232 | data is not available at the time GRUB is built, GRUB won't install
|
---|
233 | any font for the boot loader. The GRUB boot menu will be displayed
|
---|
234 | using a coarse font or in a smaller region on the screen.</para>
|
---|
235 | </warning>
|
---|
236 |
|
---|
237 | <para>
|
---|
238 | <parameter>--with-platform=efi</parameter>: Ensures building GRUB with
|
---|
239 | EFI enabled.
|
---|
240 | </para>
|
---|
241 |
|
---|
242 | <para>
|
---|
243 | <parameter>--target=x86_64</parameter>: Ensures building GRUB for
|
---|
244 | x86_64 even if building on a 32-bit LFS system. Most EFI firmware
|
---|
245 | on x86_64 does not support 32-bit bootloaders.
|
---|
246 | </para>
|
---|
247 |
|
---|
248 | <para>
|
---|
249 | <option>--target=i386</option>: A few 32-bit x86 platforms have EFI
|
---|
250 | support. And, some x86_64 platforms have a 32-bit EFI implementation,
|
---|
251 | but they are very old and rare. Use this instead of
|
---|
252 | <parameter>--target=x86_64</parameter> if you are
|
---|
253 | <emphasis role='bold'>absolutely sure</emphasis> that LFS is running
|
---|
254 | on such a system.
|
---|
255 | </para>
|
---|
256 |
|
---|
257 | </sect2>
|
---|
258 |
|
---|
259 | <sect2>
|
---|
260 | <title>Configuring GRUB</title>
|
---|
261 |
|
---|
262 | <para>
|
---|
263 | Using GRUB to make the LFS system bootable on UEFI platform will be
|
---|
264 | discussed in <xref linkend="grub-setup"/>.
|
---|
265 | </para>
|
---|
266 | </sect2>
|
---|
267 |
|
---|
268 | <sect2 role="content">
|
---|
269 | <title>Contents</title>
|
---|
270 |
|
---|
271 | <para>
|
---|
272 | A list of the installed files, along with their short
|
---|
273 | descriptions can be found at
|
---|
274 | <ulink url="&lfs-root;/chapter08/grub.html#contents-gRUB"/>.
|
---|
275 | </para>
|
---|
276 |
|
---|
277 | <para>
|
---|
278 | Listed below are the newly installed programs
|
---|
279 | along with short descriptions.
|
---|
280 | </para>
|
---|
281 |
|
---|
282 | <segmentedlist>
|
---|
283 | <segtitle>Installed Programs</segtitle>
|
---|
284 | <segtitle>Installed Directories</segtitle>
|
---|
285 |
|
---|
286 | <seglistitem>
|
---|
287 | <seg>grub-mkfont and grub-mount (optional)</seg>
|
---|
288 | <seg>/usr/lib/grub/x86_64-efi</seg>
|
---|
289 | </seglistitem>
|
---|
290 | </segmentedlist>
|
---|
291 |
|
---|
292 | <variablelist>
|
---|
293 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
294 | <?dbfo list-presentation="list"?>
|
---|
295 | <?dbhtml list-presentation="table"?>
|
---|
296 |
|
---|
297 | <varlistentry id="grub-mkfont">
|
---|
298 | <term><command>grub-mkfont</command></term>
|
---|
299 | <listitem>
|
---|
300 | <para>
|
---|
301 | converts common font file formats into PF2
|
---|
302 | </para>
|
---|
303 | <indexterm zone="grub-efi grub-mkfont">
|
---|
304 | <primary sortas="b-grub-mkfont">grub-mkfont</primary>
|
---|
305 | </indexterm>
|
---|
306 | </listitem>
|
---|
307 | </varlistentry>
|
---|
308 |
|
---|
309 | <varlistentry id="grub-mount">
|
---|
310 | <term><command>grub-mount</command></term>
|
---|
311 | <listitem>
|
---|
312 | <para>
|
---|
313 | is a debug tool for filesystem driver
|
---|
314 | </para>
|
---|
315 | <indexterm zone="grub-efi grub-mount">
|
---|
316 | <primary sortas="b-grub-mount">grub-mount</primary>
|
---|
317 | </indexterm>
|
---|
318 | </listitem>
|
---|
319 | </varlistentry>
|
---|
320 | </variablelist>
|
---|
321 |
|
---|
322 | </sect2>
|
---|
323 |
|
---|
324 | </sect1>
|
---|