[lfs-book] r9727 - in trunk/BOOK: . chapter01 chapter07

bryan at linuxfromscratch.org bryan at linuxfromscratch.org
Sat Feb 4 15:37:21 PST 2012


Author: bryan
Date: 2012-02-04 16:37:17 -0700 (Sat, 04 Feb 2012)
New Revision: 9727

Modified:
   trunk/BOOK/chapter01/changelog.xml
   trunk/BOOK/chapter07/udev.xml
   trunk/BOOK/general.ent
Log:
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.



Modified: trunk/BOOK/chapter01/changelog.xml
===================================================================
--- trunk/BOOK/chapter01/changelog.xml	2012-02-03 03:55:07 UTC (rev 9726)
+++ trunk/BOOK/chapter01/changelog.xml	2012-02-04 23:37:17 UTC (rev 9727)
@@ -38,6 +38,18 @@
 -->
 
     <listitem>
+      <para>2012-02-04</para>
+      <itemizedlist>
+        <listitem>
+          <para>[bryan] - Fix up text in section 7.4 ("device and module
+          handling"), and change the recommendation for wrapper modules to
+          use kmod's support for soft post-dependencies instead.  Fixes
+          <ulink url="&lfs-ticket-root;3010">#3010</ulink>.</para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+
+    <listitem>
       <para>2012-02-02</para>
       <itemizedlist>
         <listitem>

Modified: trunk/BOOK/chapter07/udev.xml
===================================================================
--- trunk/BOOK/chapter07/udev.xml	2012-02-03 03:55:07 UTC (rev 9726)
+++ trunk/BOOK/chapter07/udev.xml	2012-02-04 23:37:17 UTC (rev 9727)
@@ -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,25 +132,32 @@
     <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>
 
     <sect3>
@@ -247,13 +254,18 @@
       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><filename></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
       module on system boot. To do this, add the module name to the

Modified: trunk/BOOK/general.ent
===================================================================
--- trunk/BOOK/general.ent	2012-02-03 03:55:07 UTC (rev 9726)
+++ trunk/BOOK/general.ent	2012-02-04 23:37:17 UTC (rev 9727)
@@ -1,5 +1,5 @@
-<!ENTITY version "SVN-20120202">
-<!ENTITY releasedate "Feb 2, 2012">
+<!ENTITY version "SVN-20120204">
+<!ENTITY releasedate "Feb 4, 2012">
 <!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not – -->
 <!ENTITY milestone "7.1">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->




More information about the lfs-book mailing list