eudev.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. <para>采用一个规避措施,防止 /tools 目录被硬编码到
  41. Eudev 二进制文件的库文件位置中:</para>
  42. <screen><userinput remap="pre">cat &gt; config.cache &lt;&lt; "EOF"
  43. HAVE_BLKID=1
  44. BLKID_LIBS="-lblkid"
  45. BLKID_CFLAGS="-I/tools/include"
  46. EOF</userinput></screen>
  47. <para>准备安装 Eudev:</para>
  48. <screen><userinput remap="configure">./configure --prefix=/usr \
  49. --bindir=/sbin \
  50. --sbindir=/sbin \
  51. --libdir=/usr/lib \
  52. --sysconfdir=/etc \
  53. --libexecdir=/lib \
  54. --with-rootprefix= \
  55. --with-rootlibdir=/lib \
  56. --enable-manpages \
  57. --disable-static \
  58. --config-cache</userinput></screen>
  59. <para>编译该软件包:</para>
  60. <screen><userinput remap="make">LIBRARY_PATH=/tools/lib make</userinput></screen>
  61. <!--note><para>The LIBRARY_PATH variable here and the LD_LIBRARY_PATH variable
  62. below are needed to allow the use of libraries that were installed in /tools,
  63. but have not yet been installed in the main system. LIBRARY_PATH is
  64. used to find libraries during the linking process. LD_LIBRARY_PATH is
  65. used to find libraries during program execution.</para></note-->
  66. <note><para>这里的 LIBRARY_PATH 变量和下面的 LD_LIBRARY_PATH 允许使用
  67. /tools 中存在,但尚未安装到主系统中的库。LIBRARY_PATH
  68. 被用于在链接过程中查找库,LD_LIBRARY_PATH 用于在程序执行过程中查找库。
  69. </para></note>
  70. <para>创建一些目录,它们目前被用于测试,但之后也会成为安装好的
  71. eudev 的一部分。</para>
  72. <screen><userinput remap="test">mkdir -pv /lib/udev/rules.d
  73. mkdir -pv /etc/udev/rules.d</userinput></screen>
  74. <para>运行以下命令以测试编译结果:</para>
  75. <screen><userinput remap="test">make LD_LIBRARY_PATH=/tools/lib check</userinput></screen>
  76. <para>安装该软件包:</para>
  77. <screen><userinput remap="install">make LD_LIBRARY_PATH=/tools/lib install</userinput></screen>
  78. <para>安装一些在 LFS 环境中很有用的自定义规则和支持文件:</para>
  79. <screen><userinput remap="install">tar -xvf ../&udev-lfs-version;.tar.bz2
  80. make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
  81. </sect2>
  82. <sect2 id="conf-eudev" role="configuration">
  83. <title>配置 Eudev</title>
  84. <indexterm zone="conf-eudev">
  85. <primary sortas="a-Eudev">Eudev</primary>
  86. <secondary>configuring</secondary>
  87. </indexterm>
  88. <indexterm zone="conf-eudev">
  89. <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
  90. </indexterm>
  91. <para>硬件设备的相关信息被维护在
  92. <filename class="directory">/etc/udev/hwdb.d</filename> 和
  93. <filename class="directory">/lib/udev/hwdb.d</filename> 目录中。
  94. <application>Eudev</application> 需要将这些信息编译到二进制数据库
  95. <filename>/etc/udev/hwdb.bin</filename> 中。初始化该数据库:</para>
  96. <screen><userinput>LD_LIBRARY_PATH=/tools/lib udevadm hwdb --update</userinput></screen>
  97. <para>每次硬件信息有更新时,都要运行该命令。</para>
  98. </sect2>
  99. <sect2 id="contents-eudev" role="content">
  100. <title>Eudev 的内容</title>
  101. <segmentedlist>
  102. <segtitle>安装的程序</segtitle>
  103. <segtitle>安装的库</segtitle>
  104. <segtitle>安装的目录</segtitle>
  105. <seglistitem>
  106. <seg><!-- These are in /lib/udev and not to be called by the user:
  107. accelerometer, ata_id, cdrom_id, collect, mtd_probe,
  108. scsi_id, v4l_id,--> udevadm 和 udevd</seg>
  109. <seg>libudev.so</seg>
  110. <seg>/etc/udev, /lib/udev, 以及 /usr/share/doc/udev-&udev-lfs-version;</seg>
  111. </seglistitem>
  112. </segmentedlist>
  113. <variablelist>
  114. <bridgehead renderas="sect3">简要描述</bridgehead>
  115. <?dbfo list-presentation="list"?>
  116. <?dbhtml list-presentation="table"?>
  117. <varlistentry id="udevadm" revision="sysv">
  118. <term><command>udevadm</command></term>
  119. <listitem>
  120. <para>通用 udev 管理工具:控制 udevd 守护进程,
  121. 从 udev 数据库中提供信息,监视 uevent,等待 uevent 完成,
  122. 测试 udev 配置,并为指定设备触发 uevent。</para>
  123. <indexterm zone="ch-system-eudev udevadm">
  124. <primary sortas="b-udevadm">udevadm</primary>
  125. </indexterm>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry id="udevd">
  129. <term><command>udevd</command></term>
  130. <listitem>
  131. <para>一个守护进程,它在 netlink 套接字上监听 uevent,
  132. 并创建设备节点、运行配置好的外部程序,以响应这些 uevent。</para>
  133. <indexterm zone="ch-system-eudev udevd">
  134. <primary sortas="b-udevd">udevd</primary>
  135. </indexterm>
  136. </listitem>
  137. </varlistentry>
  138. <varlistentry id="libudev">
  139. <term><filename class="libraryfile">libudev</filename></term>
  140. <listitem>
  141. <para>一个提供 udev 设备信息接口的库</para>
  142. <indexterm zone="ch-system-eudev libudev">
  143. <primary sortas="c-libudev">libudev</primary>
  144. </indexterm>
  145. </listitem>
  146. </varlistentry>
  147. <varlistentry id="etc-udev">
  148. <term><filename class="directory">/etc/udev</filename></term>
  149. <listitem>
  150. <para>包含 udev 配置文件、设备权限设置和设备命名规则</para>
  151. <indexterm zone="ch-system-eudev etc-udev">
  152. <primary sortas="e-/etc/udev">/etc/udev</primary>
  153. </indexterm>
  154. </listitem>
  155. </varlistentry>
  156. </variablelist>
  157. </sect2>
  158. </sect1>