source: BOOK/chroot/common/kernfs.xml@ 7687260

clfs-3.0.0-systemd systemd
Last change on this file since 7687260 was 1d396c4, checked in by Chris Staub <chris@…>, 11 years ago

Text updates to kernfs

  • Property mode set to 100644
File size: 2.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-chroot-kernfs">
9 <?dbhtml filename="kernfs.html"?>
10
11 <title>Mounting Virtual Kernel File Systems</title>
12
13 <note os="a">
14 <para>The commands in the remainder of the book should be run as
15 the <systemitem class="username">root</systemitem> user. Check
16 that ${CLFS} is set in the
17 <systemitem class="username">root</systemitem> user&rsquo;s environment
18 before proceeding.</para>
19 </note>
20
21 <para>Various file systems exported by the kernel are used to communicate
22 to and from the kernel itself. These file systems are virtual in that no
23 disk space is used for them. The content of the file systems resides in
24 memory.</para>
25
26 <para>Begin by creating directories onto which the file systems will
27 be mounted:</para>
28
29<screen><userinput>mkdir -pv ${CLFS}/{dev,proc,sys}</userinput></screen>
30
31 <para>Now mount the file systems:</para>
32
33<screen><userinput>mount -vt proc proc ${CLFS}/proc
34mount -vt sysfs sysfs ${CLFS}/sys</userinput></screen>
35
36 <para>Remember that if for any reason you stop working on the CLFS system
37 and start again later, it is important to check that these file systems
38 are mounted again before entering the chroot environment.</para>
39
40 <para>Two device nodes, <filename class="devicefile">/dev/console</filename>
41 and <filename class="devicefile">/dev/null</filename>, are required to be
42 present on the filesystem. These are needed by the kernel even before
43 starting Udev early in the boot process, so we create them here:</para>
44
45<screen><userinput>mknod -m 600 ${CLFS}/dev/console c 5 1
46mknod -m 666 ${CLFS}/dev/null c 1 3</userinput></screen>
47
48 <para>Once the system is complete and booting, the rest of our device
49 nodes will be created by the kernel's
50 <systemitem class="filesystem">devtmpfs</systemitem> file system. For now
51 though, we will just use the <quote>bind</quote> option in the mount command
52 to make our host system's /dev structure appear in the new CLFS filesystem:</para>
53
54<screen><userinput>mount -v -o bind /dev ${CLFS}/dev</userinput></screen>
55
56 <para>Additional file systems will soon be mounted from within the chroot
57 environment. To keep the host up to date, perform a <quote>fake mount</quote>
58 for each of these now:</para>
59
60<screen><userinput>if [ -h ${CLFS}/dev/shm ]; then
61 link=$(readlink ${CLFS}/dev/shm)
62 mkdir -p ${CLFS}/$link
63 mount -f -vt tmpfs shm ${CLFS}/$link
64 unset link
65else
66 mount -f -vt tmpfs shm ${CLFS}/dev/shm
67fi
68mount -f -vt devpts -o gid=&gid-tty;,mode=620 devpts ${CLFS}/dev/pts</userinput></screen>
69
70</sect1>
Note: See TracBrowser for help on using the repository browser.