[756a787] | 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 |
|
---|
[227bd7d6] | 7 | <!ENTITY grub-efi-download-http "https://ftp.gnu.org/gnu/grub/grub-&grub-version;.tar.xz">
|
---|
[756a787] | 8 | <!ENTITY grub-efi-download-ftp " ">
|
---|
[227bd7d6] | 9 | <!ENTITY grub-efi-md5sum "cf0fd928b1e5479c8108ee52cb114363">
|
---|
| 10 | <!ENTITY grub-efi-size "6.3 MB">
|
---|
[7a91c80] | 11 | <!ENTITY grub-efi-buildsize "137 MB">
|
---|
[672f2a5] | 12 | <!ENTITY grub-efi-time "1.0 SBU (on 64-bit LFS)">
|
---|
[756a787] | 13 |
|
---|
[c6b192c] | 14 | <!ENTITY unifont-download-http "https://unifoundry.com/pub/unifont/unifont-&unifont-version;/font-builds/unifont-&unifont-version;.pcf.gz">
|
---|
[aebcd92c] | 15 | <!ENTITY unifont-md5sum "428aa81e2433db172bbf7f4136cee6c5">
|
---|
[756a787] | 16 | <!ENTITY unifont-size "1.3 MB">
|
---|
[672f2a5] | 17 |
|
---|
| 18 | <!ENTITY gcc-download-http "&gnu-http;/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.xz">
|
---|
[ce1d6581] | 19 | <!ENTITY gcc-md5sum "73bafd0af874439dcdb9fc063b6fb069">
|
---|
| 20 | <!ENTITY gcc-size "81 MB">
|
---|
[756a787] | 21 | ]>
|
---|
| 22 |
|
---|
| 23 | <sect1 id="grub-efi" xreflabel="GRUB-&grub-version; for EFI">
|
---|
| 24 | <?dbhtml filename="grub-efi.html"?>
|
---|
| 25 |
|
---|
| 26 | <sect1info>
|
---|
[fda29e4] | 27 | <date>$Date$</date>
|
---|
[756a787] | 28 | </sect1info>
|
---|
| 29 |
|
---|
| 30 | <title>GRUB-&grub-version; for EFI</title>
|
---|
| 31 |
|
---|
| 32 | <indexterm zone="grub-efi">
|
---|
| 33 | <primary sortas="a-grub-efi">grub-efi</primary>
|
---|
| 34 | </indexterm>
|
---|
| 35 |
|
---|
| 36 | <sect2 role="package">
|
---|
| 37 | <title>Introduction to GRUB</title>
|
---|
| 38 |
|
---|
| 39 | <para>
|
---|
| 40 | The <application>GRUB</application> package provides GRand Unified
|
---|
| 41 | Bootloader. In this page it will be built with UEFI support, which
|
---|
| 42 | is not enabled for GRUB built in LFS.
|
---|
| 43 | </para>
|
---|
| 44 |
|
---|
[16f7f0e] | 45 | &lfs112_checked;
|
---|
[756a787] | 46 |
|
---|
| 47 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 48 | <itemizedlist spacing="compact">
|
---|
| 49 | <listitem>
|
---|
| 50 | <para>
|
---|
| 51 | Download (HTTP): <ulink url="&grub-efi-download-http;"/>
|
---|
| 52 | </para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>
|
---|
| 56 | Download (FTP): <ulink url="&grub-efi-download-ftp;"/>
|
---|
| 57 | </para>
|
---|
| 58 | </listitem>
|
---|
| 59 | <listitem>
|
---|
| 60 | <para>
|
---|
| 61 | Download MD5 sum: &grub-efi-md5sum;
|
---|
| 62 | </para>
|
---|
| 63 | </listitem>
|
---|
| 64 | <listitem>
|
---|
| 65 | <para>
|
---|
| 66 | Download size: &grub-efi-size;
|
---|
| 67 | </para>
|
---|
| 68 | </listitem>
|
---|
| 69 | <listitem>
|
---|
| 70 | <para>
|
---|
| 71 | Estimated disk space required: &grub-efi-buildsize;
|
---|
| 72 | </para>
|
---|
| 73 | </listitem>
|
---|
| 74 | <listitem>
|
---|
| 75 | <para>
|
---|
| 76 | Estimated build time: &grub-efi-time;
|
---|
| 77 | </para>
|
---|
| 78 | </listitem>
|
---|
| 79 | </itemizedlist>
|
---|
| 80 |
|
---|
| 81 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 82 |
|
---|
| 83 | <itemizedlist spacing="compact">
|
---|
| 84 | <title>Unicode font data used to display GRUB menu</title>
|
---|
| 85 | <listitem>
|
---|
| 86 | <para>
|
---|
| 87 | Download (HTTP): <ulink url="&unifont-download-http;"/>
|
---|
| 88 | </para>
|
---|
| 89 | </listitem>
|
---|
| 90 | <listitem>
|
---|
| 91 | <para>
|
---|
| 92 | Download MD5 sum: &unifont-md5sum;
|
---|
| 93 | </para>
|
---|
| 94 | </listitem>
|
---|
| 95 | <listitem>
|
---|
| 96 | <para>
|
---|
| 97 | Download size: &unifont-size;
|
---|
| 98 | </para>
|
---|
| 99 | </listitem>
|
---|
| 100 | </itemizedlist>
|
---|
| 101 |
|
---|
[672f2a5] | 102 | <itemizedlist spacing="compact">
|
---|
| 103 | <title>GCC (only needed if building on 32-bit LFS)</title>
|
---|
| 104 | <listitem>
|
---|
| 105 | <para>
|
---|
| 106 | Download (HTTP): <ulink url="&gcc-download-http;"/>
|
---|
| 107 | </para>
|
---|
| 108 | </listitem>
|
---|
| 109 | <listitem>
|
---|
| 110 | <para>
|
---|
| 111 | Download MD5 sum: &gcc-md5sum;
|
---|
| 112 | </para>
|
---|
| 113 | </listitem>
|
---|
| 114 | <listitem>
|
---|
| 115 | <para>
|
---|
| 116 | Download size: &gcc-size;
|
---|
| 117 | </para>
|
---|
| 118 | </listitem>
|
---|
| 119 | </itemizedlist>
|
---|
| 120 |
|
---|
[756a787] | 121 | <bridgehead renderas="sect3">GRUB Dependencies</bridgehead>
|
---|
| 122 |
|
---|
[6851ade] | 123 | <bridgehead renderas="sect4">Recommended (runtime)</bridgehead>
|
---|
[11ff30f] | 124 | <para role="required">
|
---|
| 125 | <xref role="runtime" linkend="efibootmgr"/>
|
---|
[756a787] | 126 | </para>
|
---|
| 127 |
|
---|
| 128 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 129 | <para role="recommended">
|
---|
| 130 | <xref linkend="freetype2"/>
|
---|
| 131 | </para>
|
---|
| 132 |
|
---|
| 133 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 134 | <para role="optional">
|
---|
| 135 | <xref linkend="lvm2"/>
|
---|
| 136 | </para>
|
---|
| 137 |
|
---|
| 138 | <para condition="html" role="usernotes">User Notes:
|
---|
| 139 | <ulink url="&blfs-wiki;/grub-efi"/></para>
|
---|
| 140 |
|
---|
| 141 | </sect2>
|
---|
| 142 |
|
---|
| 143 | <sect2 role="installation">
|
---|
| 144 | <title>Installation of GRUB</title>
|
---|
| 145 |
|
---|
| 146 | <para>
|
---|
[d5cc78a] | 147 | First, install font data as the
|
---|
[756a787] | 148 | <systemitem class="username">root</systemitem> user:
|
---|
| 149 | </para>
|
---|
| 150 |
|
---|
| 151 | <screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &&
|
---|
[ad34447a] | 152 | gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
|
---|
[756a787] | 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 |
|
---|
[672f2a5] | 165 | <para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
|
---|
| 166 |
|
---|
| 167 | <!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
|
---|
| 168 | <screen><userinput>case $(uname -m) in i?86 )
|
---|
[7ca5792] | 169 | <literal>tar xf ../gcc-&gcc-version;.tar.xz
|
---|
| 170 | mkdir gcc-&gcc-version;/build
|
---|
| 171 | pushd gcc-&gcc-version;/build
|
---|
[672f2a5] | 172 | ../configure --prefix=$PWD/../../x86_64-gcc \
|
---|
| 173 | --target=x86_64-linux-gnu \
|
---|
| 174 | --with-system-zlib \
|
---|
| 175 | --enable-languages=c,c++ \
|
---|
| 176 | --with-ld=/usr/bin/ld
|
---|
| 177 | make all-gcc
|
---|
| 178 | make install-gcc
|
---|
| 179 | popd
|
---|
| 180 | export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
|
---|
| 181 | esac</userinput></screen>
|
---|
| 182 |
|
---|
[756a787] | 183 | <para>
|
---|
| 184 | Build <application>GRUB</application> with the following commands:
|
---|
| 185 | </para>
|
---|
| 186 |
|
---|
| 187 | <screen><userinput>./configure --prefix=/usr \
|
---|
| 188 | --sysconfdir=/etc \
|
---|
| 189 | --disable-efiemu \
|
---|
| 190 | --enable-grub-mkfont \
|
---|
| 191 | --with-platform=efi \
|
---|
[672f2a5] | 192 | --target=x86_64 \
|
---|
[756a787] | 193 | --disable-werror &&
|
---|
[672f2a5] | 194 | unset TARGET_CC &&
|
---|
[756a787] | 195 | make</userinput></screen>
|
---|
| 196 |
|
---|
| 197 | <para>
|
---|
[d5cc78a] | 198 | This package does not have a test suite providing meaningful results.
|
---|
[756a787] | 199 | </para>
|
---|
| 200 |
|
---|
| 201 | <para>
|
---|
| 202 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 203 | </para>
|
---|
| 204 |
|
---|
| 205 | <screen role="root"><userinput>make install &&
|
---|
| 206 | mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
|
---|
| 207 |
|
---|
| 208 | </sect2>
|
---|
| 209 |
|
---|
| 210 | <sect2 role="commands">
|
---|
| 211 | <title>Command Explanations</title>
|
---|
| 212 |
|
---|
| 213 | <para>
|
---|
[d5cc78a] | 214 | <parameter>--enable-grub-mkfont</parameter>: Build the tool named
|
---|
| 215 | <command>grub-mkfont</command> to generate the font file for the boot
|
---|
| 216 | loader from the font data we've installed.
|
---|
[756a787] | 217 | </para>
|
---|
| 218 |
|
---|
| 219 | <warning>
|
---|
| 220 | <para>If the recommended dependency <xref linkend="freetype2"/> is not
|
---|
[d5cc78a] | 221 | installed, it is possible to omit this option and build GRUB. However,
|
---|
[756a787] | 222 | if <command>grub-mkfont</command> is not built, or the unicode font
|
---|
[2c87187] | 223 | data is not available at the time GRUB is built, GRUB won't install
|
---|
[756a787] | 224 | any font for the boot loader. The GRUB boot menu will be displayed
|
---|
[d5cc78a] | 225 | using a coarse font and the early stage of kernel initialization will be
|
---|
| 226 | in <quote>blind mode</quote> — you can't see any kernel messages before
|
---|
[756a787] | 227 | the graphics card driver is initialized. It will be very difficult to
|
---|
[d5cc78a] | 228 | diagnose some boot issues, especially if the graphics driver is
|
---|
| 229 | built as module.</para>
|
---|
[756a787] | 230 | </warning>
|
---|
| 231 |
|
---|
| 232 | <para>
|
---|
[d5cc78a] | 233 | <parameter>--with-platform=efi</parameter>: Ensures building GRUB with
|
---|
| 234 | EFI enabled.
|
---|
[756a787] | 235 | </para>
|
---|
| 236 |
|
---|
[e724cb7] | 237 | <para>
|
---|
[672f2a5] | 238 | <parameter>--target=x86_64</parameter>: Ensures building GRUB for
|
---|
| 239 | x86_64 even if building on a 32-bit LFS system. Most EFI firmwares
|
---|
| 240 | on x86_64 does not support 32-bit bootloaders.
|
---|
| 241 | </para>
|
---|
| 242 |
|
---|
| 243 | <para>
|
---|
| 244 | <option>--target=i386</option>: A few 32-bit x86 platforms have EFI
|
---|
| 245 | support. And, some x86_64 platforms have a 32-bit EFI implementation,
|
---|
| 246 | but they are very old and rare. Use this instead of
|
---|
| 247 | <parameter>--target=x86_64</parameter> if you are
|
---|
| 248 | <emphasis role='bold'>absolutely sure</emphasis> that LFS is running
|
---|
| 249 | on such a system.
|
---|
[e724cb7] | 250 | </para>
|
---|
| 251 |
|
---|
[756a787] | 252 | </sect2>
|
---|
| 253 |
|
---|
| 254 | <sect2>
|
---|
| 255 | <title>Configuring GRUB</title>
|
---|
| 256 |
|
---|
| 257 | <para>
|
---|
| 258 | Using GRUB to make the LFS system bootable on UEFI platform will be
|
---|
| 259 | discussed in <xref linkend="grub-setup"/>.
|
---|
| 260 | </para>
|
---|
| 261 | </sect2>
|
---|
| 262 |
|
---|
| 263 | <sect2 role="content">
|
---|
| 264 | <title>Contents</title>
|
---|
| 265 |
|
---|
| 266 | <para>See the page for GRUB in LFS book.</para>
|
---|
| 267 | </sect2>
|
---|
| 268 |
|
---|
| 269 | </sect1>
|
---|