2021-03-24 01:49:08 +08:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
|
|
<!ENTITY % general-entities SYSTEM "../../../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
|
2021-06-16 15:39:36 +08:00
|
|
|
<!ENTITY grub-efi-download-http "https://ftp.gnu.org/gnu/grub/grub-&grub-version;.tar.xz">
|
2021-03-24 01:49:08 +08:00
|
|
|
<!ENTITY grub-efi-download-ftp " ">
|
2021-06-16 15:39:36 +08:00
|
|
|
<!ENTITY grub-efi-md5sum "cf0fd928b1e5479c8108ee52cb114363">
|
|
|
|
<!ENTITY grub-efi-size "6.3 MB">
|
2022-02-17 23:43:37 +08:00
|
|
|
<!ENTITY grub-efi-buildsize "137 MB">
|
2022-02-26 16:26:38 +08:00
|
|
|
<!ENTITY grub-efi-time "1.0 SBU (on 64-bit LFS)">
|
2021-03-24 01:49:08 +08:00
|
|
|
|
2021-04-05 20:36:04 +08:00
|
|
|
<!ENTITY unifont-download-http "https://unifoundry.com/pub/unifont/unifont-&unifont-version;/font-builds/unifont-&unifont-version;.pcf.gz">
|
2023-02-15 15:14:55 +08:00
|
|
|
<!ENTITY unifont-md5sum "c371b9b4a8a51228c468cc7efccec098">
|
|
|
|
<!ENTITY unifont-size "1.4 MB">
|
2022-02-26 16:26:38 +08:00
|
|
|
|
|
|
|
<!ENTITY gcc-download-http "&gnu-http;/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.xz">
|
2023-05-07 10:17:43 +08:00
|
|
|
<!ENTITY gcc-md5sum "43e4de77f2218c83ca675257ea1af9ef">
|
|
|
|
<!ENTITY gcc-size "84 MB">
|
2021-03-24 01:49:08 +08:00
|
|
|
]>
|
|
|
|
|
|
|
|
<sect1 id="grub-efi" xreflabel="GRUB-&grub-version; for EFI">
|
|
|
|
<?dbhtml filename="grub-efi.html"?>
|
|
|
|
|
|
|
|
|
|
|
|
<title>GRUB-&grub-version; for EFI</title>
|
|
|
|
|
|
|
|
<indexterm zone="grub-efi">
|
|
|
|
<primary sortas="a-grub-efi">grub-efi</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<sect2 role="package">
|
|
|
|
<title>Introduction to GRUB</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <application>GRUB</application> package provides GRand Unified
|
|
|
|
Bootloader. In this page it will be built with UEFI support, which
|
|
|
|
is not enabled for GRUB built in LFS.
|
|
|
|
</para>
|
|
|
|
|
2023-02-18 18:05:40 +08:00
|
|
|
&lfs113_checked;
|
2021-03-24 01:49:08 +08:00
|
|
|
|
|
|
|
<bridgehead renderas="sect3">Package Information</bridgehead>
|
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download (HTTP): <ulink url="&grub-efi-download-http;"/>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download (FTP): <ulink url="&grub-efi-download-ftp;"/>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download MD5 sum: &grub-efi-md5sum;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download size: &grub-efi-size;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Estimated disk space required: &grub-efi-buildsize;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Estimated build time: &grub-efi-time;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
|
|
|
|
2023-02-18 18:04:26 +08:00
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Required patch:
|
|
|
|
<ulink url="&patch-root;/grub-&grub-version;-upstream_fixes-1.patch"/>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2021-03-24 01:49:08 +08:00
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<title>Unicode font data used to display GRUB menu</title>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download (HTTP): <ulink url="&unifont-download-http;"/>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download MD5 sum: &unifont-md5sum;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download size: &unifont-size;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2022-02-26 16:26:38 +08:00
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<title>GCC (only needed if building on 32-bit LFS)</title>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download (HTTP): <ulink url="&gcc-download-http;"/>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download MD5 sum: &gcc-md5sum;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Download size: &gcc-size;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2021-03-24 01:49:08 +08:00
|
|
|
<bridgehead renderas="sect3">GRUB Dependencies</bridgehead>
|
|
|
|
|
|
|
|
<bridgehead renderas="sect4">Recommended</bridgehead>
|
|
|
|
<para role="recommended">
|
2022-08-28 23:01:36 +08:00
|
|
|
<xref role="runtime" linkend="efibootmgr"/> (runtime) and
|
2021-03-24 01:49:08 +08:00
|
|
|
<xref linkend="freetype2"/>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<bridgehead renderas="sect4">Optional</bridgehead>
|
|
|
|
<para role="optional">
|
|
|
|
<xref linkend="lvm2"/>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="installation">
|
|
|
|
<title>Installation of GRUB</title>
|
|
|
|
|
|
|
|
<para>
|
2021-03-24 03:24:51 +08:00
|
|
|
First, install font data as the
|
2021-03-24 01:49:08 +08:00
|
|
|
<systemitem class="username">root</systemitem> user:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen role="root"><userinput>mkdir -pv /usr/share/fonts/unifont &&
|
2021-05-31 14:22:19 +08:00
|
|
|
gunzip -c ../unifont-&unifont-version;.pcf.gz > /usr/share/fonts/unifont/unifont.pcf</userinput></screen>
|
2021-03-24 01:49:08 +08:00
|
|
|
|
|
|
|
<warning>
|
|
|
|
<para>Unset any environment variables which may affect the build:</para>
|
|
|
|
|
|
|
|
<screen><userinput>unset {C,CPP,CXX,LD}FLAGS</userinput></screen>
|
|
|
|
|
|
|
|
<para>Don't try <quote>tuning</quote> this package with custom
|
|
|
|
compilation flags: this package is a bootloader, with low-level
|
|
|
|
operations in the source code which is likely to be broken by some
|
|
|
|
aggressive optimizations.</para>
|
|
|
|
</warning>
|
|
|
|
|
2023-02-18 18:04:26 +08:00
|
|
|
<para>
|
|
|
|
Fix an issue causing <command>grub-install</command> to fail when the
|
|
|
|
<filename class='directory'>/boot</filename> partition (or the root
|
|
|
|
partition if <filename class='directory'>/boot</filename> is not a
|
|
|
|
separate partition) is created by e2fsprogs-1.47.0 or later:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen><userinput>patch -Np1 -i ../grub-&grub-version;-upstream_fixes-1.patch</userinput></screen>
|
|
|
|
|
2022-02-26 16:26:38 +08:00
|
|
|
<para>If you are running a 32-bit LFS, prepare a 64-bit compiler:</para>
|
|
|
|
|
|
|
|
<!-- 'literal' is used deliberately to show this is only for 32-bit LFS -->
|
|
|
|
<screen><userinput>case $(uname -m) in i?86 )
|
2022-05-10 00:39:01 +08:00
|
|
|
<literal>tar xf ../gcc-&gcc-version;.tar.xz
|
|
|
|
mkdir gcc-&gcc-version;/build
|
|
|
|
pushd gcc-&gcc-version;/build
|
2022-02-26 16:26:38 +08:00
|
|
|
../configure --prefix=$PWD/../../x86_64-gcc \
|
|
|
|
--target=x86_64-linux-gnu \
|
|
|
|
--with-system-zlib \
|
|
|
|
--enable-languages=c,c++ \
|
|
|
|
--with-ld=/usr/bin/ld
|
|
|
|
make all-gcc
|
|
|
|
make install-gcc
|
|
|
|
popd
|
|
|
|
export TARGET_CC=$PWD/x86_64-gcc/bin/x86_64-linux-gnu-gcc</literal>
|
|
|
|
esac</userinput></screen>
|
|
|
|
|
2021-03-24 01:49:08 +08:00
|
|
|
<para>
|
|
|
|
Build <application>GRUB</application> with the following commands:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen><userinput>./configure --prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--disable-efiemu \
|
|
|
|
--enable-grub-mkfont \
|
|
|
|
--with-platform=efi \
|
2022-02-26 16:26:38 +08:00
|
|
|
--target=x86_64 \
|
2021-03-24 01:49:08 +08:00
|
|
|
--disable-werror &&
|
2022-02-26 16:26:38 +08:00
|
|
|
unset TARGET_CC &&
|
2021-03-24 01:49:08 +08:00
|
|
|
make</userinput></screen>
|
|
|
|
|
|
|
|
<para>
|
2021-03-24 03:24:51 +08:00
|
|
|
This package does not have a test suite providing meaningful results.
|
2021-03-24 01:49:08 +08:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Now, as the <systemitem class="username">root</systemitem> user:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen role="root"><userinput>make install &&
|
|
|
|
mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="commands">
|
|
|
|
<title>Command Explanations</title>
|
|
|
|
|
|
|
|
<para>
|
2021-03-24 03:24:51 +08:00
|
|
|
<parameter>--enable-grub-mkfont</parameter>: Build the tool named
|
|
|
|
<command>grub-mkfont</command> to generate the font file for the boot
|
|
|
|
loader from the font data we've installed.
|
2021-03-24 01:49:08 +08:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<warning>
|
|
|
|
<para>If the recommended dependency <xref linkend="freetype2"/> is not
|
2021-03-24 03:24:51 +08:00
|
|
|
installed, it is possible to omit this option and build GRUB. However,
|
2021-03-24 01:49:08 +08:00
|
|
|
if <command>grub-mkfont</command> is not built, or the unicode font
|
2022-02-17 05:04:13 +08:00
|
|
|
data is not available at the time GRUB is built, GRUB won't install
|
2021-03-24 01:49:08 +08:00
|
|
|
any font for the boot loader. The GRUB boot menu will be displayed
|
2023-03-17 22:49:47 +08:00
|
|
|
using a coarse font or in a smaller region on the screen.</para>
|
2021-03-24 01:49:08 +08:00
|
|
|
</warning>
|
|
|
|
|
|
|
|
<para>
|
2021-03-24 03:24:51 +08:00
|
|
|
<parameter>--with-platform=efi</parameter>: Ensures building GRUB with
|
|
|
|
EFI enabled.
|
2021-03-24 01:49:08 +08:00
|
|
|
</para>
|
|
|
|
|
2022-02-26 02:10:37 +08:00
|
|
|
<para>
|
2022-02-26 16:26:38 +08:00
|
|
|
<parameter>--target=x86_64</parameter>: Ensures building GRUB for
|
|
|
|
x86_64 even if building on a 32-bit LFS system. Most EFI firmwares
|
|
|
|
on x86_64 does not support 32-bit bootloaders.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<option>--target=i386</option>: A few 32-bit x86 platforms have EFI
|
|
|
|
support. And, some x86_64 platforms have a 32-bit EFI implementation,
|
|
|
|
but they are very old and rare. Use this instead of
|
|
|
|
<parameter>--target=x86_64</parameter> if you are
|
|
|
|
<emphasis role='bold'>absolutely sure</emphasis> that LFS is running
|
|
|
|
on such a system.
|
2022-02-26 02:10:37 +08:00
|
|
|
</para>
|
|
|
|
|
2021-03-24 01:49:08 +08:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2>
|
|
|
|
<title>Configuring GRUB</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Using GRUB to make the LFS system bootable on UEFI platform will be
|
|
|
|
discussed in <xref linkend="grub-setup"/>.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="content">
|
|
|
|
<title>Contents</title>
|
|
|
|
|
|
|
|
<para>See the page for GRUB in LFS book.</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
</sect1>
|