Changeset f38842d for BOOK/system-config/common
- Timestamp:
- May 28, 2014, 12:57:40 AM (11 years ago)
- Branches:
- clfs-3.0.0-systemd, master, systemd
- Children:
- f35f6d9
- Parents:
- 7874109
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOOK/system-config/common/udev.xml
r7874109 rf38842d 29 29 <para>Linux systems in general traditionally use a static device creation 30 30 method, whereby a great many device nodes are created under <filename 31 class="directory">/dev</filename> (sometimes literally thousands of nodes),32 regardless of whether the corresponding hardware devices actually exist.33 This is typically done via a <command>MAKEDEV</command> script, which34 contains a number of calls to the <command>mknod</command> program with the35 relevant major and minor device numbers for every possible device that36 might exist in the world.</para>31 class="directory">/dev</filename> (sometimes literally thousands of 32 nodes), regardless of whether the corresponding hardware devices actually 33 exist. This is typically done via a <command>MAKEDEV</command> script, 34 which contains a number of calls to the <command>mknod</command> program 35 with the relevant major and minor device numbers for every possible 36 device that might exist in the world.</para> 37 37 38 38 </sect3> … … 42 42 43 43 <para>In February 2000, a new filesystem called <systemitem 44 class="filesystem">devfs</systemitem> was merged into the 2.3.46 kernel 45 and was made available during the 2.4 series of stable kernels. Although 46 it was present in the kernel source itself, this method of creating devices 47 dynamically never received overwhelming support from the core kernel 48 developers.</para> 44 class="filesystem">devfs</systemitem>, which dynamically created device 45 nodes as devices were found by the kernel, was merged into the 46 2.3.46 kernel and was made available during the 2.4 series of stable 47 kernels. Although it was present in the kernel source itself, this method 48 of creating devices dynamically never received overwhelming support from 49 the core kernel developers.</para> 49 50 50 51 <para>The main problem with the approach adopted by <systemitem … … 56 57 particular developer(s). The <systemitem 57 58 class="filesystem">devfs</systemitem> file system also suffered from race 58 conditions that were inherent in its design and could not be fixed without a59 substantial revision to the kernel. It was marked deprecated with the59 conditions that were inherent in its design and could not be fixed without 60 a substantial revision to the kernel. It was marked deprecated with the 60 61 release of the 2.6 kernel series, and was removed entirely as of version 61 62 2.6.18.</para> … … 78 79 class="directory">/sys</filename>), data which the built-in drivers 79 80 registered with <systemitem class="filesystem">sysfs</systemitem> are 80 available to userspace processes. With this 81 userspace-visible representation, the possibility of seeing a userspace82 replacement for <systemitem class="filesystem">devfs</systemitem> became83 much morerealistic.</para>81 available to userspace processes. With this userspace-visible 82 representation, the possibility of seeing a userspace replacement for 83 <systemitem class="filesystem">devfs</systemitem> became much more 84 realistic.</para> 84 85 85 86 </sect3> … … 88 89 <title>Udev Implementation</title> 89 90 90 <!-- <title>Device Node Creation</title> --> 91 92 <para>When Udev was introduced, the <command>udevd</command> daemon made93 calls to mknod() to create device nodes in94 <filename class="directory">/dev</filename> dynamically, based on the91 <para>Shortly after the introduction of 92 <systemitem class="filesystem">sysfs</systemitem>, work began on a 93 program called Udev to advantage of it. The <command>udev</command> 94 daemon made calls to <function>mknod()</function> to create device nodes 95 in <filename class="directory">/dev</filename> dynamically, based on the 95 96 information from <systemitem class="filesystem">sysfs</systemitem>, in 96 97 <filename class="directory">/sys</filename>. For example, 97 98 <filename>/sys/class/tty/vcs/dev</filename> contains the string 98 <quote>7:0</quote>. This string was used by <command>udev d</command>99 <quote>7:0</quote>. This string was used by <command>udev</command> 99 100 to create a device node with major number <emphasis>7</emphasis> and 100 minor number <emphasis>0</emphasis>. Using the Udev method 101 only those devices which are detected by the kernel would get device 102 nodes created for them. Because these device nodes were created each time 103 the system boots, they were stored on a 104 <systemitem class="filesystem">tmpfs</systemitem> file system (a virtual 105 file system that resides entirely in system memory). Device nodes do not 106 require much space, so the memory that is used is negligible.</para> 101 minor number <emphasis>0</emphasis>.</para> 107 102 108 103 <para>Linux kernel version 2.6.32 introduced a new virtual file system 109 called <systemitem class="filesystem">devtmpfs</systemitem>, a 110 replacement for <systemitem class="filesystem">devfs</systemitem>. 111 With this approach, a 112 <systemitem class="filesystem">devtmpfs</systemitem> file system is 113 mounted on <filename class="directory">/dev/</filename> when the system 114 is booted, and all needed device nodes are created on this virtual 115 file system. As of version 176, Udev no longer creates device nodes 116 itself, instead relying on 104 called <systemitem class="filesystem">devtmpfs</systemitem>, an improved 105 replacement for <systemitem class="filesystem">devfs</systemitem>. This 106 allows device nodes to once again be dynamically created by the kernel, 107 without many of the problems of 108 <systemitem class="filesystem">devfs</systemitem>. As of version 176, 109 Udev no longer creates device nodes itself, instead relying on 117 110 <systemitem class="filesystem">devtmpfs</systemitem> to do so.</para> 118 111 119 <para>Udev also sets appropriate ownership and permissions120 for the device nodes, and creates extra symlinks as needed (such as121 <filename class="symlink">/dev/cdrom</filename>). The ownership and122 permissions of the nodes under the123 <filename class="directory">/dev</filename> directory are124 determined by rules specified in the files within the <filename125 class="directory">/etc/udev/rules.d/</filename> directory. These are126 numbered in a similar fashion to the CLFS-Bootscripts package. If127 <command>udevd</command> can't find a rule for the device it is creating,128 it will default permissions to <emphasis>660</emphasis> and ownership to129 <emphasis>root:root</emphasis>.</para>130 131 112 </sect3> 132 113 … … 134 115 <title>Systemd and Eudev</title> 135 116 136 <para>In May 2012, Udev's source was merged with systemd, an alternate 137 <command>init</command> implementation. Some time later, several Gentoo 138 developers took the Udev code from systemd and created a fork called 139 Eudev.</para> 140 141 </sect3> 117 <para>In 2010, development began on systemd, an alternate 118 <command>init</command> implementation. Starting with Udev 183, Udev's 119 source tree was merged with systemd. Several Gentoo 120 developers who disagreed with this merge announced a project fork 121 called Eudev in December 2012, created by extracting the 122 Udev code from systemd. One of the goals of Eudev is to allow for 123 easier installation and usage of <command>udevd</command> without 124 the need for the rest of systemd.</para> 125 </sect3> 126 127 </sect2> 128 129 <sect2> 130 <title>Device Node Creation</title> 131 132 <para>By default, device nodes created by the kernel in a 133 <systemitem class="filesystem">devtmpfs</systemitem> are owned by 134 <emphasis>root:root</emphasis> and have <emphasis>600</emphasis> 135 permissions. <command>udevd</command> can modify ownership and permissions 136 of the nodes under the <filename class="directory">/dev</filename> 137 directory, and can also create additional symlinks, based on rules 138 specified in the files within the 139 <filename class="directory">/etc/udev/rules.d</filename>, 140 <filename class="directory">/lib/udev/rules.d</filename>, 141 and <filename class="directory">/run/udev/rules.d</filename> directories. 142 The names for these files start with a number, to indicate the order in 143 which they are run, and they have a <filename>.rules</filename> 144 extension (<command>udevd</command> will ignore files with any other 145 extension). All of the rules files from these directories are combined into 146 a single list, sorted by filename, and run in that order. In the event of 147 a conflict, where a rules file with the same name exists in two or more of 148 these directories, the rules in <filename class="directory">/etc</filename> 149 take the highest priority, followed by rules files in 150 <filename class="directory">/run</filename>, and finally 151 <filename class="directory">/lib</filename>. Any device for which a rule 152 cannot be found will just be ignored by <command>udevd</command> 153 and be left at the defaults defined by the kernel, as described above. For 154 more details about writing Udev rules, see 155 <ulink url="/usr/share/doc/systemd-&systemd-version;/udev.html" />.</para> 142 156 143 157 </sect2> … … 177 191 178 192 <sect2> 179 <title>Handling Hotpluggable/Dynamic Devices</title>180 181 <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3182 player, the kernel recognizes that the device is now connected and183 generates a uevent. This uevent is then handled by184 <command>udevd</command> as described above.</para>185 186 </sect2>187 188 <sect2>189 193 <title>Problems with Loading Modules and Creating Devices</title> 190 194 … … 235 239 sound cards available to OSS applications), configure 236 240 <command>modprobe</command> to load the wrapper after Udev loads the 237 wrapped module. To do this, add an <quote>install</quote> line in238 <filename>/etc/modprobe.conf</filename>. For example:</para>241 wrapped module. To do this, add an <quote>install</quote> line to a file 242 in <filename>/etc/modprobe.d</filename>. For example:</para> 239 243 240 244 <screen role="nodump"><literal>install snd-pcm /sbin/modprobe -i snd-pcm ; \ … … 253 257 254 258 <para>Either don't build the module, or blacklist it in 255 <filename>/etc/modprobe. conf</filename> file as done with the259 <filename>/etc/modprobe.d</filename> file as done with the 256 260 <emphasis>forte</emphasis> module in the example below:</para> 257 261 … … 264 268 265 269 <sect3> 266 <title>Udev creates a device incorrectly, ormakes a wrong symlink</title>270 <title>Udev makes a wrong symlink</title> 267 271 268 272 <para>This usually happens if a rule unexpectedly matches a device. For
Note:
See TracChangeset
for help on using the changeset viewer.