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