eudev.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-eudev" role="wrap" revision="sysv">
  8. <?dbhtml filename="eudev.html"?>
  9. <sect1info condition="script">
  10. <productname>eudev</productname>
  11. <productnumber>&eudev-version;</productnumber>
  12. <address>&eudev-url;</address>
  13. </sect1info>
  14. <title>Eudev-&eudev-version;</title>
  15. <indexterm zone="ch-system-eudev">
  16. <primary sortas="a-Eudev">Eudev</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Eudev 软件包包含动态创建设备节点的程序。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&eudev-ch6-sbu;</seg>
  26. <seg>&eudev-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Eudev</title>
  32. <!--
  33. <para>首先修复一个测试脚本:</para>
  34. <screen><userinput remap="pre">sed -r -i 's|/usr(/bin/test)|\1|' test/udev-test.pl</userinput></screen>
  35. -->
  36. <!--
  37. <para>Next, remove an unneeded line that causes a build failure:</para>
  38. <screen><userinput remap="pre">sed -i '/keyboard_lookup_key/d' src/udev/udev-builtin-keyboard.c</userinput></screen>
  39. -->
  40. <!--
  41. <para>首先,采用一个规避措施,防止 /tools 目录被硬编码到
  42. Eudev 二进制文件的库文件位置中:</para>
  43. <screen><userinput remap="pre">cat &gt; config.cache &lt;&lt; "EOF"
  44. HAVE_BLKID=1
  45. BLKID_LIBS="-lblkid"
  46. BLKID_CFLAGS="-I/tools/include"
  47. EOF</userinput></screen>
  48. -->
  49. <para>准备安装 Eudev:</para>
  50. <screen><userinput remap="configure">./configure --prefix=/usr \
  51. --bindir=/sbin \
  52. --sbindir=/sbin \
  53. --libdir=/usr/lib \
  54. --sysconfdir=/etc \
  55. --libexecdir=/lib \
  56. --with-rootprefix= \
  57. --with-rootlibdir=/lib \
  58. --enable-manpages \
  59. --disable-static</userinput></screen>
  60. <!-- - -config-cache</userinput></screen> -->
  61. <para>编译该软件包:</para>
  62. <screen><userinput remap="make">make</userinput></screen>
  63. <!--
  64. <screen><userinput remap="make">LIBRARY_PATH=/tools/lib make</userinput></screen>
  65. <!- -note><para>The LIBRARY_PATH variable here and the LD_LIBRARY_PATH variable
  66. below are needed to allow the use of libraries that were installed in /tools,
  67. but have not yet been installed in the main system. LIBRARY_PATH is
  68. used to find libraries during the linking process. LD_LIBRARY_PATH is
  69. used to find libraries during program execution.</para></note- ->
  70. <note><para>这里的 LIBRARY_PATH 变量和下面的 LD_LIBRARY_PATH 允许使用
  71. /tools 中存在,但尚未安装到主系统中的库。LIBRARY_PATH
  72. 被用于在链接过程中查找库,LD_LIBRARY_PATH 用于在程序执行过程中查找库。
  73. </para></note>
  74. -->
  75. <para>创建一些目录,它们目前被用于测试,但之后也会成为安装好的
  76. eudev 的一部分。</para>
  77. <screen><userinput remap="test">mkdir -pv /lib/udev/rules.d
  78. mkdir -pv /etc/udev/rules.d</userinput></screen>
  79. <para>运行以下命令以测试编译结果:</para>
  80. <screen><userinput remap="test">make check</userinput></screen>
  81. <!--<screen><userinput remap="test">make LD_LIBRARY_PATH=/tools/lib check</userinput></screen>-->
  82. <para>安装该软件包:</para>
  83. <screen><userinput remap="install">make install</userinput></screen>
  84. <!--<screen><userinput remap="install">make LD_LIBRARY_PATH=/tools/lib install</userinput></screen>-->
  85. <para>安装一些在 LFS 环境中很有用的自定义规则和支持文件:</para>
  86. <screen><userinput remap="install">tar -xvf ../&udev-lfs-version;.tar.xz
  87. make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
  88. </sect2>
  89. <sect2 id="conf-eudev" role="configuration">
  90. <title>配置 Eudev</title>
  91. <indexterm zone="conf-eudev">
  92. <primary sortas="a-Eudev">Eudev</primary>
  93. <secondary>configuring</secondary>
  94. </indexterm>
  95. <indexterm zone="conf-eudev">
  96. <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
  97. </indexterm>
  98. <para>硬件设备的相关信息被维护在
  99. <filename class="directory">/etc/udev/hwdb.d</filename> 和
  100. <filename class="directory">/lib/udev/hwdb.d</filename> 目录中。
  101. <application>Eudev</application> 需要将这些信息编译到二进制数据库
  102. <filename>/etc/udev/hwdb.bin</filename> 中。初始化该数据库:</para>
  103. <!--<screen><userinput>LD_LIBRARY_PATH=/tools/lib udevadm hwdb - -update</userinput></screen>-->
  104. <screen><userinput>udevadm hwdb --update</userinput></screen>
  105. <para>每次硬件信息有更新时,都要运行该命令。</para>
  106. </sect2>
  107. <sect2 id="contents-eudev" role="content">
  108. <title>Eudev 的内容</title>
  109. <segmentedlist>
  110. <segtitle>安装的程序</segtitle>
  111. <segtitle>安装的库</segtitle>
  112. <segtitle>安装的目录</segtitle>
  113. <seglistitem>
  114. <seg><!-- These are in /lib/udev and not to be called by the user:
  115. accelerometer, ata_id, cdrom_id, collect, mtd_probe,
  116. scsi_id, v4l_id,--> udevadm 和 udevd</seg>
  117. <seg>libudev.so</seg>
  118. <seg>/etc/udev, /lib/udev, 以及 /usr/share/doc/udev-&udev-lfs-version;</seg>
  119. </seglistitem>
  120. </segmentedlist>
  121. <variablelist>
  122. <bridgehead renderas="sect3">简要描述</bridgehead>
  123. <?dbfo list-presentation="list"?>
  124. <?dbhtml list-presentation="table"?>
  125. <varlistentry id="udevadm" revision="sysv">
  126. <term><command>udevadm</command></term>
  127. <listitem>
  128. <para>通用 udev 管理工具:控制 udevd 守护进程,
  129. 从 udev 数据库中提供信息,监视 uevent,等待 uevent 完成,
  130. 测试 udev 配置,并为指定设备触发 uevent。</para>
  131. <indexterm zone="ch-system-eudev udevadm">
  132. <primary sortas="b-udevadm">udevadm</primary>
  133. </indexterm>
  134. </listitem>
  135. </varlistentry>
  136. <varlistentry id="udevd">
  137. <term><command>udevd</command></term>
  138. <listitem>
  139. <para>一个守护进程,它在 netlink 套接字上监听 uevent,
  140. 并创建设备节点、运行配置好的外部程序,以响应这些 uevent。</para>
  141. <indexterm zone="ch-system-eudev udevd">
  142. <primary sortas="b-udevd">udevd</primary>
  143. </indexterm>
  144. </listitem>
  145. </varlistentry>
  146. <varlistentry id="libudev">
  147. <term><filename class="libraryfile">libudev</filename></term>
  148. <listitem>
  149. <para>一个提供 udev 设备信息接口的库</para>
  150. <indexterm zone="ch-system-eudev libudev">
  151. <primary sortas="c-libudev">libudev</primary>
  152. </indexterm>
  153. </listitem>
  154. </varlistentry>
  155. <varlistentry id="etc-udev">
  156. <term><filename class="directory">/etc/udev</filename></term>
  157. <listitem>
  158. <para>包含 udev 配置文件、设备权限设置和设备命名规则</para>
  159. <indexterm zone="ch-system-eudev etc-udev">
  160. <primary sortas="e-/etc/udev">/etc/udev</primary>
  161. </indexterm>
  162. </listitem>
  163. </varlistentry>
  164. </variablelist>
  165. </sect2>
  166. </sect1>