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