| 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-&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 (extracted from systemd) contains programs |
| 27 | for dynamic creation of device 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>First, remove two unneeded groups, |
| 44 | <systemitem class="groupname">render</systemitem> and |
| 45 | <systemitem class="groupname">sgx</systemitem>, from the default udev |
| 46 | rules:</para> |
| 47 | |
| 48 | <screen><userinput remap="pre"> sed -i -e 's/GROUP="render"/GROUP="video"/' \ |
| 49 | -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in</userinput></screen> |
| 50 | |
| 51 | <para>Prepare udev for compilation:</para> |
| 52 | |
| 53 | <screen><userinput remap="configure">mkdir -p build |
| 54 | cd build |
| 55 | |
| 56 | LANG=en_US.UTF-8 \ |
| 57 | meson --prefix=/usr \ |
| 58 | --sysconfdir=/etc \ |
| 59 | --localstatedir=/var \ |
| 60 | --buildtype=release \ |
| 61 | -Dblkid=true \ |
| 62 | -Ddefault-dnssec=no \ |
| 63 | -Dfirstboot=false \ |
| 64 | -Dinstall-tests=false \ |
| 65 | -Dldconfig=false \ |
| 66 | -Dlink-udev-shared=false \ |
| 67 | -Dsysusers=false \ |
| 68 | -Db_lto=false \ |
| 69 | -Drpmmacrosdir=no \ |
| 70 | -Dhomed=false \ |
| 71 | -Duserdb=false \ |
| 72 | -Dman=false \ |
| 73 | -Dmode=release \ |
| 74 | -Ddocdir=/usr/share/doc/systemd-&systemd-version; \ |
| 75 | ..</userinput></screen> |
| 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 would produce unoptimized |
| 85 | binaries.</para> |
| 86 | </listitem> |
| 87 | </varlistentry> |
| 88 | |
| 89 | <varlistentry> |
| 90 | <term><parameter>-Ddefault-dnssec=no</parameter></term> |
| 91 | <listitem> |
| 92 | <para>This switch turns off the experimental DNSSEC support.</para> |
| 93 | </listitem> |
| 94 | </varlistentry> |
| 95 | |
| 96 | <varlistentry> |
| 97 | <term><parameter>-Dfirstboot=false</parameter></term> |
| 98 | <listitem> |
| 99 | <para>This switch prevents installation of systemd |
| 100 | services responsible for setting up the system for |
| 101 | the first time. They are not useful for LFS because |
| 102 | everything is done manually.</para> |
| 103 | </listitem> |
| 104 | </varlistentry> |
| 105 | |
| 106 | <varlistentry> |
| 107 | <term><parameter>-Dinstall-tests=false</parameter></term> |
| 108 | <listitem> |
| 109 | <para>This switch prevents installation of the compiled tests.</para> |
| 110 | </listitem> |
| 111 | </varlistentry> |
| 112 | |
| 113 | <varlistentry> |
| 114 | <term><parameter>-Dldconfig=false</parameter></term> |
| 115 | <listitem> |
| 116 | <para>This switch prevents installation of a systemd unit that runs |
| 117 | <command>ldconfig</command> at boot, which is not useful for source |
| 118 | distributions such as LFS and makes the boot time longer. Remove it |
| 119 | if the described feature is desired.</para> |
| 120 | </listitem> |
| 121 | </varlistentry> |
| 122 | |
| 123 | <varlistentry> |
| 124 | <term><parameter>-Dlink-udev-shared=false</parameter></term> |
| 125 | <listitem> |
| 126 | <para>This switch prevents udevadm from linking against the |
| 127 | libsystemd.so library, and instead generates the libudev.so |
| 128 | library.</para> |
| 129 | </listitem> |
| 130 | </varlistentry> |
| 131 | |
| 132 | <varlistentry> |
| 133 | <term><parameter>-Dsysusers=false</parameter></term> |
| 134 | <listitem> |
| 135 | <para>This switch prevents installation of systemd |
| 136 | services responsible for setting up the |
| 137 | <filename>/etc/group</filename> and |
| 138 | <filename>/etc/passwd</filename> files. Both files |
| 139 | were created earlier in this chapter.</para> |
| 140 | </listitem> |
| 141 | </varlistentry> |
| 142 | |
| 143 | <varlistentry> |
| 144 | <term><parameter>-Drpmmacrosdir=no</parameter></term> |
| 145 | <listitem> |
| 146 | <para>This switch disables installation of RPM Macros |
| 147 | for use with systemd because LFS does not support RPM.</para> |
| 148 | </listitem> |
| 149 | </varlistentry> |
| 150 | |
| 151 | <varlistentry> |
| 152 | <term><parameter>-D{userdb,homed}=false</parameter></term> |
| 153 | <listitem> |
| 154 | <para>Remove two daemons that have dependencies that do not fit |
| 155 | the scope of LFS.</para> |
| 156 | </listitem> |
| 157 | </varlistentry> |
| 158 | |
| 159 | <varlistentry> |
| 160 | <term><parameter>-Dman=false</parameter></term> |
| 161 | <listitem> |
| 162 | <para>Prevent the generation of man pages to avoid extra |
| 163 | dependencies. We will install pre-generated man pages for systemd |
| 164 | from a tarball later.</para> |
| 165 | </listitem> |
| 166 | </varlistentry> |
| 167 | |
| 168 | <varlistentry> |
| 169 | <term><parameter>-Dmode=release</parameter></term> |
| 170 | <listitem> |
| 171 | <para>Disable some features considered experimental by upstream. |
| 172 | </para> |
| 173 | </listitem> |
| 174 | </varlistentry> |
| 175 | |
| 176 | </variablelist> |
| 177 | |
| 178 | <para>Compile the package:</para> |
| 179 | |
| 180 | <screen><userinput remap="make">LANG=en_US.UTF-8 ninja udevadm \ |
| 181 | $(grep '^build' build.ninja | sed 's/build \([^:]*\).*/\1/' | \ |
| 182 | egrep "^src/libudev|^src/udev|^rules.d|^hwdb.d") \ |
| 183 | $(realpath libudev.so --relative-to .)</userinput></screen> |
| 184 | |
| 185 | <para>Install the package:</para> |
| 186 | |
| 187 | <screen><userinput remap="install">install -vm755 udevadm /usr/sbin |
| 188 | ln -sv udevadm /usr/sbin/udevd |
| 189 | install -vm755 libudev.so{,*[0-9]} /usr/lib |
| 190 | install -vdm755 /usr/lib/udev |
| 191 | install -vm755 $(find src/udev -type f | fgrep -v ".") /usr/lib/udev |
| 192 | install -vm644 src/libudev/*.pc /usr/lib/pkgconfig |
| 193 | install -vm644 src/udev/*.pc /usr/share/pkgconfig |
| 194 | install -vdm755 {/usr/lib,/etc}/udev/{hwdb,rules}.d |
| 195 | install -vm644 ../src/udev/udev.conf /etc/udev |
| 196 | install -vm644 ../src/libudev/libudev.h /usr/include |
| 197 | install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d |
| 198 | install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d</userinput></screen> |
| 199 | |
| 200 | <para>Install the man pages:</para> |
| 201 | |
| 202 | <screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz --strip-components=1 \ |
| 203 | -C /usr/share/man systemd-man-pages-&systemd-man-version;/{man3/libudev.3,man5/udev.conf.5} \ |
| 204 | systemd-man-pages-&systemd-man-version;/{man7/{udev,hwdb}.7,man8/udevadm.8}</userinput></screen> |
| 205 | |
| 206 | |
| 207 | <para>Install some custom rules and support files useful in an LFS |
| 208 | environment:</para> |
| 209 | |
| 210 | <screen><userinput remap="install">tar -xvf ../&udev-lfs-version;.tar.xz |
| 211 | make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen> |
| 212 | |
| 213 | </sect2> |
| 214 | |
| 215 | <sect2 id="conf-udev" role="configuration"> |
| 216 | <title>Configuring udev</title> |
| 217 | |
| 218 | <indexterm zone="conf-udev"> |
| 219 | <primary sortas="a-udev">udev</primary> |
| 220 | <secondary>configuring</secondary> |
| 221 | </indexterm> |
| 222 | |
| 223 | <indexterm zone="conf-udev"> |
| 224 | <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary> |
| 225 | </indexterm> |
| 226 | |
| 227 | <para>Information about hardware devices is maintained in the |
| 228 | <filename class="directory">/etc/udev/hwdb.d</filename> and |
| 229 | <filename class="directory">/usr/lib/udev/hwdb.d</filename> directories. |
| 230 | <application>udev</application> needs that information to be |
| 231 | compiled into a binary database <filename>/etc/udev/hwdb.bin</filename>. |
| 232 | Create the initial database:</para> |
| 233 | |
| 234 | <screen><userinput>udevadm hwdb --update</userinput></screen> |
| 235 | |
| 236 | <para>This command needs to be run each time the hardware information is |
| 237 | updated.</para> |
| 238 | |
| 239 | </sect2> |
| 240 | |
| 241 | <sect2 id="contents-udev" role="content"> |
| 242 | <title>Contents of udev</title> |
| 243 | |
| 244 | <segmentedlist> |
| 245 | <segtitle>Installed programs</segtitle> |
| 246 | <segtitle>Installed libraries</segtitle> |
| 247 | <segtitle>Installed directories</segtitle> |
| 248 | |
| 249 | <seglistitem> |
| 250 | <seg><!-- These are in /usr/lib/udev and not to be called by the user: |
| 251 | accelerometer, ata_id, cdrom_id, collect, mtd_probe, |
| 252 | scsi_id, v4l_id,-->udevadm and udevd</seg> |
| 253 | |
| 254 | <seg>libudev.so</seg> |
| 255 | |
| 256 | <seg>/etc/udev and /usr/lib/udev</seg> |
| 257 | </seglistitem> |
| 258 | </segmentedlist> |
| 259 | |
| 260 | <variablelist> |
| 261 | <bridgehead renderas="sect3">Short Descriptions</bridgehead> |
| 262 | <?dbfo list-presentation="list"?> |
| 263 | <?dbhtml list-presentation="table"?> |
| 264 | <varlistentry id="udevadm" revision="sysv"> |
| 265 | <term><command>udevadm</command></term> |
| 266 | <listitem> |
| 267 | <para>Generic udev administration tool: controls the udevd daemon, |
| 268 | provides info from the Udev database, monitors uevents, waits for |
| 269 | uevents to finish, tests Udev configuration, and triggers uevents |
| 270 | for a given device</para> |
| 271 | <indexterm zone="ch-system-udev udevadm"> |
| 272 | <primary sortas="b-udevadm">udevadm</primary> |
| 273 | </indexterm> |
| 274 | </listitem> |
| 275 | </varlistentry> |
| 276 | |
| 277 | <varlistentry id="udevd"> |
| 278 | <term><command>udevd</command></term> |
| 279 | <listitem> |
| 280 | <para>A daemon that listens for uevents on the netlink socket, |
| 281 | creates devices and runs the configured external programs in |
| 282 | response to these uevents</para> |
| 283 | <indexterm zone="ch-system-udev udevd"> |
| 284 | <primary sortas="b-udevd">udevd</primary> |
| 285 | </indexterm> |
| 286 | </listitem> |
| 287 | </varlistentry> |
| 288 | |
| 289 | <varlistentry id="libudev"> |
| 290 | <term><filename class="libraryfile">libudev</filename></term> |
| 291 | <listitem> |
| 292 | <para>A library interface to udev device information</para> |
| 293 | <indexterm zone="ch-system-udev libudev"> |
| 294 | <primary sortas="c-libudev">libudev</primary> |
| 295 | </indexterm> |
| 296 | </listitem> |
| 297 | </varlistentry> |
| 298 | |
| 299 | <varlistentry id="etc-udev"> |
| 300 | <term><filename class="directory">/etc/udev</filename></term> |
| 301 | <listitem> |
| 302 | <para>Contains Udev configuration files, |
| 303 | device permissions, and rules for device naming</para> |
| 304 | <indexterm zone="ch-system-udev etc-udev"> |
| 305 | <primary sortas="e-/etc/udev">/etc/udev</primary> |
| 306 | </indexterm> |
| 307 | </listitem> |
| 308 | </varlistentry> |
| 309 | |
| 310 | </variablelist> |
| 311 | |
| 312 | </sect2> |
| 313 | |
| 314 | </sect1> |