aboutsummaryrefslogtreecommitdiff
path: root/zh_CN.GB2312/books/handbook/kernelconfig
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2006-06-03 15:34:25 +0000
committerXin LI <delphij@FreeBSD.org>2006-06-03 15:34:25 +0000
commit226a77678a3345584c78794e122aec72c922360e (patch)
tree296183b71b92f01a573d8d15a6823d21a2dc7628 /zh_CN.GB2312/books/handbook/kernelconfig
parente76e00aba4e8c2e6ea7b0399c1928e0071d73418 (diff)
Notes
Diffstat (limited to 'zh_CN.GB2312/books/handbook/kernelconfig')
-rw-r--r--zh_CN.GB2312/books/handbook/kernelconfig/chapter.sgml259
1 files changed, 47 insertions, 212 deletions
diff --git a/zh_CN.GB2312/books/handbook/kernelconfig/chapter.sgml b/zh_CN.GB2312/books/handbook/kernelconfig/chapter.sgml
index 73ae29100e..40d6226b76 100644
--- a/zh_CN.GB2312/books/handbook/kernelconfig/chapter.sgml
+++ b/zh_CN.GB2312/books/handbook/kernelconfig/chapter.sgml
@@ -2,7 +2,7 @@
The FreeBSD Documentation Project
The FreeBSD Chinese Documentation Project
- Original Revision: 1.163
+ Original Revision: 1.164
$FreeBSD$
-->
@@ -249,14 +249,6 @@
</listitem>
<listitem>
- <para>如果您正运行 &os; 4.0 以前的版本, 而且您
- <emphasis>不是</emphasis> 准备使用
- <command>make buildworld</command> 来升级到 &os;&nbsp;4.0
- 或更高版本的话, 则应使用方法1。
- </para>
- </listitem>
-
- <listitem>
<para> 如果您在没有升级源代码的情况下编译一个新内核(也许您只想为内核添加一个新的选项,
如<literal>IPFIREWALL</literal>),可以使用任何一种方法。
</para>
@@ -374,27 +366,13 @@
linkend="kernelconfig-noboot">无法启动</link>, 请参考那一节。</para>
<note>
- <para>在 &os; 4.X 以及更早的版本中, 内核被安装到
- <filename>/kernel</filename> 而模块则放到 <filename
- class="directory">/modules</filename>, 旧的内核则被备份到
- <filename>/kernel.old</filename>。
- 其他与启动过程相关的文件, 如
- &man.loader.8; 以及配置则放在
+ <para>其他与启动过程相关的文件, 如
+ &man.loader.8; 及其配置, 则放在
<filename>/boot</filename>。 第三方或定制的模块也可以放在
- <filename class="directory">/modules</filename>,
+ <filename class="directory">/boot/kernel</filename>,
不过应该注意保持模块和内核的同步时很重要的,
否则会导致不稳定和错误。</para>
</note>
-
- <note>
- <para>如果添加了新设备 (例如声卡)
- 并在运行 &os;&nbsp;4.X 或更早的版本,
- 则可能好需要在
- <filename class="directory">/dev</filename> 目录中添加它们的设备节点之后才能使用。
- 欲了解详情,请参考本章稍后的 <link
- linkend="kernelconfig-nodes">制作设备节点</link>
- 一节。</para>
- </note>
</sect1>
<sect1 id="kernelconfig-config">
@@ -414,12 +392,7 @@
<primary>内核</primary>
<secondary>NOTES</secondary>
</indexterm>
- <indexterm>
- <primary>kernel</primary>
- <secondary>LINT</secondary>
- </indexterm>
<indexterm><primary>NOTES</primary></indexterm>
- <indexterm><primary>LINT</primary></indexterm>
<indexterm>
<primary>内核</primary>
<secondary>配置文件</secondary>
@@ -438,24 +411,8 @@
找到。</para>
<note>
- <para><filename>NOTES</filename> 在 &os;&nbsp;4.X 中并不存在。
- 作为替代, 请参考 <filename>LINT</filename> 文件来获得关于
- <filename>GENERIC</filename> 中的选项和设备详细介绍。
- <filename>LINT</filename> 在 4.X 中完成了两项使命:
- 为构建定制内核提供可选的选项, 以及提供尽可能多的调整为非默认值的选项。
- 这么做背后的原因是这种配置文件能够帮助 (并且仍然能)
- 测试新代码以及现有代码的修改是否会造成与内核其他部分的冲突。
- 然而, 内核配置的架构在 5.X 中经历了巨大的变化;
- 其中的一个例子是设备驱动的选项被移到了 <literal>hints</literal>
- 中, 从而可以随时修改并在启动时动态加载,
- 而 <filename>LINT</filename> 不能再包含这些 hints 了。
- 由于这个以及许多其他原因,
- 决定将 <filename>LINT</filename> 改名为
- <filename>NOTES</filename>, 而保留它的主要是为了前面所说的第一个原因:
- 给出可用的选项, 为用户提供方便。</para>
-
- <para>在 &os; 5.X 和以后的版本中您仍然可以通过下面的命令生成
- <filename>LINT</filename> 文件:</para>
+ <para>如果您需要一份包含所有选项的文件,
+ 例如用于测试目的, 则应以 <username>root</username> 身份执行下列命令:</para>
<screen>&prompt.root; <userinput>cd /usr/src/sys/<replaceable>i386</replaceable>/conf &amp;&amp; make LINT</userinput></screen>
</note>
@@ -545,11 +502,11 @@ cpu I686_CPU</programlisting>
<programlisting>#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.</programlisting>
- <para>在&os; 5.X和更新的版本里面,&man.device.hints.5;被用来配置设备驱动选项。
- 在启动的时候&man.loader.8;将会检查缺省位置<filename>/boot/devicehints</filename>。
- 使用<literal>hints</literal>选项您就可以把这些hints静态编译进内核。
- 这样就没有必要在<filename>/boot</filename>下创建<filename>devicehints</filename>。
- </para>
+ <para>&man.device.hints.5; 可以用来配置设备驱动选项。
+ 在启动的时候 &man.loader.8; 将会检查缺省位置 <filename>/boot/devicehints</filename>。
+ 使用 <literal>hints</literal> 选项您就可以把这些 hints 静态编译进内核。
+ 这样就没有必要在
+ <filename>/boot</filename>下创建<filename>devicehints</filename>。</para>
<!-- XXX: Add a comment here that explains when compiling hints into
the kernel is a good idea and why. -->
@@ -659,24 +616,20 @@ options NFS_ROOT # NFS usable as /, requires NFSCLIENT</progra
<programlisting>options PROCFS # Process filesystem</programlisting>
<para>进程文件系统。 这是一个挂接在 <filename>/proc</filename>
- 的一个 <quote>伪装的</quote> 文件系统,
- 允许类似 &man.ps.1; 这样的程序给出正在运行的进程的更多信息。
- 在 &os; 5.X 和更高版本中, 绝大多数情况下都不再需要
- <literal>PROCFS</literal>,
- 因为绝大多数调试和监视工具都已经进行了修改,
- 不再需要 <literal>PROCFS</literal>: 与 &os; 4.X
- 不同, 新安装的 &os; 5.X 默认情况下并不挂接它。
- 此外, 6.X-CURRENT 内核在使用
- <literal>PROCFS</literal> 时还必须加入
- <literal>PSEUDOFS</literal> 的支持:</para>
+ 的一个 <quote>假扮的</quote> 文件系统, 其作用是允许类似 &man.ps.1;
+ 这样的程序给出正在运行的进程的进一步信息。 多数情况下,
+ 并不需要使用 <literal>PROCFS</literal>, 因为绝大多数调试和监控工具,
+ 已经进行了一系列修改, 使之不再依赖
+ <literal>PROCFS</literal>: 默认安装的系统中并不会挂接这一文件系统。
+ 此外, 在 6.X-STABLE 内核中,
+ 如果希望使用 <literal>PROCFS</literal>,
+ 就必须加入 <literal>PSEUDOFS</literal> 的支持:</para>
<programlisting>options PSEUDOFS # Pseudo-filesystem framework</programlisting>
- <para><literal>PSEUDOFS</literal> 在 &os; 4.X 上不可用。</para>
-
<programlisting>options GEOM_GPT # GUID Partition Tables.</programlisting>
- <para>这个选项提供了在一个磁盘上使用大量的分区的能力。</para>
+ <para>这个选项提供了在磁盘上使用大量的分区的能力。</para>
<programlisting>options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!]</programlisting>
@@ -903,8 +856,7 @@ device atkbdc # AT keyboard controller</programlisting>
<programlisting># splash screen/screen saver
device splash # Splash screen and screen saver support</programlisting>
- <para>启动时出现了 splash 画面!屏幕保护程序也需要它。
- 在 &os;&nbsp;4.X 中,应写作 <literal>pseudo-device splash</literal> 。</para>
+ <para>启动时的 splash 画面! 屏幕保护程序也需要这一选项。</para>
<programlisting># syscons is the default console driver, resembling an SCO console
device sc</programlisting>
@@ -914,7 +866,7 @@ device sc</programlisting>
<filename>termcap</filename> 这样的终端数据库函数库赖访问控制台,
因此无论您使用这个或与 <literal>VT220</literal> 兼容的
<literal>vt</literal> 都没有什么关系。
- 如果您在运行这种控制台时使用全屏幕程序时发生问题, 清在登录之后将
+ 如果您在运行这种控制台时使用全屏幕程序时发生问题, 请在登录之后将
<envar>TERM</envar> 变量设置为 <literal>scoansi</literal>。</para>
<programlisting># Enable this for the pcvt (VT220 compatible) console driver
@@ -1104,9 +1056,7 @@ device loop # Network loopback</programlisting>
<para>这是 TCP/IP 的通用回环设备。 如果您 telnet
或 FTP 到 <hostid>localhost</hostid> (也就是 <hostid
role="ipaddr">127.0.0.1</hostid>) 则将通过这个设备回到本机。
- 这个设备是 <emphasis>必需的</emphasis>。 在
- &os;&nbsp;4.X 中, 则应使用 <literal>pseudo-device
- loop</literal>。</para>
+ 这个设备是 <emphasis>必需的</emphasis>。</para>
<programlisting>device mem # Memory and kernel memory devices</programlisting>
@@ -1125,32 +1075,24 @@ device loop # Network loopback</programlisting>
<programlisting>device ether # Ethernet support</programlisting>
<para><literal>ether</literal> 只有在使用以太网卡时才需要。
- 它包含了通用的以太网协议代码。在
- &os;&nbsp;4.X 中应写作 <literal>pseudo-device
- ether</literal>.</para>
+ 它包含了通用的以太网协议代码。</para>
<programlisting>device sl # Kernel SLIP</programlisting>
<para><literal>sl</literal> 用以提供 SLIP 支持。
目前它几乎已经完全被 PPP 取代了, 因为后者更容易配置,
- 而且更适合调制解调器之间的连接, 并提供了更强大的功能。
- 在 &os;&nbsp;4.X 中, 这一行应写作 <literal>pseudo-device
- sl</literal>.</para>
+ 而且更适合调制解调器之间的连接, 并提供了更强大的功能。</para>
<programlisting>device ppp # Kernel PPP</programlisting>
<para>这一选项用以提供内核级的 PPP 支持, 用于拨号连接。
也有以用户模式运行的 PPP 实现, 使用
- <literal>tun</literal> 并提供包括按需拨号在内的更为灵活的功能。
- 在 &os;&nbsp;4.X 中应写作
- <literal>pseudo-device ppp</literal>.</para>
+ <literal>tun</literal> 并提供包括按需拨号在内的更为灵活的功能。</para>
<programlisting>device tun # Packet tunnel.</programlisting>
<para>它会被用户模式的 PPP 软件用到。
- 参考本书的 <link linkend="userppp">PPP</link> 以了解更多的细节。
- 在 &os;&nbsp;4.X 中则应使用 <literal>pseudo-device
- tun</literal>。</para>
+ 参考本书的 <link linkend="userppp">PPP</link> 以了解更多的细节。</para>
<programlisting><anchor id="kernelconfig-ptys">
device pty # Pseudo-ttys (telnet etc)</programlisting>
@@ -1161,35 +1103,21 @@ device pty # Pseudo-ttys (telnet etc)</programlisting>
<application>xterm</application>, 以及一些其它程序如
<application>Emacs</application> 等。</para>
- <note><para>在 &os;&nbsp;4.X 中,
- 您应该使用 <literal>pseudo-device pty
- <replaceable>number</replaceable></literal>。 <literal>pty</literal>
- 后面的 <replaceable>number</replaceable> 用于指定要创建的
- <literal>pty</literal> 数量。 如果您需要多于默认的同时
- 16 个 <application>xterm</application> 窗口或远程登录会话,
- 则应相应的提高这个值, 其上限是 256。</para></note>
-
<programlisting>device md # Memory <quote>disks</quote></programlisting>
- <para>内存盘伪设备。 对于 &os;&nbsp;4.X 则应使用
- <literal>pseudo-device md</literal>。</para>
+ <para>内存盘伪设备。</para>
<programlisting>device gif # IPv6 and IPv4 tunneling</programlisting>
<para>它实现了在 IPv4 上的 IPv6 隧道、 IPv6 上的 IPv4 隧道、
IPv4 上的 IPv4 隧道、 以及IPv6 上的 IPv6隧道。
- 从 &os;&nbsp;4.4 开始 <literal>gif</literal> 设备具有了
- <quote>自动克隆</quote> 能力, 因此只需指定
- <literal>pseudo-device gif</literal>。
- 更早版本的 &os;&nbsp;4.X 需要手工指定一个数字, 例如
- <literal>pseudo-device gif 4</literal>。</para>
+ <literal>gif</literal> 设备是
+ <quote>自动克隆</quote> 的, 它会根据需要自动创建设备节点。</para>
<programlisting>device faith # IPv6-to-IPv4 relaying (translation)</programlisting>
<para>这个伪设备能捕捉发给它的数据包,并把它们转发给
- IPv4/IPv6 翻译服务程序。在
- &os;&nbsp;4.X 中,应写作
- <literal>pseudo-device faith 1</literal>。</para>
+ IPv4/IPv6 翻译服务程序。</para>
<programlisting># The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
@@ -1198,9 +1126,7 @@ device bpf # Berkeley packet filter</programlisting>
<para>这是 Berkeley 包过滤器。这个伪设备允许网络接口被置于混杂模式,
从而,截获广播网 (例如,以太网) 上的每一个数据包。
- 截获的数据报可以保存到磁盘上,也可以使用 &man.tcpdump.1; 程序来分析。
- 在 &os;&nbsp;4.X 中,应写作
- <literal>pseudo-device bpf</literal>。</para>
+ 截获的数据报可以保存到磁盘上,也可以使用 &man.tcpdump.1; 程序来分析。</para>
<note>
<para>&man.bpf.4; 设备也被用于
@@ -1253,13 +1179,12 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
因为4GB的限制,Intel在&pentium;及后续的CPUs上增加了36位物理地址的支持。
</para>
- <para>&intel; &pentium; Pro和后续的CPUs允许内存地址扩展到64GB.(<acronym>PAE</acronym>)
- &os;通过<option>PAE</option>选项来支持这个能力。
- 在&os; 4.X系列里面,4.9-RELEASE开始支持,&os; 5.X系列里面,从5.1-RELEASE开始支持。
- in the 4.X series of &os; beginning with 4.9-RELEASE and
- in the 5.X series of &os; beginning with 5.1-RELEASE。因为Intel架构的限制,
- 高于或低于4GB都没有什么区别,内存分配到大于4GB仅仅是增加了可利用的内存池。
- </para>
+ <para>物理地址扩展 (<acronym>PAE</acronym>) 是
+ &intel; &pentium; Pro和后续的 CPU 提供的一种允许将内存地址扩展到 64GB
+ 的功能, &os; 的所有最新版本均支持此功能, 并通过
+ <option>PAE</option> 选项来启用这个能力。 因为Intel架构的限制,
+ 高于或低于 4GB 都没有什么区别,
+ 超过 4GB 的内存分配只是简单地添加到可用内存池中。</para>
<para>为了让内核支持<acronym>PAE</acronym>,只要增加下面这一行到配置文件:</para>
@@ -1284,10 +1209,11 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
</listitem>
<listitem>
- <para>没有使用&man.bus.dma.9;界面的设备驱动程序在打开了<acronym>PAE</acronym>支持的内核里面
- 会导致数据腐化(corruption)。因为这个原因,&os; 5.X的<filename>PAE</filename>内核配置文件
- 把所有在打开了<acronym>PAE</acronym>的内核上不能工作的驱动程序排除在外。
- </para>
+ <para>没有使用 &man.bus.dma.9; 接口的设备驱动程序在打开了
+ <acronym>PAE</acronym> 支持的内核中会导致数据损坏。
+ 因为这个原因, <filename>PAE</filename> 内核配置文件
+ 会把所有在打开了 <acronym>PAE</acronym>
+ 的内核上不能工作的驱动程序排除在外。</para>
</listitem>
<listitem>
@@ -1311,64 +1237,6 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
</sect2>
</sect1>
- <sect1 id="kernelconfig-nodes">
- <title>创建设备节点</title>
-
- <indexterm><primary>设备节点</primary></indexterm>
- <indexterm>
- <primary><command>MAKEDEV</command></primary>
- </indexterm>
-
- <para><emphasis>如果您在运行 &os;&nbsp;5.0 或更高版本,
- 则可以略过这节。 新版本使用
- &man.devfs.5; 来分配设备节点, 这一过程对用户是透明的。</emphasis></para>
-
- <para>内核中的几乎每个设备在 <filename>/dev</filename> 目录中都有对应的
- <quote>节点</quote> 项。 这些节点看上去像是普通的文件,
- 但事实上却是程序在使用对应的设备时, 与内核联系的入口。
- Shell 脚本 <filename>/dev/MAKEDEV</filename>
- 在首次安装操作系统时会创建几乎所有能够支持的设备节点。
- 然而, 它并不会创建 <emphasis>所有的</emphasis> 节点,
- 因此当您增加了某些设备的支持时, 就需要检查这个目录中是否有对应的项了,
- 如果没有, 就应该添加它们。 这有一个简单的例子:</para>
-
- <para>假定在内核中加入了IDE CD-ROM的支持。可以这样加入:</para>
-
- <programlisting>device acd0</programlisting>
-
- <para>这意味着您应当在<filename>/dev</filename>目录下找一些以<filename>acd0</filename>为起点的入口,
- 通常后面有一个字母,像是以<literal>c</literal>,或者<literal>r</literal>开头,表示这是一个<quote>raw</quote>设备。
- 如果那些文件不在那儿,就必须改变到<filename>/dev</filename>目录然后键入:</para>
-
- <indexterm>
- <primary><command>MAKEDEV</command></primary></indexterm>
- <screen>&prompt.root; <userinput>sh MAKEDEV acd0</userinput></screen>
-
- <para>这些脚本完成后,您要在<filename>/dev</filename>目录下确认有<filename>acd0c</filename>和
- <filename>racd0c</filename>等几个入口,这表示程序已经正确执行。
- </para>
-
- <para>以下是加入声卡节点的例子:</para>
-
- <screen>&prompt.root; <userinput>sh MAKEDEV snd0</userinput></screen>
-
- <note>
- <para>当创建完诸如声卡这样的设备节点时,如果其他人有权访问您的机器,
- 可能有必要在<filename>/etc/fbtab</filename>文件中添加这些节点来保护系统安全。
- 更多的信息参考&man.fbtab.5;
- </para>
- </note>
-
- <para>依上述的简单程序,建立任何不在<filename>GENERIC</filename>里的硬件设备节点
- </para>
-
- <note>
- <para> 所有的SCSI控制器都使用一样的设备节点,所以您无须重新建立节点。
- 另外,网卡与SLIP/PPP虚拟设备并没有任何设备节点,所以您不必担心怎么建立节点。
- </para>
- </note>
- </sect1>
-
<sect1 id="kernelconfig-trouble">
<title>如果出现问题怎么办</title>
@@ -1404,25 +1272,6 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
</varlistentry>
<varlistentry>
- <term>安装新内核失败:</term>
-
- <listitem>
- <para>如果内核编译得很顺利, 但安装失败
- (即 <command>make install</command> 或
- <command>make installkernel</command> 命令失败),
- 第一件事是检查您的系统是否是以 1 或更高的安全级运行的
- (参见 &man.init.8;)。 内核安装过程将尝试去掉原有内核的
- immutable (不可改) 标志, 并在新的内核上设置它。
- 由于安全级 1 或更高的安全级会阻止修改系统中任何文件的这个标志,
- 因此安装内核需要 0 或者更低的安全级。</para>
-
- <para>不过这只对 &os; 4.X 以及更早的版本有效。
- &os; 5.X 以及之后的版本并不会给内核设置不可改标志,
- 因此安装失败可能说明发生了更深层次的问题。</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term>内核无法启动:<anchor
id="kernelconfig-noboot"></term>
@@ -1430,9 +1279,9 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
<para>如果您的内核无法启动, 或不识别您的设备, 千万别慌!
非常幸运的是, &os; 有一个很好的机制帮助您从不兼容的内核恢复。
在 &os; 启动加载器那里简单地选择一下要启动的内核就可以了。
- 当系统在引导菜单的 10 秒倒计时时进入它。 按下除了
- <keycap>Enter</keycap> 之外的任意键, <command>unload</command>
- 然后输入
+ 当系统在引导菜单的 10 秒倒计时时进入它, 方法是选择 <quote>Escape to a loader
+ prompt</quote> 选项, 其编号为 6。 输入
+ <command>unload kernel</command>, 然后输入
<command>boot /boot/<replaceable>kernel.old</replaceable>/kernel</command>,
或者其他任何一个可以正确引导的内核即可。
当重新配置内核时, 保持一个已经证明能够正常启动的内核永远是一个好习惯。</para>
@@ -1457,20 +1306,6 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
<screen>&prompt.root; <userinput>mv /boot/kernel /boot/kernel.bad</userinput>
&prompt.root; <userinput>mv /boot/<replaceable>kernel.good</replaceable> /boot/kernel</userinput></screen>
- <para>对于 &os; 5.X 之前的版本, 正确的
- <quote>解除</quote> <command>make</command>
- 所实施的保护的命令 (为了把另一个内核永久性地挪回来) 是:</para>
-
- <screen>&prompt.root; <userinput>chflags noschg /kernel</userinput></screen>
-
- <para>如果您发现您不能这样做,您的系统的安全级别可能大于0了。在<filename>/etc/rc.conf</filename>里面编辑
- <literal>kern_securelevel</literal>并把它设置为<literal>-1</literal>然后重启。
- 当您很满意这个内核的时候,您可以再把设置改回去。</para>
-
- <para>另外,如果您要<quote>锁住</quote>内核或其他文件,以致它不能被移动或修改,
- 可以用下面的命令:</para>
-
- <screen>&prompt.root; <userinput>chflags schg /kernel</userinput></screen>
</note>
</listitem>
</varlistentry>
@@ -1480,7 +1315,7 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
<listitem>
<para>如果您安装了一个与系统中内建工具版本不同的内核,
- 例如在 4.x 系统上安装了 5.x 的内核, 许多用于检查系统状态的工具如
+ 例如在 -STABLE 系统上安装了 -CURRENT 的内核, 许多用于检查系统状态的工具如
&man.ps.1; 和 &man.vmstat.8; 都将无法正常使用。
您应该 <link linkend="makeworld">重新编译一个和内核版本一致的系统</link>。
这也是为什么一般不鼓励使用与系统其他部分版本不同的内核的一个主要原因。</para>