Applications running in user space utilize various file systems exported by the kernel to communicate with the kernel itself. These file systems are virtual: no disk space is used for them. The content of the file systems resides in memory. These file systems must be mounted in the $LFS directory tree so the applications can find them in the chroot environment.
Begin by creating directories on which the file systems will be mounted:
mkdir -pv $LFS/{dev,proc,sys,run}
During a normal boot of the LFS system, the kernel automatically
mounts the devtmpfs
filesystem on
the /dev
directory; the kernel
creates device nodes on that virtual filesystem during the boot
process or when a device is first detected or accessed. The udev
daemon may change the owner or permission of the device nodes
created by the kernel, or create new device nodes or symlinks to
ease the work of distro maintainers or system administrators. (See
Section 9.3.2.2,
« Création de nœuds de périphérique » for details.)
If the host kernel supports devtmpfs
, we can simply mount a devtmpfs
at $LFS/dev
and rely on the kernel to populate it
(the LFS building process does not need the additional work onto
devtmpfs
by udev daemon).
But, some host kernels may lack devtmpfs
support and these host distros
maintain the content of /dev
with
different methods. So the only host-agnostic way for populating
$LFS/dev
is bind mounting the host
system's /dev
directory. A bind mount
is a special type of mount that allows you to create a mirror of a
directory or mount point at some other location. Use the following
command to do this:
mount -v --bind /dev $LFS/dev
Montez maintenant les systèmes de fichiers virtuels du noyau restants :
mount -v --bind /dev/pts $LFS/dev/pts mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run
Dans certains systèmes hôtes, /dev/shm
est un lien symbolique vers /run/shm
. Le tmpfs /run a été monté tout à
l'heure, donc vous ne devez créer un répertoire que dans ce cas
précis.
In other host systems /dev/shm
is a
mount point for a tmpfs. In that case the mount of /dev above will
only create /dev/shm as a directory in the chroot environment. In
this situation we must explicitly mount a tmpfs:
if [ -h $LFS/dev/shm ]; then mkdir -pv $LFS/$(readlink $LFS/dev/shm) else mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm fi