aboutsummaryrefslogtreecommitdiff
path: root/zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml
diff options
context:
space:
mode:
Diffstat (limited to 'zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml')
-rw-r--r--zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml167
1 files changed, 70 insertions, 97 deletions
diff --git a/zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml b/zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml
index 6d0832e9df..04bce69206 100644
--- a/zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml
+++ b/zh_CN.GB2312/books/handbook/kernelconfig/chapter.xml
@@ -6,30 +6,19 @@
Original Revision: 1.199
$FreeBSD$
-->
-
-<chapter id="kernelconfig">
- <chapterinfo>
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="kernelconfig">
+ <info><title>配置FreeBSD的内核</title>
<authorgroup>
- <author>
- <firstname>Jim</firstname>
- <surname>Mock</surname>
- <contrib>Updated and restructured by </contrib>
- <!-- Mar 2000 -->
- </author>
+ <author><personname><firstname>Jim</firstname><surname>Mock</surname></personname><contrib>Updated and restructured by </contrib></author>
</authorgroup>
<authorgroup>
- <author>
- <firstname>Jake</firstname>
- <surname>Hamby</surname>
- <contrib>Originally contributed by </contrib>
- <!-- 6 Oct 1995 -->
- </author>
+ <author><personname><firstname>Jake</firstname><surname>Hamby</surname></personname><contrib>Originally contributed by </contrib></author>
</authorgroup>
- </chapterinfo>
+ </info>
- <title>配置FreeBSD的内核</title>
+
- <sect1 id="kernelconfig-synopsis">
+ <sect1 xml:id="kernelconfig-synopsis">
<title>概述</title>
<indexterm>
@@ -65,11 +54,11 @@
</listitem>
</itemizedlist>
- <para>这一章给出的命令应该以 <username>root</username> 身份执行,
+ <para>这一章给出的命令应该以 <systemitem class="username">root</systemitem> 身份执行,
否则可能会不成功。</para>
</sect1>
- <sect1 id="kernelconfig-custom-kernel">
+ <sect1 xml:id="kernelconfig-custom-kernel">
<title>为什么需要建立定制的内核?</title>
<para>过去, &os; 采用的是被人们称作
@@ -116,17 +105,13 @@
</itemizedlist>
</sect1>
- <sect1 id="kernelconfig-devices">
- <sect1info>
+ <sect1 xml:id="kernelconfig-devices">
+ <info><title>发现系统硬件</title>
<authorgroup>
- <author>
- <firstname>Tom</firstname>
- <surname>Rhodes</surname>
- <contrib>作者 </contrib>
- </author>
+ <author><personname><firstname>Tom</firstname><surname>Rhodes</surname></personname><contrib>作者 </contrib></author>
</authorgroup>
- </sect1info>
- <title>发现系统硬件</title>
+ </info>
+
<para>在尝试配置内核以前,比较明智的做法是先获得一份机器硬件的清单。
当 &os; 并不是主操作系统时,通过查看当前操作系统的配置可以很容易的
@@ -144,7 +129,7 @@
&man.dmesg.8; 工具以及 &man.man.1; 命令。&os;
上大多数的驱动程序都有一份手册页(manual page)列出了所支持的硬件,
在系统启动的时候,被发现的硬件也会被列出。举例来说,
- 下面的这几行表示 <devicename>psm</devicename> 驱动找到了一个鼠标:</para>
+ 下面的这几行表示 <filename>psm</filename> 驱动找到了一个鼠标:</para>
<programlisting>psm0: &lt;PS/2 Mouse&gt; irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
@@ -167,10 +152,10 @@ psm0: model Generic PS/2 mouse, device ID 0</programlisting>
class = network
subclass = ethernet</programlisting>
- <para>这个片断取自于 <command>pciconf <option>-lv</option></command>
- 命令的输出,显示 <devicename>ath</devicename>
+ <para>这个片断取自于 <command>pciconf -lv</command>
+ 命令的输出,显示 <filename>ath</filename>
驱动找到了一个无线以太网设备。输入命令
- <command>man <replaceable>ath</replaceable></command>
+ <command>man ath</command>
就能查阅有关 &man.ath.4; 的手册页(manual page)了。</para>
<para>还可以传给 &man.man.1; 命令 <option>-k</option> 选项,
@@ -187,7 +172,7 @@ ath_hal(4) - Atheros Hardware Access Layer (HAL)</programlisting>
那么编译制定内核的过程就显得不那么困难了。</para>
</sect1>
- <sect1 id="kernelconfig-modules">
+ <sect1 xml:id="kernelconfig-modules">
<title>内核驱动,子系统和模块</title>
<indexterm>
<primary>kernel</primary>
@@ -199,10 +184,10 @@ ath_hal(4) - Atheros Hardware Access Layer (HAL)</programlisting>
那么很可能已经存在一个现成的模块了。</para>
<para>内核模块存放在目录
- <filename class="directory">/boot/kernel</filename>
+ <filename>/boot/kernel</filename>
中,并能由 &man.kldload.8; 命令加载入正在运行的内核。
基本上所有的内核驱动都有特定的模块和手册页。比如,
- 下面提到的 <devicename>ath</devicename> 无线以太网驱动。
+ 下面提到的 <filename>ath</filename> 无线以太网驱动。
在这个设备的联机手册中有以下信息:</para>
<programlisting>Alternatively, to load the driver as a module at boot time, place the
@@ -229,7 +214,7 @@ following line in &man.loader.conf.5;:
</warning>
</sect1>
- <sect1 id="kernelconfig-building">
+ <sect1 xml:id="kernelconfig-building">
<title>建立并安装一个定制的内核</title>
<indexterm>
<primary>内核</primary>
@@ -242,7 +227,7 @@ following line in &man.loader.conf.5;:
<filename>/sys</filename> 来访问它。
这里的众多子目录包含了内核的不同部分,
但对我们所要完成的任务最重要的目录是
- <filename><replaceable>arch</replaceable>/conf</filename>,
+ <filename>arch/conf</filename>,
您将在这里编辑定制的内核配置; 以及
<filename>compile</filename>, 编译过程中的文件将放置在这里。
<replaceable>arch</replaceable> 表示
@@ -280,15 +265,15 @@ following line in &man.loader.conf.5;:
&prompt.root; <userinput>cat /cdrom/src/sbase.[a-d]* | tar -xzvf -</userinput></screen>
</note>
- <para>接下来, 进入 <filename><replaceable>arch</replaceable>/conf</filename>
+ <para>接下来, 进入 <filename>arch/conf</filename>
目录下面, 复制 <filename>GENERIC</filename> 配置文件,
并给这个文件起一个容易辨认的名称, 它就是您的内核名称。例如:</para>
- <screen>&prompt.root; <userinput>cd /usr/src/sys/<replaceable>i386</replaceable>/conf</userinput>
-&prompt.root; <userinput>cp GENERIC <replaceable>MYKERNEL</replaceable></userinput></screen>
+ <screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf</userinput>
+&prompt.root; <userinput>cp GENERIC MYKERNEL</userinput></screen>
<para>通常,这个名称是大写的,如果您正维护着多台不同硬件的&os;机器,
以您机器的域名来命名是非常好的主意。我们把它命名为
- <filename><replaceable>MYKERNEL</replaceable></filename>就是这个原因。
+ <filename>MYKERNEL</filename>就是这个原因。
</para>
<tip>
@@ -304,29 +289,28 @@ following line in &man.loader.conf.5;:
而您的修改也就随之丢失了。</para>
<para>您也可以考虑把内核配置文件放到别的地方,
- 然后再到 <filename><replaceable>i386</replaceable></filename>
+ 然后再到 <filename>i386</filename>
目录中创建一个指向它的符号链接。</para>
<para>例如:</para>
- <screen>&prompt.root; <userinput>cd /usr/src/sys/<replaceable>i386</replaceable>/conf</userinput>
+ <screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf</userinput>
&prompt.root; <userinput>mkdir /root/kernels</userinput>
-&prompt.root; <userinput>cp GENERIC /root/kernels/<replaceable>MYKERNEL</replaceable></userinput>
-&prompt.root; <userinput>ln -s /root/kernels/<replaceable>MYKERNEL</replaceable></userinput></screen>
+&prompt.root; <userinput>cp GENERIC /root/kernels/MYKERNEL</userinput>
+&prompt.root; <userinput>ln -s /root/kernels/MYKERNEL</userinput></screen>
</tip>
<note>
- <para>必须以 <username>root</username> 身份执行这些和接下来命令,
+ <para>必须以 <systemitem class="username">root</systemitem> 身份执行这些和接下来命令,
否则就会得到 <errortype>permission denied</errortype> 的错误提示。
</para>
</note>
<para>现在就可以用您喜欢的文本编辑器来编辑
- <filename><replaceable>MYKERNEL</replaceable></filename> 了。
+ <filename>MYKERNEL</filename> 了。
如果您刚刚开始使用 FreeBSD, 唯一可用的编辑器很可能是
<application>vi</application>, 它的使用比较复杂, 限于篇幅,
- 这里不予介绍, 您可以在 <link
- linkend="bibliography">参考书目</link> 一章中找到很多相关书籍。
+ 这里不予介绍, 您可以在 <link linkend="bibliography">参考书目</link> 一章中找到很多相关书籍。
不过, &os; 也提供了一个更好用的编辑器,
它叫做 <application>ee</application>, 对于新手来说,
这很可能是一个不错的选择。
@@ -340,8 +324,7 @@ following line in &man.loader.conf.5;:
</para>
<note>
- <para>如果您和 &os; project 进行了 <link
- linkend="updating-upgrading">代码同步</link>,
+ <para>如果您和 &os; project 进行了 <link linkend="updating-upgrading">代码同步</link>,
则一定要在进行任何更新之前查看
<filename>/usr/src/UPDATING</filename>。
这个文件中描述了更新过的代码中出现的重大问题或需要注意的地方。
@@ -355,8 +338,7 @@ following line in &man.loader.conf.5;:
<title>联编内核</title>
<step>
- <para>进入 <filename
- class="directory">/usr/src</filename> 目录:</para>
+ <para>进入 <filename>/usr/src</filename> 目录:</para>
<screen>&prompt.root; <userinput>cd /usr/src</userinput></screen>
</step>
@@ -364,13 +346,13 @@ following line in &man.loader.conf.5;:
<step>
<para>编译内核:</para>
- <screen>&prompt.root; <userinput>make buildkernel KERNCONF=<replaceable>MYKERNEL</replaceable></userinput></screen>
+ <screen>&prompt.root; <userinput>make buildkernel KERNCONF=MYKERNEL</userinput></screen>
</step>
<step>
<para>安装新内核:</para>
- <screen>&prompt.root; <userinput>make installkernel KERNCONF=<replaceable>MYKERNEL</replaceable></userinput></screen>
+ <screen>&prompt.root; <userinput>make installkernel KERNCONF=MYKERNEL</userinput></screen>
</step>
</procedure>
@@ -396,39 +378,33 @@ following line in &man.loader.conf.5;:
</tip>
<indexterm>
- <primary><filename class="directory">/boot/kernel.old</filename></primary>
+ <primary><filename>/boot/kernel.old</filename></primary>
</indexterm>
- <para>新内核将会被复制到 <filename
- class="directory">/boot/kernel</filename> 目录中成为
+ <para>新内核将会被复制到 <filename>/boot/kernel</filename> 目录中成为
<filename>/boot/kernel/kernel</filename> 而旧的则被移到
<filename>/boot/kernel.old/kernel</filename>。
现在关闭系统, 然后用新的内核启动计算机。 如果出现问题,
后面的一些 <link linkend="kernelconfig-trouble">故障排除方法</link>
- 将帮您摆脱困境。 如果您的内核 <link
- linkend="kernelconfig-noboot">无法启动</link>, 请参考那一节。</para>
+ 将帮您摆脱困境。 如果您的内核 <link linkend="kernelconfig-noboot">无法启动</link>, 请参考那一节。</para>
<note>
<para>其他与启动过程相关的文件, 如
&man.loader.8; 及其配置, 则放在
<filename>/boot</filename>。 第三方或定制的模块也可以放在
- <filename class="directory">/boot/kernel</filename>,
+ <filename>/boot/kernel</filename>,
不过应该注意保持模块和内核的同步时很重要的,
否则会导致不稳定和错误。</para>
</note>
</sect1>
- <sect1 id="kernelconfig-config">
- <sect1info>
+ <sect1 xml:id="kernelconfig-config">
+ <info><title>配置文件</title>
<authorgroup>
- <author>
- <firstname>Joel</firstname>
- <surname>Dahl</surname>
- <contrib>Updated by </contrib>
- </author>
+ <author><personname><firstname>Joel</firstname><surname>Dahl</surname></personname><contrib>Updated by </contrib></author>
</authorgroup>
- </sect1info>
- <title>配置文件</title>
+ </info>
+
<indexterm>
<primary>内核</primary>
<secondary>NOTES</secondary>
@@ -444,8 +420,7 @@ following line in &man.loader.conf.5;:
实际上, 绝大多数行都只包括一个参数。
在 <literal>#</literal> 之后的内容会被认为是注释而忽略掉。
接下来几节, 将以 <filename>GENERIC</filename> 中的顺序介绍所有关键字。
- <anchor
- id="kernelconfig-options"/> 如果需要与平台有关的选项和设备的详细列表,
+ <anchor xml:id="kernelconfig-options"/> 如果需要与平台有关的选项和设备的详细列表,
请参考与 <filename>GENERIC</filename> 文件在同一个目录中的那个
<filename>NOTES</filename>,
而平台无关的选项, 则可以在
@@ -479,9 +454,9 @@ options IPDIVERT
<note>
<para>如果您需要一份包含所有选项的文件,
- 例如用于测试目的, 则应以 <username>root</username> 身份执行下列命令:</para>
+ 例如用于测试目的, 则应以 <systemitem class="username">root</systemitem> 身份执行下列命令:</para>
- <screen>&prompt.root; <userinput>cd /usr/src/sys/<replaceable>i386</replaceable>/conf &amp;&amp; make LINT</userinput></screen>
+ <screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf &amp;&amp; make LINT</userinput></screen>
</note>
<indexterm>
@@ -492,7 +467,7 @@ options IPDIVERT
<para>下面是一个 <filename>GENERIC</filename>
内核配置文件的例子, 它包括了一些需要解释的注释。
这个例子应该和您复制的
- <filename>/usr/src/sys/<replaceable>i386</replaceable>/conf/GENERIC</filename>
+ <filename>/usr/src/sys/i386/conf/GENERIC</filename>
非常接近。</para>
<indexterm>
@@ -532,7 +507,7 @@ cpu I686_CPU</programlisting>
<programlisting>ident GENERIC</programlisting>
<para>这是内核的名字。 您应该取一个自己的名字,
- 例如取名叫 <literal><replaceable>MYKERNEL</replaceable></literal>,
+ 例如取名叫 <literal>MYKERNEL</literal>,
如果您一直在按照前面的说明做的话。
您放在
<literal>ident</literal> 后面的字符串在启动内核时会显示出来,
@@ -634,7 +609,7 @@ options NFS_ROOT # NFS usable as /, requires NFSCLIENT</progra
就可以把它注释掉。
如前面所介绍的那样, 在您第一次挂接 DOS 分区时,
内核会自动加载需要的模块。 此外,
- <filename role="package">emulators/mtools</filename>
+ <package>emulators/mtools</package>
软件提供了一个很方便的功能,
通过它您可以直接访问 DOS 软盘而无需挂接或卸下它们
(而且也完全不需要 <literal>MSDOSFS</literal>)。</para>
@@ -795,7 +770,7 @@ device ata</programlisting>
<para>这个选项需要 <literal>device ata</literal>, 它用于 ATA
RAID 驱动。</para>
- <programlisting><anchor id="kernelconfig-atapi"/>
+ <programlisting><anchor xml:id="kernelconfig-atapi"/>
device atapicd # ATAPI CDROM drives</programlisting>
<para>这个是ATAPI CDROM驱动器所必须的。</para>
@@ -976,11 +951,11 @@ device cardbus # CardBus (32-bit) bus</programlisting>
device sio # 8250, 16[45]50 based serial ports</programlisting>
<para>这些串口在 &ms-dos;/&windows; 的世界中称为
- <devicename>COM</devicename> 口。</para>
+ <filename>COM</filename> 口。</para>
<note>
- <para>如果使用内置式的调制解调器, 并占用 <devicename>COM4</devicename>
- 而您另有一个串口在 <devicename>COM2</devicename>, 则必须把调制解调器的
+ <para>如果使用内置式的调制解调器, 并占用 <filename>COM4</filename>
+ 而您另有一个串口在 <filename>COM2</filename>, 则必须把调制解调器的
IRQ 改为 2 (由于晦涩的技术原因,
IRQ2 = IRQ 9) 才能够在 &os; 中访问它。
如果有多口的串口卡, 请参考 &man.sio.4; 以了解需要在
@@ -988,11 +963,11 @@ device sio # 8250, 16[45]50 based serial ports</programli
某些显卡 (特别是基于 S3 芯片的卡) 使用形如 <literal>0x*2e8</literal>
的 IO 地址, 而许多廉价的串口卡不能够正确地对 16-位
IO 地址空间进行解码, 因此它们会产生冲突,
- 并造成 <devicename>COM4</devicename> 实际上无法使用。</para>
+ 并造成 <filename>COM4</filename> 实际上无法使用。</para>
<para>每一个串口都需要有一个唯一的 IRQ (除非您使用支持中断分享的串口卡),
- 因此默认的 <devicename>COM3</devicename>
- 和 <devicename>COM4</devicename> IRQ 是不能使用的。</para>
+ 因此默认的 <filename>COM3</filename>
+ 和 <filename>COM4</filename> IRQ 是不能使用的。</para>
</note>
<programlisting># Parallel port
@@ -1091,7 +1066,7 @@ device xe # Xircom pccard Ethernet
#device le</programlisting>
<para>ISA 以太网卡驱动。 参见
- <filename>/usr/src/sys/<replaceable>i386</replaceable>/conf/NOTES</filename>
+ <filename>/usr/src/sys/i386/conf/NOTES</filename>
以了解关于哪个驱动程序能够驱动您的网卡的细节。</para>
<programlisting># Wireless NIC cards
@@ -1121,8 +1096,7 @@ device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
device loop # Network loopback</programlisting>
<para>这是 TCP/IP 的通用回环设备。 如果您 telnet
- 或 FTP 到 <hostid>localhost</hostid> (也就是 <hostid
- role="ipaddr">127.0.0.1</hostid>) 则将通过这个设备回到本机。
+ 或 FTP 到 <systemitem>localhost</systemitem> (也就是 <systemitem class="ipaddress">127.0.0.1</systemitem>) 则将通过这个设备回到本机。
这个设备是 <emphasis>必需的</emphasis>。</para>
<programlisting>device random # Entropy device</programlisting>
@@ -1151,7 +1125,7 @@ device loop # Network loopback</programlisting>
<para>它会被用户模式的 PPP 软件用到。
参考本书的 <link linkend="userppp">PPP</link> 以了解更多的细节。</para>
- <programlisting><anchor id="kernelconfig-ptys"/>
+ <programlisting><anchor xml:id="kernelconfig-ptys"/>
device pty # Pseudo-ttys (telnet etc)</programlisting>
<para>这是一个 <quote>pseudo-terminal</quote> 或模拟登入端口。
@@ -1223,7 +1197,7 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
<para>支持各类火线设备。</para>
<para>要了解 &os; 所支持的设备的其他情况, 请参考
- <filename>/usr/src/sys/<replaceable>i386</replaceable>/conf/NOTES</filename>。</para>
+ <filename>/usr/src/sys/i386/conf/NOTES</filename>。</para>
<sect2>
<title>大内存支持(<acronym>PAE</acronym>)</title>
@@ -1290,7 +1264,7 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
</sect2>
</sect1>
- <sect1 id="kernelconfig-trouble">
+ <sect1 xml:id="kernelconfig-trouble">
<title>如果出现问题怎么办</title>
<para>在定制一个内核时,可能会出现四种问题。它们是:</para>
@@ -1325,8 +1299,7 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
</varlistentry>
<varlistentry>
- <term>内核无法启动:<anchor
- id="kernelconfig-noboot"/></term>
+ <term>内核无法启动:<anchor xml:id="kernelconfig-noboot"/></term>
<listitem>
<para>如果您的内核无法启动, 或不识别您的设备, 千万别慌!
@@ -1335,7 +1308,7 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
当系统在引导菜单的 10 秒倒计时时进入它, 方法是选择 <quote>Escape to a loader
prompt</quote> 选项, 其编号为 6。 输入
<command>unload kernel</command>, 然后输入
- <command>boot /boot/<replaceable>kernel.old</replaceable>/kernel</command>,
+ <command>boot /boot/kernel.old/kernel</command>,
或者其他任何一个可以正确引导的内核即可。
当重新配置内核时, 保持一个已经证明能够正常启动的内核永远是一个好习惯。</para>
@@ -1352,12 +1325,12 @@ device fwe # Ethernet over FireWire (non-standard!)</programl
因为在安装新内核时, <filename>kernel.old</filename>
会被上次安装的那个可能不正常的内核覆盖掉。
另外, 尽快把可用的内核挪到
- <filename class="directory">/boot/kernel</filename>
+ <filename>/boot/kernel</filename>
否则类似 &man.ps.1; 这样的命令可能无法正常工作。
为了完成这一点, 需要修改目录的名字:</para>
- <screen>&prompt.root; <userinput>mv /boot/kernel <replaceable>/boot/kernel.bad</replaceable></userinput>
-&prompt.root; <userinput>mv /boot/<replaceable>kernel.good</replaceable> /boot/kernel</userinput></screen>
+ <screen>&prompt.root; <userinput>mv /boot/kernel /boot/kernel.bad</userinput>
+&prompt.root; <userinput>mv /boot/kernel.good /boot/kernel</userinput></screen>
</note>
</listitem>