update information
This commit is contained in:
parent
258e49078f
commit
4986201e82
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: compat_linux.8,v 1.40 2017/10/02 12:55:10 wiz Exp $
|
||||
.\" $NetBSD: compat_linux.8,v 1.41 2021/04/24 07:12:17 nia Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1995 Frank van der Linden
|
||||
.\" All rights reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd September 29, 2017
|
||||
.Dd April 4, 2021
|
||||
.Dt COMPAT_LINUX 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -40,14 +40,12 @@
|
|||
supports running Linux binaries.
|
||||
This applies to amd64, arm, alpha, i386, m68k, and powerpc systems for now.
|
||||
Both the a.out and ELF binary formats are supported.
|
||||
Most programs should work, including the ones that use the Linux SVGAlib (only
|
||||
on i386).
|
||||
Most programs should work.
|
||||
.Nx
|
||||
amd64 can execute both 32bit and 64bit linux programs.
|
||||
amd64 can execute both 32-bit and 64-bit Linux programs.
|
||||
Programs that will not work include some that use
|
||||
i386-specific calls, such as enabling virtual 8086 mode.
|
||||
Currently, sound is only partially supported for Linux binaries (they will
|
||||
probably run, depending on what Linux sound support features are used).
|
||||
Currently, sound is supported through OSSv3 compat.
|
||||
.Pp
|
||||
The Linux compatibility feature is active
|
||||
for kernels compiled with the
|
||||
|
@ -64,6 +62,9 @@ and/or
|
|||
.Dv EXEC_ELF64
|
||||
options (respectively) should be enabled in addition to
|
||||
.Dv COMPAT_LINUX .
|
||||
If sound support is desired,
|
||||
.Dv COMPAT_OSSAUDIO
|
||||
should be enabled.
|
||||
.Pp
|
||||
A lot of programs are dynamically linked.
|
||||
This means that you will also need the Linux shared libraries that the
|
||||
|
@ -77,7 +78,7 @@ This directory is named
|
|||
.Pa /emul/linux
|
||||
or
|
||||
.Pa /emul/linux32
|
||||
for 32bit emulation on 64bit systems.
|
||||
for 32-bit emulation on 64-bit systems.
|
||||
Any file operations done by Linux programs run under
|
||||
.Nx
|
||||
will look in this directory first.
|
||||
|
@ -109,275 +110,62 @@ 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.
|
||||
.Ss Setting up shared libraries
|
||||
How to get to 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
|
||||
.Nx
|
||||
system to
|
||||
do the necessary installation steps).
|
||||
.Bl -enum
|
||||
.It
|
||||
For i386, you can simply install the SuSE shared libs using the
|
||||
.Pa pkgsrc/emulators/suse100_linux
|
||||
package(s).
|
||||
On PowerPC ports, the
|
||||
.Pa pkgsrc/emulators/linuxppc_lib
|
||||
will install the needed libraries.
|
||||
If you are on other platforms, or this doesn't supply you with all
|
||||
the needed libraries, read on.
|
||||
.It
|
||||
You have access to a Linux system.
|
||||
In this case you can temporarily install the binary there, see what
|
||||
shared libraries it needs, and copy them to your
|
||||
.Nx
|
||||
system.
|
||||
Example: you have just ftp-ed the Linux binary of Doom.
|
||||
Put it on the Linux system you have access to, and check which shared libraries it
|
||||
needs by running
|
||||
.Sq ldd linuxxdoom :
|
||||
.Bd -literal -offset indent
|
||||
(me@linux) ldd linuxxdoom
|
||||
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
|
||||
.Ed
|
||||
.Pp
|
||||
You would need go get all the files from the last column, and
|
||||
put them under
|
||||
.Pa /emul/linux ,
|
||||
with the names in the first column
|
||||
as symbolic links pointing to them.
|
||||
This means you eventually have these files on your
|
||||
.Nx
|
||||
system:
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /emul/linux/usr/X11/lib/libXt.so.3.1.0
|
||||
.It
|
||||
.Pa /emul/linux/usr/X11/lib/libXt.so.3
|
||||
(symbolic link to the above)
|
||||
.It
|
||||
.Pa /emul/linux/usr/X11/lib/libX11.so.3.1.0
|
||||
.It
|
||||
.Pa /emul/linux/usr/X11/lib/libX11.so.3
|
||||
(symbolic link to the above)
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4.6.29
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4
|
||||
(symbolic link to the above)
|
||||
.El
|
||||
.Pp
|
||||
Note that if you already have a Linux shared library with a
|
||||
matching major revision number to the first column of the
|
||||
.Xr ldd 1
|
||||
output, you won't 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:
|
||||
.Pp
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4.6.27
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4
|
||||
->
|
||||
.Pa /emul/linux/lib/libc.so.4.6.27
|
||||
.El
|
||||
.Pp
|
||||
and you find that the
|
||||
.Ic ldd
|
||||
output for a new binary you want to install is:
|
||||
Find the dependencies of a Linux binary using
|
||||
.Xr readelf 1 :
|
||||
.Bd -literal
|
||||
libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29
|
||||
$ readelf -d ./runner | grep Shared
|
||||
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libz.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libXxf86vm.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libGL.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libopenal.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libm.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [librt.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
|
||||
0x00000001 (NEEDED) Shared library: [libdl.so.2]
|
||||
0x00000001 (NEEDED) Shared library: [libcrypto.so.1.0.0]
|
||||
0x00000001 (NEEDED) Shared library: [libXext.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libX11.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libXrandr.so.2]
|
||||
0x00000001 (NEEDED) Shared library: [libGLU.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libssl.so.1.0.0]
|
||||
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libc.so.6]
|
||||
.Ed
|
||||
.Pp
|
||||
you won't need to worry about copying
|
||||
.Pa /lib/libc.so.4.6.29
|
||||
too, because the program should work fine with the slightly older version.
|
||||
You can decide to replace the libc.so anyway, and that should leave
|
||||
you with:
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4.6.29
|
||||
.It
|
||||
.Pa /emul/linux/lib/libc.so.4
|
||||
->
|
||||
.Pa /emul/linux/lib/libc.so.4.6.29
|
||||
.El
|
||||
For x86, you can simply install the openSUSE shared libraries using the
|
||||
.Pa pkgsrc/emulators/suse131_*
|
||||
or
|
||||
.Pa pkgsrc/emulators/suse131_32_*
|
||||
packages.
|
||||
.Pp
|
||||
Please note that the symbolic link mechanism is
|
||||
.Em only
|
||||
needed for Linux binaries, the
|
||||
.Nx
|
||||
runtime linker takes care of
|
||||
looking for matching major revision numbers itself, you
|
||||
don't need to worry about that.
|
||||
.Pp
|
||||
Finally, you must make sure that you have the Linux runtime linker
|
||||
and its config files on your system.
|
||||
You should copy these
|
||||
files from the Linux system to their appropriate place on your
|
||||
.Nx
|
||||
system (in the
|
||||
.Pa /emul/linux
|
||||
tree):
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /lib/ld.so
|
||||
.It
|
||||
.Pa /etc/ld.so.cache
|
||||
.It
|
||||
.Pa /etc/ld.so.config
|
||||
.El
|
||||
.It
|
||||
You don't have access to a Linux system.
|
||||
In that case, you should get the extra files you need from various ftp sites.
|
||||
Information on where to look for the various files is appended below.
|
||||
For now, let's assume you know where to get the files.
|
||||
.Pp
|
||||
Retrieve the following files (from _one_ ftp site to avoid
|
||||
any version mismatches), and install them under
|
||||
.Pa /emul/linux
|
||||
(i.e.
|
||||
.Pa /foo/bar
|
||||
is installed as
|
||||
.Pa /emul/linux/foo/bar ) :
|
||||
.Pp
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /sbin/ldconfig
|
||||
.It
|
||||
.Pa /usr/bin/ldd
|
||||
.It
|
||||
.Pa /lib/libc.so.x.y.z
|
||||
.It
|
||||
.Pa /lib/ld.so
|
||||
.El
|
||||
.Pp
|
||||
.Ic ldconfig
|
||||
For example, an application which requires
|
||||
.Pa libcrypto.so.1.0.0 ,
|
||||
.Pa libXext.so.6 ,
|
||||
and
|
||||
.Ic ldd
|
||||
don't necessarily need to be under
|
||||
.Pa /emul/linux ,
|
||||
you can install them elsewhere in the system too.
|
||||
Just make sure they don't conflict with their
|
||||
.Nx
|
||||
counterparts.
|
||||
A good idea would be to install them in
|
||||
.Pa /usr/local/bin
|
||||
as
|
||||
.Ic ldconfig-linux
|
||||
.Pa libGL.so.1
|
||||
will require
|
||||
.Dv openssl ,
|
||||
.Dv x11 ,
|
||||
and
|
||||
.Ic ldd-linux .
|
||||
.Dv glx ,
|
||||
in addition to the
|
||||
.Dv base
|
||||
SUSE package.
|
||||
.Pp
|
||||
Create the file
|
||||
.Pa /emul/linux/etc/ld.so.conf ,
|
||||
containing the directories in which the Linux runtime linker should look
|
||||
for shared libs.
|
||||
It is a plain text file, containing a directory name on each line.
|
||||
.Pa /lib
|
||||
and
|
||||
.Pa /usr/lib
|
||||
are standard, you could add the following:
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /usr/X11/lib
|
||||
.It
|
||||
.Pa /usr/local/lib
|
||||
.El
|
||||
.Pp
|
||||
Note that these are mapped to
|
||||
.Pa /emul/linux/XXXX
|
||||
by
|
||||
.Nx Ap s
|
||||
compat
|
||||
code, and should exist as such on your system.
|
||||
.Pp
|
||||
Run the Linux
|
||||
.Ic ldconfig
|
||||
program.
|
||||
It should be statically
|
||||
linked, so it doesn't need any shared libraries by itself.
|
||||
It will create the file
|
||||
.Pa /emul/linux/etc/ld.so.cache
|
||||
You should rerun the Linux version of
|
||||
.Ic ldconfig
|
||||
each time you add a new shared library.
|
||||
.Pp
|
||||
You should now be set up for Linux binaries which only need
|
||||
a shared libc.
|
||||
You can test this by running the Linux
|
||||
.Ic ldd
|
||||
on itself.
|
||||
Suppose that you have it installed as
|
||||
.Ic ldd-linux ,
|
||||
it should produce something like:
|
||||
.Pp
|
||||
.Bl -tag -width 123 -compact -offset indent
|
||||
.It (me@netbsd) ldd-linux `which ldd-linux`
|
||||
libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29
|
||||
.El
|
||||
.Pp
|
||||
This being done, you are ready to install new Linux binaries.
|
||||
Whenever you install a new Linux program, you should check
|
||||
if it needs shared libraries, and if so, whether you have
|
||||
them installed in the
|
||||
.Pa /emul/linux
|
||||
tree.
|
||||
To do this, you run the Linux
|
||||
.Ic ldd
|
||||
on the new program, and watch its output.
|
||||
.Ic ldd
|
||||
(see also the manual page for
|
||||
.Xr ldd 1 )
|
||||
will print a list
|
||||
of shared libraries that the program depends on, in the
|
||||
form
|
||||
.Aq majorname
|
||||
.Pq Aq jumpversion
|
||||
=>
|
||||
.Aq fullname .
|
||||
.Pp
|
||||
If it prints
|
||||
.Dq not found
|
||||
instead of
|
||||
.Aq fullname
|
||||
it means that you need an extra library.
|
||||
Which library this is, is shown in
|
||||
.Aq majorname ,
|
||||
which will be of the form libXXXX.so.<N>
|
||||
You will need to find a libXXXX.so.<N>.<mm> on a
|
||||
Linux ftp site, and install it on your system.
|
||||
The XXXX (name) and
|
||||
.Aq N
|
||||
(major revision number) should match; the minor number(s)
|
||||
.Aq mm
|
||||
are less important, though it is advised to take the most recent version.
|
||||
.It
|
||||
Set up linux specific devices:
|
||||
.Pp
|
||||
.Bl -tag -width 123 -compact -offset indent
|
||||
.It (me@netbsd) cd /usr/share/examples/emul/linux/etc
|
||||
.br
|
||||
.It (me@netbsd) cp LINUX_MAKEDEV /emul/linux/dev
|
||||
.br
|
||||
.It (me@netbsd) cd /emul/linux/dev && sh LINUX_MAKEDEV all
|
||||
.El
|
||||
.El
|
||||
Otherwise, you may have to obtain shared libraries from another Linux
|
||||
system, and copy them to e.g.
|
||||
.Pa /emul/linux/lib64 .
|
||||
.Ss Setting up procfs
|
||||
Some Linux binaries expect procfs to be mounted and that it would
|
||||
contain some Linux specific stuff.
|
||||
Some Linux binaries expect procfs to be mounted and that it
|
||||
contains some Linux-specific extensions.
|
||||
If it's not the case, they behave unexpectedly or even crash.
|
||||
.Pp
|
||||
Mount procfs on
|
||||
.Nx
|
||||
using following command:
|
||||
.Bl -tag -width 123 -offset indent
|
||||
.It (me@netbsd) mount_procfs -o linux procfs /emul/linux/proc
|
||||
.It $ mount_procfs -o linux procfs /emul/linux/proc
|
||||
.El
|
||||
.Pp
|
||||
You can also set up your system so that procfs is mounted automatically
|
||||
|
@ -396,158 +184,30 @@ Newer version of Linux use
|
|||
for network information, such as NIS and DNS.
|
||||
You must create or get a valid copy of this file and put it in
|
||||
.Pa /emul/linux/etc .
|
||||
.Ss Finding the necessary files
|
||||
.Em Note :
|
||||
the information below is valid as of the time this
|
||||
document was first written (March, 1995), but certain details
|
||||
such as names of ftp sites, directories and distribution names
|
||||
may have changed by the time you read this.
|
||||
.Pp
|
||||
Linux is distributed by several groups that make their own set
|
||||
of binaries that they distribute.
|
||||
Each distribution has its own name, like
|
||||
.Dq Slackware
|
||||
or
|
||||
.Dq Yggdrasil .
|
||||
The distributions are
|
||||
available on a lot of ftp sites.
|
||||
Sometimes the files are unpacked,
|
||||
and you can get the individual files you need, but mostly they
|
||||
are stored in distribution sets, usually consisting of subdirectories
|
||||
with gzipped tar files in them.
|
||||
The primary ftp sites for the distributions are:
|
||||
.Bl -item -compact -offset indent
|
||||
.It
|
||||
.Pa sunsite.unc.edu:/pub/Linux/distributions
|
||||
.It
|
||||
.Pa tsx-11.mit.edu:/pub/linux/distributions
|
||||
.El
|
||||
.Pp
|
||||
Some European mirrors:
|
||||
.Bl -item -compact -offset indent
|
||||
.It
|
||||
.Pa ftp.luth.se:/pub/linux/distributions
|
||||
.It
|
||||
.Pa ftp.demon.co.uk:/pub/linux/distributions
|
||||
.It
|
||||
.Pa src.doc.ic.ac.uk:/packages/linux/distributions
|
||||
.El
|
||||
.Pp
|
||||
For simplicity, let's concentrate on Slackware here.
|
||||
This distribution
|
||||
consists of a number of subdirectories, containing separate packages.
|
||||
Normally, they're controlled by an install program, but you can
|
||||
retrieve files
|
||||
.Dq by hand
|
||||
too.
|
||||
First of all, you will need to look in the
|
||||
.Pa contents
|
||||
subdir of the distribution.
|
||||
You will find a lot of small textfiles here describing the contents of
|
||||
the separate packages.
|
||||
The fastest way to look something up is to retrieve all the files in the
|
||||
contents subdirectory, and grep through them for the file you need.
|
||||
Here is an example of a list of files that you might need, and
|
||||
in which contents-file you will find it by grepping through them:
|
||||
.Bd -literal -offset indent
|
||||
Needed Package
|
||||
|
||||
ld.so ldso
|
||||
ldconfig ldso
|
||||
ldd ldso
|
||||
libc.so.4 shlibs
|
||||
libX11.so.6.0 xf_lib
|
||||
libXt.so.6.0 xf_lib
|
||||
libX11.so.3 oldlibs
|
||||
libXt.so.3 oldlibs
|
||||
.Ed
|
||||
.Pp
|
||||
So, in this case, you will need the packages ldso, shlibs, xf_lib and oldlibs.
|
||||
In each of the contents-files for these packages, look for a line saying
|
||||
.Dq PACKAGE LOCATION ,
|
||||
it will tell you on which
|
||||
.Sq disk
|
||||
the package is,
|
||||
in our case it will tell us in which subdirectory we need to look.
|
||||
For our example, we would find the following locations:
|
||||
.Bd -literal -offset indent
|
||||
Package Location
|
||||
|
||||
ldso diska2
|
||||
shlibs diska2
|
||||
oldlibs diskx6
|
||||
xf_lib diskx9
|
||||
.Ed
|
||||
.Pp
|
||||
The locations called
|
||||
.Pa diskXX
|
||||
refer to the
|
||||
.Pa slakware/XX
|
||||
subdirectories
|
||||
of the distribution, others may be found in the
|
||||
.Pa contrib
|
||||
subdirectory.
|
||||
In this case, we could now retrieve the packages we need by retrieving
|
||||
the following files (relative to the root of the Slackware distribution
|
||||
tree):
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa slakware/a2/ldso.tgz
|
||||
.It
|
||||
.Pa slakware/a2/shlibs.tgz
|
||||
.It
|
||||
.Pa slakware/x6/oldlibs/tgz
|
||||
.It
|
||||
.Pa slakware/x9/xf_lib.tgz
|
||||
.El
|
||||
.Pp
|
||||
Extract the files from these gzipped tarfiles in your /emul/linux directory
|
||||
(possibly omitting or afterwards removing files you don't need), and you
|
||||
are done.
|
||||
.Ss Programs using SVGAlib
|
||||
SVGAlib binaries require some extra care.
|
||||
You need to have
|
||||
.Cd options WSDISPLAY_COMPAT_USL
|
||||
in your kernel (see
|
||||
.Xr wscons 4 ) ,
|
||||
and you will also have to create
|
||||
some symbolic links in the
|
||||
.Pa /emul/linux/dev
|
||||
directory, namely:
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Pa /emul/linux/dev/console
|
||||
->
|
||||
.Pa /dev/tty
|
||||
.It
|
||||
.Pa /emul/linux/dev/mouse
|
||||
-> whatever device your mouse is connected to
|
||||
.It
|
||||
.Pa /emul/linux/dev/ttyS0
|
||||
->
|
||||
.Pa /dev/tty00
|
||||
.It
|
||||
.Pa /emul/linux/dev/ttyS1
|
||||
->
|
||||
.Pa /dev/tty01
|
||||
.El
|
||||
.Pp
|
||||
Be warned: the first link mentioned here makes SVGAlib binaries
|
||||
work, but may confuse others, so you may have to remove it again at
|
||||
some point.
|
||||
.Sh CAVEATS
|
||||
When using a modular kernel (see
|
||||
.Nm
|
||||
is generally not enabled in
|
||||
.Dv GENERIC
|
||||
kernels for secuity reasons,
|
||||
but is available as a module.
|
||||
It must be added to
|
||||
.Xr modules.conf 5
|
||||
to be used.
|
||||
.Pp
|
||||
When using a
|
||||
.Dv MODULAR
|
||||
kernel (see
|
||||
.Xr module 7 ) ,
|
||||
the linux and linux32 emulations are not activated automatically (for
|
||||
security reasons).
|
||||
To activate the emulation, set the appropriate
|
||||
.Xr sysctl 8 Ap s :
|
||||
binary compatibility is not activated automatically.
|
||||
To activate it, set the appropriate
|
||||
.Xr sysctl 8
|
||||
variables:
|
||||
.Bd -literal
|
||||
sysctl -w emul.linux.enabled=1
|
||||
sysctl -w emul.linux32.enabled=1
|
||||
.Ed
|
||||
.Sh BUGS
|
||||
The information about Linux distributions may become outdated.
|
||||
The information about Linux distributions will become outdated.
|
||||
.Pp
|
||||
Absolute pathnames pointed to by symbolic links are only looked up in the
|
||||
shadow root when the symbolic link itself was found by an absolute
|
||||
|
|
Loading…
Reference in New Issue