aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07
diff options
context:
space:
mode:
authorBryan Kadzban <bryan@linuxfromscratch.org>2012-02-04 23:37:17 +0000
committerBryan Kadzban <bryan@linuxfromscratch.org>2012-02-04 23:37:17 +0000
commit841b7235aa2c0d12622dff65a3a6c763f6f7493e (patch)
treed3cb5f17b7e63d7de9f2a0db6cb7654f03b8c8b2 /chapter07
parent6b13ebc66a82fec58a3ed531e79064d2ae28a0a3 (diff)
Change the recipe for wrapper kernel module dependencies to use the explicit soft-dependency support added to kmod. While I'm here, rewrite a bunch of the chapter-7 udev processing documentation, now that we use devtmpfs.
Fixes #3010. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9727 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07')
-rw-r--r--chapter07/udev.xml64
1 files changed, 38 insertions, 26 deletions
diff --git a/chapter07/udev.xml b/chapter07/udev.xml
index 3ceb7704c..33d10c17d 100644
--- a/chapter07/udev.xml
+++ b/chapter07/udev.xml
@@ -32,9 +32,9 @@
<para>Using the Udev method, only those devices which are detected by the
kernel get device nodes created for them. Because these device nodes will be
created each time the system boots, they will be stored on a <systemitem
- class="filesystem">tmpfs</systemitem> file system (a virtual file system that
- resides entirely in system memory). Device nodes do not require much space, so
- the memory that is used is negligible.</para>
+ class="filesystem">devtmpfs</systemitem> file system (a virtual file system
+ that resides entirely in system memory). Device nodes do not require much
+ space, so the memory that is used is negligible.</para>
<sect2>
<title>History</title>
@@ -87,8 +87,8 @@
class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename
class="directory">/sys</filename>), data which the built-in drivers
registered with <systemitem class="filesystem">sysfs</systemitem> are
- available to userspace processes and to <command>udevd</command> for device
- node creation.</para>
+ available to userspace processes and to <command>udevd</command> for
+ processing (including modifications to device nodes).</para>
</sect3>
@@ -132,24 +132,31 @@
<sect3>
<title>Device Node Creation</title>
- <para>To obtain the right major and minor number for a device, Udev
- relies on the information provided by <systemitem
- class="filesystem">sysfs</systemitem> in <filename
- class="directory">/sys</filename>. For example,
- <filename>/sys/class/tty/vcs/dev</filename> contains the string
- <quote>7:0</quote>. This string is used by <command>udevd</command> to
- create a device node with major number <emphasis>7</emphasis> and minor
- <emphasis>0</emphasis>. The names and permissions of the nodes created
- under the <filename class="directory">/dev</filename> directory are
- determined by rules specified in the files within the <filename
- class="directory">/etc/udev/rules.d/</filename> directory. These are
- numbered in a similar fashion to the LFS-Bootscripts package. If
- <command>udevd</command> can't find a rule for the device it is creating,
- it will default permissions to <emphasis>660</emphasis> and ownership to
- <emphasis>root:root</emphasis>. Documentation on the syntax of the Udev
- rules configuration files are available in
- <filename>/usr/share/doc/udev-&udev-version;/writing_udev_rules/index.html</filename>
- </para>
+ <para>As of Udev-&udev-version;, <command>udevd</command> no longer
+ creates device files in <filename class="directory">/dev</filename>.
+ Instead, this must be handled in the kernel, by the <systemitem
+ class="filesystem">devtmpfs</systemitem> filesystem. Any driver that
+ wishes to register a device node will go through <systemitem
+ class="filesystem">devtmpfs</systemitem> (via the driver core) to do it.
+ When a <systemitem class="filesystem">devtmpfs</systemitem> instance is
+ mounted on <filename class="directory">/dev</filename>, the device node
+ will initially be created with a fixed name, permissions, and owner.</para>
+
+ <para>A short time later, the kernel will send a uevent to <command>
+ udevd</command>. Based on the rules specified in the files within the
+ <filename class="directory">/etc/udev/rules.d</filename>, <filename
+ class="directory">/lib/udev/rules.d</filename>, and <filename
+ class="directory">/run/udev/rules.d</filename> directories, <command>
+ udevd</command> will create additional symlinks to the device node,
+ or change its permissions, owner, or group, or modify the internal
+ <command>udevd</command> database entry for that object.</para>
+
+ <para>The rules in these three directories are numbered in a similar
+ fashion to the LFS-Bootscripts package, and all three directories are
+ merged together. If <command>udevd</command> can't find a rule for the
+ device it is creating, it will leave the permissions and ownership at
+ whatever <systemitem class="filesystem">devtmpfs</systemitem> used
+ initially.</para>
</sect3>
@@ -247,12 +254,17 @@
enhances the functionality of <emphasis>snd-pcm</emphasis> by making the
sound cards available to OSS applications), configure
<command>modprobe</command> to load the wrapper after Udev loads the
- wrapped module. To do this, add an <quote>install</quote> line in any
+ wrapped module. To do this, add a <quote>softdep</quote> line in any
<filename>/etc/modprobe.d/<replaceable>&lt;filename&gt;</replaceable>.conf</filename>
file. For example:</para>
-<screen role="nodump"><literal>install snd-pcm /sbin/modprobe -i snd-pcm ; \
- /sbin/modprobe snd-pcm-oss ; true</literal></screen>
+<screen role="nodump"><literal>softdep snd-pcm post: snd-pcm-oss</literal></screen>
+
+ <para>Note that the <quote>softdep</quote> command also allows
+ <literal>pre:</literal> dependencies, or a mixture of both
+ <literal>pre:</literal> and <literal>post:</literal>. See the
+ <filename>modprobe.d(5)</filename> manual page for more information
+ on <quote>softdep</quote> syntax and capabilities.</para>
<para>If the module in question is not a wrapper and is useful by itself,
configure the <command>modules</command> bootscript to load this