8.62. GRUB-2.06

The GRUB package contains the GRand Unified Bootloader.

Approximate build time: 0.3 SBU
Required disk space: 161 MB

8.62.1. Installation of GRUB



On ARM64 systems, the following instruction builds GRUB for UEFI. But the built GRUB lacks some features because a few optional dependencies of GRUB for UEFI is beyond the scope of LFS and not installed yet.

If your system firmware does not support UEFI, you need to skip the content of this page and try to figure out how to boot your system.

If your system has UEFI support and you wish to boot LFS with UEFI, you can skip this package in LFS, and install GRUB with UEFI support (and its dependencies) by following the instructions on the BLFS page (with --target=x86_64 removed).



Unset any environment variables which may affect the build:


Don't try tuning this package with custom compilation flags. This package is a bootloader. The low-level operations in the source code may be broken by aggressive optimization.

Fix an issue causing grub-install to fail when the /boot partition (or the root partition if /boot is not a separate partition) is created by e2fsprogs-1.47.0 or later:

patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch

Apply an upstream change so GRUB will be capable to load compressed kernel image on an ARM64 system:

sed '/ARMXX_MAGIC/,+2d' -i grub-core/loader/arm64/linux.c

Prepare GRUB for compilation:

./configure --prefix=/usr          \
            --sysconfdir=/etc      \
            --disable-efiemu       \

The meaning of the new configure options:


This allows the build to complete with warnings introduced by more recent versions of Flex.


This option minimizes what is built by disabling a feature and eliminating some test programs not needed for LFS.

Compile the package:


The test suite for this packages is not recommended. Most of the tests depend on packages that are not available in the limited LFS environment. To run the tests anyway, run make check.

Install the package:

make install
mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions

Making your LFS system bootable with GRUB will be discussed in Section 10.4, “Using GRUB to Set Up the Boot Process”.

8.62.2. Contents of GRUB

Installed programs: grub-bios-setup, grub-editenv, grub-file, grub-fstest, grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, grub-menulst2cfg, grub-mkconfig, grub-mkimage, grub-mklayout, grub-mknetdir, grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, grub-ofpathname, grub-probe, grub-reboot, grub-render-label, grub-script-check, grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg
Installed directories: /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install is first run)

Short Descriptions


Is a helper program for grub-install


Is a tool to edit the environment block


Checks to see if the given file is of the specified type


Is a tool to debug the filesystem driver


Glues 32-bit and 64-bit binaries into a single file (for Apple machines)


Installs GRUB on your drive


Is a script that converts an xkb layout into one recognized by GRUB


Is the Mac-style bless for HFS or HFS+ file systems (bless is peculiar to Apple machines; it makes a device bootable)


Converts a GRUB Legacy menu.lst into a grub.cfg for use with GRUB 2


Generates a grub.cfg file


Makes a bootable image of GRUB


Generates a GRUB keyboard layout file


Prepares a GRUB netboot directory


Generates an encrypted PBKDF2 password for use in the boot menu


Makes a system pathname relative to its root


Makes a bootable image of GRUB suitable for a floppy disk, CDROM/DVD, or a USB drive


Generates a standalone image


Is a helper program that prints the path to a GRUB device


Probes device information for a given path or device


Sets the default boot entry for GRUB for the next boot only


Renders Apple .disk_label for Apple Macs


Checks the GRUB configuration script for syntax errors


Sets the default boot entry for GRUB


Is a helper program for grub-setup


Transforms a syslinux config file into grub.cfg format