258 lines
7.2 KiB
Groff
258 lines
7.2 KiB
Groff
.\" $NetBSD: compat_svr4.8,v 1.25 2009/10/21 01:07:46 snj Exp $
|
|
.\"
|
|
.\" Copyright (c) 1996 Christos Zoulas
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.\" Stolen from compat_linux.8,v 1.2 1995/10/16 20:17:59 fvdl
|
|
.\"
|
|
.Dd April 19, 1999
|
|
.Dt COMPAT_SVR4 8
|
|
.Os
|
|
.Sh NAME
|
|
.Nm compat_svr4
|
|
.Nd setup procedure for running SVR4/iBCS2 binaries
|
|
.Nm compat_svr4_32
|
|
.Nd setup procedure for running 32-bit SVR4/iBCS2 binaries
|
|
.Sh DESCRIPTION
|
|
.Nx
|
|
supports running SVR4/iBCS2 binaries. This code has been tested on
|
|
i386 (with binaries from SCO OpenServer and XENIX), m68k (with binaries from
|
|
.Tn AMIX )
|
|
and sparc (with binaries from Solaris) systems. Most programs should work,
|
|
but not ones that use or depend on:
|
|
.sp
|
|
.Bl -item -compact -offset indent
|
|
.It
|
|
kernel internal data structures
|
|
.It
|
|
the
|
|
.Pa /proc
|
|
filesystem
|
|
.It
|
|
the ticotsord loopback RPC mechanism (NIS uses this)
|
|
.It
|
|
sound and video interfaces
|
|
.It
|
|
threads (ttsession uses threads)
|
|
.It
|
|
the streams administrative driver
|
|
.El
|
|
.sp
|
|
The SVR4 compatibility feature is active
|
|
for kernels compiled with the
|
|
.Dv COMPAT_SVR4
|
|
option enabled.
|
|
Since support for ELF executables is included
|
|
only if the kernel is compiled with the
|
|
.Dv EXEC_ELF32
|
|
or
|
|
.Dv EXEC_ELF64
|
|
options enabled, kernels which include
|
|
.Dv COMPAT_SVR4
|
|
should also typically include
|
|
.Dv EXEC_ELF32
|
|
(for 32-bit ELF support)
|
|
and/or
|
|
.Dv EXEC_ELF64
|
|
(for 64-bit ELF support).
|
|
.Pp
|
|
Another compatibility feature is
|
|
.Dv COMPAT_SVR4_32 ,
|
|
which allows the execution of 32-bit SVR4 binaries on a machine
|
|
with a 64-bit kernel. This requires
|
|
.Dv EXEC_ELF32
|
|
and
|
|
.Dv COMPAT_NETBSD32
|
|
options as well as
|
|
.Dv COMPAT_SVR4 .
|
|
It is configured the same way as
|
|
.Dv COMPAT_SVR4
|
|
but uses the
|
|
.Pa /emul/svr4_32
|
|
directory instead of
|
|
.Pa /emul/svr4 .
|
|
But typically,
|
|
.Pa /emul/svr4_32
|
|
can be made to point to
|
|
.Pa /emul/svr4
|
|
if the
|
|
operating system donating the libraries has support for both 32-bit
|
|
and 64-bit binaries.
|
|
.Pp
|
|
Execution of 32-bit SVR4 binaries on a machine with a 32-bit kernel uses
|
|
.Dv COMPAT_SVR4 ,
|
|
not
|
|
.Dv COMPAT_SVR4_32 .
|
|
.Pp
|
|
Most SVR4 programs are dynamically linked. This means that you will
|
|
also need the shared libraries that the program depends on and the
|
|
runtime linker. Also, you will need to create a
|
|
.Dq shadow root
|
|
directory for SVR4 binaries on your
|
|
.Nx
|
|
system. This directory
|
|
is named
|
|
.Pa /emul/svr4 .
|
|
Any file operations done by SVR4 programs run under
|
|
.Nx
|
|
will look in this directory first. So, if a SVR4
|
|
program opens, for example,
|
|
.Pa /etc/passwd ,
|
|
.Nx
|
|
will
|
|
first try to open
|
|
.Pa /emul/svr4/etc/passwd ,
|
|
and if that does not exist open the
|
|
.Sq real
|
|
.Pa /etc/passwd
|
|
file. It is recommended that you install
|
|
SVR4 packages that include configuration files, etc under
|
|
.Pa /emul/svr4 ,
|
|
to avoid naming conflicts with possible
|
|
.Nx
|
|
counterparts. Shared
|
|
libraries should also be installed in the shadow tree.
|
|
.Pp
|
|
The simplest way to set up your system for SVR4 binaries is:
|
|
.Bl -enum -compact
|
|
.It
|
|
Make the necessary directories:
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@netbsd) mkdir -p /emul/svr4/{dev,etc}
|
|
.br
|
|
.It (me@netbsd) mkdir -p /emul/svr4/usr/{bin,lib,ucblib}
|
|
.br
|
|
.It (me@netbsd) mkdir -p /emul/svr4/usr/openwin/{bin,lib}
|
|
.br
|
|
.It (me@netbsd) mkdir -p /emul/svr4/usr/dt/{bin,lib}
|
|
.El
|
|
.Pp
|
|
.It
|
|
Copy files from an svr4 system:
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@svr4) cd /usr/lib
|
|
.br
|
|
.It (me@svr4) tar -cf -\ . | \e
|
|
.in +5
|
|
.It rsh netbsd 'cd /emul/svr4/usr/lib \*[Am]\*[Am] tar -xpf -'
|
|
.in -5
|
|
.El
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@svr4) cd /usr/ucblib
|
|
.br
|
|
.It (me@svr4) tar -cf -\ . | \e
|
|
.in +5
|
|
.It rsh netbsd 'cd /emul/svr4/usr/ucblib \*[Am]\*[Am] tar -xpf -'
|
|
.in -5
|
|
.El
|
|
.Pp
|
|
If you are running openwindows:
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@svr4) cd /usr/openwin/lib
|
|
.br
|
|
.It (me@svr4) tar -cf -\ . | \e
|
|
.in +5
|
|
.It rsh netbsd 'cd /emul/svr4/usr/openwin/lib \*[Am]\*[Am] tar -xpf -'
|
|
.in -5
|
|
.It (me@svr4) cd /usr/dt/lib
|
|
.br
|
|
.It (me@svr4) tar -cf -\ . | \e
|
|
.in +5
|
|
.It rsh netbsd 'cd /emul/svr4/usr/dt/lib \*[Am]\*[Am] tar -xpf -'
|
|
.in -5
|
|
.El
|
|
.It
|
|
You will also probably need the timezone files from your Solaris
|
|
system, otherwise emulated binaries will run on UTC time.
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@netbsd) mkdir -p /emul/svr4/usr/share/lib/zoneinfo
|
|
.br
|
|
.It (me@netbsd) mkdir -p /emul/svr4/etc/default
|
|
.br
|
|
.It (me@svr4) cd /usr/share/lib/zoneinfo
|
|
.br
|
|
.It (me@solaris) tar -cf - . | \e
|
|
.in +5
|
|
.It rsh netbsd 'cd /emul/svr4/usr/share/lib/zoneinfo \*[Am]\*[Am]
|
|
.It tar -xpf -'
|
|
.in -5
|
|
.br
|
|
.It (me@netbsd) echo TZ=US/Pacific \*[Gt] /emul/svr4/etc/default/init
|
|
.br
|
|
.El
|
|
.It
|
|
Set up the configuration files and devices:
|
|
.Pp
|
|
.Bl -tag -width 123 -compact -offset indent
|
|
.It (me@netbsd) cd /usr/share/examples/emul/svr4/etc
|
|
.br
|
|
.It (me@netbsd) cp netconfig nsswitch.conf /emul/svr4/etc
|
|
.br
|
|
.It (me@netbsd) cp SVR4_MAKEDEV /emul/svr4/dev
|
|
.br
|
|
.It (me@netbsd) cd /emul/svr4/dev \*[Am]\*[Am] sh SVR4_MAKEDEV all
|
|
.El
|
|
.Pp
|
|
As the major number allocated for emulation of SVR4 devices may vary between
|
|
.Nx
|
|
platforms, the SVR4_MAKEDEV script uses the
|
|
.Xr uname 1
|
|
command to determine the architecture the devices nodes are being created for;
|
|
this can be overridden by setting the
|
|
.Ev MACHINE
|
|
environment variable accordingly.
|
|
.El
|
|
.Pp
|
|
An alternative method is to mount a whole SVR4 partition in
|
|
.Pa /emul/svr4
|
|
and then override with other mounts
|
|
.Pa /emul/svr4/etc
|
|
and
|
|
.Pa /emul/svr4/dev .
|
|
.Sh BUGS
|
|
Many system calls are still not emulated. The streams emulation is
|
|
incomplete (socketpair does not work yet).
|
|
.Pp
|
|
Most SVR4 executables can not handle directory offset cookies \*[Gt] 32
|
|
bits. More recent ones, compiled for large file support (Solaris 2.6
|
|
and up) can. With older programs, you will see the message
|
|
.Dq svr4_getdents: dir offset too large for emulated program"
|
|
when this happens. Currently,
|
|
this can only happen on NFS mounted filesystems, mounted from servers
|
|
that return offsets with information in the upper 32 bits. These errors
|
|
should rarely happen, but can be avoided by mounting this filesystem with
|
|
offset translation enabled. See the
|
|
.Fl X
|
|
option to
|
|
.Xr mount_nfs 8 .
|
|
The
|
|
.Fl 2
|
|
option to
|
|
.Xr mount_nfs 8
|
|
will also have the desired effect, but is less preferable.
|