|
Lines 2-8
Link Here
|
| 2 |
The FreeBSD Documentation Project |
2 |
The FreeBSD Documentation Project |
| 3 |
|
3 |
|
| 4 |
$FreeBSD: doc/zh_TW.Big5/books/handbook/linuxemu/chapter.sgml,v 1.3 2006/01/31 01:31:03 vanilla Exp $ |
4 |
$FreeBSD: doc/zh_TW.Big5/books/handbook/linuxemu/chapter.sgml,v 1.3 2006/01/31 01:31:03 vanilla Exp $ |
| 5 |
Original revision: 1.127 |
5 |
Original revision: 1.132 |
| 6 |
--> |
6 |
--> |
| 7 |
|
7 |
|
| 8 |
<chapter id="linuxemu"> |
8 |
<chapter id="linuxemu"> |
|
Lines 28-128
Link Here
|
| 28 |
</authorgroup> |
28 |
</authorgroup> |
| 29 |
</chapterinfo> |
29 |
</chapterinfo> |
| 30 |
|
30 |
|
| 31 |
<title>Linux Binary Compatibility</title> |
31 |
<title>»P Linux Binary ªº¬Û®e¤è±</title> |
| 32 |
|
32 |
|
| 33 |
<sect1 id="linuxemu-synopsis"> |
33 |
<sect1 id="linuxemu-synopsis"> |
| 34 |
<title>Synopsis</title> |
34 |
<title>·§z</title> |
| 35 |
<indexterm><primary>Linux binary compatibility</primary></indexterm> |
35 |
<indexterm><primary>Linux binary compatibility</primary></indexterm> |
| 36 |
<indexterm> |
36 |
<indexterm> |
| 37 |
<primary>binary compatibility</primary> |
37 |
<primary>binary compatibility</primary> |
| 38 |
<secondary>Linux</secondary> |
38 |
<secondary>Linux</secondary> |
| 39 |
</indexterm> |
39 |
</indexterm> |
| 40 |
|
40 |
|
| 41 |
<para>FreeBSD provides binary compatibility with several other |
41 |
<para>FreeBSD ¦³´£¨Ñ¨ä¥L´XºØ &unix; like §@·~¨t²Îªº binary ¬Û®e©Ê¡A¨ä¤¤¥]¬A¤F Linux¡C |
| 42 |
&unix; like operating systems, including Linux. At this point, |
42 |
§A¥i¯à·|¯Ç´e¡G¬°¤°»ò FreeBSD »Ýn¯à°÷°õ¦æ Linux ±M¥Î°õ¦æÀÉ(binary)©O¡Hµª®×«Ü²³æ¡A |
| 43 |
you may be asking yourself why exactly, does |
43 |
³\¦h¤½¥q¡B¶}µoªÌ¥u·| Linux ¶}µoµ{¦¡¡A¦]¬°³o¬O¥Ø«e¸ê°T¬É <quote>³Ì¼öªù</quote> ªºª±·N¡C |
| 44 |
FreeBSD need to be able to run Linux binaries? The answer to that |
44 |
³o¹G±o³\¦h FreeBSD ¨Ï¥ÎªÌ¤£±o¤£¥hÄU»¡³o¨Ç¤H¬O§_´£¨Ñ¥iª½±µ¦b FreeBSD ¤W°õ¦æªºª©¥»¡C |
| 45 |
question is quite simple. Many companies and developers develop |
45 |
¦ý°ÝÃD¬O¡A¤j¦h¼Æ¤½¥q¨Ã¤£ÁA¸Ñ·|¦³¦h¤Ö¤H·|¥Î FreeBSD ª©¡A¦]¦¹¥L̤´¥u¶}µo Linux ª©¡C |
| 46 |
only for Linux, since it is the latest <quote>hot thing</quote> in |
46 |
¨º»ò FreeBSD ¨Ï¥ÎªÌ¸Ó«ç»ò¿ì©O¡Hµª®×´N¬O¥Î FreeBSD ©Ò´£¨Ñªº Linux binary ¬Û®e¡C</para> |
| 47 |
the computing world. That leaves the rest of us FreeBSD users |
47 |
|
| 48 |
bugging these same companies and developers to put out native |
48 |
<para>²³æ¨ÓÁ¿¡A³oºØ¬Û®e©Ê¥iÅý FreeBSD ¨Ï¥ÎªÌª½±µ°õ¦æ¬ù 90% ªº Linux µ{¦¡¡A¦Ó¤£¥²°µ¥ô¦ó×§ï¡C |
| 49 |
FreeBSD versions of their applications. The problem is, that most |
49 |
³o¨Ç¥]¬A¤F¡G <application>&staroffice;</application>¡B |
| 50 |
of these companies do not really realize how many people would use |
50 |
<application>&netscape;</application> ªº Linux ª©¡B |
| 51 |
their product if there were FreeBSD versions too, and most continue |
51 |
<application>&adobe; &acrobat;</application>¡B |
| 52 |
to only develop for Linux. So what is a FreeBSD user to do? This |
52 |
<application><trademark class="registered">RealPlayer</trademark></application>¡B |
| 53 |
is where the Linux binary compatibility of FreeBSD comes into |
53 |
<application><trademark>VMware</trademark></application>¡B |
| 54 |
play.</para> |
54 |
<application>&oracle;</application>¡B |
| 55 |
|
55 |
<application><trademark class="registered">WordPerfect</trademark></application>¡B<application>Doom</application>¡B |
| 56 |
<para>In a nutshell, the compatibility allows FreeBSD users to run |
56 |
<application>Quake</application> µ¥µ¥¡C¦¹¥~¡A¤]¦³¤H¦^³ø»¡¦b¬Y¨Ç±¡ªp¤U¡A |
| 57 |
about 90% of all Linux applications without modification. This |
57 |
³o¨Ç¦b FreeBSD ¤W°õ¦æªº Linux µ{¦¡¡A¬Æ¦Ü¤ñ쥻¦b Linux °õ¦æ±o§ó¦n¡C</para> |
| 58 |
includes applications such as <application>&staroffice;</application>, |
58 |
|
| 59 |
the Linux version of <application>&netscape;</application>, |
59 |
<para>µM¦Ó©O¡AÁÙ¬O¦³¨Ç¥u Linux ¯S©wªº§@·~¨t²Î¥\¯à¡A¦b FreeBSD ¤W¨Ã¥¼¤ä´©¡C |
| 60 |
<application>&adobe; &acrobat;</application>, |
60 |
¦pªG Linux µ{¦¡¹L©óÀݥΥu¦³ &i386; ¬[ºc¤W¤~¯à¥Îªº¥\¯à¡A¤ñ¦p¡GµêÀÀ 8086 ¼Ò¦¡¡A |
| 61 |
<application><trademark class="registered">RealPlayer</trademark></application>, |
61 |
«h¥i¯àµLªk¦b FreeBSD ¹B§@¥¿±`¡C</para> |
| 62 |
<application><trademark>VMware</trademark></application>, |
|
|
| 63 |
<application>&oracle;</application>, |
| 64 |
<application><trademark class="registered">WordPerfect</trademark></application>, <application>Doom</application>, |
| 65 |
<application>Quake</application>, and more. It is also reported |
| 66 |
that in some situations, Linux binaries perform better on FreeBSD |
| 67 |
than they do under Linux.</para> |
| 68 |
|
| 69 |
<para>There are, however, some Linux-specific operating system |
| 70 |
features that are not supported under FreeBSD. Linux binaries will |
| 71 |
not work on FreeBSD if they overly use &i386; specific |
| 72 |
calls, such as enabling virtual 8086 mode.</para> |
| 73 |
|
62 |
|
| 74 |
<para>After reading this chapter, you will know:</para> |
63 |
<para>Ū§¹³o³¹¡A±z±N¤F¸Ñ¡G</para> |
| 75 |
<itemizedlist> |
64 |
<itemizedlist> |
| 76 |
<listitem> |
65 |
<listitem> |
| 77 |
<para>How to enable Linux binary compatibility on your system.</para> |
66 |
<para>¦p¦ó±Ò¥Î Linux ¬Û®e¼Ò¦¡¡C</para> |
| 78 |
</listitem> |
67 |
</listitem> |
| 79 |
|
68 |
|
| 80 |
<listitem> |
69 |
<listitem> |
| 81 |
<para>How to install additional Linux shared |
70 |
<para>¦p¦ó¦w¸ËÃB¥~ªº Linux share libraries¡C</para> |
| 82 |
libraries.</para> |
|
|
| 83 |
</listitem> |
71 |
</listitem> |
| 84 |
|
72 |
|
| 85 |
<listitem> |
73 |
<listitem> |
| 86 |
<para>How to install Linux applications on your FreeBSD system.</para> |
74 |
<para>¦p¦ó¦b FreeBSD ¤W¦w¸Ë Linux µ{¦¡¡C</para> |
| 87 |
</listitem> |
75 |
</listitem> |
| 88 |
|
76 |
|
| 89 |
<listitem> |
77 |
<listitem> |
| 90 |
<para>The implementation details of Linux compatibility in FreeBSD.</para> |
78 |
<para>FreeBSD ¤Wªº Linux ¬Û®e¼Ò¦¡ªº¹ê§@²Ó¸`¡C</para> |
| 91 |
</listitem> |
79 |
</listitem> |
| 92 |
</itemizedlist> |
80 |
</itemizedlist> |
| 93 |
|
81 |
|
| 94 |
<para>Before reading this chapter, you should:</para> |
82 |
<para>¦b¾\Ū³o³¹¤§«e¡A±zÀ³·í¤F¸Ñ¡G</para> |
| 95 |
|
83 |
|
| 96 |
<itemizedlist> |
84 |
<itemizedlist> |
| 97 |
<listitem> |
85 |
<listitem> |
| 98 |
<para>Know how to install additional third-party |
86 |
<para>ª¾¹D¦p¦ó³z¹L port ¾÷¨î¨Ó¦w¸Ë³nÅé(<xref linkend="ports">)¡C</para> |
| 99 |
software (<xref linkend="ports">).</para> |
|
|
| 100 |
</listitem> |
87 |
</listitem> |
| 101 |
</itemizedlist> |
88 |
</itemizedlist> |
| 102 |
|
89 |
|
| 103 |
</sect1> |
90 |
</sect1> |
| 104 |
|
91 |
|
| 105 |
<sect1 id="linuxemu-lbc-install"> |
92 |
<sect1 id="linuxemu-lbc-install"> |
| 106 |
<title>Installation</title> |
93 |
<title>¦w¸Ë</title> |
| 107 |
|
94 |
|
| 108 |
<indexterm><primary>KLD (kernel loadable object)</primary></indexterm> |
95 |
<indexterm><primary>KLD (kernel loadable object)</primary></indexterm> |
| 109 |
|
96 |
|
| 110 |
<para>Linux binary compatibility is not turned on by default. The |
97 |
<para>¹w³]¨Ã¤£·|¥´¶} Linux ¬Û®e¼Ò¦¡¡A³Ì²³æªº±Ò¥Î¤è¦¡¡A´N¬O¸ü¤J |
| 111 |
easiest way to enable this functionality is to load the |
|
|
| 112 |
<literal>linux</literal> KLD object (<quote>Kernel LoaDable |
98 |
<literal>linux</literal> KLD object (<quote>Kernel LoaDable |
| 113 |
object</quote>). You can load this module by typing the |
99 |
object</quote>)¡C ¸ü¤J¤è¦¡¡A½Ð¤Á¬° <username>root</username> |
| 114 |
following as <username>root</username>:</para> |
100 |
Åv¡AµM«á¥´¤U¦C«ü¥O¡G</para> |
| 115 |
|
101 |
|
| 116 |
<screen>&prompt.root; <userinput>kldload linux</userinput></screen> |
102 |
<screen>&prompt.root; <userinput>kldload linux</userinput></screen> |
| 117 |
|
103 |
|
| 118 |
<para>If you would like Linux compatibility to always be enabled, |
104 |
<para>Yn¨C¦¸¶}¾÷³£±Ò¥Îªº¸Ü¡A½Ð§â¤U¦C¤º®e¥[¨ì |
| 119 |
then you should add the following line to |
105 |
<filename>/etc/rc.conf</filename> ÀÉ¡G</para> |
| 120 |
<filename>/etc/rc.conf</filename>:</para> |
|
|
| 121 |
|
106 |
|
| 122 |
<programlisting>linux_enable="YES"</programlisting> |
107 |
<programlisting>linux_enable="YES"</programlisting> |
| 123 |
|
108 |
|
| 124 |
<para>The &man.kldstat.8; command can be used to verify that the |
109 |
<para>¥t¥~¥i¥H¥Î &man.kldstat.8; «ü¥O¡A¨Ó½T»{¦³þ¨Ç KLD ¦³¸ü¤J¡G</para> |
| 125 |
KLD is loaded:</para> |
|
|
| 126 |
|
110 |
|
| 127 |
<screen>&prompt.user; <userinput>kldstat</userinput> |
111 |
<screen>&prompt.user; <userinput>kldstat</userinput> |
| 128 |
Id Refs Address Size Name |
112 |
Id Refs Address Size Name |
|
Lines 130-136
Link Here
|
| 130 |
7 1 0xc24db000 d000 linux.ko</screen> |
114 |
7 1 0xc24db000 d000 linux.ko</screen> |
| 131 |
<indexterm> |
115 |
<indexterm> |
| 132 |
<primary>kernel options</primary> |
116 |
<primary>kernel options</primary> |
| 133 |
<secondary>LINUX</secondary> |
117 |
<secondary>COMPAT_LINUX</secondary> |
| 134 |
</indexterm> |
118 |
</indexterm> |
| 135 |
|
119 |
|
| 136 |
<para>If for some reason you do not want to or cannot load the KLD, |
120 |
<para>If for some reason you do not want to or cannot load the KLD, |
|
Lines 160-166
Link Here
|
| 160 |
from the <ulink type="html" url="file://localhost/usr/ports/">Ports Collection</ulink>. |
144 |
from the <ulink type="html" url="file://localhost/usr/ports/">Ports Collection</ulink>. |
| 161 |
Simply do the following:</para> |
145 |
Simply do the following:</para> |
| 162 |
|
146 |
|
| 163 |
<screen>&prompt.root; <userinput>cd /usr/ports/emulators/linux_base</userinput> |
147 |
<screen>&prompt.root; <userinput>cd /usr/ports/emulators/linux_base-fc4</userinput> |
| 164 |
&prompt.root; <userinput>make install distclean</userinput></screen> |
148 |
&prompt.root; <userinput>make install distclean</userinput></screen> |
| 165 |
|
149 |
|
| 166 |
<para>You should now have working Linux binary compatibility. |
150 |
<para>You should now have working Linux binary compatibility. |
|
Lines 1563-1570
Link Here
|
| 1563 |
<title>Installation of FreeBSD</title> |
1547 |
<title>Installation of FreeBSD</title> |
| 1564 |
|
1548 |
|
| 1565 |
<para>First you have to install FreeBSD. There are several ways to do |
1549 |
<para>First you have to install FreeBSD. There are several ways to do |
| 1566 |
this (FreeBSD 4.3 was installed via FTP, FreeBSD 4.5 directly from |
1550 |
this, for more information read the <xref |
| 1567 |
the RELEASE CD) for more information read the <xref |
|
|
| 1568 |
linkend="install-diff-media">.</para> |
1551 |
linkend="install-diff-media">.</para> |
| 1569 |
|
1552 |
|
| 1570 |
<sect3 id="disk-layout"> |
1553 |
<sect3 id="disk-layout"> |
|
Lines 2066-2072
Link Here
|
| 2066 |
and <application>&oracle;</application>, therefore choose a larger |
2049 |
and <application>&oracle;</application>, therefore choose a larger |
| 2067 |
number of shared memory pages.</para> |
2050 |
number of shared memory pages.</para> |
| 2068 |
|
2051 |
|
| 2069 |
<note><para>With the default installation of FreeBSD 4.5 on &i386;, |
2052 |
<note><para>With the default installation of FreeBSD on &i386;, |
| 2070 |
leave <literal>MAXDSIZ</literal> and <literal>DFLDSIZ</literal> at 1 GB maximum. Otherwise, strange |
2053 |
leave <literal>MAXDSIZ</literal> and <literal>DFLDSIZ</literal> at 1 GB maximum. Otherwise, strange |
| 2071 |
errors like <errorname>ORA-27102: out of memory</errorname> and |
2054 |
errors like <errorname>ORA-27102: out of memory</errorname> and |
| 2072 |
<errorname>Linux Error: 12: Cannot allocate memory</errorname> |
2055 |
<errorname>Linux Error: 12: Cannot allocate memory</errorname> |
|
Lines 3037-3043
Link Here
|
| 3037 |
<sect3 id="ora-00001"> |
3020 |
<sect3 id="ora-00001"> |
| 3038 |
<title><errorcode>ORA-00001</errorcode></title> |
3021 |
<title><errorcode>ORA-00001</errorcode></title> |
| 3039 |
<para>This error only happened with |
3022 |
<para>This error only happened with |
| 3040 |
<application>&oracle; 8.1.7</application> on FreeBSD 4.5. |
3023 |
<application>&oracle; 8.1.7</application> on FreeBSD. |
| 3041 |
The reason was that the <application>&oracle;</application> database could not initialize itself |
3024 |
The reason was that the <application>&oracle;</application> database could not initialize itself |
| 3042 |
properly and crashed, leaving semaphores and shared memory on the |
3025 |
properly and crashed, leaving semaphores and shared memory on the |
| 3043 |
system. The next try to start the database then returned |
3026 |
system. The next try to start the database then returned |