2004-05-03 22:28:58 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2007-03-21 18:42:58 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2005-02-19 22:16:42 +00:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
2006-02-05 13:17:43 +00:00
|
|
|
|
2004-05-03 22:28:58 +01:00
|
|
|
<sect1 id="ch-system-kernfs">
|
2006-02-05 13:17:43 +00:00
|
|
|
<?dbhtml filename="kernfs.html"?>
|
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<title>Preparing Virtual Kernel File Systems</title>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<indexterm zone="ch-system-kernfs">
|
|
|
|
<primary sortas="e-/dev/">/dev/*</primary>
|
|
|
|
</indexterm>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<para>Various file systems exported by the kernel are used to communicate to
|
|
|
|
and from the kernel itself. These file systems are virtual in that no disk
|
|
|
|
space is used for them. The content of the file systems resides in
|
|
|
|
memory.</para>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<para>Begin by creating directories onto which the file systems will be
|
|
|
|
mounted:</para>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2009-11-09 20:29:43 +00:00
|
|
|
<screen><userinput>mkdir -v $LFS/{dev,proc,sys}</userinput></screen>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<sect2>
|
|
|
|
<title>Creating Initial Device Nodes</title>
|
|
|
|
|
|
|
|
<para>When the kernel boots the system, it requires the presence of a few
|
|
|
|
device nodes, in particular the <filename
|
|
|
|
class="devicefile">console</filename> and <filename
|
|
|
|
class="devicefile">null</filename> devices. The device nodes will be created
|
2006-04-13 21:17:52 +01:00
|
|
|
on the hard disk so that they are available before <command>udevd</command>
|
|
|
|
has been started, and additionally when Linux is started with
|
|
|
|
<parameter>init=/bin/bash</parameter>. Create the devices by running the
|
2006-04-13 19:45:33 +01:00
|
|
|
following commands:</para>
|
|
|
|
|
|
|
|
<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
|
|
|
|
mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="ch-system-bindmount">
|
|
|
|
<title>Mounting and Populating /dev</title>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<para>The recommended method of populating the <filename
|
|
|
|
class="directory">/dev</filename> directory with devices is to mount a
|
|
|
|
virtual filesystem (such as <systemitem
|
|
|
|
class="filesystem">tmpfs</systemitem>) on the <filename
|
|
|
|
class="directory">/dev</filename> directory, and allow the devices to be
|
|
|
|
created dynamically on that virtual filesystem as they are detected or
|
2010-07-18 22:27:21 +01:00
|
|
|
accessed. Device creation is generally done during the boot process
|
|
|
|
by Udev. Since this new system does not yet have Udev and has not yet
|
|
|
|
been booted, it is necessary to mount and populate <filename
|
2006-04-13 19:45:33 +01:00
|
|
|
class="directory">/dev</filename> manually. This is accomplished by bind
|
|
|
|
mounting the host system's <filename class="directory">/dev</filename>
|
|
|
|
directory. A bind mount is a special type of mount that allows you to
|
|
|
|
create a mirror of a directory or mount point to some other location. Use
|
|
|
|
the following command to achieve this:</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2007-02-24 04:56:32 +00:00
|
|
|
<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
|
2006-04-13 19:45:33 +01:00
|
|
|
|
|
|
|
</sect2>
|
2006-08-03 20:29:29 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
<sect2 id="ch-system-kernfsmount">
|
|
|
|
<title>Mounting Virtual Kernel File Systems</title>
|
|
|
|
|
|
|
|
<para>Now mount the remaining virtual kernel filesystems:</para>
|
|
|
|
|
|
|
|
<screen><userinput>mount -vt devpts devpts $LFS/dev/pts
|
|
|
|
mount -vt tmpfs shm $LFS/dev/shm
|
|
|
|
mount -vt proc proc $LFS/proc
|
|
|
|
mount -vt sysfs sysfs $LFS/sys</userinput></screen>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
2006-04-13 19:45:33 +01:00
|
|
|
</sect2>
|
2004-05-03 22:28:58 +01:00
|
|
|
|
|
|
|
</sect1>
|