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

📄 kernelconfig-config.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!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>The Configuration File</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="Building and Installing a Custom Kernel"href="kernelconfig-building.html" /><link rel="NEXT" title="Making Device Nodes" href="kernelconfig-nodes.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-building.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-nodes.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="KERNELCONFIG-CONFIG" name="KERNELCONFIG-CONFIG">8.4 TheConfiguration File</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Updated for FreeBSD 5.X by</span> JoelDahl.</i> <p>The general format of a configuration file is quite simple. Each line contains akeyword and one or more arguments. For simplicity, most lines only contain one argument.Anything following a <var class="LITERAL">#</var> is considered a comment and ignored.The following sections describe each keyword, generally in the order they are listed in<tt class="FILENAME">GENERIC</tt>, although some related keywords have been groupedtogether in a single section (such as Networking) even though they are actually scatteredthroughout the <tt class="FILENAME">GENERIC</tt> file. <a id="KERNELCONFIG-OPTIONS"name="KERNELCONFIG-OPTIONS"></a> For an exhaustive list of architecture dependent optionsand devices, see the <tt class="FILENAME">NOTES</tt> file in the same directory as <ttclass="FILENAME">GENERIC</tt>. For architecure independent options, see <ttclass="FILENAME">/usr/src/sys/conf/NOTES</tt>.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> <tt class="FILENAME">NOTES</tt> does not exist in FreeBSD&nbsp;4.X.Instead, see the <tt class="FILENAME">LINT</tt> file for detailed explanations of optionsand devices in <tt class="FILENAME">GENERIC</tt>. <tt class="FILENAME">LINT</tt> servedtwo purposes in 4.X: to provide a reference for choosing kernel options when building acustom kernel, and to provide a kernel configuration with as many tweakable optionstweaked to non-default values as possible. The reason behind this was that such aconfiguration helped (and still does) a lot when testing new code and changes to existingcode that may cause conflicts with other parts of the kernel. However, the kernelconfiguration framework went through some heavy changes in 5.X; one example of this isthat the driver configuration options were moved to a <var class="LITERAL">hints</var>file so that they could be changed and loaded dynamically at boot time, and <ttclass="FILENAME">LINT</tt> could not contain those hints anymore. For this and otherreasons, the <tt class="FILENAME">LINT</tt> file was renamed to <ttclass="FILENAME">NOTES</tt> and retained mostly the first reason for its existence:documenting the available options for user convenience.</p><p>In FreeBSD 5.X and later versions you can still generate a buildable <ttclass="FILENAME">LINT</tt> file by typing:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /usr/src/sys/<varclass="REPLACEABLE">i386</var>/conf &#38;&#38; make LINT</kbd></pre></blockquote></div><p>The following is an example of the <tt class="FILENAME">GENERIC</tt> kernelconfiguration file with various additional comments where needed for clarity. Thisexample should match your copy in <tt class="FILENAME">/usr/src/sys/<varclass="REPLACEABLE">i386</var>/conf/GENERIC</tt> fairly closely.</p><pre class="PROGRAMLISTING">## GENERIC -- Generic kernel configuration file for FreeBSD/i386## For more information on this file, please read the handbook section on# Kernel Configuration Files:##    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html## The handbook is also available locally in /usr/share/doc/handbook# if you've installed the doc distribution, otherwise always see the# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the# latest information.## An exhaustive list of options and more detailed explanations of the# device lines is also present in the ../../conf/NOTES and NOTES files. # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES.## $FreeBSD: /repoman/r/ncvs/src/sys/i386/conf/GENERIC,v 1.413 2004/08/11 01:34:18 rwatson Exp $</pre><p>The following are the mandatory keywords required in <span class="emphasis"><iclass="EMPHASIS">every</i></span> kernel you build:</p><pre class="PROGRAMLISTING">machine        i386</pre><p>This is the machine architecture. It must be either <var class="LITERAL">alpha</var>,<var class="LITERAL">amd64</var>, <var class="LITERAL">i386</var>, <varclass="LITERAL">ia64</var>, <var class="LITERAL">pc98</var>, <varclass="LITERAL">powerpc</var>, or <var class="LITERAL">sparc64</var>.</p><pre class="PROGRAMLISTING">cpu          I486_CPUcpu          I586_CPUcpu          I686_CPU</pre><p>The above option specifies the type of CPU you have in your system. You may havemultiple instances of the CPU line (if, for example, you are not sure whether you shoulduse <var class="LITERAL">I586_CPU</var> or <var class="LITERAL">I686_CPU</var>), but fora custom kernel it is best to specify only the CPU you have. If you are unsure of yourCPU type, you can check the <tt class="FILENAME">/var/run/dmesg.boot</tt> file to viewyour boot messages.</p><p>Support for <var class="LITERAL">I386_CPU</var> is still provided in the source ofFreeBSD, but it is disabled by default in both -STABLE and -CURRENT. This means that toinstall FreeBSD with a 386-class cpu, you now have the following options:</p><ul><li><p>Install an older FreeBSD release and rebuild from source as described in <ahref="kernelconfig-building.html">Section 8.3</a>.</p></li><li><p>Build the userland and kernel on a newer machine and install on the 386 using theprecompiled <tt class="FILENAME">/usr/obj</tt> files (see <ahref="small-lan.html">Section 19.5</a> for details).</p></li><li><p>Roll your own release of FreeBSD which includes <var class="LITERAL">I386_CPU</var>support in the kernels of the installation CD-ROM.</p></li></ul><p>The first of these options is probably the easiest of all, but you will need a lot ofdisk space which, on a 386-class machine, may be difficult to find.</p><pre class="PROGRAMLISTING">ident          GENERIC</pre><p>This is the identification of the kernel. You should change this to whatever you namedyour kernel, i.e. <var class="LITERAL">MYKERNEL</var> if you have followed theinstructions of the previous examples. The value you put in the <varclass="LITERAL">ident</var> string will print when you boot up the kernel, so it isuseful to give the new kernel a different name if you want to keep it separate from yourusual kernel (e.g., you want to build an experimental kernel).</p><pre class="PROGRAMLISTING">maxusers          <var class="REPLACEABLE">n</var></pre><p>The <var class="LITERAL">maxusers</var> option sets the size of a number of importantsystem tables. This number is supposed to be roughly equal to the number of simultaneoususers you expect to have on your machine.</p><p>Starting with FreeBSD&nbsp;4.5, the system will auto-tune this setting for you if youexplicitly set it to <var class="LITERAL">0</var><a id="AEN9627" name="AEN9627"href="#FTN.AEN9627"><span class="footnote">[1]</span></a>. In FreeBSD&nbsp;5.X and above,<var class="LITERAL">maxusers</var> will default to <var class="LITERAL">0</var> if notspecified. If you are using an version of FreeBSD earlier than 4.5, or you want to manageit yourself you will want to set <var class="LITERAL">maxusers</var> to at least 4,especially if you are using the X Window System or compiling software. The reason is thatthe most important table set by <var class="LITERAL">maxusers</var> is the maximum numberof processes, which is set to <var class="LITERAL">20 + 16 * maxusers</var>, so if youset <var class="LITERAL">maxusers</var> to 1, then you can only have 36 simultaneousprocesses, including the 18 or so that the system starts up at boot time and the 15 or soyou will probably create when you start the X Window System. Even a simple task likereading a manual page will start up nine processes to filter, decompress, and view it.Setting <var class="LITERAL">maxusers</var> to 64 will allow you to have up to 1044simultaneous processes, which should be enough for nearly all uses. If, however, you seethe dreaded <span class="ERRORTYPE">proc table full</span> error when trying to startanother program, or are running a server with a large number of simultaneous users (like<tt class="HOSTID">ftp.FreeBSD.org</tt>), you can always increase the number andrebuild.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> <var class="LITERAL">maxusers</var> does <span class="emphasis"><iclass="EMPHASIS">not</i></span> limit the number of users which can log into yourmachine. It simply sets various table sizes to reasonable values considering the maximumnumber of users you will likely have on your system and how many processes each of themwill be running. One keyword which <span class="emphasis"><iclass="EMPHASIS">does</i></span> limit the number of simultaneous remote logins and Xterminal windows is <a href="kernelconfig-config.html#KERNELCONFIG-PTYS"><varclass="LITERAL">pseudo-device pty 16</var></a>. With FreeBSD&nbsp;5.X, you do not have toworry about this number since the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pty&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pty</span>(4)</span></a> driver is``auto-cloning''; you simply use the line <var class="LITERAL">device pty</var> in yourconfiguration file.</p></blockquote></div><pre class="PROGRAMLISTING"># Floating point support - do not disable.device          npx</pre><p><var class="LITERAL">npx</var> is the interface to the floating point math unit inFreeBSD, which is either the hardware co-processor or the software math emulator. This is<span class="emphasis"><i class="EMPHASIS">not</i></span> optional.</p><pre class="PROGRAMLISTING"># Pseudo devicesdevice   loop          # Network loopback</pre><p>This is the generic loopback device for TCP/IP. If you telnet or FTP to <ttclass="HOSTID">localhost</tt> (a.k.a. <tt class="HOSTID">127.0.0.1</tt>) it will comeback at you through this device. This is <span class="emphasis"><iclass="EMPHASIS">mandatory</i></span>. Under FreeBSD&nbsp;4.X you have to use the line<var class="LITERAL">pseudo-device loop</var>.</p><p>Everything that follows is more or less optional. See the notes underneath or next toeach option for more information.</p><pre class="PROGRAMLISTING">#To statically compile in device wiring instead of /boot/device.hints#hints          "GENERIC.hints"         # Default places to look for devices.</pre><p>In FreeBSD 5.X and newer versions the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=device.hints&sektion=5&manpath=FreeBSD+6-current"><span class="CITEREFENTRY"><span class="REFENTRYTITLE">device.hints</span>(5)</span></a>is used to configure options of the device drivers. The default location that <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=loader&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">loader</span>(8)</span></a> will checkat boot time is <tt class="FILENAME">/boot/device.hints</tt>. Using the <varclass="LITERAL">hints</var> option you can compile these hints statically into yourkernel. Then there is no need to create a <tt class="FILENAME">device.hints</tt> file in<tt class="FILENAME">/boot</tt>.</p><pre class="PROGRAMLISTING">#makeoptions     DEBUG=-g          # Build kernel with gdb(1) debug symbols</pre><p>The normal build process of FreeBSD does not include debugging information whenbuilding the kernel and strips most symbols after the resulting kernel is linked, to savesome space at the install location. If you are going to do tests of kernels in the-CURRENT branch or develop changes of your own for the FreeBSD kernel, you might want touncomment this line. It will enable the use of the <var class="OPTION">-g</var> optionwhich enables debugging information when passed to <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=gcc&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">gcc</span>(1)</span></a>. The same canbe accomplished by the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=config&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">config</span>(8)</span></a> <varclass="OPTION">-g</var> option, if you are using the ``traditional'' way for buildingyour kernels (see <a href="kernelconfig-building.html">Section 8.3</a> for moreinformation).</p><pre class="PROGRAMLISTING">options          SCHED_4BSD         # 4BSD scheduler</pre><p>The traditional scheduler for FreeBSD. Depending on your system's workload, you maygain performance by using the new ULE scheduler for FreeBSD that has been designedspecially for SMP, but works just fine on UP systems too. If you wish to try it out,replace <var class="LITERAL">SCHED_4BSD</var> with <var class="LITERAL">SCHED_ULE</var>in your configuration file.</p><pre class="PROGRAMLISTING">options          INET              # InterNETworking</pre><p>Networking support. Leave this in, even if you do not plan to be connected to anetwork. Most programs require at least loopback networking (i.e., making networkconnections within your PC), so this is essentially mandatory.</p><pre class="PROGRAMLISTING">options          INET6             # IPv6 communications protocols</pre><p>This enables the IPv6 communication protocols.</p><pre class="PROGRAMLISTING">options          FFS               # Berkeley Fast Filesystem</pre><p>This is the basic hard drive file system. Leave it in if you boot from the harddisk.</p><pre class="PROGRAMLISTING">options          UFS_ACL           # Support for access control lists

⌨️ 快捷键说明

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