Whitespace-only fixes, translators please ignore.

This commit is contained in:
Warren Block 2014-03-15 04:26:47 +00:00
parent b4175eaa66
commit 6579761b53
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44239

View file

@ -4,25 +4,48 @@
$FreeBSD$ $FreeBSD$
--> -->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="linuxemu"> <chapter xmlns="http://docbook.org/ns/docbook"
<info><title>&linux; Binary Compatibility</title> xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="linuxemu">
<info>
<title>&linux; Binary Compatibility</title>
<authorgroup> <authorgroup>
<author><personname><firstname>Jim</firstname><surname>Mock</surname></personname><contrib>Restructured and parts updated by </contrib></author> <author>
<personname>
<firstname>Jim</firstname>
<surname>Mock</surname>
</personname>
<contrib>Restructured and parts updated by </contrib>
</author>
<!-- 22 Mar 2000 --> <!-- 22 Mar 2000 -->
</authorgroup> </authorgroup>
<authorgroup> <authorgroup>
<author><personname><firstname>Brian N.</firstname><surname>Handy</surname></personname><contrib>Originally contributed by </contrib></author> <author>
<author><personname><firstname>Rich</firstname><surname>Murphey</surname></personname></author> <personname>
<firstname>Brian N.</firstname>
<surname>Handy</surname>
</personname>
<contrib>Originally contributed by </contrib>
</author>
<author>
<personname>
<firstname>Rich</firstname>
<surname>Murphey</surname>
</personname>
</author>
</authorgroup> </authorgroup>
</info> </info>
<sect1 xml:id="linuxemu-synopsis"> <sect1 xml:id="linuxemu-synopsis">
<title>Synopsis</title> <title>Synopsis</title>
<indexterm><primary>Linux binary <indexterm>
compatibility</primary></indexterm> <primary>Linux binary compatibility</primary>
</indexterm>
<indexterm> <indexterm>
<primary>binary compatibility</primary> <primary>binary compatibility</primary>
<secondary>Linux</secondary> <secondary>Linux</secondary>
@ -43,6 +66,7 @@
calls, such as enabling virtual 8086 mode.</para> calls, such as enabling virtual 8086 mode.</para>
<para>After reading this chapter, you will know:</para> <para>After reading this chapter, you will know:</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>How to enable &linux; binary compatibility on a &os; <para>How to enable &linux; binary compatibility on a &os;
@ -94,8 +118,8 @@
/usr/ports/emulators/linux_base-f10</userinput> &prompt.root; <userinput>make install distclean</userinput></screen> /usr/ports/emulators/linux_base-f10</userinput> &prompt.root; <userinput>make install distclean</userinput></screen>
<para>Once the port is installed, enable &linux; binary <para>Once the port is installed, enable &linux; binary
compatibility by loading the <literal>linux</literal> compatibility by loading the <literal>linux</literal> module.
module. Type the following as Type the following as
<systemitem class="username">root</systemitem>:</para> <systemitem class="username">root</systemitem>:</para>
<screen>&prompt.root; <userinput>kldload linux</userinput></screen> <screen>&prompt.root; <userinput>kldload linux</userinput></screen>
@ -120,26 +144,26 @@ Id Refs Address Size Name
</indexterm> </indexterm>
<para>Users who prefer to statically link &linux; binary <para>Users who prefer to statically link &linux; binary
compatibility into the kernel should add <literal>options compatibility into the kernel should add
COMPAT_LINUX</literal> to the custom kernel configuration <literal>options COMPAT_LINUX</literal> to the custom kernel
file. Compile and install the new kernel as described in <xref linkend="kernelconfig"/>.</para> configuration file. Compile and install the new kernel as
described in <xref linkend="kernelconfig"/>.</para>
<sect2 xml:id="linuxemu-libs-manually"> <sect2 xml:id="linuxemu-libs-manually">
<title>Installing Libraries Manually</title> <title>Installing Libraries Manually</title>
<para>While using the Ports Collection is recommended, &linux; <para>While using the Ports Collection is recommended, &linux;
libraries can be installed manually. The &linux; shared libraries can be installed manually. The &linux; shared
libraries required by a program and the runtime linker libraries required by a program and the runtime linker should
should be copied to <filename>/compat/linux</filename>. Any shared be copied to <filename>/compat/linux</filename>. Any shared
libraries opened by &linux; programs run under &os; will libraries opened by &linux; programs run under &os; will look
look in this directory first. For example, if a &linux; in this directory first. For example, if a &linux; program
program loads <filename>/lib/libc.so</filename>, &os; will loads <filename>/lib/libc.so</filename>, &os; will first try
first try to open to open <filename>/compat/linux/lib/libc.so</filename>, and if
<filename>/compat/linux/lib/libc.so</filename>, and if that that does not exist, it will then try
does not exist, it will then try <filename>/lib/libc.so</filename>. Shared libraries should be
<filename>/lib/libc.so</filename>. Shared libraries should installed to <filename>/compat/linux/lib</filename> rather
be installed to <filename>/compat/linux/lib</filename> rather than than to the paths that the &linux; <command>ld.so</command>
to the paths that the &linux; <command>ld.so</command>
reports.</para> reports.</para>
<para>Generally, one will need to look for the shared <para>Generally, one will need to look for the shared
@ -152,13 +176,16 @@ Id Refs Address Size Name
<sect3> <sect3>
<title>How to Install Additional Shared Libraries</title> <title>How to Install Additional Shared Libraries</title>
<indexterm><primary>shared libraries</primary></indexterm> <indexterm>
<primary>shared libraries</primary>
</indexterm>
<para>If the <literal>linux_base</literal> port is installed <para>If the <literal>linux_base</literal> port is installed
and an application still complains about missing shared and an application still complains about missing shared
libraries, there are two methods <systemitem class="username">root</systemitem> libraries, there are two methods
can use to determine which shared libraries the &linux; <systemitem class="username">root</systemitem> can use to
binaries need.</para> determine which shared libraries the &linux; binaries
need.</para>
<para>If a &linux; system is available, determine which shared <para>If a &linux; system is available, determine which shared
libraries the application needs, and copy them to the &os; libraries the application needs, and copy them to the &os;
@ -175,7 +202,9 @@ libXt.so.3 (DLL Jump 3.1) =&gt; /usr/X11/lib/libXt.so.3.1.0
libX11.so.3 (DLL Jump 3.1) =&gt; /usr/X11/lib/libX11.so.3.1.0 libX11.so.3 (DLL Jump 3.1) =&gt; /usr/X11/lib/libX11.so.3.1.0
libc.so.4 (DLL Jump 4.5pl26) =&gt; /lib/libc.so.4.6.29</screen> libc.so.4 (DLL Jump 4.5pl26) =&gt; /lib/libc.so.4.6.29</screen>
<indexterm><primary>symbolic links</primary></indexterm> <indexterm>
<primary>symbolic links</primary>
</indexterm>
<para>Copy all the files in the last column into <para>Copy all the files in the last column into
<filename>/compat/linux</filename> on <filename>/compat/linux</filename> on
the &os; system, with the names in the first column as the &os; system, with the names in the first column as
@ -256,7 +285,9 @@ Abort</screen>
<screen>&prompt.user; <userinput>brandelf -t Linux my-linux-elf-binary</userinput></screen> <screen>&prompt.user; <userinput>brandelf -t Linux my-linux-elf-binary</userinput></screen>
<indexterm><primary>GNU toolchain</primary></indexterm> <indexterm>
<primary>GNU toolchain</primary>
</indexterm>
<para>Since the GNU toolchain places the appropriate branding <para>Since the GNU toolchain places the appropriate branding
information into ELF binaries automatically, this step is information into ELF binaries automatically, this step is
usually not necessary.</para> usually not necessary.</para>
@ -271,7 +302,8 @@ Abort</screen>
<para>In order to install a &linux; RPM-based application, first <para>In order to install a &linux; RPM-based application, first
install the <package>archivers/rpm2cpio</package> package or install the <package>archivers/rpm2cpio</package> package or
port. Once installed, <systemitem class="username">root</systemitem> can use this port. Once installed,
<systemitem class="username">root</systemitem> can use this
command to install a <filename>.rpm</filename> as command to install a <filename>.rpm</filename> as
follows:</para> follows:</para>
@ -298,22 +330,24 @@ Abort</screen>
<programlisting>order hosts, bind <programlisting>order hosts, bind
multi on</programlisting> multi on</programlisting>
<para>This order specifies that <para>This order specifies that <filename>/etc/hosts</filename>
<filename>/etc/hosts</filename> is searched first and DNS is searched first and DNS is searched second. When
is searched second. When
<filename>/compat/linux/etc/host.conf</filename> does not <filename>/compat/linux/etc/host.conf</filename> does not
exist, &linux; applications use exist, &linux; applications use
<filename>/etc/host.conf</filename> and complain about the <filename>/etc/host.conf</filename> and complain about the
incompatible &os; syntax. Remove incompatible &os; syntax. Remove <literal>bind</literal> if a
<literal>bind</literal> if a name server is not configured name server is not configured using
using <filename>/etc/resolv.conf</filename>.</para> <filename>/etc/resolv.conf</filename>.</para>
</sect2> </sect2>
</sect1> </sect1>
<?ignore While the installer works, the binaries do not. As of Oct 2013, Linux <?ignore
emulation is 32-bit but the trial version of Mathematica is only
available as 64-bit. This section should be revisited if Linux While the installer works, the binaries do not. As of Oct 2013,
Linux emulation is 32-bit but the trial version of Mathematica is
only available as 64-bit. This section should be revisited if Linux
emulation gets 64-bit binary support. emulation gets 64-bit binary support.
<sect1 id="linuxemu-mathematica"> <sect1 id="linuxemu-mathematica">
<sect1info> <sect1info>
<authorgroup> <authorgroup>
@ -332,11 +366,11 @@ multi on</programlisting>
<secondary><application>Mathematica</application></secondary> <secondary><application>Mathematica</application></secondary>
</indexterm> </indexterm>
<para>This section describes the process of installing the <para>This section describes the process of installing the &linux;
&linux; version of <application>&mathematica; 9.X</application> version of <application>&mathematica; 9.X</application> onto a
onto a &os; system. <application>&mathematica;</application> &os; system. <application>&mathematica;</application> is a
is a commercial, computational software program used in commercial, computational software program used in scientific,
scientific, engineering, and mathematical fields. A 30 day trial version is engineering, and mathematical fields. A 30 day trial version is
available for download from <ulink available for download from <ulink
url="http://www.wolfram.com/mathematica/">wolfram.com/mathematica</ulink>.</para> url="http://www.wolfram.com/mathematica/">wolfram.com/mathematica</ulink>.</para>
@ -350,8 +384,8 @@ multi on</programlisting>
<screen>&prompt.root; <userinput>sysctl kern.fallback_elf_brand=3</userinput></screen> <screen>&prompt.root; <userinput>sysctl kern.fallback_elf_brand=3</userinput></screen>
<para>&os; will now assume that unbranded ELF binaries <para>&os; will now assume that unbranded ELF binaries use the
use the &linux; <acronym>ABI</acronym> which should allow the &linux; <acronym>ABI</acronym> which should allow the
installer to execute from the CDROM.</para> installer to execute from the CDROM.</para>
<para>The downloaded file will be saved to <para>The downloaded file will be saved to
@ -375,7 +409,6 @@ Enter the installation directory, or press ENTER to select /usr/local/Wolfram/Ma
Now installing... Now installing...
*********************** ***********************
Installation complete.</programlisting> Installation complete.</programlisting>
</sect2> </sect2>
<sect2> <sect2>
@ -387,8 +420,7 @@ Installation complete.</programlisting>
fonts to be installed locally. This means that these fonts fonts to be installed locally. This means that these fonts
need to be copied from the CDROM or from a host with need to be copied from the CDROM or from a host with
<application>&mathematica;</application> installed to the <application>&mathematica;</application> installed to the
local machine. These fonts are normally stored in local machine. These fonts are normally stored in <filename
<filename
class="directory">/cdrom/Unix/Files/SystemFiles/Fonts</filename> class="directory">/cdrom/Unix/Files/SystemFiles/Fonts</filename>
on the CDROM, or <filename on the CDROM, or <filename
class="directory">/usr/local/mathematica/SystemFiles/Fonts</filename> class="directory">/usr/local/mathematica/SystemFiles/Fonts</filename>
@ -492,11 +524,10 @@ Installation complete.</programlisting>
<step> <step>
<para>Install the <application>FLEXlm</application> license <para>Install the <application>FLEXlm</application> license
manager by running the manager by running the <filename>INSTALL_LIC</filename>
<filename>INSTALL_LIC</filename> install shell script that install shell script that comes with
comes with <application>&maple;</application>. Specify <application>&maple;</application>. Specify the primary
the primary hostname for the machine for the license hostname for the machine for the license server.</para>
server.</para>
</step> </step>
<step> <step>
@ -524,14 +555,16 @@ Installation complete.</programlisting>
<literal>"FreeBSD"|\</literal>.</para> <literal>"FreeBSD"|\</literal>.</para>
<para>This patch instructs <application>&maple;</application> <para>This patch instructs <application>&maple;</application>
to recognize &os; as a type of &linux; to recognize &os; as a type of &linux; system. The
system. The <filename>bin/maple</filename> shell script <filename>bin/maple</filename> shell script calls the
calls the <filename>bin/maple.system.type</filename> shell <filename>bin/maple.system.type</filename> shell script
script which in turn calls <command>uname -a</command> to which in turn calls <command>uname -a</command> to find out
find out the operating system name. Depending on the OS the operating system name. Depending on the OS name it will
name it will find out which binaries to use.</para></step> find out which binaries to use.</para>
</step>
<step><para>Start the license server.</para> <step>
<para>Start the license server.</para>
<para>The following script, installed as <para>The following script, installed as
<filename>/usr/local/rtc/rc.d/lmgrd</filename> is a <filename>/usr/local/rtc/rc.d/lmgrd</filename> is a
@ -562,28 +595,31 @@ stop)
esac esac
exit 0 exit 0
----- snip ------------</programlisting></step> ----- snip ------------</programlisting>
</step>
<step>
<step><para>Test that <para>Test that <application>&maple;</application>
<application>&maple;</application> starts:</para> starts:</para>
<screen>&prompt.user; <userinput>cd /usr/local/maple/bin</userinput> <screen>&prompt.user; <userinput>cd /usr/local/maple/bin</userinput>
&prompt.user; <userinput>./xmaple</userinput></screen> &prompt.user; <userinput>./xmaple</userinput></screen>
<para>Once everything is working, consider writing <para>Once everything is working, consider writing Maplesoft
Maplesoft to let them know you would like a native &os; to let them know you would like a native &os;
version!</para></step> version!</para>
</step>
</procedure> </procedure>
<sect2> <sect2>
<title>Common Pitfalls</title> <title>Common Pitfalls</title>
<itemizedlist> <itemizedlist>
<listitem><para><command>lmgrd</command> is known to be <listitem>
picky about the license file and to dump core if there <para><command>lmgrd</command> is known to be picky about
are any problems. A correct license file should look the license file and to dump core if there are any
like this:</para> problems. A correct license file should look like
this:</para>
<programlisting># <programlisting>#
======================================================= =======================================================
@ -606,13 +642,16 @@ FEATURE Maple maplelmg 2000.0831 permanent 1 XXXXXXXXXXXX \
<para>Editing the license file works as long as the <para>Editing the license file works as long as the
<quote>FEATURE</quote> line is not edited. That line is <quote>FEATURE</quote> line is not edited. That line is
protected by the license key.</para></listitem> protected by the license key.</para>
</listitem>
</itemizedlist> </itemizedlist>
</sect2> </sect2>
</sect1> </sect1>
--> -->
<!-- <!--
As of October, 2013, the Linux version of Matlab is only available for 64-bit. As of October, 2013, the Linux version of Matlab is only available
for 64-bit.
<sect1 id="linuxemu-matlab"> <sect1 id="linuxemu-matlab">
<sect1info> <sect1info>
<authorgroup> <authorgroup>
@ -623,6 +662,7 @@ FEATURE Maple maplelmg 2000.0831 permanent 1 XXXXXXXXXXXX \
</author> </author>
</authorgroup> </authorgroup>
</sect1info> </sect1info>
<title>Installing &matlab;</title> <title>Installing &matlab;</title>
<indexterm> <indexterm>
@ -631,9 +671,9 @@ FEATURE Maple maplelmg 2000.0831 permanent 1 XXXXXXXXXXXX \
</indexterm> </indexterm>
<para>This document describes the process of installing the <para>This document describes the process of installing the
&linux; version of <application>&matlab; version &linux; version of
6.5</application> onto a &os; system. It works quite well, <application>&matlab; version 6.5</application> onto a &os;
with the exception of the system. It works quite well, with the exception of the
<application>&java.virtual.machine;</application> which is <application>&java.virtual.machine;</application> which is
described further in <xref linkend="matlab-jre"/>.</para> described further in <xref linkend="matlab-jre"/>.</para>
@ -790,9 +830,10 @@ exit 0</programlisting>
</procedure> </procedure>
<tip> <tip>
<para>Depending on the version of <filename <para>Depending on the version of
role="package">emulators/linux_base</filename>, running <filename role="package">emulators/linux_base</filename>,
this script may result in errors. To avoid errors, edit running this script may result in errors. To avoid errors,
edit
<filename>/compat/linux/usr/local/matlab/bin/matlab</filename>, <filename>/compat/linux/usr/local/matlab/bin/matlab</filename>,
and change the line that says:</para> and change the line that says:</para>
@ -818,8 +859,9 @@ exit 0</programlisting>
<programlisting>! $MATLAB/bin/finish.sh</programlisting> <programlisting>! $MATLAB/bin/finish.sh</programlisting>
<note><para>The <literal>$MATLAB</literal> is <note>
literal.</para></note> <para>The <literal>$MATLAB</literal> is literal.</para>
</note>
<tip> <tip>
<para>The same directory contains <para>The same directory contains
@ -827,13 +869,13 @@ exit 0</programlisting>
<filename>finishdlg.m</filename>, which allow the <filename>finishdlg.m</filename>, which allow the
workspace to be saved before quitting. If either file workspace to be saved before quitting. If either file
is used, insert the line above immediately after the is used, insert the line above immediately after the
<literal>save</literal> command.</para></tip> <literal>save</literal> command.</para>
</tip>
</step> </step>
<step> <step>
<para>Create <para>Create <filename>$MATLAB/bin/finish.sh</filename>
<filename>$MATLAB/bin/finish.sh</filename> which which contains the following:</para>
contains the following:</para>
<programlisting>#!/compat/linux/bin/sh <programlisting>#!/compat/linux/bin/sh
(sleep 5; killall -1 matlab_helper) &amp; (sleep 5; killall -1 matlab_helper) &amp;
@ -857,9 +899,10 @@ exit 0</programlisting>
</sect1> </sect1>
<sect1 id="linuxemu-oracle"> <sect1 id="linuxemu-oracle">
While the Oracle website is unclear, the installation script is: You While the Oracle website is unclear, the installation script is:
are attempting to install 64-bit Oracle on a 32-bit operating system. You are attempting to install 64-bit Oracle on a 32-bit operating
This is not supported and will not work. system. This is not supported and will not work.
<sect1info> <sect1info>
<authorgroup> <authorgroup>
<author> <author>
@ -869,6 +912,7 @@ exit 0</programlisting>
</author> </author>
</authorgroup> </authorgroup>
</sect1info> </sect1info>
<title>Installing &oracle;</title> <title>Installing &oracle;</title>
<indexterm> <indexterm>
@ -890,8 +934,9 @@ exit 0</programlisting>
<para>To run the intelligent agent, install the Red Hat Tcl <para>To run the intelligent agent, install the Red Hat Tcl
package: <filename>tcl-8.0.3-20.i386.rpm</filename>. The package: <filename>tcl-8.0.3-20.i386.rpm</filename>. The
general command for installing RPMs with the <filename general command for installing RPMs with the
role='package'>archivers/rpm</filename> port is:</para> <filename role='package'>archivers/rpm</filename> port
is:</para>
<screen>&prompt.root; <userinput>rpm -i --ignoreos --root /compat/linux --dbpath /var/lib/rpm <replaceable>package</replaceable></userinput></screen> <screen>&prompt.root; <userinput>rpm -i --ignoreos --root /compat/linux --dbpath /var/lib/rpm <replaceable>package</replaceable></userinput></screen>
@ -910,7 +955,9 @@ exit 0</programlisting>
<sect3 id="linuxemu-kernel-tuning"> <sect3 id="linuxemu-kernel-tuning">
<title>Kernel Tuning</title> <title>Kernel Tuning</title>
<indexterm><primary>kernel tuning</primary></indexterm> <indexterm>
<primary>kernel tuning</primary>
</indexterm>
<para>As described in the <application>&oracle;</application> <para>As described in the <application>&oracle;</application>
installation guide, the maximum size of shared memory needs installation guide, the maximum size of shared memory needs
@ -965,26 +1012,23 @@ options SYSVMSG #SysV interprocess communication</programlisting>
<thead> <thead>
<row> <row>
<entry>Variable</entry> <entry>Variable</entry>
<entry>Value</entry> <entry>Value</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><envar>LD_LIBRARY_PATH</envar></entry> <entry><envar>LD_LIBRARY_PATH</envar></entry>
<entry><literal>$ORACLE_HOME/lib</literal></entry> <entry><literal>$ORACLE_HOME/lib</literal></entry>
</row> </row>
<row> <row>
<entry><envar>CLASSPATH</envar></entry> <entry><envar>CLASSPATH</envar></entry>
<entry><literal>$ORACLE_HOME/jdbc/lib/classes111.zip</literal></entry> <entry><literal>$ORACLE_HOME/jdbc/lib/classes111.zip</literal></entry>
</row> </row>
<row> <row>
<entry><envar>PATH</envar></entry> <entry><envar>PATH</envar></entry>
<entry><literal>/compat/linux/bin <entry><literal>/compat/linux/bin
/compat/linux/sbin /compat/linux/sbin
/compat/linux/usr/bin /compat/linux/usr/bin
@ -1087,10 +1131,10 @@ export PATH</programlisting>
<sect3 id="linuxemu-patch-tcl"> <sect3 id="linuxemu-patch-tcl">
<title>Patching <filename>genclntsh</filename></title> <title>Patching <filename>genclntsh</filename></title>
<para>The script <command>genclntsh</command> is used to <para>The script <command>genclntsh</command> is used to create
create a single shared client library when building the a single shared client library when building the demos. Apply
demos. Apply the following patch to comment out the the following patch to comment out the definition of
definition of <envar>PATH</envar>:</para> <envar>PATH</envar>:</para>
<programlisting>*** bin/genclntsh.orig Wed Sep 30 07:37:19 1998 <programlisting>*** bin/genclntsh.orig Wed Sep 30 07:37:19 1998
--- bin/genclntsh Tue Dec 22 15:36:49 1998 --- bin/genclntsh Tue Dec 22 15:36:49 1998
@ -1132,9 +1176,9 @@ export PATH</programlisting>
<indexterm><primary>execution class loader</primary></indexterm> <indexterm><primary>execution class loader</primary></indexterm>
<para>&os; has an abstraction called an <quote>execution class <para>&os; has an abstraction called an
loader</quote>. This is a wedge into the &man.execve.2; <quote>execution class loader</quote>. This is a wedge into the
system call.</para> &man.execve.2; system call.</para>
<para>Historically, the &unix; loader examined the magic number <para>Historically, the &unix; loader examined the magic number
(generally the first 4 or 8 bytes of the file) to see if it was (generally the first 4 or 8 bytes of the file) to see if it was
@ -1144,8 +1188,8 @@ export PATH</programlisting>
<para>If it was not the binary type for the system, the <para>If it was not the binary type for the system, the
&man.execve.2; call returned a failure, and the shell &man.execve.2; call returned a failure, and the shell
attempted to start executing it as shell commands. The attempted to start executing it as shell commands. The
assumption was a default of <quote>whatever the current shell assumption was a default of
is</quote>.</para> <quote>whatever the current shell is</quote>.</para>
<para>Later, a hack was made for &man.sh.1; to examine the first <para>Later, a hack was made for &man.sh.1; to examine the first
two characters, and if they were <literal>:\n</literal>, it two characters, and if they were <literal>:\n</literal>, it
@ -1155,9 +1199,13 @@ export PATH</programlisting>
a fallback to the <literal>#!</literal> loader for running shell a fallback to the <literal>#!</literal> loader for running shell
interpreters or shell scripts.</para> interpreters or shell scripts.</para>
<indexterm><primary>ELF</primary></indexterm> <indexterm>
<primary>ELF</primary>
</indexterm>
<indexterm><primary>Solaris</primary></indexterm> <indexterm>
<primary>Solaris</primary>
</indexterm>
<para>For the &linux; <acronym>ABI</acronym> support, &os; sees <para>For the &linux; <acronym>ABI</acronym> support, &os; sees
the magic number as an ELF binary. The ELF loader looks for a the magic number as an ELF binary. The ELF loader looks for a
@ -1178,58 +1226,56 @@ export PATH</programlisting>
<para>When the ELF loader sees the <literal>Linux</literal> <para>When the ELF loader sees the <literal>Linux</literal>
brand, the loader replaces a pointer in the brand, the loader replaces a pointer in the
<literal>proc</literal> structure. All system calls are <literal>proc</literal> structure. All system calls are indexed
indexed through this pointer. In addition, the process is through this pointer. In addition, the process is flagged for
flagged for special handling of the trap vector for the signal special handling of the trap vector for the signal trampoline
trampoline code, and several other (minor) fix-ups that are code, and several other (minor) fix-ups that are handled by the
handled by the &linux; kernel module.</para> &linux; kernel module.</para>
<para>The &linux; system call vector contains, among other <para>The &linux; system call vector contains, among other things,
things, a list of <literal>sysent[]</literal> entries whose a list of <literal>sysent[]</literal> entries whose addresses
addresses reside in the kernel module.</para> reside in the kernel module.</para>
<para>When a system call is called by the &linux; binary, the <para>When a system call is called by the &linux; binary, the trap
trap code dereferences the system call function pointer off code dereferences the system call function pointer off the
the <literal>proc</literal> structure, and gets the &linux;, <literal>proc</literal> structure, and gets the &linux;, not the
not the &os;, system call entry points.</para> &os;, system call entry points.</para>
<para>&linux; mode dynamically <emphasis>reroots</emphasis> <para>&linux; mode dynamically <emphasis>reroots</emphasis>
lookups. This is, in effect, equivalent to the lookups. This is, in effect, equivalent to the
<option>union</option> option to file system mounts. First, <option>union</option> option to file system mounts. First, an
an attempt is made to lookup the file in <filename attempt is made to lookup the file in <filename
class="directory">/compat/linux/<replaceable>original-path</replaceable></filename>. class="directory">/compat/linux/<replaceable>original-path</replaceable></filename>.
If that fails, the lookup is done in If that fails, the lookup is done in <filename
<filename
class="directory">/<replaceable>original-path</replaceable></filename>. class="directory">/<replaceable>original-path</replaceable></filename>.
This makes sure that binaries that require other binaries can This makes sure that binaries that require other binaries can
run. For example, the &linux; toolchain can all run under run. For example, the &linux; toolchain can all run under
&linux; <acronym>ABI</acronym> support. It also means that &linux; <acronym>ABI</acronym> support. It also means that the
the &linux; binaries can load and execute &os; binaries, if &linux; binaries can load and execute &os; binaries, if there
there are no corresponding &linux; binaries present, and that are no corresponding &linux; binaries present, and that a
a &man.uname.1; command can be placed in the &man.uname.1; command can be placed in the
<filename>/compat/linux</filename> directory <filename>/compat/linux</filename> directory tree to ensure that
tree to ensure that the &linux; binaries can not tell they are the &linux; binaries can not tell they are not running on
not running on &linux;.</para> &linux;.</para>
<para>In effect, there is a &linux; kernel in the &os; kernel. <para>In effect, there is a &linux; kernel in the &os; kernel.
The various underlying functions that implement all of the The various underlying functions that implement all of the
services provided by the kernel are identical to both the services provided by the kernel are identical to both the &os;
&os; system call table entries, and the &linux; system call system call table entries, and the &linux; system call table
table entries: file system operations, virtual memory entries: file system operations, virtual memory operations,
operations, signal delivery, and System V IPC. The only signal delivery, and System V IPC. The only difference is that
difference is that &os; binaries get the &os; &os; binaries get the &os; <emphasis>glue</emphasis> functions,
<emphasis>glue</emphasis> functions, and &linux; binaries get and &linux; binaries get the &linux; <emphasis>glue</emphasis>
the &linux; <emphasis>glue</emphasis> functions. The &os; functions. The &os; <emphasis>glue</emphasis> functions are
<emphasis>glue</emphasis> functions are statically linked into statically linked into the kernel, and the &linux;
the kernel, and the &linux; <emphasis>glue</emphasis> <emphasis>glue</emphasis> functions can be statically linked, or
functions can be statically linked, or they can be accessed they can be accessed via a kernel module.</para>
via a kernel module.</para>
<para>Technically, this is not really emulation, it is an <para>Technically, this is not really emulation, it is an
<acronym>ABI</acronym> implementation. It is sometimes called <acronym>ABI</acronym> implementation. It is sometimes called
<quote>&linux; emulation</quote> because the implementation <quote>&linux; emulation</quote> because the implementation was
was done at a time when there was no other word to describe done at a time when there was no other word to describe what was
what was going on. Saying that &os; ran &linux; binaries was going on. Saying that &os; ran &linux; binaries was not true,
not true, since the code was not compiled in.</para> since the code was not compiled in.</para>
</sect1> </sect1>
</chapter> </chapter>