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