📄 kernelconfig-nodes.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Making Device Nodes</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Configuring the FreeBSD Kernel" href="kernelconfig.html" /><link rel="PREVIOUS" title="The Configuration File" href="kernelconfig-config.html" /><link rel="NEXT" title="If Something Goes Wrong" href="kernelconfig-trouble.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="kernelconfig-config.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 8 Configuring the FreeBSDKernel</td><td width="10%" align="right" valign="bottom"><a href="kernelconfig-trouble.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="KERNELCONFIG-NODES" name="KERNELCONFIG-NODES">8.5 Making DeviceNodes</a></h1><p><span class="emphasis"><i class="EMPHASIS">If you are running FreeBSD 5.0 orlater you can safely skip this section. These versions use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=devfs&sektion=5&manpath=FreeBSD+6-current"><span class="CITEREFENTRY"><span class="REFENTRYTITLE">devfs</span>(5)</span></a> toallocate device nodes transparently for the user.</i></span></p><p>Almost every device in the kernel has a corresponding ``node'' entry in the <ttclass="FILENAME">/dev</tt> directory. These nodes look like regular files, but areactually special entries into the kernel which programs use to access the device. Theshell script <tt class="FILENAME">/dev/MAKEDEV</tt>, which is executed when you firstinstall the operating system, creates nearly all of the device nodes supported. However,it does not create <span class="emphasis"><i class="EMPHASIS">all</i></span> of them, sowhen you add support for a new device, it pays to make sure that the appropriate entriesare in this directory, and if not, add them. Here is a simple example:</p><p>Suppose you add the IDE CD-ROM support to the kernel. The line to add is:</p><pre class="PROGRAMLISTING">device acd0</pre><p>This means that you should look for some entries that start with <ttclass="FILENAME">acd0</tt> in the <tt class="FILENAME">/dev</tt> directory, possiblyfollowed by a letter, such as <var class="LITERAL">c</var>, or preceded by the letter<var class="LITERAL">r</var>, which means a ``raw'' device. It turns out that those filesare not there, so you must change to the <tt class="FILENAME">/dev</tt> directory andtype:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">sh MAKEDEV acd0</kbd></pre><p>When this script finishes, you will find that there are now <ttclass="FILENAME">acd0c</tt> and <tt class="FILENAME">racd0c</tt> entries in <ttclass="FILENAME">/dev</tt> so you know that it executed correctly.</p><p>For sound cards, the following command creates the appropriate entries:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">sh MAKEDEV snd0</kbd></pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> When creating device nodes for devices such as sound cards, if otherpeople have access to your machine, it may be desirable to protect the devices fromoutside access by adding them to the <tt class="FILENAME">/etc/fbtab</tt> file. See <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=fbtab&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">fbtab</span>(5)</span></a> for moreinformation.</p></blockquote></div><p>Follow this simple procedure for any other non-<tt class="FILENAME">GENERIC</tt>devices which do not have entries.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> All SCSI controllers use the same set of <tt class="FILENAME">/dev</tt>entries, so you do not need to create these. Also, network cards and SLIP/PPPpseudo-devices do not have entries in <tt class="FILENAME">/dev</tt> at all, so you donot have to worry about these either.</p></blockquote></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="kernelconfig-config.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="kernelconfig-trouble.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">The Configuration File</td><td width="34%" align="center" valign="top"><a href="kernelconfig.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">If Something Goes Wrong</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -