⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udev.html

📁 CLFS(Cross-Compiled Linux From Scratch)的文档 Version CLFS-SVN-20060417
💻 HTML
📖 第 1 页 / 共 2 页
字号:
          "filename">/dev</tt> entry for it.        </p>        <p>          This brings us to one problem that exists with <span><strong class=          "command">udev</strong></span>, and likewise with <tt class=          "systemitem">devfs</tt> before it. It is commonly referred to as          the &ldquo;<span class="quote">chicken and egg</span>&rdquo;          problem. Most Linux distributions handle loading modules via          entries in <tt class="filename">/etc/modules.conf</tt>. Access to a          device node causes the appropriate kernel module to load. With          <span><strong class="command">udev</strong></span>, this method          will not work because the device node does not exist until the          module is loaded. To solve this, the <span><strong class=          "command">S05modules</strong></span> bootscript was added to the          LFS-Bootscripts package, along with the <tt class=          "filename">/etc/sysconfig/modules</tt> file. By adding module names          to the <tt class="filename">modules</tt> file, these modules will          be loaded when the computer starts up. This allows          <span><strong class="command">udev</strong></span> to detect the          devices and create the appropriate device nodes.        </p>        <p>          Note that on slower machines or for drivers that create a lot of          device nodes, the process of creating devices may take a few          seconds to complete. This means that some device nodes may not be          immediately accessible.        </p>      </div>      <div class="sect2" lang="en" xml:lang="en">        <div class="titlepage">          <h2 class="sect2">            11.5.3. Handling Hotpluggable/Dynamic Devices          </h2>        </div>        <p>          When you plug in a device, such as a Universal Serial Bus (USB) MP3          player, the kernel recognizes that the device is now connected and          generates a hotplug event. If the driver is already loaded (either          because it was compiled into the kernel or because it was loaded          via the <span><strong class="command">S05modules</strong></span>          bootscript), <span><strong class="command">udev</strong></span>          will be called upon to create the relevant device node(s) according          to the <tt class="systemitem">sysfs</tt> data available in          <tt class="filename">/sys</tt>.        </p>        <p>          If the driver for the just plugged in device is available as a          module but currently unloaded, the Hotplug package will load the          appropriate module and make this device available by creating the          device node(s) for it.        </p>      </div>      <div class="sect2" lang="en" xml:lang="en">        <div class="titlepage">          <h2 class="sect2">            11.5.4. Problems with Creating Devices          </h2>        </div>        <p>          There are a few known problems when it comes to automatically          creating device nodes:        </p>        <p>          1) A kernel driver may not export its data to <tt class=          "systemitem">sysfs</tt>.        </p>        <p>          This is most common with third party drivers from outside the          kernel tree. Udev will be unable to automatically create device          nodes for such drivers. Use the <tt class=          "filename">/etc/sysconfig/createfiles</tt> configuration file to          manually create the devices. Consult the <tt class=          "filename">devices.txt</tt> file inside the kernel documentation or          the documentation for that driver to find the proper major/minor          numbers.        </p>        <p>          2) A non-hardware device is required. This is most common with the          Advanced Linux Sound Architecture (ALSA) project's Open Sound          System (OSS) compatibility module. These types of devices can be          handled in one of two ways:        </p>        <div class="itemizedlist">          <ul>            <li>              <p>                Adding the module names to <tt class=                "filename">/etc/sysconfig/modules</tt>              </p>            </li>            <li>              <p>                Using an &ldquo;<span class="quote">install</span>&rdquo;                line in <tt class="filename">/etc/modprobe.conf</tt>. This                tells the <span><strong class=                "command">modprobe</strong></span> command                &ldquo;<span class="quote">when loading this module, also                load this other module, at the same time.</span>&rdquo; For                example:              </p>              <pre class="userinput"><kbd class="command">install snd-pcm modprobe -i snd-pcm ; modprobe \    snd-pcm-oss ; true</kbd></pre>              <p>                This will cause the system to load both the <span class=                "emphasis"><em>snd-pcm</em></span> and <span class=                "emphasis"><em>snd-pcm-oss</em></span> modules when any                request is made to load the driver <span class=                "emphasis"><em>snd-pcm</em></span>.              </p>            </li>          </ul>        </div>      </div>      <div class="sect2" lang="en" xml:lang="en">        <div class="titlepage">          <h2 class="sect2">            11.5.5. Useful Reading          </h2>        </div>        <p>          Additional helpful documentation is available at the following          sites:        </p>        <div class="itemizedlist">          <ul>            <li>              <p>                A Userspace Implementation of <tt class=                "systemitem">devfs</tt> <a href=                "http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf">                <i>http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf</i></a>              </p>            </li>            <li>              <p>                udev FAQ <a href=                "http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ">                <i>http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ</i></a>              </p>            </li>            <li>              <p>                The Linux Kernel Driver Model <a href=                "http://public.planetmirror.com/pub/lca/2003/proceedings/papers/Patrick_Mochel/Patrick_Mochel.pdf">                <i>http://public.planetmirror.com/pub/lca/2003/proceedings/papers/Patrick_Mochel/Patrick_Mochel.pdf</i></a>              </p>            </li>          </ul>        </div>      </div>    </div>    <div class="navfooter">      <ul>        <li class="prev">          <a accesskey="p" href="usage.html" title=          "How Do These Bootscripts Work?">Prev</a>          <p>            How Do These Bootscripts Work?          </p>        </li>        <li class="next">          <a accesskey="n" href="setclock.html" title=          "Configuring the setclock Script">Next</a>          <p>            Configuring the setclock Script          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;11.&nbsp;Setting Up System Bootscripts">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS">          Home</a>.        </li>      </ul>    </div>  </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -