hotplug.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-hotplug" xreflabel="Hotplug" role="wrap">
  7. <title>Hotplug-&hotplug-version;</title>
  8. <?dbhtml filename="hotplug.html"?>
  9. <indexterm zone="ch-system-hotplug"><primary sortas="a-Hotplug">Hotplug</primary></indexterm>
  10. <sect2 role="package"><title/>
  11. <para>The Hotplug package contains scripts that react upon hotplug events
  12. generated by the kernel. Such events correspond to every change in the
  13. in the kernel state visible in the "sysfs" filesystem, e.g., the addition and
  14. removal of hardware. This package also detects existing hardware during
  15. boot and inserts the relevant modules into the running kernel.
  16. </para>
  17. <segmentedlist>
  18. <segtitle>&buildtime;</segtitle>
  19. <segtitle>&diskspace;</segtitle>
  20. <seglistitem><seg>0.01 SBU</seg><seg>0.1 MB</seg></seglistitem>
  21. </segmentedlist>
  22. </sect2>
  23. <sect2 role="installation">
  24. <title>Installation of Hotplug</title>
  25. <para>
  26. The <command>usb.rc</command> script provided by the
  27. <application>Hotplug</application> package depends on the programs
  28. <command>usbutils</command> and <command>which</command> being present.
  29. However, these programs are not called for any useful purpose.
  30. Apply the patch that removes those dependencies:
  31. </para>
  32. <screen><userinput>patch -Np1 -i ../hotplug-&hotplug-version;-bogus_deps-1.patch</userinput></screen>
  33. <para>
  34. USB coldplugging is somewhat broken in <application>Hotplug</application>
  35. by default: the DEVICE environment variable is not passed to user-defined USB
  36. hotplug handlers. Fix this with the following patch:
  37. </para>
  38. <screen><userinput>patch -Np1 -i ../hotplug-&hotplug-version;-device-2.patch</userinput></screen>
  39. <!-- Waiting for hotplug-2004_04_01-isapnp-4.patch
  40. <para>
  41. There is an optional patch that adds ISAPNP hardware detection
  42. capabilities to Hotplug. It is not well tested and in fact contains known
  43. bugs. If you chose to apply it, run the following command:
  44. </para>
  45. <screen><userinput>patch -Np1 -i ../hotplug-&hotplug-version;-isapnp-2.patch</userinput></screen>
  46. -->
  47. <para>Now install the Hotplug package:</para>
  48. <screen><userinput>make install</userinput></screen>
  49. <para>Remove Hotplug's not-so-clean init script, since we're going to be using
  50. the script including with LFS-Bootscripts:</para>
  51. <screen><userinput>rm -rf /etc/init.d</userinput></screen>
  52. <para>Network device hotplugging is not supported by LFS bootscripts yet. For
  53. that reason, remove the network hotplug agent:</para>
  54. <screen><userinput>rm -f /etc/hotplug/net.agent</userinput></screen>
  55. <!-- Will be useless with version 4 of the isapnp patch
  56. <para>
  57. If you have applied the ISAPNP patch, add some required entries to
  58. <filename>/etc/modprobe.conf</filename>:</para>
  59. <screen><userinput>cat &gt;&gt;/etc/modprobe.conf &lt;&lt;"EOF"
  60. # Begin /etc/modprobe.conf entries for ISAPNP hardware detection script
  61. # by Marco d'Itri
  62. alias pnp:dPNP0511 irtty-sir
  63. alias pnp:dPNP0700 floppy
  64. alias pnp:dPNP0800 pcspkr
  65. alias pnp:dPNP0B00 rtc
  66. alias pnp:dPNP0303 atkbd
  67. alias pnp:dPNP0F13 psmouse
  68. alias pnp:dPNPB02F analog
  69. # End /etc/modprobe.conf entries for ISAPNP hardware detection script
  70. EOF</userinput></screen>
  71. <para>These entries may not be needed in newer versions of the Linux kernel,
  72. since Marco d'Itri will try to convince developers to put them into the
  73. corresponding modules themselves.</para>
  74. -->
  75. </sect2>
  76. <sect2 id="contents-hotplug" role="content"><title>Contents of Hotplug</title>
  77. <variablelist>
  78. <varlistentry id="hotplug">
  79. <term><command>/sbin/hotplug</command></term>
  80. <listitem>
  81. <indexterm zone="ch-system-hotplug hotplug"><primary
  82. sortas="b-hotplug">hotplug</primary></indexterm>
  83. <para>This script is called by default by Linux kernel when something
  84. changes in its internal state (e.g., a new device is added or removed).</para>
  85. </listitem>
  86. </varlistentry>
  87. <varlistentry id="hotplug-rc">
  88. <term><command>*.rc</command> files in
  89. <filename class="directory">/etc/hotplug</filename> directory</term>
  90. <listitem>
  91. <indexterm zone="ch-system-hotplug hotplug-rc"><primary
  92. sortas="e-/etc/hotplug/*.rc">/etc/hotplug/*.rc</primary></indexterm>
  93. <para>These scripts are used for cold plugging, i.e., detection and other
  94. specific actions upon hardware already present during system startup.
  95. They are called by the <filename>hotplug</filename> initscript that comes
  96. from the lfs-bootscripts package.
  97. The <command>*.rc</command>
  98. scripts try to recover hotplug events that were lost during system boot
  99. because, e.g., the root filesystem was not mounted by the kernel.
  100. </para>
  101. </listitem>
  102. </varlistentry>
  103. <varlistentry id="hotplug-agent">
  104. <term><command>*.agent</command> files in
  105. <filename class="directory">/etc/hotplug</filename> directory</term>
  106. <listitem>
  107. <indexterm zone="ch-system-hotplug hotplug-agent"><primary
  108. sortas="e-/etc/hotplug/*.agent">/etc/hotplug/*.agent</primary></indexterm>
  109. <para>These scripts are called by <command>/sbin/hotplug</command>
  110. in response to different types of hotplug events generated by the kernel.
  111. Their action is to insert corresponding kernel modules and call user-provided
  112. scripts, if any.
  113. </para>
  114. </listitem>
  115. </varlistentry>
  116. <varlistentry id="hotplug-functions">
  117. <term><filename>/etc/hotplug/hotplug.functions</filename></term>
  118. <listitem>
  119. <indexterm zone="ch-system-hotplug hotplug-functions"><primary
  120. sortas="e-/etc/hotplug/hotplug.functions">/etc/hotplug/hotplug.functions</primary></indexterm>
  121. <para>This file contains common functions used by other scripts in Hotplug
  122. package.
  123. </para>
  124. </listitem>
  125. </varlistentry>
  126. <varlistentry id="hotplug-blacklist">
  127. <term><filename>/etc/hotplug/blacklist</filename></term>
  128. <listitem>
  129. <indexterm zone="ch-system-hotplug hotplug-blacklist"><primary
  130. sortas="e-/etc/hotplug/blacklist">/etc/hotplug/blacklist</primary></indexterm>
  131. <para>This file contains the list of modules that should never be
  132. inserted into the kernel by hotplug scripts.
  133. </para>
  134. </listitem>
  135. </varlistentry>
  136. <varlistentry id="hotplug-subdirs">
  137. <term><filename class="directory">/etc/hotplug/{pci,usb}</filename></term>
  138. <listitem>
  139. <indexterm zone="ch-system-hotplug hotplug-subdirs"><primary
  140. sortas="e-/etc/hotplug/{pci,usb}">/etc/hotplug/{pci,usb}</primary></indexterm>
  141. <para>These directories are supposed to contain user-written handlers for
  142. hotplug events.
  143. </para>
  144. </listitem>
  145. </varlistentry>
  146. <varlistentry id="hotplug-usb.usermap">
  147. <term><filename>/etc/hotplug/usb.usermap</filename></term>
  148. <listitem>
  149. <indexterm zone="ch-system-hotplug hotplug-usb.usermap"><primary
  150. sortas="e-/etc/hotplug/usb.usermap">/etc/hotplug/usb.usermap</primary></indexterm>
  151. <para>This file contains rules that determine which user-defined handlers to
  152. call for each USB device, based on its vendor, id and other attributes.
  153. </para>
  154. </listitem>
  155. </varlistentry>
  156. <varlistentry id="hotplug-hotplug.d">
  157. <term><filename class="directory">/etc/hotplug.d</filename></term>
  158. <listitem>
  159. <indexterm zone="ch-system-hotplug hotplug-hotplug.d"><primary
  160. sortas="e-/etc/hotplug.d">/etc/hotplug.d</primary></indexterm>
  161. <para>This directory contains programs (or symlinks to them)
  162. that are interested in receiving hotplug events. E.g.,
  163. <application>udev</application> puts its symlink here during installation.
  164. </para>
  165. </listitem>
  166. </varlistentry>
  167. </variablelist>
  168. </sect2>
  169. </sect1>