aboutsummaryrefslogtreecommitdiffstats
path: root/chapter06/hotplug.xml
blob: 6832fda2ccc988c73c0d9ca927e0b99f75dafec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  <!ENTITY % patches-entities SYSTEM "../patches.ent">
  %general-entities;
  %patches-entities;
]>
<sect1 id="ch-system-hotplug" xreflabel="Hotplug" role="wrap">
<title>Hotplug-&hotplug-version;</title>
<?dbhtml filename="hotplug.html"?>

<indexterm zone="ch-system-hotplug"><primary sortas="a-Hotplug">Hotplug</primary></indexterm>

<sect2 role="package"><title/>
<para>The Hotplug package contains scripts that react upon hotplug events
generated by the kernel. Such events correspond to every change in the kernel
state visible in the <systemitem class="filesystem">sysfs</systemitem>
filesystem, e.g., the addition and removal of hardware. This package also
detects existing hardware during boot and inserts the relevant modules into the
running kernel.</para>

<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem><seg>0.01 SBU</seg><seg>460 KB</seg></seglistitem>
</segmentedlist>

<segmentedlist>
<segtitle>&dependencies;</segtitle>
<seglistitem><seg>Bash, Coreutils, Find, Gawk, and Make</seg></seglistitem>
</segmentedlist>
</sect2>

<sect2 role="installation">
<title>Installation of Hotplug</title>

<para>Install the Hotplug package:</para>

<screen><userinput>make install</userinput></screen>

<para>Copy a file that the <quote>install</quote> target omits.</para>

<screen><userinput>cp etc/hotplug/pnp.distmap /etc/hotplug</userinput></screen>

<para>Remove the init script that Hotplug installs, since we're going to be
using the script included with LFS-Bootscripts:</para>

<screen><userinput>rm -rf /etc/init.d</userinput></screen>

<para>Network device hotplugging is not supported by LFS bootscripts yet. For
that reason, remove the network hotplug agent:</para>

<screen><userinput>rm -f /etc/hotplug/net.agent</userinput></screen>

<para>Create a directory for storing firmware that can be loaded by
<command>hotplug</command>:</para>

<screen><userinput>mkdir /lib/firmware</userinput></screen>

</sect2>


<sect2 id="contents-hotplug" role="content"><title>Contents of Hotplug</title>

<segmentedlist>
<segtitle>Installed program</segtitle>
<segtitle>Installed scripts</segtitle>
<segtitle>Installed files</segtitle>
<seglistitem><seg>hotplug</seg>
<seg>/etc/hotplug/*.rc, /etc/hotplug/*.agent</seg>
<seg>/etc/hotplug/hotplug.functions, /etc/hotplug/blacklist, /etc/hotplug/{pci,usb},
/etc/hotplug/usb.usermap, /etc/hotplug.d, and /var/log/hotplug/events</seg></seglistitem>
</segmentedlist>

<variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>

<varlistentry id="hotplug">
<term><command>hotplug</command></term>
<listitem>
<para>This script is called by default by the Linux kernel when something
changes in its internal state (e.g., a new device is added or an existing device
is removed)</para>
<indexterm zone="ch-system-hotplug hotplug"><primary
sortas="b-hotplug">hotplug</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-rc">
<term><command>/etc/hotplug/*.rc</command></term>
<listitem>
<para>These scripts are used for cold plugging, i.e., detecting and acting upon
hardware already present during system startup.  They are called by the
<filename>hotplug</filename> initscript that comes from the LFS-Bootscripts
package.  The <command>*.rc</command> scripts try to recover hotplug events that
were lost during system boot because, for example, the root filesystem was not
mounted by the kernel</para>
<indexterm zone="ch-system-hotplug hotplug-rc"><primary
sortas="d-/etc/hotplug/*.rc">/etc/hotplug/*.rc</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-agent">
<term><command>/etc/hotplug/*.agent</command></term>
<listitem>
<para>These scripts are called by <command>hotplug</command>
in response to different types of hotplug events generated by the kernel.
Their action is to insert corresponding kernel modules and call any
user-provided scripts</para>
<indexterm zone="ch-system-hotplug hotplug-agent"><primary
sortas="d-/etc/hotplug/*.agent">/etc/hotplug/*.agent</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-blacklist">
<term><filename>/etc/hotplug/blacklist</filename></term>
<listitem>
<para>This file contains the list of modules that should never be inserted into
the kernel by the Hotplug scripts</para>
<indexterm zone="ch-system-hotplug hotplug-blacklist"><primary
sortas="e-/etc/hotplug/blacklist">/etc/hotplug/blacklist</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-functions">
<term><filename>/etc/hotplug/hotplug.functions</filename></term>
<listitem>
<para>This file contains common functions used by other scripts in the Hotplug
package</para>
<indexterm zone="ch-system-hotplug hotplug-functions"><primary
sortas="e-/etc/hotplug/hotplug.functions">/etc/hotplug/hotplug.functions</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-subdirs">
<term><filename class="directory">/etc/hotplug/{pci,usb}</filename></term>
<listitem>
<para>These directories contain user-written handlers for hotplug events</para>
<indexterm zone="ch-system-hotplug hotplug-subdirs"><primary
sortas="e-/etc/hotplug/{pci,usb}">/etc/hotplug/{pci,usb}</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-usb.usermap">
<term><filename>/etc/hotplug/usb.usermap</filename></term>
<listitem>
<para>This file contains rules that determine which user-defined handlers to
call for each USB device, based on its vendor ID and other attributes</para>
<indexterm zone="ch-system-hotplug hotplug-usb.usermap"><primary
sortas="e-/etc/hotplug/usb.usermap">/etc/hotplug/usb.usermap</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-hotplug.d">
<term><filename class="directory">/etc/hotplug.d</filename></term>
<listitem>
<para>This directory contains programs (or symlinks to them) that are interested
in receiving hotplug events. For example, Udev puts its symlink here during
installation</para>
<indexterm zone="ch-system-hotplug hotplug-hotplug.d"><primary
sortas="e-/etc/hotplug.d">/etc/hotplug.d</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-firmware">
<term><filename class="directory">/lib/firmware</filename></term>
<listitem>
<para>This directory contains the firmware for devices that need to have their
firmware loaded before use</para>
<indexterm zone="ch-system-hotplug hotplug-firmware"><primary
sortas="e-/lib/firmware">/lib/firmware</primary></indexterm>
</listitem>
</varlistentry>

<varlistentry id="hotplug-events">
<term><filename>/var/log/hotplug/events</filename></term>
<listitem>
<para>This file contains all the events that <command>hotplug</command> has
called since bootup</para>
<indexterm zone="ch-system-hotplug hotplug-events"><primary
sortas="e-/var/log/hotplug/events">/var/log/hotplug/events</primary></indexterm>
</listitem>
</varlistentry>

</variablelist>
</sect2>
</sect1>