1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
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 "cf0fd928b1e5479c8108ee52cb114363">
|
---|
10 | <!ENTITY grub-efi-size "6.3 MB">
|
---|
11 | <!ENTITY grub-efi-buildsize "137 MB">
|
---|
12 | <!ENTITY grub-efi-time "1.0 SBU (on 64-bit LFS)">
|
---|
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 "c371b9b4a8a51228c468cc7efccec098">
|
---|
16 | <!ENTITY unifont-size "1.4 MB">
|
---|
17 |
|
---|
18 | <!ENTITY gcc-download-http "&gnu-http;/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.xz">
|
---|
19 | <!ENTITY gcc-md5sum "43e4de77f2218c83ca675257ea1af9ef">
|
---|
20 | <!ENTITY gcc-size "84 MB">
|
---|
21 | ]>
|
---|
22 |
|
---|
23 | <sect1 id="grub-efi" xreflabel="GRUB-&grub-version; for EFI">
|
---|
24 | <?dbhtml filename="grub-efi.html"?>
|
---|
25 |
|
---|
26 |
|
---|
27 | <title>GRUB-&grub-version; for EFI</title>
|
---|
28 |
|
---|
29 | <indexterm zone="grub-efi">
|
---|
30 | <primary sortas="a-grub-efi">grub-efi</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 | <sect2 role="package">
|
---|
34 | <title>Introduction to GRUB</title>
|
---|
35 |
|
---|
36 | <para>
|
---|
37 | The <application>GRUB</application> package provides GRand Unified
|
---|
38 | Bootloader. In this page it will be built with UEFI support, which
|
---|
39 | is not enabled for GRUB built in LFS.
|
---|
40 | </para>
|
---|
41 |
|
---|
42 | &lfs113_checked;
|
---|
43 |
|
---|
44 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
45 | <itemizedlist spacing="compact">
|
---|
46 | <listitem>
|
---|
47 | <para>
|
---|
48 | Download (HTTP): <ulink url="&grub-efi-download-http;"/>
|
---|
49 | </para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>
|
---|
53 | Download (FTP): <ulink url="&grub-efi-download-ftp;"/>
|
---|
54 | </para>
|
---|
55 | </listitem>
|
---|
56 | <listitem>
|
---|
57 | <para>
|
---|
58 | Download MD5 sum: &grub-efi-md5sum;
|
---|
59 | </para>
|
---|
60 | </listitem>
|
---|
61 | <listitem>
|
---|
62 | <para>
|
---|
63 | Download size: &grub-efi-size;
|
---|
64 | </para>
|
---|
65 | </listitem>
|
---|
66 | <listitem>
|
---|
67 | <para>
|
---|
68 | Estimated disk space required: &grub-efi-buildsize;
|
---|
69 | </para>
|
---|
70 | </listitem>
|
---|
71 | <listitem>
|
---|
72 | <para>
|
---|
73 | Estimated build time: &grub-efi-time;
|
---|
74 | </para>
|
---|
75 | </listitem>
|
---|
76 | </itemizedlist>
|
---|
77 |
|
---|
78 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
79 |
|
---|
80 | <itemizedlist spacing="compact">
|
---|
81 | <listitem>
|
---|
82 | <para>
|
---|
83 | Required patch:
|
---|
84 | <ulink url="&patch-root;/grub-&grub-version;-upstream_fixes-1.patch"/>
|
---|
85 | </para>
|
---|
86 | </listitem>
|
---|
87 | </itemizedlist>
|
---|
88 |
|
---|
89 | <itemizedlist spacing="compact">
|
---|
90 | <title>Unicode font data used to display GRUB menu</title>
|
---|
91 | <listitem>
|
---|
92 | <para>
|
---|
93 | Download (HTTP): <ulink url="&unifont-download-http;"/>
|
---|
94 | </para>
|
---|
95 | </listitem>
|
---|
96 | <listitem>
|
---|
97 | <para>
|
---|
98 | Download MD5 sum: &unifont-md5sum;
|
---|
99 | </para>
|
---|
100 | </listitem>
|
---|
101 | <listitem>
|
---|
102 | <para>
|
---|
103 | Download size: &unifont-size;
|
---|
104 | </para>
|
---|
105 | </listitem>
|
---|
106 | </itemizedlist>
|
---|
107 |
|
---|
108 | <itemizedlist spacing="compact">
|
---|
109 | <title>GCC (only needed if building on 32-bit LFS)</title>
|
---|
110 | <listitem>
|
---|
111 | <para>
|
---|
112 | Download (HTTP): <ulink url="&gcc-download-http;"/>
|
---|
113 | </para>
|
---|
114 | </listitem>
|
---|
115 | <listitem>
|
---|
116 | <para>
|
---|
117 | Download MD5 sum: &gcc-md5sum;
|
---|
118 | </para>
|
---|
119 | </listitem>
|
---|
120 | <listitem>
|
---|
121 | <para>
|
---|
122 | Download size: &gcc-size;
|
---|
123 | </para>
|
---|
124 | </listitem>
|
---|
125 | </itemizedlist>
|
---|
126 |
|
---|
127 | <bridgehead renderas="sect3">GRUB Dependencies</bridgehead>
|
---|
128 |
|
---|
129 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
130 | <para role="recommended">
|
---|
131 | <xref role="runtime" linkend="efibootmgr"/> (runtime) and
|
---|
132 | <xref linkend="freetype2"/>
|
---|
133 | </para>
|
---|
134 |
|
---|
135 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
136 | <para role="optional">
|
---|
137 | <xref linkend="lvm2"/>
|
---|
138 | </para>
|
---|
139 |
|
---|
140 |
|
---|
141 | </sect2>
|
---|
142 |
|
---|
143 | <sect2 role="installation">
|
---|
144 | <title>Installation of GRUB</title>
|
---|
145 |
|
---|
146 | <para>
|
---|
147 | First, install font data as the
|
---|
148 | <systemitem class="username">root</systemitem> user:
|
---|
149 | </para>
|
---|
150 |
|
---|
151 | <screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &&
|
---|
152 | gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
|
---|
153 |
|
---|
154 | <warning>
|
---|
155 | <para>Unset any environment variables which may affect the build:</para>
|
---|
156 |
|
---|
157 | <screen><userinput>unset {C,CPP,CXX,LD}FLAGS</userinput></screen>
|
---|
158 |
|
---|
159 | <para>Don't try <quote>tuning</quote> this package with custom
|
---|
160 | compilation flags: this package is a bootloader, with low-level
|
---|
161 | operations in the source code which is likely to be broken by some
|
---|
162 | aggressive optimizations.</para>
|
---|
163 | </warning>
|
---|
164 |
|
---|
165 | <para>
|
---|
166 | Fix an issue causing <command>grub-install</command> to fail when the
|
---|
167 | <filename class='directory'>/boot</filename> partition (or the root
|
---|
168 | partition if <filename class='directory'>/boot</filename> is not a
|
---|
169 | separate partition) is created by e2fsprogs-1.47.0 or later:
|
---|
170 | </para>
|
---|
171 |
|
---|
172 | <screen><userinput>patch -Np1 -i ../grub-&grub-version;-upstream_fixes-1.patch</userinput></screen>
|
---|
173 |
|
---|
174 | <para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
|
---|
175 |
|
---|
176 | <!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
|
---|
177 | <screen><userinput>case $(uname -m) in i?86 )
|
---|
178 | <literal>tar xf ../gcc-&gcc-version;.tar.xz
|
---|
179 | mkdir gcc-&gcc-version;/build
|
---|
180 | pushd gcc-&gcc-version;/build
|
---|
181 | ../configure --prefix=$PWD/../../x86_64-gcc \
|
---|
182 | --target=x86_64-linux-gnu \
|
---|
183 | --with-system-zlib \
|
---|
184 | --enable-languages=c,c++ \
|
---|
185 | --with-ld=/usr/bin/ld
|
---|
186 | make all-gcc
|
---|
187 | make install-gcc
|
---|
188 | popd
|
---|
189 | export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
|
---|
190 | esac</userinput></screen>
|
---|
191 |
|
---|
192 | <para>
|
---|
193 | Build <application>GRUB</application> with the following commands:
|
---|
194 | </para>
|
---|
195 |
|
---|
196 | <screen><userinput>./configure --prefix=/usr \
|
---|
197 | --sysconfdir=/etc \
|
---|
198 | --disable-efiemu \
|
---|
199 | --enable-grub-mkfont \
|
---|
200 | --with-platform=efi \
|
---|
201 | --target=x86_64 \
|
---|
202 | --disable-werror &&
|
---|
203 | unset TARGET_CC &&
|
---|
204 | make</userinput></screen>
|
---|
205 |
|
---|
206 | <para>
|
---|
207 | This package does not have a test suite providing meaningful results.
|
---|
208 | </para>
|
---|
209 |
|
---|
210 | <para>
|
---|
211 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
212 | </para>
|
---|
213 |
|
---|
214 | <screen role="root"><userinput>make install &&
|
---|
215 | mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</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 firmwares
|
---|
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>See the page for GRUB in LFS book.</para>
|
---|
272 | </sect2>
|
---|
273 |
|
---|
274 | </sect1>
|
---|