2020-06-07 21:16:00 +01: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;
|
|
|
|
]>
|
|
|
|
|
|
|
|
<sect1 id="ch-tools-kernfs">
|
|
|
|
<?dbhtml filename="kernfs.html"?>
|
|
|
|
|
|
|
|
<title>Preparing Virtual Kernel File Systems</title>
|
|
|
|
|
|
|
|
<indexterm zone="ch-tools-kernfs">
|
|
|
|
<primary sortas="e-/dev/">/dev/*</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<para>Begin by creating directories onto which the file systems will be
|
|
|
|
mounted:</para>
|
|
|
|
|
2021-08-25 06:30:13 +01:00
|
|
|
<screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen>
|
2020-06-07 21:16:00 +01:00
|
|
|
|
2020-06-22 21:51:45 +01:00
|
|
|
<sect2 id="ch-tools-kernfsmount">
|
2020-06-07 21:16:00 +01:00
|
|
|
<title>Mounting Virtual Kernel File Systems</title>
|
|
|
|
|
2021-08-25 06:30:13 +01:00
|
|
|
<para>The kernel has already mounted
|
|
|
|
<systemitem class="filesystem">devtmpfs</systemitem>.
|
|
|
|
Mount the remaining virtual kernel filesystems:</para>
|
|
|
|
|
|
|
|
<screen><userinput>mkdir -pv /dev/{pts,shm}
|
|
|
|
mount -vt devpts /dev/pts /dev/pts -o gid=5,mode=620
|
|
|
|
mount -vt proc proc /proc
|
|
|
|
mount -vt sysfs sysfs /sys
|
|
|
|
mount -vt tmpfs tmpfs /run
|
|
|
|
mount -vt tmpfs tmpfs /dev/shm</userinput></screen>
|
2020-06-07 21:16:00 +01:00
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<title>The meaning of the mount options for devpts:</title>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>gid=5</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>This ensures that all devpts-created device nodes are owned by
|
|
|
|
group ID 5. This is the ID we will use later on for the <systemitem
|
|
|
|
class="groupname">tty</systemitem> group. We use the group ID instead
|
|
|
|
of a name, since the host system might use a different ID for its
|
|
|
|
<systemitem class="groupname">tty</systemitem> group.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>mode=0620</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>This ensures that all devpts-created device nodes have mode 0620
|
|
|
|
(user readable and writable, group writable). Together with the
|
|
|
|
option above, this ensures that devpts will create device nodes that
|
|
|
|
meet the requirements of grantpt(), meaning the Glibc
|
|
|
|
<command>pt_chown</command> helper binary (which is not installed by
|
|
|
|
default) is not necessary.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
2021-08-25 06:30:13 +01:00
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="ch-tools-devadjust">
|
|
|
|
<title>Adjusting devtmpfs</title>
|
|
|
|
|
|
|
|
<para>Now <systemitem class='filesystem'>proc</systemitem> filesystem
|
|
|
|
is mounted, we can replace the device nodes for standard I/O streams
|
|
|
|
with symlinks to pseudo files in
|
|
|
|
<filename class="directory">/proc/self/fd</filename> (which are symlinks
|
|
|
|
to the files connected to the standard I/O streams for the current
|
|
|
|
process). This is necessary for I/O redirection in the building system
|
|
|
|
of some packages to function properly:</para>
|
|
|
|
|
|
|
|
<screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin
|
|
|
|
ln -sfv /proc/self/fd/1 /dev/stdout
|
|
|
|
ln -sfv /proc/self/fd/2 /dev/stderr</userinput></screen>
|
2020-06-07 21:16:00 +01:00
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
</sect1>
|