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
This commit is contained in:
Bryan Kadzban 2012-02-04 23:37:17 +00:00
parent 6b13ebc66a
commit 841b7235aa
3 changed files with 52 additions and 28 deletions

View File

@ -37,6 +37,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> <listitem>
<para>2012-02-02</para> <para>2012-02-02</para>
<itemizedlist> <itemizedlist>

View File

@ -32,9 +32,9 @@
<para>Using the Udev method, only those devices which are detected by the <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 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 created each time the system boots, they will be stored on a <systemitem
class="filesystem">tmpfs</systemitem> file system (a virtual file system that class="filesystem">devtmpfs</systemitem> file system (a virtual file system
resides entirely in system memory). Device nodes do not require much space, so that resides entirely in system memory). Device nodes do not require much
the memory that is used is negligible.</para> space, so the memory that is used is negligible.</para>
<sect2> <sect2>
<title>History</title> <title>History</title>
@ -87,8 +87,8 @@
class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename
class="directory">/sys</filename>), data which the built-in drivers class="directory">/sys</filename>), data which the built-in drivers
registered with <systemitem class="filesystem">sysfs</systemitem> are registered with <systemitem class="filesystem">sysfs</systemitem> are
available to userspace processes and to <command>udevd</command> for device available to userspace processes and to <command>udevd</command> for
node creation.</para> processing (including modifications to device nodes).</para>
</sect3> </sect3>
@ -132,24 +132,31 @@
<sect3> <sect3>
<title>Device Node Creation</title> <title>Device Node Creation</title>
<para>To obtain the right major and minor number for a device, Udev <para>As of Udev-&udev-version;, <command>udevd</command> no longer
relies on the information provided by <systemitem creates device files in <filename class="directory">/dev</filename>.
class="filesystem">sysfs</systemitem> in <filename Instead, this must be handled in the kernel, by the <systemitem
class="directory">/sys</filename>. For example, class="filesystem">devtmpfs</systemitem> filesystem. Any driver that
<filename>/sys/class/tty/vcs/dev</filename> contains the string wishes to register a device node will go through <systemitem
<quote>7:0</quote>. This string is used by <command>udevd</command> to class="filesystem">devtmpfs</systemitem> (via the driver core) to do it.
create a device node with major number <emphasis>7</emphasis> and minor When a <systemitem class="filesystem">devtmpfs</systemitem> instance is
<emphasis>0</emphasis>. The names and permissions of the nodes created mounted on <filename class="directory">/dev</filename>, the device node
under the <filename class="directory">/dev</filename> directory are will initially be created with a fixed name, permissions, and owner.</para>
determined by rules specified in the files within the <filename
class="directory">/etc/udev/rules.d/</filename> directory. These are <para>A short time later, the kernel will send a uevent to <command>
numbered in a similar fashion to the LFS-Bootscripts package. If udevd</command>. Based on the rules specified in the files within the
<command>udevd</command> can't find a rule for the device it is creating, <filename class="directory">/etc/udev/rules.d</filename>, <filename
it will default permissions to <emphasis>660</emphasis> and ownership to class="directory">/lib/udev/rules.d</filename>, and <filename
<emphasis>root:root</emphasis>. Documentation on the syntax of the Udev class="directory">/run/udev/rules.d</filename> directories, <command>
rules configuration files are available in udevd</command> will create additional symlinks to the device node,
<filename>/usr/share/doc/udev-&udev-version;/writing_udev_rules/index.html</filename> or change its permissions, owner, or group, or modify the internal
</para> <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,12 +254,17 @@
enhances the functionality of <emphasis>snd-pcm</emphasis> by making the enhances the functionality of <emphasis>snd-pcm</emphasis> by making the
sound cards available to OSS applications), configure sound cards available to OSS applications), configure
<command>modprobe</command> to load the wrapper after Udev loads the <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> <filename>/etc/modprobe.d/<replaceable>&lt;filename&gt;</replaceable>.conf</filename>
file. For example:</para> file. For example:</para>
<screen role="nodump"><literal>install snd-pcm /sbin/modprobe -i snd-pcm ; \ <screen role="nodump"><literal>softdep snd-pcm post: snd-pcm-oss</literal></screen>
/sbin/modprobe snd-pcm-oss ; true</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, <para>If the module in question is not a wrapper and is useful by itself,
configure the <command>modules</command> bootscript to load this configure the <command>modules</command> bootscript to load this

View File

@ -1,5 +1,5 @@
<!ENTITY version "SVN-20120202"> <!ENTITY version "SVN-20120204">
<!ENTITY releasedate "Feb 2, 2012"> <!ENTITY releasedate "Feb 4, 2012">
<!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "7.1"> <!ENTITY milestone "7.1">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->