[a289860] | 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 |
|
---|
[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 |
|
---|
| 68 | meson setup \
|
---|
| 69 | --prefix=/usr \
|
---|
| 70 | --buildtype=release \
|
---|
| 71 | -Dmode=release \
|
---|
| 72 | -Ddev-kvm-mode=0660 \
|
---|
| 73 | -Dlink-udev-shared=false \
|
---|
[5196dae] | 74 | -Dlogind=false \
|
---|
| 75 | -Dvconsole=false \
|
---|
[a289860] | 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>
|
---|
[5196dae] | 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>
|
---|
[a289860] | 126 | </variablelist>
|
---|
| 127 |
|
---|
| 128 | <para>Only build the components needed for udev:</para>
|
---|
| 129 |
|
---|
[5196dae] | 130 | <screen><userinput remap="make">ninja udevadm systemd-hwdb \
|
---|
| 131 | $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \
|
---|
[a289860] | 132 | $(realpath libudev.so --relative-to .)</userinput></screen>
|
---|
| 133 |
|
---|
| 134 | <para>Install the package:</para>
|
---|
| 135 |
|
---|
[823fbde] | 136 | <screen><userinput remap="install">install -vm755 -d {/usr/lib,/etc}/udev/{hwdb.d,rules.d,network}
|
---|
[f7c36d04] | 137 | install -vm755 -d /usr/{lib,share}/pkgconfig
|
---|
[5196dae] | 138 | install -vm755 udevadm /usr/bin/
|
---|
| 139 | install -vm755 systemd-hwdb /usr/bin/udev-hwdb
|
---|
| 140 | ln -svfn ../bin/udevadm /usr/sbin/udevd
|
---|
| 141 | cp -av libudev.so{,*[0-9]} /usr/lib/
|
---|
| 142 | install -vm644 ../src/libudev/libudev.h /usr/include/
|
---|
| 143 | install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/
|
---|
| 144 | install -vm644 src/udev/*.pc /usr/share/pkgconfig/
|
---|
| 145 | install -vm644 ../src/udev/udev.conf /etc/udev/
|
---|
| 146 | install -vm644 rules.d/* ../rules.d/README /usr/lib/udev/rules.d/
|
---|
[4bc51b9] | 147 | install -vm644 $(find ../rules.d/*.rules \
|
---|
| 148 | -not -name '*power-switch*') /usr/lib/udev/rules.d/
|
---|
[5196dae] | 149 | install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/
|
---|
[4bc51b9] | 150 | install -vm755 $(find src/udev \
|
---|
[823fbde] | 151 | -type f -not -name '*.*') /usr/lib/udev
|
---|
| 152 | install -vm644 ../network/99-default.link /usr/lib/udev/network</userinput></screen>
|
---|
[a289860] | 153 |
|
---|
| 154 | <para>Install some custom rules and support files useful in an LFS
|
---|
| 155 | environment:</para>
|
---|
| 156 |
|
---|
| 157 | <screen><userinput remap="install">tar -xvf ../../&udev-lfs-version;.tar.xz
|
---|
| 158 | make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
|
---|
| 159 |
|
---|
[cce6c92] | 160 | <para>Install the man pages:</para>
|
---|
| 161 |
|
---|
| 162 | <!-- Please make sure systemd man pages tarball has a common leading
|
---|
| 163 | component in the path. -->
|
---|
[264a80d] | 164 | <screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz \
|
---|
| 165 | --no-same-owner --strip-components=1 \
|
---|
[cce6c92] | 166 | -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \
|
---|
[823fbde] | 167 | '*/systemd.link.5' \
|
---|
[cce6c92] | 168 | '*/systemd-'{hwdb,udevd.service}.8
|
---|
[823fbde] | 169 |
|
---|
| 170 | sed 's|systemd/network|udev/network|' \
|
---|
| 171 | /usr/share/man/man5/systemd.link.5 \
|
---|
| 172 | > /usr/share/man/man5/udev.link.5
|
---|
| 173 |
|
---|
[264a80d] | 174 | sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \
|
---|
| 175 | > /usr/share/man/man8/udev-hwdb.8
|
---|
[823fbde] | 176 |
|
---|
[cce6c92] | 177 | sed 's|lib.*udevd|sbin/udevd|' \
|
---|
| 178 | /usr/share/man/man8/systemd-udevd.service.8 \
|
---|
| 179 | > /usr/share/man/man8/udevd.8
|
---|
[823fbde] | 180 |
|
---|
| 181 | rm /usr/share/man/man*/systemd*</userinput></screen>
|
---|
[cce6c92] | 182 |
|
---|
[a289860] | 183 | </sect2>
|
---|
| 184 |
|
---|
| 185 | <sect2 id="conf-udev" role="configuration">
|
---|
| 186 | <title>Configuring Udev</title>
|
---|
| 187 |
|
---|
| 188 | <indexterm zone="conf-udev">
|
---|
| 189 | <primary sortas="a-Udev">Udev</primary>
|
---|
| 190 | <secondary>configuring</secondary>
|
---|
| 191 | </indexterm>
|
---|
| 192 |
|
---|
| 193 | <indexterm zone="conf-udev">
|
---|
| 194 | <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
|
---|
| 195 | </indexterm>
|
---|
| 196 |
|
---|
| 197 | <para>Information about hardware devices is maintained in the
|
---|
| 198 | <filename class="directory">/etc/udev/hwdb.d</filename> and
|
---|
| 199 | <filename class="directory">/usr/lib/udev/hwdb.d</filename> directories.
|
---|
| 200 | <application>Udev</application> needs that information to be compiled
|
---|
| 201 | into a binary database <filename>/etc/udev/hwdb.bin</filename>. Create the
|
---|
| 202 | initial database:</para>
|
---|
| 203 |
|
---|
| 204 | <screen><userinput>udev-hwdb update</userinput></screen>
|
---|
| 205 |
|
---|
| 206 | <para>This command needs to be run each time the hardware information is
|
---|
| 207 | updated.</para>
|
---|
| 208 |
|
---|
| 209 | </sect2>
|
---|
| 210 |
|
---|
| 211 | <sect2 id="contents-udev" role="content">
|
---|
| 212 | <title>Contents of Udev</title>
|
---|
| 213 |
|
---|
| 214 | <segmentedlist>
|
---|
| 215 | <segtitle>Installed programs</segtitle>
|
---|
| 216 | <segtitle>Installed libraries</segtitle>
|
---|
| 217 | <segtitle>Installed directories</segtitle>
|
---|
| 218 |
|
---|
| 219 | <seglistitem>
|
---|
| 220 | <seg>udevadm, udevd (symlink to udevadm), and udev-hwdb</seg>
|
---|
| 221 |
|
---|
| 222 | <seg>libudev.so</seg>
|
---|
| 223 |
|
---|
| 224 | <seg>/etc/udev and /usr/lib/udev</seg>
|
---|
| 225 | </seglistitem>
|
---|
| 226 | </segmentedlist>
|
---|
| 227 |
|
---|
| 228 | <variablelist>
|
---|
| 229 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 230 | <?dbfo list-presentation="list"?>
|
---|
| 231 | <?dbhtml list-presentation="table"?>
|
---|
| 232 | <varlistentry id="udevadm" revision="sysv">
|
---|
| 233 | <term><command>udevadm</command></term>
|
---|
| 234 | <listitem>
|
---|
| 235 | <para>Generic udev administration tool: controls the udevd daemon,
|
---|
| 236 | provides info from the Udev database, monitors uevents, waits for
|
---|
| 237 | uevents to finish, tests Udev configuration, and triggers uevents
|
---|
| 238 | for a given device</para>
|
---|
| 239 | <indexterm zone="ch-system-udev udevadm">
|
---|
| 240 | <primary sortas="b-udevadm">udevadm</primary>
|
---|
| 241 | </indexterm>
|
---|
| 242 | </listitem>
|
---|
| 243 | </varlistentry>
|
---|
| 244 |
|
---|
| 245 | <varlistentry id="udevd">
|
---|
| 246 | <term><command>udevd</command></term>
|
---|
| 247 | <listitem>
|
---|
| 248 | <para>A daemon that listens for uevents on the netlink socket,
|
---|
| 249 | creates devices and runs the configured external programs in
|
---|
| 250 | response to these uevents</para>
|
---|
| 251 | <indexterm zone="ch-system-udev udevd">
|
---|
| 252 | <primary sortas="b-udevd">udevd</primary>
|
---|
| 253 | </indexterm>
|
---|
| 254 | </listitem>
|
---|
| 255 | </varlistentry>
|
---|
| 256 |
|
---|
| 257 | <varlistentry id="udev-hwdb">
|
---|
| 258 | <term><command>udev-hwdb</command></term>
|
---|
| 259 | <listitem>
|
---|
[4ca4e8b] | 260 | <para>Updates or queries the hardware database.</para>
|
---|
[a289860] | 261 | <indexterm zone="ch-system-udev udev-hwdb">
|
---|
| 262 | <primary sortas="b-udev-hwdb">udev-hwdb</primary>
|
---|
| 263 | </indexterm>
|
---|
| 264 | </listitem>
|
---|
| 265 | </varlistentry>
|
---|
| 266 |
|
---|
| 267 | <varlistentry id="libudev">
|
---|
| 268 | <term><filename class="libraryfile">libudev</filename></term>
|
---|
| 269 | <listitem>
|
---|
| 270 | <para>A library interface to udev device information</para>
|
---|
| 271 | <indexterm zone="ch-system-udev libudev">
|
---|
| 272 | <primary sortas="c-libudev">libudev</primary>
|
---|
| 273 | </indexterm>
|
---|
| 274 | </listitem>
|
---|
| 275 | </varlistentry>
|
---|
| 276 |
|
---|
| 277 | <varlistentry id="etc-udev">
|
---|
| 278 | <term><filename class="directory">/etc/udev</filename></term>
|
---|
| 279 | <listitem>
|
---|
| 280 | <para>Contains Udev configuration files,
|
---|
| 281 | device permissions, and rules for device naming</para>
|
---|
| 282 | <indexterm zone="ch-system-udev etc-udev">
|
---|
| 283 | <primary sortas="e-/etc/udev">/etc/udev</primary>
|
---|
| 284 | </indexterm>
|
---|
| 285 | </listitem>
|
---|
| 286 | </varlistentry>
|
---|
| 287 |
|
---|
| 288 | </variablelist>
|
---|
| 289 |
|
---|
| 290 | </sect2>
|
---|
| 291 |
|
---|
| 292 | </sect1>
|
---|