.\" $OpenBSD: compat_linux.8,v 1.47 2014/02/17 21:06:31 juanfra Exp $ .\" $NetBSD: compat_linux.8,v 1.2 1995/10/16 20:17:59 fvdl Exp $ .\" .\" Copyright (c) 1995 Frank van der Linden .\" 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. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed for the NetBSD Project .\" by Frank van der Linden .\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" 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. .\" .Dd $Mdocdate: February 17 2014 $ .Dt COMPAT_LINUX 8 .Os .Sh NAME .Nm compat_linux .Nd setup for running Linux binaries under emulation .Sh DESCRIPTION .Ox supports running Linux binaries. This only applies to i386 systems and the ELF binary format. Most programs should work, including the ones that use the Linux SVGAlib. Additionally, OSS audio is emulated, so Linux binaries can access the native audio transparently. Programs that will not work include those that use i386-specific calls, such as enabling virtual 8086 mode. .Pp The Linux compatibility feature is active for kernels compiled with the .Nm COMPAT_LINUX option and kern.emul.linux .Xr sysctl 8 enabled. .Pp A lot of programs are dynamically linked. This means that the Linux shared libraries that the programs depend on and the runtime linker are also needed. Additionally, a "shadow root" directory for Linux binaries on the .Ox system will have to be created. This directory is named .Pa /emul/linux . Any file operations done by Linux programs run under .Ox will look in this directory first. So, if a Linux program opens, for example, .Pa /etc/passwd , .Ox will first try to open .Pa /emul/linux/etc/passwd , and if that does not exist open the `real' .Pa /etc/passwd file. It is recommended that Linux packages that include configuration files, etc., be installed under .Pa /emul/linux , to avoid naming conflicts with possible .Ox counterparts. Shared libraries should also be installed in the shadow tree. .Ss Setting up shared libraries Run .Xr pkg_add 1 to install the fedora_base package from the emulators category. The fedora_base package contains the shared libraries, binaries, and other related files necessary to run Linux applications. .Ss Programs using SVGAlib SVGAlib binaries require some extra care. The pcvt virtual console driver has to be in the kernel for them to work, and some symbolic links in the .Pa /emul/linux/dev directory will have to be created, namely: .Bd -unfilled -offset indent /emul/linux/dev/console -> /dev/tty /emul/linux/dev/mouse -> whatever device the mouse is connected to /emul/linux/dev/ttyS0 -> /dev/tty00 /emul/linux/dev/ttyS1 -> /dev/tty01 .Ed .Pp Be warned: the first link mentioned here makes SVGAlib binaries work, but may confuse others, so it may be necessary to remove it again at some point. .Ss Programs using OSS (Linux) audio Only the DSP device is emulated, the following link should be created: .Pp .D1 /emul/linux/dev/dsp -> /dev/audio .Ss Other links Linux binaries may require CD-ROM support requires a link to the CD-ROM device, similar to: .Pp .D1 /emul/linux/dev/cdrom -> /dev/cd0a (first CD-ROM) .Ss File systems Many Linux binaries expect .Pa /proc to have procfs mounted on it. Some binaries will require it to be mounted using the .Fl o Ar linux option. .Sh BUGS .Nm is incomplete and currently only supported on the i386.