[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">
|
---|
[dbb689b] | 15 | <!ENTITY unifont-md5sum "94ff8cb4d5674cd2f38b00cede5e06d5">
|
---|
[7cff22d] | 16 | <!ENTITY unifont-size "1.4 MB">
|
---|
[756a787] | 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 |
|
---|
[c6c286b] | 38 | &lfs113_checked;
|
---|
[756a787] | 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 |
|
---|
[6f87ba86] | 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 |
|
---|
[756a787] | 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 |
|
---|
[672f2a5] | 104 | <itemizedlist spacing="compact">
|
---|
| 105 | <title>GCC (only needed if building on 32-bit LFS)</title>
|
---|
| 106 | <listitem>
|
---|
| 107 | <para>
|
---|
[bd141376] | 108 | Refer to <xref linkend='gcc'/> page for download info.
|
---|
[672f2a5] | 109 | </para>
|
---|
| 110 | </listitem>
|
---|
| 111 | </itemizedlist>
|
---|
| 112 |
|
---|
[756a787] | 113 | <bridgehead renderas="sect3">GRUB Dependencies</bridgehead>
|
---|
| 114 |
|
---|
| 115 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 116 | <para role="recommended">
|
---|
[8013518e] | 117 | <xref role="runtime" linkend="efibootmgr"/> (runtime) and
|
---|
[756a787] | 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>
|
---|
[d5cc78a] | 133 | First, install font data as the
|
---|
[756a787] | 134 | <systemitem class="username">root</systemitem> user:
|
---|
| 135 | </para>
|
---|
| 136 |
|
---|
| 137 | <screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &&
|
---|
[ad34447a] | 138 | gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
|
---|
[756a787] | 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 |
|
---|
[6f87ba86] | 151 | <para>
|
---|
| 152 | Fix an issue causing <command>grub-install</command> to fail when the
|
---|
| 153 | <filename class='directory'>/boot</filename> partition (or the root
|
---|
| 154 | partition if <filename class='directory'>/boot</filename> is not a
|
---|
| 155 | separate partition) is created by e2fsprogs-1.47.0 or later:
|
---|
| 156 | </para>
|
---|
| 157 |
|
---|
| 158 | <screen><userinput>patch -Np1 -i ../grub-&grub-version;-upstream_fixes-1.patch</userinput></screen>
|
---|
| 159 |
|
---|
[672f2a5] | 160 | <para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
|
---|
| 161 |
|
---|
| 162 | <!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
|
---|
| 163 | <screen><userinput>case $(uname -m) in i?86 )
|
---|
[7ca5792] | 164 | <literal>tar xf ../gcc-&gcc-version;.tar.xz
|
---|
| 165 | mkdir gcc-&gcc-version;/build
|
---|
| 166 | pushd gcc-&gcc-version;/build
|
---|
[672f2a5] | 167 | ../configure --prefix=$PWD/../../x86_64-gcc \
|
---|
| 168 | --target=x86_64-linux-gnu \
|
---|
| 169 | --with-system-zlib \
|
---|
| 170 | --enable-languages=c,c++ \
|
---|
| 171 | --with-ld=/usr/bin/ld
|
---|
| 172 | make all-gcc
|
---|
| 173 | make install-gcc
|
---|
| 174 | popd
|
---|
| 175 | export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
|
---|
| 176 | esac</userinput></screen>
|
---|
| 177 |
|
---|
[756a787] | 178 | <para>
|
---|
| 179 | Build <application>GRUB</application> with the following commands:
|
---|
| 180 | </para>
|
---|
| 181 |
|
---|
| 182 | <screen><userinput>./configure --prefix=/usr \
|
---|
| 183 | --sysconfdir=/etc \
|
---|
| 184 | --disable-efiemu \
|
---|
| 185 | --enable-grub-mkfont \
|
---|
| 186 | --with-platform=efi \
|
---|
[672f2a5] | 187 | --target=x86_64 \
|
---|
[756a787] | 188 | --disable-werror &&
|
---|
[672f2a5] | 189 | unset TARGET_CC &&
|
---|
[756a787] | 190 | make</userinput></screen>
|
---|
| 191 |
|
---|
| 192 | <para>
|
---|
[d5cc78a] | 193 | This package does not have a test suite providing meaningful results.
|
---|
[756a787] | 194 | </para>
|
---|
| 195 |
|
---|
| 196 | <para>
|
---|
| 197 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 198 | </para>
|
---|
| 199 |
|
---|
| 200 | <screen role="root"><userinput>make install &&
|
---|
| 201 | mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
|
---|
| 202 |
|
---|
| 203 | </sect2>
|
---|
| 204 |
|
---|
| 205 | <sect2 role="commands">
|
---|
| 206 | <title>Command Explanations</title>
|
---|
| 207 |
|
---|
| 208 | <para>
|
---|
[d5cc78a] | 209 | <parameter>--enable-grub-mkfont</parameter>: Build the tool named
|
---|
| 210 | <command>grub-mkfont</command> to generate the font file for the boot
|
---|
| 211 | loader from the font data we've installed.
|
---|
[756a787] | 212 | </para>
|
---|
| 213 |
|
---|
| 214 | <warning>
|
---|
| 215 | <para>If the recommended dependency <xref linkend="freetype2"/> is not
|
---|
[d5cc78a] | 216 | installed, it is possible to omit this option and build GRUB. However,
|
---|
[756a787] | 217 | if <command>grub-mkfont</command> is not built, or the unicode font
|
---|
[2c87187] | 218 | data is not available at the time GRUB is built, GRUB won't install
|
---|
[756a787] | 219 | any font for the boot loader. The GRUB boot menu will be displayed
|
---|
[0cef3a67] | 220 | using a coarse font or in a smaller region on the screen.</para>
|
---|
[756a787] | 221 | </warning>
|
---|
| 222 |
|
---|
| 223 | <para>
|
---|
[d5cc78a] | 224 | <parameter>--with-platform=efi</parameter>: Ensures building GRUB with
|
---|
| 225 | EFI enabled.
|
---|
[756a787] | 226 | </para>
|
---|
| 227 |
|
---|
[e724cb7] | 228 | <para>
|
---|
[672f2a5] | 229 | <parameter>--target=x86_64</parameter>: Ensures building GRUB for
|
---|
[ee763b6] | 230 | x86_64 even if building on a 32-bit LFS system. Most EFI firmware
|
---|
[672f2a5] | 231 | on x86_64 does not support 32-bit bootloaders.
|
---|
| 232 | </para>
|
---|
| 233 |
|
---|
| 234 | <para>
|
---|
| 235 | <option>--target=i386</option>: A few 32-bit x86 platforms have EFI
|
---|
| 236 | support. And, some x86_64 platforms have a 32-bit EFI implementation,
|
---|
| 237 | but they are very old and rare. Use this instead of
|
---|
| 238 | <parameter>--target=x86_64</parameter> if you are
|
---|
| 239 | <emphasis role='bold'>absolutely sure</emphasis> that LFS is running
|
---|
| 240 | on such a system.
|
---|
[e724cb7] | 241 | </para>
|
---|
| 242 |
|
---|
[756a787] | 243 | </sect2>
|
---|
| 244 |
|
---|
| 245 | <sect2>
|
---|
| 246 | <title>Configuring GRUB</title>
|
---|
| 247 |
|
---|
| 248 | <para>
|
---|
| 249 | Using GRUB to make the LFS system bootable on UEFI platform will be
|
---|
| 250 | discussed in <xref linkend="grub-setup"/>.
|
---|
| 251 | </para>
|
---|
| 252 | </sect2>
|
---|
| 253 |
|
---|
| 254 | <sect2 role="content">
|
---|
| 255 | <title>Contents</title>
|
---|
| 256 |
|
---|
| 257 | <para>See the page for GRUB in LFS book.</para>
|
---|
| 258 | </sect2>
|
---|
| 259 |
|
---|
| 260 | </sect1>
|
---|