1
0

symlinks.po 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. msgid ""
  2. msgstr ""
  3. "Project-Id-Version: PACKAGE VERSION\n"
  4. "POT-Creation-Date: 2020-06-17 12:44+0800\n"
  5. "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  6. "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  7. "Language-Team: LANGUAGE <LL@li.org>\n"
  8. "Language: zh_CN\n"
  9. "MIME-Version: 1.0\n"
  10. "Content-Type: text/plain; charset=UTF-8\n"
  11. "Content-Transfer-Encoding: 8bit\n"
  12. "X-Generator: Translate Toolkit 2.2.5\n"
  13. #. type: Content of: <sect1><title>
  14. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:11
  15. msgid "Managing Devices"
  16. msgstr "管理设备"
  17. #. type: Content of: <sect1><sect2><title>
  18. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:15
  19. msgid "Network Devices"
  20. msgstr "网络设备"
  21. #. type: Content of: <sect1><sect2><para>
  22. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:17
  23. msgid ""
  24. "Udev, by default, names network devices according to Firmware/BIOS data or "
  25. "physical characteristics like the bus, slot, or MAC address. The purpose of "
  26. "this naming convention is to ensure that network devices are named "
  27. "consistently and not based on the time the network card was discovered. For "
  28. "example, on a computer having two network cards made by Intel and Realtek, "
  29. "the network card manufactured by Intel may become eth0 and the Realtek card "
  30. "becomes eth1. In some cases, after a reboot the cards could get renumbered "
  31. "the other way around."
  32. msgstr ""
  33. "Udev 在默认情况下,根据固件或 BIOS 的数据,或总线、插槽与 MAC 地址等物理特性"
  34. "命名网络设备。这种命名法的主要目的是保证网络设备在每次引导时获得一致的命"
  35. "名,而不是基于网卡被系统发现的时间进行命名。例如,在老式命名方法中,如果一"
  36. "台计算机拥有两块网卡,其中一块由 Intel 生产,另一块由 Realtek 生产,则 "
  37. "Intel 网卡可能被命名为 eth0,而 Realtek 网卡被命名为 eth1。然而在重新启动系"
  38. "统后,它们的顺序可能会颠倒。"
  39. #. type: Content of: <sect1><sect2><para>
  40. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:26
  41. msgid ""
  42. "In the new naming scheme, typical network device names would then be "
  43. "something like enp5s0 or wlp3s0. If this naming convention is not desired, "
  44. "the traditional naming scheme or a custom scheme can be implemented."
  45. msgstr ""
  46. "在新的命名架构中,典型的网络设备名称就像 enp5s0 或 wlp3s0 这样。如果您不喜欢"
  47. "这种命名惯例,可以采用传统或自定义命名架构。"
  48. #. type: Content of: <sect1><sect2><sect3><title>
  49. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:32
  50. msgid "Disabling Persistent Naming on the Kernel Command Line"
  51. msgstr "在内核命令行中禁用一致性命名"
  52. #. type: Content of: <sect1><sect2><sect3><para>
  53. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:34
  54. msgid ""
  55. "The traditional naming scheme using eth0, eth1, etc can be restored by "
  56. "adding <userinput>net.ifnames=0</userinput> on the kernel command line. "
  57. "This is most appropriate for those systems that have only one ethernet "
  58. "device of the same type. Laptops often have multiple ethernet connections "
  59. "that are named eth0 and wlan0 and are also candidates for this method. The "
  60. "command line is passed in the GRUB configuration file. See <xref linkend="
  61. "\"grub-cfg\"/>."
  62. msgstr ""
  63. "传统的,如同 eth0,eth1 这样的命名架构可以通过在内核命令行中加入 "
  64. "<userinput>net.ifnames=0</userinput> 而恢复。这在那些没有两块同类以太网设备"
  65. "的机器上最为合适。笔记本一般拥有两个以太网连接,在这种命名方式下分别是 eth0 "
  66. "和 wlan0,也可以采用这种方法。内核命令行需要写入 GRUB 配置文件中,参阅 "
  67. "<xref linkend=\"grub-cfg\"/>。"
  68. #. type: Content of: <sect1><sect2><sect3><title>
  69. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:45
  70. msgid "Creating Custom Udev Rules"
  71. msgstr "创建自定义 Udev 规则"
  72. #. type: Content of: <sect1><sect2><sect3><para>
  73. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:47
  74. msgid ""
  75. "The naming scheme can be customized by creating custom udev rules. A script "
  76. "has been included that generates the initial rules. Generate these rules by "
  77. "running:"
  78. msgstr ""
  79. "可以创建自定义 Udev 规则,定制命名架构。系统中包含一个生成初始规则的脚本,执"
  80. "行以下命令生成初始规则:"
  81. #. type: Content of: <sect1><sect2><sect3><screen>
  82. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:51
  83. #, no-wrap
  84. msgid "<userinput>bash /lib/udev/init-net-rules.sh</userinput>"
  85. msgstr "<userinput>bash /lib/udev/init-net-rules.sh</userinput>"
  86. #. type: Content of: <sect1><sect2><sect3><para>
  87. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:53
  88. msgid ""
  89. "Now, inspect the <filename>/etc/udev/rules.d/70-persistent-net.rules</"
  90. "filename> file, to find out which name was assigned to which network device:"
  91. msgstr ""
  92. "现在检查文件 <filename>/etc/udev/rules.d/70-persistent-net.rules</"
  93. "filename>,确认网络设备与命名的对应关系:"
  94. #. type: Content of: <sect1><sect2><sect3><screen>
  95. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:57
  96. #, no-wrap
  97. msgid "<userinput>cat /etc/udev/rules.d/70-persistent-net.rules</userinput>"
  98. msgstr "<userinput>cat /etc/udev/rules.d/70-persistent-net.rules</userinput>"
  99. #. type: Content of: <sect1><sect2><sect3><note><para>
  100. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:59
  101. msgid ""
  102. "In some cases such as when MAC addresses have been assigned to a network "
  103. "card manually or in a virtual environment such as Qemu or Xen, the network "
  104. "rules file may not have been generated because addresses are not "
  105. "consistently assigned. In these cases, this method cannot be used."
  106. msgstr ""
  107. "某些情况下,例如 MAC 地址被手动指定给了某块网卡,或在 Qemu、Xen 等虚拟环境"
  108. "下,可能不会生成网络设备规则文件,因为 MAC 地址的分配没有一致性。此时不能使"
  109. "用本方法。"
  110. #. type: Content of: <sect1><sect2><sect3><para>
  111. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:65
  112. msgid ""
  113. "The file begins with a comment block followed by two lines for each NIC. The "
  114. "first line for each NIC is a commented description showing its hardware IDs "
  115. "(e.g. its PCI vendor and device IDs, if it's a PCI card), along with its "
  116. "driver in parentheses, if the driver can be found. Neither the hardware ID "
  117. "nor the driver is used to determine which name to give an interface; this "
  118. "information is only for reference. The second line is the udev rule that "
  119. "matches this NIC and actually assigns it a name."
  120. msgstr ""
  121. "该文件的开头是一个注释块,之后对于每个网络接口设备 (NIC) 都给出两行。第一行是"
  122. "注释,给出该 NIC 的硬件 ID (例如对于 PCI 设备,就是 PCI 生产商 ID 和设备 "
  123. "ID),如果能找到驱动程序的话,也会在括号中给出。它们并不被用于确定该设备的命"
  124. "名,仅供您在编写规则时进行参考。第二行是匹配该 NIC 的 udev 规则,和实际赋予它"
  125. "的设备名。"
  126. #. type: Content of: <sect1><sect2><sect3><para>
  127. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:73
  128. msgid ""
  129. "All udev rules are made up of several keys, separated by commas and optional "
  130. "whitespace. This rule's keys and an explanation of each of them are as "
  131. "follows:"
  132. msgstr ""
  133. "所有 udev 规则包含若干键值,用逗号和可选的空格进行分隔。下面给出规则中包含的"
  134. "键值和对它们的解释:"
  135. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  136. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:79
  137. msgid ""
  138. "<literal>SUBSYSTEM==\"net\"</literal> - This tells udev to ignore devices "
  139. "that are not network cards."
  140. msgstr ""
  141. "<literal>SUBSYSTEM==\"net\"</literal> - 告诉 udev 忽略除网卡以外的设备。"
  142. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  143. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:83
  144. msgid ""
  145. "<literal>ACTION==\"add\"</literal> - This tells udev to ignore this rule for "
  146. "a uevent that isn't an add (\"remove\" and \"change\" uevents also happen, "
  147. "but don't need to rename network interfaces)."
  148. msgstr ""
  149. "<literal>ACTION==\"add\"</literal> - 告诉 udev 忽略除了“添加”外的所有 uevent "
  150. "(也存在“删除”或“修改”类型的 uevent,但在这种情况下不需要重命名网络接口)。"
  151. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  152. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:88
  153. msgid ""
  154. "<literal>DRIVERS==\"?*\"</literal> - This exists so that udev will ignore "
  155. "VLAN or bridge sub-interfaces (because these sub-interfaces do not have "
  156. "drivers). These sub-interfaces are skipped because the name that would be "
  157. "assigned would collide with their parent devices."
  158. msgstr ""
  159. "<literal>DRIVERS==\"?*\"</literal> - 这使得 udev 忽略 VLAN 或桥接子接口 (它们"
  160. "没有驱动程序)。它们必须被忽略,否则其命名会与父设备冲突。"
  161. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  162. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:94
  163. msgid ""
  164. "<literal>ATTR{address}</literal> - The value of this key is the NIC's MAC "
  165. "address."
  166. msgstr "<literal>ATTR{address}</literal> - 该键的值是 NIC 的 MAC 地址。"
  167. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  168. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:98
  169. msgid ""
  170. "<literal>ATTR{type}==\"1\"</literal> - This ensures the rule only matches "
  171. "the primary interface in the case of certain wireless drivers which create "
  172. "multiple virtual interfaces. The secondary interfaces are skipped for the "
  173. "same reason that VLAN and bridge sub-interfaces are skipped: there would be "
  174. "a name collision otherwise."
  175. msgstr ""
  176. "<literal>ATTR{type}==\"1\"</literal> - 这保证在使用创建多个虚拟接口的无线驱动"
  177. "程序时,只匹配主要接口。跳过其他接口的原因和忽略 VLAN 与桥接子接口一样,是"
  178. "为了防止命名冲突。"
  179. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  180. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:105
  181. msgid ""
  182. "<literal>NAME</literal> - The value of this key is the name that udev will "
  183. "assign to this interface."
  184. msgstr "<literal>NAME</literal> - 该键的值是 udev 将赋予该网络接口的命名。"
  185. #. type: Content of: <sect1><sect2><sect3><para>
  186. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:110
  187. msgid ""
  188. "The value of <literal>NAME</literal> is the important part. Make sure you "
  189. "know which name has been assigned to each of your network cards before "
  190. "proceeding, and be sure to use that <literal>NAME</literal> value when "
  191. "creating your configuration files below."
  192. msgstr ""
  193. "<literal>NAME</literal> 的值是我们关注的重点。在继续阅读之前,您需要确保自己"
  194. "知道赋予每个网络接口的命名,在之后的配置文件中需要使用这些名称作为 "
  195. "<literal>NAME</literal> 的值。"
  196. #. type: Content of: <sect1><sect2><title>
  197. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:121
  198. msgid "CD-ROM symlinks"
  199. msgstr "CD-ROM 符号链接"
  200. #. type: Content of: <sect1><sect2><para>
  201. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:123
  202. msgid ""
  203. "Some software that you may want to install later (e.g., various media "
  204. "players) expect the <filename class=\"symlink\">/dev/cdrom</filename> and "
  205. "<filename class=\"symlink\">/dev/dvd</filename> symlinks to exist, and to "
  206. "point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put "
  207. "references to those symlinks into <filename>/etc/fstab</filename>. Udev "
  208. "comes with a script that will generate rules files to create these symlinks "
  209. "for you, depending on the capabilities of each device, but you need to "
  210. "decide which of two modes of operation you wish to have the script use."
  211. msgstr ""
  212. "您之后可能希望安装的一些程序 (如某些媒体播放器) 预期 <filename class="
  213. "\"symlink\">/dev/cdrom</filename> 和 <filename class=\"symlink\">/dev/dvd</"
  214. "filename> 符号链接存在,并指向 CD-ROM 或 DVD-ROM 设备。另外,在 <filename>/"
  215. "etc/fstab</filename> 中引用它们也非常方便。Udev 提供了一个脚本,能根据每个设"
  216. "备的功能,为您生成创建这两个符号链接的规则。但是,您需要确定,自己希望使用该"
  217. "脚本提供的两种操作模式中的哪一种。"
  218. #. type: Content of: <sect1><sect2><para>
  219. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:132
  220. msgid ""
  221. "First, the script can operate in <quote>by-path</quote> mode (used by "
  222. "default for USB and FireWire devices), where the rules it creates depend on "
  223. "the physical path to the CD or DVD device. Second, it can operate in "
  224. "<quote>by-id</quote> mode (default for IDE and SCSI devices), where the "
  225. "rules it creates depend on identification strings stored on the CD or DVD "
  226. "device itself. The path is determined by udev's <command>path_id</command> "
  227. "script, and the identification strings are read from the hardware by its "
  228. "<command>ata_id</command> or <command>scsi_id</command> programs, depending "
  229. "on which type of device you have."
  230. msgstr ""
  231. "首先,该脚本可以在 <quote>by-path</quote> 模式下运行 (这是 USB 和 FireWire 设"
  232. "备的默认模式),此时它创建的规则依赖于 CD 或 DVD 设备的物理路径。其次,它可以"
  233. "在 <quote>by-id</quote> 模式下运行,此时它创建的规则依赖于 CD 或 DVD 设备本身"
  234. "存储的识别字符串。物理路径由 udev 的 <command>path_id</command> 脚本确定,而"
  235. "识别字符串由 <command>ata_id</command> 或 <command>scsi_id</command> 程序 (根"
  236. "据设备类型选用其中一个) 从硬件中读取。"
  237. #. type: Content of: <sect1><sect2><para>
  238. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:142
  239. msgid ""
  240. "There are advantages to each approach; the correct approach to use will "
  241. "depend on what kinds of device changes may happen. If you expect the "
  242. "physical path to the device (that is, the ports and/or slots that it plugs "
  243. "into) to change, for example because you plan on moving the drive to a "
  244. "different IDE port or a different USB connector, then you should use the "
  245. "<quote>by-id</quote> mode. On the other hand, if you expect the device's "
  246. "identification to change, for example because it may die, and you would "
  247. "replace it with a different device with the same capabilities and which is "
  248. "plugged into the same connectors, then you should use the <quote>by-path</"
  249. "quote> mode."
  250. msgstr ""
  251. "两种方式各有优缺点,正确地方式依赖于设备可能发生的变化。如果您预期指向设备的"
  252. "物理路径 (即它连接的端口或插槽) 可能变化,例如您可能会将它移动到另一个 IDE "
  253. "接口或另一个 USB 接口,您应该使用 <quote>by-id</quote> 模式。另一方面,如果"
  254. "您可能用具有相同功能,并接入相同接口的另一台设备替换它,则您应该使用 "
  255. "<quote>by-path</quote> 模式。"
  256. #. type: Content of: <sect1><sect2><para>
  257. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:153
  258. msgid ""
  259. "If either type of change is possible with your drive, then choose a mode "
  260. "based on the type of change you expect to happen more often."
  261. msgstr "如果两种变化都可能发生,则根据您预期较常发生的变化选择模式。"
  262. #. type: Content of: <sect1><sect2><important><para>
  263. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:159
  264. msgid ""
  265. "External devices (for example, a USB-connected CD drive) should not use by-"
  266. "path persistence, because each time the device is plugged into a new "
  267. "external port, its physical path will change. All externally-connected "
  268. "devices will have this problem if you write udev rules to recognize them by "
  269. "their physical path; the problem is not limited to CD and DVD drives."
  270. msgstr ""
  271. "外接设备 (例如 USB 接口的 CD 驱动器) 不应使用 by-path 模式,因为每次将该设备"
  272. "插入到新的外部接口时,其物理路径都可能变化。只要您使用了基于物理路径识别外接"
  273. "设备的 udev 规则,都会导致这个问题,并不仅限于 CD 或 DVD 设备。"
  274. #. type: Content of: <sect1><sect2><para>
  275. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:166
  276. msgid ""
  277. "If you wish to see the values that the udev scripts will use, then for the "
  278. "appropriate CD-ROM device, find the corresponding directory under <filename "
  279. "class=\"directory\">/sys</filename> (e.g., this can be <filename class="
  280. "\"directory\">/sys/block/hdd</filename>) and run a command similar to the "
  281. "following:"
  282. msgstr ""
  283. "如果您希望知道 udev 脚本会使用的路径或识别字符串值,对于正确的 CD-ROM 驱动"
  284. "器,在 <filename class=\"directory\">/sys</filename> 目录中找到对应的目录 (例"
  285. "如 <filename class=\"directory\">/sys/block/hdd</filename>),然后运行类似下"
  286. "面这样的命令:"
  287. #. type: Content of: <sect1><sect2><screen>
  288. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:172
  289. #, no-wrap
  290. msgid "<userinput>udevadm test /sys/block/hdd</userinput>"
  291. msgstr "<userinput>udevadm test /sys/block/hdd</userinput>"
  292. #. type: Content of: <sect1><sect2><para>
  293. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:174
  294. msgid ""
  295. "Look at the lines containing the output of various *_id programs. The "
  296. "<quote>by-id</quote> mode will use the ID_SERIAL value if it exists and is "
  297. "not empty, otherwise it will use a combination of ID_MODEL and ID_REVISION. "
  298. "The <quote>by-path</quote> mode will use the ID_PATH value."
  299. msgstr ""
  300. "观察包含一些 *_id 程序输出的行。<quote>by-id</quote> 模式在 ID_SERIAL 存在且"
  301. "非空时会使用它,否则就使用 ID_MODEL 和 ID_REVISION 的组合。<quote>by-path</"
  302. "quote> 模式会使用 ID_PATH 的值。"
  303. #. type: Content of: <sect1><sect2><para>
  304. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:179
  305. msgid ""
  306. "If the default mode is not suitable for your situation, then the following "
  307. "modification can be made to the <filename>/etc/udev/rules.d/83-cdrom-"
  308. "symlinks.rules</filename> file, as follows (where <replaceable>mode</"
  309. "replaceable> is one of <quote>by-id</quote> or <quote>by-path</quote>):"
  310. msgstr ""
  311. "如果默认模式不适合您的情况,可以像下面这样修改 <filename>/etc/udev/rules."
  312. "d/83-cdrom-symlinks.rules</filename> 文件 (将 <replaceable>mode</"
  313. "replaceable> 替换成 <quote>by-id</quote> 或 <quote>by-path</quote> 中的一"
  314. "个):"
  315. #. type: Content of: <sect1><sect2><screen>
  316. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:185
  317. #, no-wrap
  318. msgid ""
  319. "<userinput>sed -e 's/\"write_cd_rules\"/\"write_cd_rules <replaceable>mode</replaceable>\"/' \\\n"
  320. " -i /etc/udev/rules.d/83-cdrom-symlinks.rules</userinput>"
  321. msgstr ""
  322. "<userinput>sed -e 's/\"write_cd_rules\"/\"write_cd_rules <replaceable>mode</replaceable>\"/' \\\n"
  323. " -i /etc/udev/rules.d/83-cdrom-symlinks.rules</userinput>"
  324. #. type: Content of: <sect1><sect2><para>
  325. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:188
  326. msgid ""
  327. "Note that it is not necessary to create the rules files or symlinks at this "
  328. "time because you have bind-mounted the host's <filename class=\"directory\">/"
  329. "dev</filename> directory into the LFS system and we assume the symlinks "
  330. "exist on the host. The rules and symlinks will be created the first time you "
  331. "boot your LFS system."
  332. msgstr ""
  333. "注意现在并不需要创建规则文件和符号链接,因为已经绑定挂载了宿主的 <filename "
  334. "class=\"directory\">/dev</filename> 目录,我们假定宿主系统存在正确的符号链"
  335. "接。只要在第一次引导 LFS 系统后创建规则和符号链接即可。"
  336. #. type: Content of: <sect1><sect2><para>
  337. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:194
  338. msgid ""
  339. "However, if you have multiple CD-ROM devices, then the symlinks generated at "
  340. "that time may point to different devices than they point to on your host "
  341. "because devices are not discovered in a predictable order. The assignments "
  342. "created when you first boot the LFS system will be stable, so this is only "
  343. "an issue if you need the symlinks on both systems to point to the same "
  344. "device. If you need that, then inspect (and possibly edit) the generated "
  345. "<filename>/etc/udev/rules.d/70-persistent-cd.rules</filename> file after "
  346. "booting, to make sure the assigned symlinks match what you need."
  347. msgstr ""
  348. "然而,如果您有多个 CD-ROM 设备,则生成的符号链接可能指向不同于您的宿主系统的"
  349. "设备,因为设备发现的顺序不可预测。在您第一次引导 LFS 系统后,创建的设备分配"
  350. "将会是稳定的,因此这仅在您希望宿主系统和 LFS 中的符号链接指向同一设备时才会成"
  351. "为问题。如果您有这种需求,在引导后检查 (如果需要的话修改) 生成的 <filename>/"
  352. "etc/udev/rules.d/70-persistent-cd.rules</filename> 文件,保证分配的符号链接和"
  353. "您的需要一致。"
  354. #. type: Content of: <sect1><sect2><title>
  355. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:207
  356. msgid "Dealing with duplicate devices"
  357. msgstr "处理重复设备"
  358. #. type: Content of: <sect1><sect2><para>
  359. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:209
  360. msgid ""
  361. "As explained in <xref linkend=\"ch-config-udev\"/>, the order in which "
  362. "devices with the same function appear in <filename class=\"directory\">/dev</"
  363. "filename> is essentially random. E.g., if you have a USB web camera and a "
  364. "TV tuner, sometimes <filename>/dev/video0</filename> refers to the camera "
  365. "and <filename>/dev/video1</filename> refers to the tuner, and sometimes "
  366. "after a reboot the order changes. For all classes of hardware except sound "
  367. "cards and network cards, this is fixable by creating udev rules for custom "
  368. "persistent symlinks. The case of network cards is covered separately in "
  369. "<xref linkend=\"ch-config-network\"/>, and sound card configuration can be "
  370. "found in <ulink url=\"&blfs-book;postlfs/devices.html\">BLFS</ulink>."
  371. msgstr ""
  372. "正如<xref linkend=\"ch-config-udev\"/>中所述,那些功能相同的设备在 "
  373. "<filename class=\"directory\">/dev</filename> 中的顺序是随机的。例如,如果您"
  374. "有一个 USB 摄像头和一个电视棒,有时 <filename>/dev/video0</filename> 会指向"
  375. "摄像头,<filename>/dev/video1</filename> 指向电视棒,而有时在重启后这个顺序"
  376. "正好颠倒过来。对于所有除了声卡和网卡以外的设备,该问题都可以通过"
  377. "创建自定义持久化符号链接的 Udev 规则来解决。对于网卡的解决方案在<xref linkend=\"ch-"
  378. "config-network\"/>中单独描述,而声卡配置可以在 <ulink url=\"&blfs-book;"
  379. "postlfs/devices.html\">BLFS</ulink> 中找到。"
  380. #. type: Content of: <sect1><sect2><para>
  381. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:222
  382. msgid ""
  383. "For each of your devices that is likely to have this problem (even if the "
  384. "problem doesn't exist in your current Linux distribution), find the "
  385. "corresponding directory under <filename class=\"directory\">/sys/class</"
  386. "filename> or <filename class=\"directory\">/sys/block</filename>. For video "
  387. "devices, this may be <filename class=\"directory\">/sys/class/video4linux/"
  388. "video<replaceable>X</replaceable></filename>. Figure out the attributes "
  389. "that identify the device uniquely (usually, vendor and product IDs and/or "
  390. "serial numbers work):"
  391. msgstr ""
  392. "对于您的每个可能有这类问题的设备 (即使在您当前使用的 Linux 发行版上并没有问"
  393. "题),找到 <filename class=\"directory\">/sys/class</filename> 或 <filename "
  394. "class=\"directory\">/sys/block</filename> 中的对应目录。对于视频设备,目录可"
  395. "能是 <filename class=\"directory\"> /sys/class/video4linux/"
  396. "video<replaceable>X</replaceable></filename>。找出能够唯一确认该设备的属性 "
  397. "(通常是厂商和产品 ID,或者序列号):"
  398. #. type: Content of: <sect1><sect2><screen>
  399. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:233
  400. #, no-wrap
  401. msgid "<userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput>"
  402. msgstr "<userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput>"
  403. #. type: Content of: <sect1><sect2><para>
  404. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:235
  405. msgid "Then write rules that create the symlinks, e.g.:"
  406. msgstr "然后编写创建符号链接的规则,例如:"
  407. #. type: Content of: <sect1><sect2><screen>
  408. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:237
  409. #, no-wrap
  410. msgid ""
  411. "<userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; \"EOF\"\n"
  412. "<literal>\n"
  413. "# Persistent symlinks for webcam and tuner\n"
  414. "KERNEL==\"video*\", ATTRS{idProduct}==\"1910\", ATTRS{idVendor}==\"0d81\", SYMLINK+=\"webcam\"\n"
  415. "KERNEL==\"video*\", ATTRS{device}==\"0x036f\", ATTRS{vendor}==\"0x109e\", SYMLINK+=\"tvtuner\"\n"
  416. "</literal>\n"
  417. "EOF</userinput>"
  418. msgstr ""
  419. "<userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; \"EOF\"\n"
  420. "<literal>\n"
  421. "# 摄像头和电视棒的持久化符号链接\n"
  422. "KERNEL==\"video*\", ATTRS{idProduct}==\"1910\", ATTRS{idVendor}==\"0d81\", SYMLINK+=\"webcam\"\n"
  423. "KERNEL==\"video*\", ATTRS{device}==\"0x036f\", ATTRS{vendor}==\"0x109e\", SYMLINK+=\"tvtuner\"\n"
  424. "</literal>\n"
  425. "EOF</userinput>"
  426. #. type: Content of: <sect1><sect2><para>
  427. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:245
  428. msgid ""
  429. "The result is that <filename>/dev/video0</filename> and <filename>/dev/"
  430. "video1</filename> devices still refer randomly to the tuner and the web "
  431. "camera (and thus should never be used directly), but there are symlinks "
  432. "<filename>/dev/tvtuner</filename> and <filename>/dev/webcam</filename> that "
  433. "always point to the correct device."
  434. msgstr ""
  435. "结果是,<filename>/dev/video0</filename> 和 <filename>/dev/video1</filename> "
  436. "仍然会随机指向电视棒和摄像头 (因此不应直接使用它们),但符号链接 <filename>/"
  437. "dev/tvtuner</filename> 和 <filename>/dev/webcam</filename> 总会指向正确设备。"