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

clfs-3.0.0-sysvinit sysvinit
Last change on this file since c318be6 was 24b004c, checked in by Chris Staub <chris@…>, 11 years ago

Remove end-of-line spaces

  • 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, /dev/console and /dev/null, are required to be
41 present on the filesystem. These are needed by the kernel even before
42 starting Eudev early in the boot process, so we create them here:</para>
43
44<screen><userinput>mknod -m 600 ${CLFS}/dev/console c 5 1
45mknod -m 666 ${CLFS}/dev/null c 1 3</userinput></screen>
46
47 <para>Once the system is complete and booting, the rest of our device
48 nodes are created by Udev, part of Systemd. Since this package is not
49 available to us right now, we must take other steps to provide device
50 nodes under on the CLFS filesystem. We will use the <quote>bind</quote>
51 option in the mount command to make our host system's /dev structure
52 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.