source: chapter06/kernfs.xml@ d2c332bc

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since d2c332bc was d2c332bc, checked in by Archaic <archaic@…>, 18 years ago

Merged the udev_update branch to trunk.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7509 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-kernfs">
9 <?dbhtml filename="kernfs.html"?>
10
11 <title>Preparing Virtual Kernel File Systems</title>
12
13 <indexterm zone="ch-system-kernfs">
14 <primary sortas="e-/dev/">/dev/*</primary>
15 </indexterm>
16
17 <para>Various file systems exported by the kernel are used to communicate to
18 and from the kernel itself. These file systems are virtual in that no disk
19 space is used for them. The content of the file systems resides in
20 memory.</para>
21
22 <para>Begin by creating directories onto which the file systems will be
23 mounted:</para>
24
25<screen><userinput>mkdir -pv $LFS/{dev,proc,sys}</userinput></screen>
26
27 <sect2>
28 <title>Creating Initial Device Nodes</title>
29
30 <para>When the kernel boots the system, it requires the presence of a few
31 device nodes, in particular the <filename
32 class="devicefile">console</filename> and <filename
33 class="devicefile">null</filename> devices. The device nodes will be created
34 on the hard disk so that they are available before <command>udev</command>
35 has been started, and additionally when Linux is started in single user mode
36 (hence the restrictive permissions on <filename
37 class="devicefile">console</filename>). Create the devices by running the
38 following commands:</para>
39
40<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
41mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
42
43 </sect2>
44
45 <sect2 id="ch-system-bindmount">
46 <title>Mounting and Populating /dev</title>
47
48 <para>The recommended method of populating the <filename
49 class="directory">/dev</filename> directory with devices is to mount a
50 virtual filesystem (such as <systemitem
51 class="filesystem">tmpfs</systemitem>) on the <filename
52 class="directory">/dev</filename> directory, and allow the devices to be
53 created dynamically on that virtual filesystem as they are detected or
54 accessed. This is generally done during the boot process by Udev. Since
55 this new system does not yet have Udev and has not yet been booted, it is
56 necessary to mount and populate <filename
57 class="directory">/dev</filename> manually. This is accomplished by bind
58 mounting the host system's <filename class="directory">/dev</filename>
59 directory. A bind mount is a special type of mount that allows you to
60 create a mirror of a directory or mount point to some other location. Use
61 the following command to achieve this:</para>
62
63<screen><userinput>mount --bind /dev $LFS/dev</userinput></screen>
64
65 </sect2>
66
67 <sect2 id="ch-system-kernfsmount">
68 <title>Mounting Virtual Kernel File Systems</title>
69
70 <para>Now mount the remaining virtual kernel filesystems:</para>
71
72<screen><userinput>mount -vt devpts devpts $LFS/dev/pts
73mount -vt tmpfs shm $LFS/dev/shm
74mount -vt proc proc $LFS/proc
75mount -vt sysfs sysfs $LFS/sys</userinput></screen>
76
77 </sect2>
78
79</sect1>
Note: See TracBrowser for help on using the repository browser.