source: BOOK/chroot/common/kernfs.xml@ 8e667c11

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

Text updates to kernfs

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[3f8be484]1<?xml version="1.0" encoding="ISO-8859-1"?>
[aa18ac0]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[3f8be484]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
[d2ecc65]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>
[3f8be484]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
[040521bc]29<screen><userinput>mkdir -pv ${CLFS}/{dev,proc,sys}</userinput></screen>
[3f8be484]30
31 <para>Now mount the file systems:</para>
32
[040521bc]33<screen><userinput>mount -vt proc proc ${CLFS}/proc
34mount -vt sysfs sysfs ${CLFS}/sys</userinput></screen>
[3f8be484]35
[fb40919]36 <para>Remember that if for any reason you stop working on the CLFS system
[3f8be484]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
[1d396c4]40 <para>Two device nodes, <filename class="devicefile">/dev/console</filename>
41 and <filename class="devicefile">/dev/null</filename>, are required to be
[27e1607]42 present on the filesystem. These are needed by the kernel even before
[1d396c4]43 starting Udev early in the boot process, so we create them here:</para>
[3f8be484]44
[040521bc]45<screen><userinput>mknod -m 600 ${CLFS}/dev/console c 5 1
46mknod -m 666 ${CLFS}/dev/null c 1 3</userinput></screen>
[27e1607]47
48 <para>Once the system is complete and booting, the rest of our device
[1d396c4]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>
[27e1607]53
[040521bc]54<screen><userinput>mount -v -o bind /dev ${CLFS}/dev</userinput></screen>
[27e1607]55
[24b004c]56 <para>Additional file systems will soon be mounted from within the chroot
[27e1607]57 environment. To keep the host up to date, perform a <quote>fake mount</quote>
58 for each of these now:</para>
59
[ebfb62d]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
[8f1ae86]68mount -f -vt devpts -o gid=&gid-tty;,mode=620 devpts ${CLFS}/dev/pts</userinput></screen>
[3f8be484]69
70</sect1>
Note: See TracBrowser for help on using the repository browser.