source: postlfs/filesystems/uefi-bootloaders/grub-efi.xml

trunk
Last change on this file was a9922f2, checked in by Xi Ruoyao <xry111@…>, 8 weeks ago

uefi-bootloaders: Tag

  • Property mode set to 100644
File size: 7.9 KB
Line 
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 "72f95e7ecb47a4c7ed610babe6959ead">
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 &lfs121_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"/>
124 </para>
125
126
127 </sect2>
128
129 <sect2 role="installation">
130 <title>Installation of GRUB</title>
131
132 <para>
133 First, install font data as the
134 <systemitem class="username">root</systemitem> user:
135 </para>
136
137<screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &amp;&amp;
138gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
139
140 <warning>
141 <para>Unset any environment variables which may affect the build:</para>
142
143 <screen><userinput>unset {C,CPP,CXX,LD}FLAGS</userinput></screen>
144
145 <para>Don't try <quote>tuning</quote> this package with custom
146 compilation flags: this package is a bootloader, with low-level
147 operations in the source code which is likely to be broken by some
148 aggressive optimizations.</para>
149 </warning>
150
151 <para>
152 Add a file missing from the release tarball:
153 </para>
154
155 <screen><userinput>echo <literal>depends bli part_gpt</literal> > grub-core/extra_deps.lst</userinput></screen>
156
157 <para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
158
159<!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
160<screen><userinput>case $(uname -m) in i?86 )
161 <literal>tar xf ../gcc-&gcc-version;.tar.xz
162 mkdir gcc-&gcc-version;/build
163 pushd gcc-&gcc-version;/build
164 ../configure --prefix=$PWD/../../x86_64-gcc \
165 --target=x86_64-linux-gnu \
166 --with-system-zlib \
167 --enable-languages=c,c++ \
168 --with-ld=/usr/bin/ld
169 make all-gcc
170 make install-gcc
171 popd
172 export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
173esac</userinput></screen>
174
175 <para>
176 Build <application>GRUB</application> with the following commands:
177 </para>
178
179<screen><userinput>./configure --prefix=/usr \
180 --sysconfdir=/etc \
181 --disable-efiemu \
182 --enable-grub-mkfont \
183 --with-platform=efi \
184 --target=x86_64 \
185 --disable-werror &amp;&amp;
186unset TARGET_CC &amp;&amp;
187make</userinput></screen>
188
189 <para>
190 This package does not have a test suite providing meaningful results.
191 </para>
192
193 <para>
194 Now, as the <systemitem class="username">root</systemitem> user:
195 </para>
196
197<screen role="root"><userinput>make install &amp;&amp;
198mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
199
200 </sect2>
201
202 <sect2 role="commands">
203 <title>Command Explanations</title>
204
205 <para>
206 <parameter>--enable-grub-mkfont</parameter>: Build the tool named
207 <command>grub-mkfont</command> to generate the font file for the boot
208 loader from the font data we've installed.
209 </para>
210
211 <warning>
212 <para>If the recommended dependency <xref linkend="freetype2"/> is not
213 installed, it is possible to omit this option and build GRUB. However,
214 if <command>grub-mkfont</command> is not built, or the unicode font
215 data is not available at the time GRUB is built, GRUB won't install
216 any font for the boot loader. The GRUB boot menu will be displayed
217 using a coarse font or in a smaller region on the screen.</para>
218 </warning>
219
220 <para>
221 <parameter>--with-platform=efi</parameter>: Ensures building GRUB with
222 EFI enabled.
223 </para>
224
225 <para>
226 <parameter>--target=x86_64</parameter>: Ensures building GRUB for
227 x86_64 even if building on a 32-bit LFS system. Most EFI firmware
228 on x86_64 does not support 32-bit bootloaders.
229 </para>
230
231 <para>
232 <option>--target=i386</option>: A few 32-bit x86 platforms have EFI
233 support. And, some x86_64 platforms have a 32-bit EFI implementation,
234 but they are very old and rare. Use this instead of
235 <parameter>--target=x86_64</parameter> if you are
236 <emphasis role='bold'>absolutely sure</emphasis> that LFS is running
237 on such a system.
238 </para>
239
240 </sect2>
241
242 <sect2>
243 <title>Configuring GRUB</title>
244
245 <para>
246 Using GRUB to make the LFS system bootable on UEFI platform will be
247 discussed in <xref linkend="grub-setup"/>.
248 </para>
249 </sect2>
250
251 <sect2 role="content">
252 <title>Contents</title>
253
254 <para>See the page for GRUB in LFS book.</para>
255 </sect2>
256
257</sect1>
Note: See TracBrowser for help on using the repository browser.