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