various changes made to the markup and/or indentation. PR: docs/17638 Submitted by: Murray Stokely <murray> Written by: marcel While I'm here, prepend 'linuxemu-' to the IDs in this file, so they're consistent with our other usage.
785 lines
32 KiB
Text
785 lines
32 KiB
Text
<!--
|
|
The FreeBSD Documentation Project
|
|
|
|
$FreeBSD: doc/en_US.ISO_8859-1/books/handbook/linuxemu/chapter.sgml,v 1.28 2000/03/23 01:32:00 jim Exp $
|
|
-->
|
|
|
|
<chapter id="linuxemu">
|
|
<title>Linux Binary Compatibility</title>
|
|
|
|
<para><emphasis>Restructured and parts updated by &a.jim;, 22 March
|
|
2000. Originally contributed by &a.handy; and
|
|
&a.rich;</emphasis></para>
|
|
|
|
<sect1>
|
|
<title>Synopsis</title>
|
|
|
|
<para>The following chapter will cover FreeBSD's Linux binary
|
|
compatibility features, how to install it, and how it works.</para>
|
|
|
|
<para>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 “hot thing” 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>In a nutshell, the compatibility allows FreeBSD users to run
|
|
about 90% of all Linux applications without modification. This
|
|
includes applications such as Star Office, the Linux version of
|
|
Netscape, Adobe Acrobat, RealPlayer 5 and 7, VMWare, Oracle,
|
|
WordPerfect, Doom, Quake, and more. It is also reported that in
|
|
some situations, Linux binaries perform better on FreeBSD than they
|
|
do under 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 the Linux
|
|
<filename>/proc</filename> filesystem (which is different from
|
|
FreeBSD's <filename>/proc</filename> filesystem), or i386-specific
|
|
calls, such as enabling virtual 8086 mode.</para>
|
|
|
|
<para>For information on installing the Linux binary compatibility
|
|
mode, see the <link linkend="linuxemu-lbc-install">next section</link>.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="linuxemu-lbc-install">
|
|
<title>Installation</title>
|
|
|
|
<para>With the advent of 3.0-RELEASE, it is no longer necessary to
|
|
specify <literal>options LINUX</literal> or
|
|
<literal>options COMPAT_LINUX</literal> in your kernel
|
|
configuration.</para>
|
|
|
|
<para>The Linux binary compatibility is now done via a KLD object
|
|
(“Kernel LoaDable object”), so it can be installed
|
|
“on-the-fly” without having to reboot. You will,
|
|
however, need to have the following in
|
|
<filename>/etc/rc.conf</filename>:</para>
|
|
|
|
<programlisting>linux_enable=“YES”</programlisting>
|
|
|
|
<para>This, in turn, triggers the following action in
|
|
<filename>/etc/rc.i386</filename>:</para>
|
|
|
|
<programlisting>
|
|
# Start the Linux binary compatibility if requested.
|
|
#
|
|
case ${linux_enable} in
|
|
[Yy][Ee][Ss])
|
|
echo -n ' linux'; linux > /dev/null 2>&1
|
|
;;
|
|
esac</programlisting>
|
|
|
|
<para>If you wish to verify that the KLD is loaded,
|
|
<command>kldstat</command> will do that:</para>
|
|
|
|
<screen>&prompt.user; <userinput>kldstat</userinput>
|
|
Id Refs Address Size Name
|
|
1 2 0xc0100000 16bdb8 kernel
|
|
7 1 0xc24db000 d000 linux.ko</screen>
|
|
|
|
<para>If for some reason you do not want to or cannot load the KLD,
|
|
then you may statically link the binary compatibility in the kernel
|
|
by adding <literal>options LINUX</literal> to your kernel
|
|
configuration file. Then install your new kernel as described in
|
|
the <link linkend="kernelconfig">kernel configuration</link> section
|
|
of this handbook.</para>
|
|
|
|
<sect2>
|
|
<title>Installing Linux Runtime Libraries</title>
|
|
|
|
<para>This can be done one of two ways, either by using the <link
|
|
linkend="linuxemu-libs-port">linux_base</link> port, or by installing them
|
|
<link linkend="linuxemu-libs-manually">manually</link>.</para>
|
|
|
|
<sect3 id="linuxemu-libs-port">
|
|
<title>Installing using the linux_base port</title>
|
|
|
|
<para>This is by far the easiest method to use when installing the
|
|
runtime libraries. It is just like installing any other port
|
|
from the <ulink url="../ports/">ports collection</ulink>.
|
|
Simply do the following:</para>
|
|
|
|
<screen>&prompt.root; <userinput>cd /usr/ports/emulators/linux_base</userinput>
|
|
&prompt.root; <userinput>make install distclean</userinput></screen>
|
|
|
|
<para>You should now have working Linux binary compatibility.
|
|
Some programs may complain about incorrect minor versions of the
|
|
system libraries. In general, however, this does not seem to be
|
|
a problem.</para>
|
|
</sect3>
|
|
|
|
<sect3 id="linuxemu-libs-manually">
|
|
<title>Installing libraries manually</title>
|
|
|
|
<para>If you do not have the “ports” collection
|
|
installed, you can install the libraries by hand instead. You
|
|
will need the Linux shared libraries that the program depends on
|
|
and the runtime linker. Also, you will need to create a
|
|
“shadow root” directory,
|
|
<filename>/compat/linux</filename>, for Linux libraries on your
|
|
FreeBSD system. Any shared libraries opened by Linux programs
|
|
run under FreeBSD will look in this tree first. So, if a Linux
|
|
program loads, for example, <filename>/lib/libc.so</filename>,
|
|
FreeBSD will first try to open
|
|
<filename>/compat/linux/lib/libc.so</filename>, and if that does
|
|
not exist, it will then try <filename>/lib/libc.so</filename>.
|
|
Shared libraries should be installed in the shadow tree
|
|
<filename>/compat/linux/lib</filename> rather than the paths
|
|
that the Linux <command>ld.so</command> reports.</para>
|
|
|
|
<para>Generally, you will need to look for the shared libraries
|
|
that Linux binaries depend on only the first few times that you
|
|
install a Linux program on your FreeBSD system. After a while,
|
|
you will have a sufficient set of Linux shared libraries on your
|
|
system to be able to run newly imported Linux binaries without
|
|
any extra work.</para>
|
|
</sect3>
|
|
|
|
<sect3>
|
|
<title>How to install additional shared libraries</title>
|
|
|
|
<para>What if you install the <filename>linux_base</filename> port
|
|
and your application still complains about missing shared
|
|
libraries? How do you know which shared libraries Linux
|
|
binaries need, and where to get them? Basically, there are 2
|
|
possibilities (when following these instructions you will need
|
|
to be root on your FreeBSD system).</para>
|
|
|
|
<para>If you have access to a Linux system, see what shared
|
|
libraries the application needs, and copy them to your FreeBSD
|
|
system. Look at the following example:</para>
|
|
|
|
<informalexample>
|
|
<para>Let us assume you have just ftp'd the Linux binary of
|
|
Doom, and put it on a Linux system you have access to. You
|
|
then can check which shared libraries it needs by running
|
|
<command>ldd linuxxdoom</command>, like so:</para>
|
|
|
|
<screen>&prompt.user; <userinput>ldd linuxxdoom</userinput>
|
|
libXt.so.3 (DLL Jump 3.1) => /usr/X11/lib/libXt.so.3.1.0
|
|
libX11.so.3 (DLL Jump 3.1) => /usr/X11/lib/libX11.so.3.1.0
|
|
libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29</screen>
|
|
|
|
<para>You would need to get all the files from the last column,
|
|
and put them under <filename>/compat/linux</filename>, with
|
|
the names in the first column as symbolic links pointing to
|
|
them. This means you eventually have these files on your
|
|
FreeBSD system:</para>
|
|
|
|
<screen>/compat/linux/usr/X11/lib/libXt.so.3.1.0
|
|
/compat/linux/usr/X11/lib/libXt.so.3 -> libXt.so.3.1.0
|
|
/compat/linux/usr/X11/lib/libX11.so.3.1.0
|
|
/compat/linux/usr/X11/lib/libX11.so.3 -> libX11.so.3.1.0
|
|
/compat/linux/lib/libc.so.4.6.29 /compat/linux/lib/libc.so.4 -> libc.so.4.6.29</screen>
|
|
|
|
<blockquote>
|
|
<note>
|
|
<para>Note that if you already have a Linux shared library
|
|
with a matching major revision number to the first column
|
|
of the <command>ldd</command> output, you will not need to
|
|
copy the file named in the last column to your system, the
|
|
one you already have should work. It is advisable to copy
|
|
the shared library anyway if it is a newer version,
|
|
though. You can remove the old one, as long as you make
|
|
the symbolic link point to the new one. So, if you have
|
|
these libraries on your system:</para>
|
|
|
|
<screen>/compat/linux/lib/libc.so.4.6.27
|
|
/compat/linux/lib/libc.so.4 -> libc.so.4.6.27</screen>
|
|
|
|
<para>and you find a new binary that claims to require a
|
|
later version according to the output of
|
|
<command>ldd</command>:</para>
|
|
|
|
<screen>libc.so.4 (DLL Jump 4.5pl26) -> libc.so.4.6.29</screen>
|
|
|
|
<para>If it is only one or two versions out of date in the
|
|
in the trailing digit then do not worry about copying
|
|
<filename>/lib/libc.so.4.6.29</filename> too, because the
|
|
program should work fine with the slightly older version.
|
|
However, if you like, you can decide to replace the
|
|
<filename>libc.so</filename> anyway, and that should leave
|
|
you with:</para>
|
|
|
|
<screen>/compat/linux/lib/libc.so.4.6.29
|
|
/compat/linux/lib/libc.so.4 -> libc.so.4.6.29</screen>
|
|
</note>
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
<note>
|
|
<para>The symbolic link mechanism is
|
|
<emphasis>only</emphasis> needed for Linux binaries. The
|
|
FreeBSD runtime linker takes care of looking for matching
|
|
major revision numbers itself and you do not need to worry
|
|
about it.</para>
|
|
</note>
|
|
</blockquote>
|
|
</informalexample>
|
|
</sect3>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Installing Linux ELF binaries</title>
|
|
|
|
<para>ELF binaries sometimes require an extra step of
|
|
“branding”. If you attempt to run an unbranded ELF
|
|
binary, you will get an error message like the following;</para>
|
|
|
|
<screen>&prompt.user; <userinput>./my-linux-elf-binary</userinput>
|
|
ELF binary type not known
|
|
Abort</screen>
|
|
|
|
<para>To help the FreeBSD kernel distinguish between a FreeBSD ELF
|
|
binary from a Linux binary, use the &man.brandelf.1;
|
|
utility.</para>
|
|
|
|
<screen>&prompt.user; <userinput>brandelf -t Linux my-linux-elf-binary</userinput></screen>
|
|
|
|
<para>The GNU toolchain now places the appropriate branding
|
|
information into ELF binaries automatically, so you this step
|
|
should become increasingly more rare in the future.</para>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Configuring the host name resolver</title>
|
|
|
|
<para>If DNS does not work or you get this message:</para>
|
|
|
|
<screen>resolv+: "bind" is an invalid keyword resolv+:
|
|
"hosts" is an invalid keyword</screen>
|
|
|
|
<para>You will need to configure a
|
|
<filename>/compat/linux/etc/host.conf</filename> file
|
|
containing:</para>
|
|
|
|
<programlisting>
|
|
order hosts, bind
|
|
multi on</programlisting>
|
|
|
|
<para>The order here specifies that <filename>/etc/hosts</filename>
|
|
is searched first and DNS is searched second. When
|
|
<filename>/compat/linux/etc/host.conf</filename> is not
|
|
installed, linux applications find FreeBSD's
|
|
<filename>/etc/host.conf</filename> and complain about the
|
|
incompatible FreeBSD syntax. You should remove
|
|
<literal>bind</literal> if you have not configured a name server
|
|
using the <filename>/etc/resolv.conf</filename> file.</para>
|
|
</sect2>
|
|
</sect1>
|
|
|
|
<sect1 id="linuxemu-mathematica">
|
|
<title>Installing Mathematica</title>
|
|
|
|
<para><emphasis>Updated for Mathematica version 4.0 by Murray Stokely
|
|
<email>murray@cdrom.com</email> and merged with work by Bojan
|
|
Bistrovic <email>bojanb@physics.odu.edu</email>.</emphasis></para>
|
|
|
|
<para>This document describes the process of installing the Linux
|
|
version of Mathematica 4.0 onto a FreeBSD system.</para>
|
|
|
|
<para>The Linux version of Mathematica runs perfectly under FreeBSD
|
|
however the binaries shipped by Wolfram need to be branded so that
|
|
FreeBSD knows to use the Linux ABI to execute them.</para>
|
|
|
|
<para>The Linux version of Mathematica or Mathematica for Students can
|
|
be ordered directly from Wolfram at <ulink
|
|
url="http://www.wolfram.com/">http://www.wolfram.com/</ulink>.</para>
|
|
|
|
<sect2>
|
|
<title>Branding the Linux binaries</title>
|
|
|
|
<para>The Linux binaries are located in the <filename>Unix</filename>
|
|
directory of the Mathematica CDROM distributed by Wolfram. You
|
|
need to copy this directory tree to your local hard drive so that
|
|
you can brand the Linux binaries with &man.brandelf.1; before
|
|
running the installer:</para>
|
|
|
|
<screen>&prompt.root; <userinput>mount /cdrom</userinput>
|
|
&prompt.root; <userinput>cp -rp /cdrom/Unix/ /localdir/</userinput>
|
|
&prompt.root; <userinput>brandelf -t Linux /localdir/Files/SystemFiles/Kernel/Binaries/Linux/*</userinput>
|
|
&prompt.root; <userinput>brandelf -t Linux /localdir/Files/SystemFiles/FrontEnd/Binaries/Linux/*</userinput>
|
|
&prompt.root; <userinput>brandelf -t Linux /localdir/Files/SystemFiles/Installation/Binaries/Linux/*</userinput>
|
|
&prompt.root; <userinput>cd /localdir/Installers/Linux/</userinput>
|
|
&prompt.root; <userinput>./MathInstaller</userinput></screen>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Obtaining your Mathematica Password</title>
|
|
|
|
<para>Before you can run Mathematica you will have to obtain a
|
|
password from Wolfram that corresponds to your “machine
|
|
ID”.</para>
|
|
|
|
<para>Once you have installed the Linux compatibility runtime
|
|
libraries and unpacked Mathematica you can obtain the
|
|
“machine ID” by running the program
|
|
<command>mathinfo</command> in the Install directory. This
|
|
machine ID is based solely on the MAC address of your first
|
|
ethernet card.</para>
|
|
|
|
<screen>&prompt.root; <userinput>cd /localdir/Files/SystemFiles/Installation/Binaries/Linux</userinput>
|
|
&prompt.root; <userinput>mathinfo</userinput>
|
|
disco.example.com 7115-70839-20412</screen>
|
|
|
|
<para>When you register with Wolfram, either by email, phone or fax,
|
|
you will give them the “machine ID” and they will
|
|
respond with a corresponding password consisting of groups of
|
|
numbers. You can then enter this information when you attempt to
|
|
run Mathematica for the first time exactly as you would for any
|
|
other Mathematica platform.</para>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Running the Mathematica front end over a network</title>
|
|
|
|
<para>Mathematica uses some special fonts to display characters not
|
|
present in any of the standard font sets (integrals, sums, greek
|
|
letters, etc.). The X protocol requires these fonts to be install
|
|
<emphasis>locally</emphasis>. This means you will have to copy
|
|
these fonts from the CDROM or from a host with Mathematica
|
|
installed to your local machine. These fonts are normally stored
|
|
in <filename>/cdrom/Unix/Files/SystemFiles/Fonts</filename> on the
|
|
CDROM, or
|
|
<filename>/usr/local/mathematica/SystemFiles/Fonts</filename> on
|
|
your hard drive. The actual fonts are in the subdirectories
|
|
<filename>Type1</filename> and <filename>X</filename>. There are
|
|
several ways to use them, as described below.</para>
|
|
|
|
<para>The first way is to copy them into one of the existing font
|
|
directories in <filename>/usr/X11R6/lib/X11/fonts</filename>.
|
|
This will require editing the <filename>fonts.dir</filename> file,
|
|
adding the font names to it, and changing the number of fonts on
|
|
the first line. Alternatively, you should also just be able to
|
|
run <command>mkfontdir</command> in the directory you have copied
|
|
them to.</para>
|
|
|
|
<para>The second way to do this is to copy the directories to
|
|
<filename>/usr/X11R6/lib/X11/fonts</filename>:</para>
|
|
|
|
<screen>&prompt.root; <userinput>cd /usr/X11R6/lib/X11/fonts</userinput>
|
|
&prompt.root; <userinput>mkdir X</userinput>
|
|
&prompt.root; <userinput>mkdir MathType1</userinput>
|
|
&prompt.root; <userinput>cd /cdrom/Unix/Files/SystemFiles/Fonts</userinput>
|
|
&prompt.root; <userinput>cp X/* /usr/X11R6/lib/X11/fonts/X</userinput>
|
|
&prompt.root; <userinput>cp Type1/* /usr/X11R6/lib/X11/fonts/MathType1</userinput>
|
|
&prompt.root; <userinput>cd /usr/X11R6/lib/X11/fonts/X</userinput>
|
|
&prompt.root; <userinput>mkfontdir</userinput>
|
|
&prompt.root; <userinput>cd ../MathType1</userinput>
|
|
&prompt.root; <userinput>mkfontdir</userinput</screen>
|
|
|
|
<para>Now add the new font directories to your font path:</para>
|
|
|
|
<screen>&prompt.root; <userinput>xset fp+ /usr/X11R6/lib/X11/fonts/X</userinput>
|
|
&prompt.root; <userinput>xset fp+ /usr/X11R6/lib/X11/fonts/MathType1</userinput>
|
|
&prompt.root; <userinput>xset fp rehash</userinput></screen>
|
|
|
|
<para>If you are using the XFree86 server, you can have these font
|
|
directories loaded automatically by adding them to your
|
|
<filename>XF86Config</filename> file.</para>
|
|
|
|
<para>If you <emphasis>do not</emphasis> already have a directory
|
|
called <filename>/usr/X11R6/lib/X11/fonts/Type1</filename>, you
|
|
can change the name of the <filename>MathType1</filename>
|
|
directory in the example above to
|
|
<filename>Type1</filename>.</para>
|
|
</sect2>
|
|
</sect1>
|
|
|
|
<sect1 id="linuxemu-oracle">
|
|
<title>Installing Oracle</title>
|
|
|
|
<para><emphasis>Contributed by Marcel Moolenaar
|
|
<email>marcel@cup.hp.com</email></emphasis></para>
|
|
|
|
<sect2>
|
|
<title>Preface</title>
|
|
<para>This document describes the process of installing Oracle 8.0.5 and
|
|
Oracle 8.0.5.1 Enterprise Edition for Linux onto a FreeBSD
|
|
machine</para>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Installing the Linux environment</title>
|
|
|
|
<para>Make sure you have both <filename>linux_base</filename> and
|
|
<filename>linux_devtools</filename> from the ports collection
|
|
installed. These ports are added to the collection after the release
|
|
of FreeBSD 3.2. If you are using FreeBSD 3.2 or an older version for
|
|
that matter, update your ports collection. You may want to consider
|
|
updating your FreeBSD version too. If you run into difficulties with
|
|
<filename>linux_base-6.1</filename> or
|
|
<filename>linux_devtools-6.1</filename> you may have to use version
|
|
5.2 of these packages.</para>
|
|
|
|
<para>If you want to run the intelligent agent, you'll
|
|
also need to install the Red Hat tcl package:
|
|
<filename>tcl-8.0.3-20.i386.rpm</filename>. The general command
|
|
for installing packages with the official RPM port is :</para>
|
|
|
|
<screen>&prompt.root; <userinput>rpm -i --ignoreos --root /compat/linux --dbpath /var/lib/rpm <replaceable>package</replaceable></userinput></screen>
|
|
|
|
<para>Installation of the package should not generate any errors.</para>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Creating the Oracle environment</title>
|
|
|
|
<para>Before you can install Oracle, you need to set up a proper
|
|
environment. This document only describes what to do
|
|
<emphasis>specially</emphasis> to run Oracle for Linux on FreeBSD, not
|
|
what has been described in the Oracle installation guide.</para>
|
|
|
|
<sect3 id="linuxemu-kernel-tuning">
|
|
<title>Kernel Tuning</title>
|
|
|
|
<para>As described in the Oracle installation guide, you need to set
|
|
the maximum size of shared memory. Don't use
|
|
<literal>SHMMAX</literal> under FreeBSD. <literal>SHMMAX</literal>
|
|
is merely calculated out of <literal>SHMMAXPGS</literal> and
|
|
<literal>PGSIZE</literal>. Therefore define
|
|
<literal>SHMMAXPGS</literal>. All other options can be used as
|
|
described in the guide. For example:</para>
|
|
|
|
<programlisting>options SHMMAXPGS=10000
|
|
options SHMMNI=100
|
|
options SHMSEG=10
|
|
options SEMMNS=200
|
|
options SEMMNI=70
|
|
options SEMMSL=61</programlisting>
|
|
|
|
<para>Set these options to suit your intended use of Oracle.</para>
|
|
|
|
<para>Also, make sure you have the following options in your kernel
|
|
config-file:</para>
|
|
|
|
<programlisting>options SYSVSHM #SysV shared memory
|
|
options SYSVSEM #SysV semaphores
|
|
options SYSVMSG #SysV interprocess communication</programlisting>
|
|
</sect3>
|
|
|
|
<sect3 id="linuxemu-oracle-account">
|
|
|
|
<title>Oracle account</title>
|
|
|
|
<para>Create an Oracle account just as you would create any other
|
|
account. The Oracle account is special only that you need to give
|
|
it a Linux shell. Add <literal>/compat/linux/bin/bash</literal> to
|
|
<filename>/etc/shells</filename> and set the shell for the Oracle
|
|
account to <filename>/compat/linux/bin/bash</filename>.</para>
|
|
</sect3>
|
|
|
|
<sect3 id="linuxemu-environment">
|
|
<title>Environment</title>
|
|
|
|
<para>Besides the normal Oracle variables, such as
|
|
<envar>ORACLE_HOME</envar> and <envar>ORACLE_SID</envar> you must
|
|
set the following environment variables:</para>
|
|
|
|
<informaltable frame="none">
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>Variable</entry>
|
|
|
|
<entry>Value</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry><envar>LD_LIBRARY_PATH</envar></entry>
|
|
|
|
<entry><literal>$ORACLE_HOME/lib</literal></entry>
|
|
</row>
|
|
|
|
<row>
|
|
<entry><envar>CLASSPATH</envar></entry>
|
|
|
|
<entry><literal>$ORACLE_HOME/jdbc/lib/classes111.zip</literal></entry>
|
|
</row>
|
|
|
|
<row>
|
|
<entry><envar>PATH</envar></entry>
|
|
|
|
<entry><literal>/compat/linux/bin
|
|
/compat/linux/sbin
|
|
/compat/linux/usr/bin
|
|
/compat/linux/usr/sbin
|
|
/bin
|
|
/sbin
|
|
/usr/bin
|
|
/usr/sbin
|
|
/usr/local/bin
|
|
$ORACLE_HOME/bin</literal></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
|
|
<para>It is advised to set all the environment variables in
|
|
<filename>.profile</filename>. A complete example is:</para>
|
|
|
|
<programlisting>ORACLE_BASE=/oracle; export ORACLE_BASE
|
|
ORACLE_HOME=/oracle; export ORACLE_HOME
|
|
LD_LIBRARY_PATH=$ORACLE_HOME/lib
|
|
export LD_LIBRARY_PATH
|
|
ORACLE_SID=ORCL; export ORACLE_SID
|
|
ORACLE_TERM=386x; export ORACLE_TERM
|
|
CLASSPATH=$ORACLE_HOME/jdbc/lib/classes111.zip
|
|
export CLASSPATH
|
|
PATH=/compat/linux/bin:/compat/linux/sbin:/compat/linux/usr/bin:/compat/linux/usr/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:$ORACLE_HOME/bin
|
|
export PATH</programlisting>
|
|
</sect3>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Installing Oracle</title>
|
|
|
|
<para>Due to a slight inconsistency in the Linux emulator, you need to
|
|
create a directory named <filename>.oracle</filename> in
|
|
<filename>/var/tmp</filename> before you start the installer. Either
|
|
make it world writable or let it be owner by the oracle user. You
|
|
should be able to install Oracle without any problems. If you have
|
|
problems, check your Oracle distribution and/or configuration first!
|
|
After you have installed Oracle, apply the patches described in the
|
|
next two subsections.</para>
|
|
|
|
<para>A frequent problem is that the TCP protocol adapter is not
|
|
installed right. As a consequence, you cannot start any TCP listeners.
|
|
The following actions help solve this problem:</para>
|
|
|
|
<screen>&prompt.root; <userinput>cd $ORACLE_HOME/network/lib</userinput>
|
|
&prompt.root; <userinput>make -f ins_network.mk ntcontab.o</userinput>
|
|
&prompt.root; <userinput>cd $ORACLE_HOME/lib</userinput>
|
|
&prompt.root; <userinput>ar r libnetwork.a ntcontab.o</userinput>
|
|
&prompt.root; <userinput>cd $ORACLE_HOME/network/lib</userinput>
|
|
&prompt.root; <userinput>make -f ins_network.mk install</userinput></screen>
|
|
|
|
<para>Don't forget to run <filename>root.sh</filename> again!</para>
|
|
|
|
<sect3 id="linuxemu-patch-root">
|
|
<title>Patching root.sh</title>
|
|
|
|
<para>When installing Oracle, some actions, which need to be performed
|
|
as <username>root</username>, are recorded in a shell script called
|
|
<filename>root.sh</filename>. <filename>root.sh</filename> is
|
|
written in the <filename>orainst</filename> directory. Apply the
|
|
following patch to root.sh, to have it use to proper location of
|
|
chown or alternatively run the script under a Linux native
|
|
shell.</para>
|
|
|
|
<programlisting>*** orainst/root.sh.orig Tue Oct 6 21:57:33 1998
|
|
--- orainst/root.sh Mon Dec 28 15:58:53 1998
|
|
***************
|
|
*** 31,37 ****
|
|
# This is the default value for CHOWN
|
|
# It will redefined later in this script for those ports
|
|
# which have it conditionally defined in ss_install.h
|
|
! CHOWN=/bin/chown
|
|
#
|
|
# Define variables to be used in this script
|
|
--- 31,37 ----
|
|
# This is the default value for CHOWN
|
|
# It will redefined later in this script for those ports
|
|
# which have it conditionally defined in ss_install.h
|
|
! CHOWN=/usr/sbin/chown
|
|
#
|
|
# Define variables to be used in this script</programlisting>
|
|
|
|
<para>When you don't install Oracle from CD, you can path the source
|
|
for <filename>root.sh</filename>. It is called
|
|
<filename>rthd.sh</filename> and is located in the
|
|
<filename>orainst</filename> directory in the source tree.</para>
|
|
</sect3>
|
|
|
|
<sect3 id="linuxemu-patch-tcl">
|
|
<title>Patching genclntsh</title>
|
|
|
|
<para>The script genclntsh is used to create a single shared client
|
|
library. It is used when building the demos. Apply the following
|
|
patch to comment out the definition of PATH:</para>
|
|
|
|
<programlisting>*** bin/genclntsh.orig Wed Sep 30 07:37:19 1998
|
|
--- bin/genclntsh Tue Dec 22 15:36:49 1998
|
|
***************
|
|
*** 32,38 ****
|
|
#
|
|
# Explicit path to ensure that we're using the correct commands
|
|
#PATH=/usr/bin:/usr/ccs/bin export PATH
|
|
! PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin export PATH
|
|
#
|
|
# each product MUST provide a $PRODUCT/admin/shrept.lst
|
|
--- 32,38 ----
|
|
#
|
|
# Explicit path to ensure that we're using the correct commands
|
|
#PATH=/usr/bin:/usr/ccs/bin export PATH
|
|
! #PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin export PATH
|
|
#
|
|
# each product MUST provide a $PRODUCT/admin/shrept.lst</programlisting>
|
|
</sect3>
|
|
</sect2>
|
|
|
|
<sect2>
|
|
<title>Running Oracle</title>
|
|
|
|
<para>When you have followed the instructions, you should be able to run
|
|
Oracle as if it was run on Linux itself.</para>
|
|
</sect2>
|
|
</sect1>
|
|
|
|
<sect1>
|
|
<title>Advanced Topics</title>
|
|
|
|
<para>If you are curious as to how the Linux binary compatibility
|
|
works, this is the section you want to read. Most of what follows
|
|
is based heavily on an email written to &a.chat; by Terry Lambert
|
|
<email>tlambert@primenet.com</email> (Message ID:
|
|
<literal><199906020108.SAA07001@usr09.primenet.com></literal>).</para>
|
|
<sect2>
|
|
<title>How Does It Work?</title>
|
|
|
|
<para>FreeBSD has an abstraction called an “execution class
|
|
loader”. This is a wedge into the &man.execve.2; system
|
|
call.</para>
|
|
|
|
<para>What happens is that FreeBSD has a list of loaders, instead of
|
|
a single loader with a fallback to the <literal>#!</literal>
|
|
loader for running any shell interpreters or shell scripts.</para>
|
|
|
|
<para>Historically, the only loader on the UNIX platform examined
|
|
the magic number (generally the first 4 or 8 bytes of the file) to
|
|
see if it was a binary known to the system, and if so, invoked the
|
|
binary loader.</para>
|
|
|
|
<para>If it was not the binary type for the system, the
|
|
&man.execve.2; call returned a failure, and the shell attempted to
|
|
start executing it as shell commands.</para>
|
|
|
|
<para>The assumption was a default of “whatever the current
|
|
shell is”.</para>
|
|
|
|
<para>Later, a hack was made for &man.sh.1; to examine the first two
|
|
characters, and if they were <literal>:\n</literal>, then it
|
|
invoked the &man.csh.1; shell instead (we believe SCO first made
|
|
this hack).</para>
|
|
|
|
<para>What FreeBSD does now is go through a list of loaders, with a
|
|
generic <literal>#!</literal> loader that knows about interpreters
|
|
as the characters which follow to the next whitespace next to
|
|
last, followed by a fallback to
|
|
<filename>/bin/sh</filename>.</para>
|
|
|
|
<para>For the Linux ABI support, FreeBSD sees the magic number as an
|
|
ELF binary (it makes no distinction between FreeBSD, Solaris,
|
|
Linux, or any other OS which has an ELF image type, at this
|
|
point).</para>
|
|
|
|
<para>The ELF loader looks for a specialized
|
|
<emphasis>brand</emphasis>, which is a comment section in the ELF
|
|
image, and which is not present on SVR4/Solaris ELF
|
|
binaries.</para>
|
|
|
|
<para>For Linux binaries to function, they must be
|
|
<emphasis>branded</emphasis> as type <literal>Linux</literal>;
|
|
from &man.brandelf.1;:</para>
|
|
|
|
<screen>&prompt.root; <userinput>brandelf -t Linux file</userinput></screen>
|
|
|
|
<para>When this is done, the ELF loader will see the
|
|
<literal>Linux</literal> brand on the file.</para>
|
|
|
|
<para>When the ELF loader sees the <literal>Linux</literal> brand,
|
|
the loader replaces a pointer in the <literal>proc</literal>
|
|
structure. All system calls are indexed through this pointer (in
|
|
a traditional UNIX system, this would be the
|
|
<literal>sysent[]</literal> structure array, containing the system
|
|
calls). In addition, the process flagged for special handling of
|
|
the trap vector for the signal trampoline code, and sever other
|
|
(minor) fix-ups that are handled by the Linux kernel
|
|
module.</para>
|
|
|
|
<para>The Linux system call vector contains, among other things, a
|
|
list of <literal>sysent[]</literal> entries whose addresses reside
|
|
in the kernel module.</para>
|
|
|
|
<para>When a system call is called by the Linux binary, the trap
|
|
code dereferences the system call function pointer off the
|
|
<literal>proc</literal> structure, and gets the Linux, not the
|
|
FreeBSD, system call entry points.</para>
|
|
|
|
<para>In addition, the Linux mode dynamically
|
|
<emphasis>reroots</emphasis> lookups; this is, in effect, what the
|
|
<literal>union</literal> option to FS mounts
|
|
(<emphasis>not</emphasis> the unionfs!) does. First, an attempt
|
|
is made to lookup the file in the
|
|
<filename>/compat/linux/<replaceable>original-path</replaceable></filename>
|
|
directory, <emphasis>then</emphasis> only if that fails, the
|
|
lookup is done in the
|
|
<filename>/<replaceable>original-path</replaceable></filename>
|
|
directory. This makes sure that binaries that require other
|
|
binaries can run (e.g., the Linux toolchain can all run under
|
|
Linux ABI support). It also means that the Linux binaries can
|
|
load and exec FreeBSD binaries, if there are no corresponding
|
|
Linux binaries present, and that you could place a &man.uname.1;
|
|
command in the <filename>/compat/linux</filename> directory tree
|
|
to ensure that the Linux binaries could not tell they were not
|
|
running on Linux.</para>
|
|
|
|
<para>In effect, there is a Linux kernel in the FreeBSD kernel; the
|
|
various underlying functions that implement all of the services
|
|
provided by the kernel are identical to both the FreeBSD system
|
|
call table entries, and the Linux system call table entries: file
|
|
system operations, virtual memory operations, signal delivery,
|
|
System V IPC, etc… The only difference is that FreeBSD
|
|
binaries get the FreeBSD <emphasis>glue</emphasis> functions, and
|
|
Linux binaries get the Linux <emphasis>glue</emphasis> functions
|
|
(most older OS's only had their own <emphasis>glue</emphasis>
|
|
functions: addresses of functions in a static global
|
|
<literal>sysent[]</literal> structure array, instead of addresses
|
|
of functions dereferenced off a dynamically initialized pointer in
|
|
the <literal>proc</literal> structure of the process making the
|
|
call).</para>
|
|
|
|
<para>Which one is the native FreeBSD ABI? It does not matter.
|
|
Basically the only difference is that (currently; this could
|
|
easily be changed in a future release, and probably will be after
|
|
this) the FreeBSD <emphasis>glue</emphasis> functions are
|
|
statically linked into the kernel, and the Linux glue functions
|
|
can be statically linked, or they can be accessed via a kernel
|
|
module.</para>
|
|
|
|
<para>Yeah, but is this really emulation? No. It is an ABI
|
|
implementation, not an emulation. There is no emulator (or
|
|
simulator, to cut off the next question) involved.</para>
|
|
|
|
<para>So why is it sometimes called “Linux emulation”?
|
|
To make it hard to sell FreeBSD! <!-- smiley -->8-). Really, it
|
|
is because the historical implementation was done at a time when
|
|
there was really no word other than that to describe what was
|
|
going on; saying that FreeBSD ran Linux binaries was not true, if
|
|
you did not compile the code in or load a module, and there needed
|
|
to be a word to describe what was being loaded—hence
|
|
“the Linux emulator”.</para>
|
|
</sect2>
|
|
</sect1>
|
|
</chapter>
|
|
|
|
<!--
|
|
Local Variables:
|
|
mode: sgml
|
|
sgml-declaration: "../chapter.decl"
|
|
sgml-indent-data: t
|
|
sgml-omittag: nil
|
|
sgml-always-quote-attributes: t
|
|
sgml-parent-document: ("../book.sgml" "part" "chapter")
|
|
End:
|
|
-->
|
|
|