- Update handbook/linuxemu

PR:		docs/101390
Submitted by:	chinsan.tw at gmail.com
This commit is contained in:
Vanilla I. Shu 2006-08-05 04:52:05 +00:00
parent 5b7f1bad82
commit 133be87c21
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=28415

View file

@ -2,7 +2,7 @@
The FreeBSD Documentation Project
$FreeBSD$
Original revision: 1.127
Original revision: 1.132
-->
<chapter id="linuxemu">
@ -28,101 +28,85 @@
</authorgroup>
</chapterinfo>
<title>Linux Binary Compatibility</title>
<title>與 Linux Binary 的相容方面</title>
<sect1 id="linuxemu-synopsis">
<title>Synopsis</title>
<title>概述</title>
<indexterm><primary>Linux binary compatibility</primary></indexterm>
<indexterm>
<primary>binary compatibility</primary>
<secondary>Linux</secondary>
</indexterm>
<para>FreeBSD provides binary compatibility with several other
&unix; like operating systems, including Linux. At this point,
you may be asking yourself why exactly, does
FreeBSD need to be able to run Linux binaries? The answer to that
question is quite simple. Many companies and developers develop
only for Linux, since it is the latest <quote>hot thing</quote> in
the computing world. That leaves the rest of us FreeBSD users
bugging these same companies and developers to put out native
FreeBSD versions of their applications. The problem is, that most
of these companies do not really realize how many people would use
their product if there were FreeBSD versions too, and most continue
to only develop for Linux. So what is a FreeBSD user to do? This
is where the Linux binary compatibility of FreeBSD comes into
play.</para>
<para>FreeBSD 有提供其他幾種 &unix; like 作業系統的 binary 相容性,其中包括了 Linux。
你可能會納悶:為什麼 FreeBSD 需要能夠執行 Linux 專用執行檔(binary)呢?答案很簡單,
許多公司、開發者只會 Linux 開發程式,因為這是目前資訊界 <quote>最熱門</quote> 的玩意。
這逼得許多 FreeBSD 使用者不得不去勸說這些人是否提供可直接在 FreeBSD 上執行的版本。
但問題是,大多數公司並不瞭解會有多少人會用 FreeBSD 版,因此他們仍只開發 Linux 版。
那麼 FreeBSD 使用者該怎麼辦呢?答案就是用 FreeBSD 所提供的 Linux binary 相容。</para>
<para>In a nutshell, the compatibility allows FreeBSD users to run
about 90% of all Linux applications without modification. This
includes applications such as <application>&staroffice;</application>,
the Linux version of <application>&netscape;</application>,
<application>&adobe;&nbsp;&acrobat;</application>,
<application><trademark class="registered">RealPlayer</trademark></application>,
<application><trademark>VMware</trademark></application>,
<application>&oracle;</application>,
<application><trademark class="registered">WordPerfect</trademark></application>, <application>Doom</application>,
<application>Quake</application>, and more. It is also reported
that in some situations, Linux binaries perform better on FreeBSD
than they do under Linux.</para>
<para>簡單來講,這種相容性可讓 FreeBSD 使用者直接執行約 90% 的 Linux 程式,而不必做任何修改。
這些包括了: <application>&staroffice;</application>、
<application>&netscape;</application> 的 Linux 版、
<application>&adobe;&nbsp;&acrobat;</application>、
<application><trademark class="registered">RealPlayer</trademark></application>、
<application><trademark>VMware</trademark></application>、
<application>&oracle;</application>、
<application><trademark class="registered">WordPerfect</trademark></application>、<application>Doom</application>、
<application>Quake</application> 等等。此外,也有人回報說在某些情況下,
這些在 FreeBSD 上執行的 Linux 程式,甚至比原本在 Linux 執行得更好。</para>
<para>There are, however, some Linux-specific operating system
features that are not supported under FreeBSD. Linux binaries will
not work on FreeBSD if they overly use &i386; specific
calls, such as enabling virtual 8086 mode.</para>
<para>然而呢,還是有些只限 Linux 特定的作業系統功能,在 FreeBSD 上並未支援。
如果 Linux 程式過於濫用只有 &i386; 架構上才能用的功能,比如:虛擬 8086 模式,
則可能無法在 FreeBSD 運作正常。</para>
<para>After reading this chapter, you will know:</para>
<para>讀完這章,您將了解:</para>
<itemizedlist>
<listitem>
<para>How to enable Linux binary compatibility on your system.</para>
<para>如何啟用 Linux 相容模式。</para>
</listitem>
<listitem>
<para>How to install additional Linux shared
libraries.</para>
<para>如何安裝額外的 Linux share libraries。</para>
</listitem>
<listitem>
<para>How to install Linux applications on your FreeBSD system.</para>
<para>如何在 FreeBSD 上安裝 Linux 程式。</para>
</listitem>
<listitem>
<para>The implementation details of Linux compatibility in FreeBSD.</para>
<para>FreeBSD 上的 Linux 相容模式的實作細節。</para>
</listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
<para>在閱讀這章之前,您應當了解:</para>
<itemizedlist>
<listitem>
<para>Know how to install additional third-party
software (<xref linkend="ports">).</para>
<para>知道如何透過 port 機制來安裝軟體(<xref linkend="ports">)。</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="linuxemu-lbc-install">
<title>Installation</title>
<title>安裝</title>
<indexterm><primary>KLD (kernel loadable object)</primary></indexterm>
<para>Linux binary compatibility is not turned on by default. The
easiest way to enable this functionality is to load the
<para>預設並不會打開 Linux 相容模式,最簡單的啟用方式,就是載入
<literal>linux</literal> KLD object (<quote>Kernel LoaDable
object</quote>). You can load this module by typing the
following as <username>root</username>:</para>
object</quote>)。 載入方式,請切為 <username>root</username>
權限,然後打下列指令:</para>
<screen>&prompt.root; <userinput>kldload linux</userinput></screen>
<para>If you would like Linux compatibility to always be enabled,
then you should add the following line to
<filename>/etc/rc.conf</filename>:</para>
<para>若要每次開機都啟用的話,請把下列內容加到
<filename>/etc/rc.conf</filename> 檔:</para>
<programlisting>linux_enable="YES"</programlisting>
<para>The &man.kldstat.8; command can be used to verify that the
KLD is loaded:</para>
<para>另外可以用 &man.kldstat.8; 指令,來確認有哪些 KLD 有載入:</para>
<screen>&prompt.user; <userinput>kldstat</userinput>
Id Refs Address Size Name
@ -130,7 +114,7 @@ Id Refs Address Size Name
7 1 0xc24db000 d000 linux.ko</screen>
<indexterm>
<primary>kernel options</primary>
<secondary>LINUX</secondary>
<secondary>COMPAT_LINUX</secondary>
</indexterm>
<para>If for some reason you do not want to or cannot load the KLD,
@ -160,7 +144,7 @@ Id Refs Address Size Name
from the <ulink type="html" url="file://localhost/usr/ports/">Ports Collection</ulink>.
Simply do the following:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/emulators/linux_base</userinput>
<screen>&prompt.root; <userinput>cd /usr/ports/emulators/linux_base-fc4</userinput>
&prompt.root; <userinput>make install distclean</userinput></screen>
<para>You should now have working Linux binary compatibility.
@ -1563,8 +1547,7 @@ export PATH</programlisting>
<title>Installation of FreeBSD</title>
<para>First you have to install FreeBSD. There are several ways to do
this (FreeBSD&nbsp;4.3 was installed via FTP, FreeBSD&nbsp;4.5 directly from
the RELEASE CD) for more information read the <xref
this, for more information read the <xref
linkend="install-diff-media">.</para>
<sect3 id="disk-layout">
@ -2066,7 +2049,7 @@ options SEMUME=100 #number of UNDO keys</programlisting>
and <application>&oracle;</application>, therefore choose a larger
number of shared memory pages.</para>
<note><para>With the default installation of FreeBSD&nbsp;4.5 on &i386;,
<note><para>With the default installation of FreeBSD on &i386;,
leave <literal>MAXDSIZ</literal> and <literal>DFLDSIZ</literal> at 1&nbsp;GB maximum. Otherwise, strange
errors like <errorname>ORA-27102: out of memory</errorname> and
<errorname>Linux Error: 12: Cannot allocate memory</errorname>
@ -3037,7 +3020,7 @@ rscp/TCP0B = TCP0B</programlisting>
<sect3 id="ora-00001">
<title><errorcode>ORA-00001</errorcode></title>
<para>This error only happened with
<application>&oracle; 8.1.7</application> on FreeBSD&nbsp;4.5.
<application>&oracle; 8.1.7</application> on FreeBSD.
The reason was that the <application>&oracle;</application> database could not initialize itself
properly and crashed, leaving semaphores and shared memory on the
system. The next try to start the database then returned