/[gentoo]/xml/htdocs/doc/en/udev-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/udev-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.52 Revision 1.53
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/udev-guide.xml,v 1.52 2010/12/26 19:21:44 nightmorph Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/udev-guide.xml,v 1.53 2011/03/12 05:44:14 nightmorph Exp $ -->
4 4
5<guide> 5<guide>
6<title>Gentoo udev Guide</title> 6<title>Gentoo udev Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
21 21
22<!-- The content of this document is licensed under the CC-BY-SA license --> 22<!-- The content of this document is licensed under the CC-BY-SA license -->
23<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 23<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
24<license/> 24<license/>
25 25
26<version>7</version> 26<version>8</version>
27<date>2010-12-26</date> 27<date>2011-03-11</date>
28 28
29<chapter> 29<chapter>
30<title>What is udev?</title> 30<title>What is udev?</title>
31<section> 31<section>
32<title>The /dev Directory</title> 32<title>The /dev Directory</title>
69 <li>Provides consistent naming</li> 69 <li>Provides consistent naming</li>
70 <li>Provides a user-space API</li> 70 <li>Provides a user-space API</li>
71</ul> 71</ul>
72 72
73<p> 73<p>
74To provide these features, udev is developed in three separate projects: 74Every time a change happens within the device structure, the kernel emits a
75<e>namedev</e>, <e>libsysfs</e> and, of course, <e>udev</e>. 75<e>uevent</e> which gets picked up by udev. udev then follows the rules as
76</p> 76declared in the <path>/etc/udev/rules.d</path> and
77 77<path>/lib/udev/rules.d</path> directories. Based on the information contained
78</body> 78within the uevent, it finds the rule or rules it needs to trigger and performs
79</section> 79the required actions. These actions can be creating or deleting device files,
80<section> 80but can also trigger the loading of particular firmware files into the
81<title>namedev</title> 81kernel memory.
82<body>
83
84<p>
85Namedev allows you to define the device naming separately from the udev program.
86This allows for flexible naming policies and naming schemes developed by
87separate entities. This device naming subsystem provides a standard interface
88that udev can use.
89</p>
90
91<p>
92Currently only a single naming scheme is provided by namedev; the one provided
93by LANANA, used by the majority of Linux systems currently and therefore very
94suitable for the majority of Linux users.
95</p>
96
97<p>
98Namedev uses a 5-step procedure to find out the name of a given device. If the
99device name is found in one of the given steps, that name is used. The steps
100are:
101</p>
102
103<ul>
104 <li>label or serial number</li>
105 <li>bus device number</li>
106 <li>bus topology</li>
107 <li>statically given name</li>
108 <li>kernel provided name</li>
109</ul>
110
111<p>
112The <e>label or serial number</e> step checks if the device has a unique
113identifier. For instance USB devices have a unique USB serial number; SCSI
114devices have a unique UUID. If namedev finds a match between this unique number
115and a given configuration file, the name provided in the configuration file is
116used.
117</p>
118
119<p>
120The <e>bus device number</e> step checks the device bus number. For
121non-hot-swappable environments this procedure is sufficient to
122identify a hardware device. For instance PCI bus numbers rarely change in the
123lifetime of a system. Again, if namedev finds a match between this position and
124a given configuration file, the name provided in that configuration file is
125used.
126</p>
127
128<p>
129Likewise the <e>bus topology</e> is a rather static way of defining devices as
130long as the user doesn't switch devices. When the position of the device matches
131a given setting provided by the user, the accompanying name is used.
132</p>
133
134<p>
135The fourth step, <e>statically given name</e>, is a simple string replacement.
136When the kernel name (the default name) matches a given replacement string, the
137substitute name will be used.
138</p>
139
140<p>
141The final step (<e>kernel provided name</e>) is a catch-all: this one takes
142the default name provided by the kernel. In the majority of cases this is
143sufficient as it matches the device naming used on current Linux systems.
144</p>
145
146</body>
147</section>
148<section>
149<title>libsysfs</title>
150<body>
151
152<p>
153udev interacts with the kernel through the sysfs pseudo filesystem. The libsysfs
154project provides a common API to access the information given by the sysfs
155filesystem in a generic way. This allows for querying all kinds of hardware
156without having to make assumptions on the kind of hardware.
157</p>
158
159</body>
160</section>
161<section>
162<title>udev</title>
163<body>
164
165<p>
166Every time the kernel gets an event in the device structure, it asks udev to
167take a look. udev follows the rules in the <path>/etc/udev/rules.d/</path>
168directory. udev then uses the information given by the kernel to perform the
169necessary actions on the <path>/dev</path> structure (creating or deleting
170device files).
171</p> 82</p>
172 83
173</body> 84</body>
174</section> 85</section>
175</chapter> 86</chapter>
180<title>Requirements</title> 91<title>Requirements</title>
181<body> 92<body>
182 93
183<p> 94<p>
184udev is meant to be used in combination with a 2.6 kernel (like 95udev is meant to be used in combination with a 2.6 kernel (like
185<c>gentoo-sources</c> with the default 2007.0 profile). If you're using such a 96<c>gentoo-sources</c> with the default 10.0 profile). If you're using such a
186kernel then you just have to make sure that you have a recent 97kernel then you just should have no issues whatsoever with using udev as the
187<c>sys-apps/baselayout</c> version. That's all you need. 98necessary support is built-in in all stable <c>sys-apps/baselayout</c>
99versions. Normally, udev should already be installed on your system, but if
100this is not the case, then it is easy to install:
188</p> 101</p>
189 102
190<pre caption="Installing udev"> 103<pre caption="Installing udev">
191# <i>emerge udev</i> 104# <i>emerge udev</i>
192</pre> 105</pre>
194<p> 107<p>
195Kernelwise, be sure to activate the following options: 108Kernelwise, be sure to activate the following options:
196</p> 109</p>
197 110
198<pre caption="Required kernel options"> 111<pre caption="Required kernel options">
112General Setup ---&gt;
113 <comment>(Make sure the following item is *not* enabled)</comment>
114 [ ] enable deprecated sysfs features to support old userspace tools
115
199File systems ---&gt; 116File Systems ---&gt;
200 [*] Inotify file change notification support
201 [*] Inotify support for userspace 117 [*] Inotify support for userspace
202 Pseudo filesystems ---&gt; 118 Pseudo filesystems ---&gt;
203 [*] /proc file system support
204 [*] Virtual memory file system support (former shm fs) 119 [*] Virtual memory file system support (former shm fs)
205</pre> 120</pre>
206 121
207<p> 122<p>
208If you use <c>genkernel</c>, you don't need to do anything special. Genkernel 123If you use <c>genkernel</c>, you don't need to do anything special. Genkernel
209sets up udev by default. 124sets up udev by default.
210</p>
211
212</body>
213</section>
214<section>
215<title>Configuration</title>
216<body>
217
218<p>
219If you want to use the udev settings Gentoo provides to make your life
220comfortable, then read no more. Gentoo will use udev but keep a static
221<path>/dev</path> so that you will never have any missing device nodes.
222The Gentoo init scripts won't run the devfsd daemon and will deactivate devfs
223when you boot up.
224</p>
225
226<p>
227But if you are a die-hard and want to run a udev-only, unmodified system as is
228intended by the udev development (including the difficulties of missing device
229nodes because udev doesn't support them yet), by all means, read on :)
230</p>
231
232<p>
233We'll deactivate the rules that save the device file nodes: edit the
234<c>RC_DEVICE_TARBALL</c> variable in <path>/etc/conf.d/rc</path> and set it to
235<c>no</c>:
236</p>
237
238<pre caption="/etc/conf.d/rc">
239RC_DEVICE_TARBALL="no"
240</pre>
241
242<p>
243If you have included devfs support in your kernel, you can deactivate it in
244the bootloader configuration: add <c>gentoo=nodevfs</c> as a kernel parameter.
245If you want to use devfs and deactivate udev, add <c>gentoo=noudev</c> as kernel
246parameter.
247</p> 125</p>
248 126
249</body> 127</body>
250</section> 128</section>
251</chapter> 129</chapter>

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20