source: chapter08/udev.xml@ 89c61e5

multilib
Last change on this file since 89c61e5 was 89c61e5, checked in by Thomas Trepl <thomas@…>, 5 months ago

Automatic merge of trunk into multilib

  • Property mode set to 100644
File size: 14.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
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
8<sect1 id="ch-system-udev" role="wrap" revision="sysv">
9 <?dbhtml filename="udev.html"?>
10
11 <sect1info condition="script">
12 <productname>udev</productname>
13 <productnumber>&systemd-version;</productnumber>
14 <address>&systemd-url;</address>
15 </sect1info>
16
17 <title>Udev from Systemd-&systemd-version;</title>
18
19 <indexterm zone="ch-system-udev">
20 <primary sortas="a-Udev">Udev</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Udev package contains programs for dynamic creation of device
27 nodes.</para>
28
29 <segmentedlist>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
32
33 <seglistitem>
34 <seg>&udev-fin-sbu;</seg>
35 <seg>&udev-fin-du;</seg>
36 </seglistitem>
37 </segmentedlist>
38 </sect2>
39
40 <sect2 role="installation">
41 <title>Installation of Udev</title>
42
43 <para>Udev is part of the systemd-&systemd-version; package. Use
44 the systemd-&systemd-version;.tar.xz file as the source tarball.</para>
45
46 <para>Remove two unneeded groups,
47 <systemitem class="groupname">render</systemitem> and
48 <systemitem class="groupname">sgx</systemitem>, from the default udev
49 rules:</para>
50
51 <screen><userinput remap="pre">sed -i -e 's/GROUP="render"/GROUP="video"/' \
52 -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in</userinput></screen>
53
54 <para>Remove one udev rule requiring a full Systemd installation:</para>
55
56 <screen><userinput remap="pre">sed '/systemd-sysctl/s/^/#/' -i rules.d/99-systemd.rules.in</userinput></screen>
57
58 <para>Adjust the hardcoded paths to network configuration files for the
59 standalone udev installation:</para>
60
61 <screen><userinput remap="pre">sed '/NETWORK_DIRS/s/systemd/udev/' -i src/basic/path-lookup.h</userinput></screen>
62
63 <para>Prepare Udev for compilation:</para>
64
65<screen><userinput remap="configure">mkdir -p build
66cd build
67
68meson setup \
69 --prefix=/usr \
70 --buildtype=release \
71 -Dmode=release \
72 -Ddev-kvm-mode=0660 \
73 -Dlink-udev-shared=false \
74 -Dlogind=false \
75 -Dvconsole=false \
76 ..</userinput></screen>
77
78 <variablelist>
79 <title>The meaning of the meson options:</title>
80
81 <varlistentry>
82 <term><parameter>--buildtype=release</parameter></term>
83 <listitem>
84 <para>This switch overrides the default buildtype
85 (<quote>debug</quote>), which produces unoptimized
86 binaries.</para>
87 </listitem>
88 </varlistentry>
89
90 <varlistentry>
91 <term><parameter>-Dmode=release</parameter></term>
92 <listitem>
93 <para>Disable some features considered experimental by upstream.
94 </para>
95 </listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><parameter>-Ddev-kvm-mode=0660</parameter></term>
100 <listitem>
101 <para>The default udev rule would allow all users to access
102 <filename class='devicefile'>/dev/kvm</filename>. The editors
103 consider it dangerous. This option overrides it.</para>
104 </listitem>
105 </varlistentry>
106
107 <varlistentry>
108 <term><parameter>-Dlink-udev-shared=false</parameter></term>
109 <listitem>
110 <para>This option prevents udev from linking to the internal
111 systemd shared library,
112 <systemitem class='library'>libsystemd-shared</systemitem>.
113 This library is designed to be shared by many Systemd components
114 and it's too overkill for a udev-only installation.</para>
115 </listitem>
116 </varlistentry>
117
118 <varlistentry>
119 <term><parameter>-Dlogind=false -Dvconsole=false</parameter></term>
120 <listitem>
121 <para>These options prevent the generation of several udev rule
122 files belonging to the other Systemd components that we won't
123 install.</para>
124 </listitem>
125 </varlistentry>
126 </variablelist>
127
128 <para>Get the list of the shipped udev helpers and save it into an
129 environment variable (exporting it is not strictly necessary, but it makes
130 building as a regular user or using a package manager easier):</para>
131
132 <screen><userinput remap="make">export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | \
133 awk '{print $3}' | tr -d ",'" | grep -v 'udevadm')</userinput></screen>
134
135 <para>Only build the components needed for udev:</para>
136
137 <screen><userinput remap="make">ninja udevadm systemd-hwdb \
138 $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \
139 $(realpath libudev.so --relative-to .) \
140 $udev_helpers udevadm</userinput></screen>
141
142 <para>Install the package:</para>
143
144 <screen><userinput remap="install">install -vm755 -d {/usr/lib,/etc}/udev/{hwdb.d,rules.d,network}
145install -vm755 -d /usr/{lib,share}/pkgconfig
146install -vm755 udevadm /usr/bin/
147install -vm755 systemd-hwdb /usr/bin/udev-hwdb
148ln -svfn ../bin/udevadm /usr/sbin/udevd
149cp -av libudev.so{,*[0-9]} /usr/lib/
150install -vm644 ../src/libudev/libudev.h /usr/include/
151install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/
152install -vm644 src/udev/*.pc /usr/share/pkgconfig/
153install -vm644 ../src/udev/udev.conf /etc/udev/
154install -vm644 rules.d/* ../rules.d/README /usr/lib/udev/rules.d/
155install -vm644 $(find ../rules.d/*.rules \
156 -not -name '*power-switch*') /usr/lib/udev/rules.d/
157install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/
158install -vm755 $udev_helpers /usr/lib/udev
159install -vm644 ../network/99-default.link /usr/lib/udev/network</userinput></screen>
160
161 <para>Install some custom rules and support files useful in an LFS
162 environment:</para>
163
164<screen><userinput remap="install">tar -xvf ../../&udev-lfs-version;.tar.xz
165make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
166
167 <para>Install the man pages:</para>
168
169 <!-- Please make sure systemd man pages tarball has a common leading
170 component in the path. -->
171<screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz \
172 --no-same-owner --strip-components=1 \
173 -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \
174 '*/systemd.link.5' \
175 '*/systemd-'{hwdb,udevd.service}.8
176
177sed 's|systemd/network|udev/network|' \
178 /usr/share/man/man5/systemd.link.5 \
179 > /usr/share/man/man5/udev.link.5
180
181sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \
182 > /usr/share/man/man8/udev-hwdb.8
183
184sed 's|lib.*udevd|sbin/udevd|' \
185 /usr/share/man/man8/systemd-udevd.service.8 \
186 > /usr/share/man/man8/udevd.8
187
188rm /usr/share/man/man*/systemd*</userinput></screen>
189
190 <para>Finally, unset the <envar>udev_helpers</envar> variable:</para>
191
192 <!-- remap="make" seems confusing but we don't have sth. like
193 remap="clean". -->
194 <screen><userinput remap="make">unset udev_helpers</userinput></screen>
195
196 </sect2>
197
198 <!-- - - - - - - - - - -->
199 <!-- Multilib - 32bit -->
200 <!-- - - - - - - - - - -->
201 <sect2 arch="ml_32,ml_all" role="installation">
202 <title>Installation of Udev - 32bit</title>
203
204 <para>Clean previous build (while still in the build directory):</para>
205
206<screen><userinput remap="pre">rm -rf *</userinput></screen>
207
208 <para>Prepare Udev for compilation:</para>
209
210<screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \
211CC="gcc -m32 -march=i686" \
212CXX="g++ -m32 -march=i686" \
213LANG=en_US.UTF-8 \
214meson setup \
215 --prefix=/usr \
216 --buildtype=release \
217 -Dmode=release \
218 -Ddev-kvm-mode=0660 \
219 -Dlink-udev-shared=false \
220 ..</userinput></screen>
221
222 <para>Compile the package:</para>
223
224<screen><userinput remap="make">ninja \
225 $(grep -o -E "^build (src/libudev|src/udev)[^:]*" \
226 build.ninja | awk '{ print $2 }') \
227 $(realpath libudev.so --relative-to .)</userinput></screen>
228
229 <para>Install the package:</para>
230
231<screen><userinput remap="install">mkdir -pv /usr/lib32/pkgconfig &amp;&amp;
232cp -av libudev.so{,*[0-9]} /usr/lib32/ &amp;&amp;
233sed -e "s;/usr/lib;&amp;32;g" src/libudev/libudev.pc > /usr/lib32/pkgconfig/libudev.pc</userinput></screen>
234
235 </sect2><!-- m32 -->
236
237 <!-- - - - - - - - - - -->
238 <!-- Multilib - x32bit -->
239 <!-- - - - - - - - - - -->
240 <sect2 arch="ml_x32,ml_all" role="installation">
241 <title>Installation of Udev - x32bit</title>
242 <para>Clean previous build (while still in the build directory):</para>
243
244<screen><userinput remap="pre">rm -rf *</userinput></screen>
245
246 <para>Prepare Udev for compilation:</para>
247
248<screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/libx32/pkgconfig" \
249CC="gcc -mx32" \
250CXX="g++ -mx32" \
251CFLAGS+=" -Wno-error=shift-overflow" \
252CXXFLAGS+=" -Wno-error=shift-overflow" \
253LANG=en_US.UTF-8 \
254meson setup \
255 --prefix=/usr \
256 --buildtype=release \
257 -Dmode=release \
258 -Ddev-kvm-mode=0660 \
259 -Dlink-udev-shared=false \
260 ..</userinput></screen>
261
262 <para>Compile the package:</para>
263
264<screen><userinput remap="make">ninja \
265 $(grep -o -E "^build (src/libudev|src/udev)[^:]*" \
266 build.ninja | awk '{ print $2 }') \
267 $(realpath libudev.so --relative-to .)</userinput></screen>
268
269 <para>Install the package:</para>
270
271<screen><userinput remap="install">mkdir -pv /usr/libx32/pkgconfig &amp;&amp;
272cp -av libudev.so{,*[0-9]} /usr/libx32/ &amp;&amp;
273sed -e "s;/usr/lib;&amp;x32;g" src/libudev/libudev.pc > /usr/libx32/pkgconfig/libudev.pc</userinput></screen>
274
275 </sect2><!-- mx32 -->
276
277 <sect2 id="conf-udev" role="configuration">
278 <title>Configuring Udev</title>
279
280 <indexterm zone="conf-udev">
281 <primary sortas="a-Udev">Udev</primary>
282 <secondary>configuring</secondary>
283 </indexterm>
284
285 <indexterm zone="conf-udev">
286 <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
287 </indexterm>
288
289 <para>Information about hardware devices is maintained in the
290 <filename class="directory">/etc/udev/hwdb.d</filename> and
291 <filename class="directory">/usr/lib/udev/hwdb.d</filename> directories.
292 <application>Udev</application> needs that information to be compiled
293 into a binary database <filename>/etc/udev/hwdb.bin</filename>. Create the
294 initial database:</para>
295
296<screen><userinput>udev-hwdb update</userinput></screen>
297
298 <para>This command needs to be run each time the hardware information is
299 updated.</para>
300
301 </sect2>
302
303 <sect2 id="contents-udev" role="content">
304 <title>Contents of Udev</title>
305
306 <segmentedlist>
307 <segtitle>Installed programs</segtitle>
308 <segtitle>Installed libraries</segtitle>
309 <segtitle>Installed directories</segtitle>
310
311 <seglistitem>
312 <seg>udevadm, udevd (symlink to udevadm), and udev-hwdb</seg>
313
314 <seg>libudev.so</seg>
315
316 <seg>/etc/udev and /usr/lib/udev</seg>
317 </seglistitem>
318 </segmentedlist>
319
320 <variablelist>
321 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
322 <?dbfo list-presentation="list"?>
323 <?dbhtml list-presentation="table"?>
324 <varlistentry id="udevadm" revision="sysv">
325 <term><command>udevadm</command></term>
326 <listitem>
327 <para>Generic udev administration tool: controls the udevd daemon,
328 provides info from the Udev database, monitors uevents, waits for
329 uevents to finish, tests Udev configuration, and triggers uevents
330 for a given device</para>
331 <indexterm zone="ch-system-udev udevadm">
332 <primary sortas="b-udevadm">udevadm</primary>
333 </indexterm>
334 </listitem>
335 </varlistentry>
336
337 <varlistentry id="udevd">
338 <term><command>udevd</command></term>
339 <listitem>
340 <para>A daemon that listens for uevents on the netlink socket,
341 creates devices and runs the configured external programs in
342 response to these uevents</para>
343 <indexterm zone="ch-system-udev udevd">
344 <primary sortas="b-udevd">udevd</primary>
345 </indexterm>
346 </listitem>
347 </varlistentry>
348
349 <varlistentry id="udev-hwdb">
350 <term><command>udev-hwdb</command></term>
351 <listitem>
352 <para>Updates or queries the hardware database.</para>
353 <indexterm zone="ch-system-udev udev-hwdb">
354 <primary sortas="b-udev-hwdb">udev-hwdb</primary>
355 </indexterm>
356 </listitem>
357 </varlistentry>
358
359 <varlistentry id="libudev">
360 <term><filename class="libraryfile">libudev</filename></term>
361 <listitem>
362 <para>A library interface to udev device information</para>
363 <indexterm zone="ch-system-udev libudev">
364 <primary sortas="c-libudev">libudev</primary>
365 </indexterm>
366 </listitem>
367 </varlistentry>
368
369 <varlistentry id="etc-udev">
370 <term><filename class="directory">/etc/udev</filename></term>
371 <listitem>
372 <para>Contains Udev configuration files,
373 device permissions, and rules for device naming</para>
374 <indexterm zone="ch-system-udev etc-udev">
375 <primary sortas="e-/etc/udev">/etc/udev</primary>
376 </indexterm>
377 </listitem>
378 </varlistentry>
379
380 </variablelist>
381
382 </sect2>
383
384</sect1>
Note: See TracBrowser for help on using the repository browser.