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

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since dc5ab7c 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
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
[27e1607]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
[e81586f]42 starting Eudev early in the boot process, so we create them here:</para>
[3f8be484]43
[040521bc]44<screen><userinput>mknod -m 600 ${CLFS}/dev/console c 5 1
45mknod -m 666 ${CLFS}/dev/null c 1 3</userinput></screen>
[27e1607]46
47 <para>Once the system is complete and booting, the rest of our device
[849369d]48 nodes are created by Udev, part of Systemd. Since this package is not
[27e1607]49 available to us right now, we must take other steps to provide device
[fb40919]50 nodes under on the CLFS filesystem. We will use the <quote>bind</quote>
[27e1607]51 option in the mount command to make our host system's /dev structure
[fb40919]52 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.