This chapter shows how to build the last missing bits of the temporary system: the tools needed to build the various packages. Now that all circular dependencies have been resolved, a “chroot” environment, completely isolated from the host operating system (except for the running kernel), can be used for the build.
For proper operation of the isolated environment, some communication with the running kernel must be established. This is done via the so-called Virtual Kernel File Systems, which will be mounted before entering the chroot environment. You may want to verify that they are mounted by issuing the findmnt command.
Until Section 7.4,
“Entering the Chroot Environment”, the commands must be run as
root, with the LFS variable set. After entering the aarch64 chroot,
all commands are run as root,
fortunately without access to the OS of the computer you built LFS
on. Be careful anyway, as it is easy to destroy the whole LFS system
with bad commands.
You have two options: download an aarch64 live ISO to boot, or copy a
static binary of qemu-aarch64-static to both the
host and chroot environment, possibly registering it with
/proc/sys/fs/binfmt_misc to enable
transparent emulation of aarch64 binaries on your host system.
More difficult is to configure a dedicated user with a limited
environment setting CFLAGS, CXXFLAGS, and LDFLAGS to
target the aarch64 sysroot alongside an appropriate cross-compiler
such as aarch64-linux-gnu-gcc.