1e6769554SRui Paulo.\" Copyright (c) 2000 Sheldon Hearn 2e6769554SRui Paulo.\" All rights reserved. 3e6769554SRui Paulo.\" 4e6769554SRui Paulo.\" Redistribution and use in source and binary forms, with or without 5e6769554SRui Paulo.\" modification, are permitted provided that the following conditions 6e6769554SRui Paulo.\" are met: 7e6769554SRui Paulo.\" 1. Redistributions of source code must retain the above copyright 8e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer. 9e6769554SRui Paulo.\" 2. Redistributions in binary form must reproduce the above copyright 10e6769554SRui Paulo.\" notice, this list of conditions and the following disclaimer in the 11e6769554SRui Paulo.\" documentation and/or other materials provided with the distribution. 12e6769554SRui Paulo.\" 13e6769554SRui Paulo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14e6769554SRui Paulo.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15e6769554SRui Paulo.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16e6769554SRui Paulo.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17e6769554SRui Paulo.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18e6769554SRui Paulo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19e6769554SRui Paulo.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20e6769554SRui Paulo.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21e6769554SRui Paulo.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22e6769554SRui Paulo.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23e6769554SRui Paulo.\" SUCH DAMAGE. 24e6769554SRui Paulo.\" 25e6769554SRui Paulo.\" $FreeBSD$ 26e6769554SRui Paulo.\" 2777d3337cSDmitry Chagin.Dd August 1, 2017 28c383d55bSGavin Atkinson.Dt LINUX 4 29e6769554SRui Paulo.Os 30e6769554SRui Paulo.Sh NAME 31e6769554SRui Paulo.Nm linux 32e6769554SRui Paulo.Nd Linux ABI support 33e6769554SRui Paulo.Sh SYNOPSIS 3439eb4bc6SBernhard SchmidtTo compile support for this ABI into an i386 kernel 35e6769554SRui Pauloplace the following line in your 36e6769554SRui Paulokernel configuration file: 37e6769554SRui Paulo.Bd -ragged -offset indent 38e6769554SRui Paulo.Cd "options COMPAT_LINUX" 39e6769554SRui Paulo.Ed 40e6769554SRui Paulo.Pp 4139eb4bc6SBernhard Schmidtfor an amd64 kernel use: 4239eb4bc6SBernhard Schmidt.Bd -ragged -offset indent 4339eb4bc6SBernhard Schmidt.Cd "options COMPAT_LINUX32" 4439eb4bc6SBernhard Schmidt.Ed 4539eb4bc6SBernhard Schmidt.Pp 46e6769554SRui PauloAlternatively, to load the ABI as a 47e6769554SRui Paulomodule at boot time, place the following line in 48e6769554SRui Paulo.Xr loader.conf 5 : 49e6769554SRui Paulo.Bd -literal -offset indent 50e6769554SRui Paulolinux_load="YES" 51e6769554SRui Paulo.Ed 52e6769554SRui Paulo.Sh DESCRIPTION 53e6769554SRui PauloThe 54e6769554SRui Paulo.Nm 55e6769554SRui Paulomodule provides limited 56e6769554SRui PauloLinux ABI (application binary interface) compatibility 57e6769554SRui Paulofor userland applications. 58e6769554SRui PauloThe module provides the following significant facilities: 59e6769554SRui Paulo.Bl -bullet 60e6769554SRui Paulo.It 61e6769554SRui PauloAn image activator 62e6769554SRui Paulofor correctly branded 63e6769554SRui Paulo.Xr elf 5 64e6769554SRui Pauloexecutable images 65e6769554SRui Paulo.It 66e6769554SRui PauloSpecial signal handling for activated images 67e6769554SRui Paulo.It 68e6769554SRui PauloLinux to native system call translation 69e6769554SRui Paulo.El 70e6769554SRui Paulo.Pp 71e6769554SRui PauloIt is important to note that the Linux ABI support 72e6769554SRui Pauloit not provided through an emulator. 73e6769554SRui PauloRather, a true (albeit limited) ABI implementation is provided. 74e6769554SRui Paulo.Pp 75e6769554SRui PauloThe following 76e6769554SRui Paulo.Xr sysctl 8 77e6769554SRui Paulotunable variables are available: 78e6769554SRui Paulo.Bl -tag -width compat.linux.oss_version 79e6769554SRui Paulo.It compat.linux.osname 80e6769554SRui PauloLinux kernel operating system name. 81e6769554SRui Paulo.It compat.linux.osrelease 82e6769554SRui PauloLinux kernel operating system release. 83e6769554SRui PauloChanging this to something else is discouraged on non-development systems, 84e6769554SRui Paulobecause it may change the way Linux programs work. 85e6769554SRui PauloRecent versions of GNU libc are known to use different syscalls depending 86e6769554SRui Pauloon the value of this sysctl. 87e6769554SRui Paulo.It compat.linux.oss_version 88e6769554SRui PauloLinux Open Sound System version. 89e6769554SRui Paulo.El 90e6769554SRui Paulo.Pp 91e6769554SRui PauloThe 92e6769554SRui Paulo.Nm 93e6769554SRui Paulomodule can be linked into the kernel statically with the 94e6769554SRui Paulo.Dv COMPAT_LINUX 95e6769554SRui Paulokernel configuration option 96e6769554SRui Pauloor loaded as required. 97e6769554SRui PauloThe following command will load the module 98e6769554SRui Pauloif it is neither linked into the kernel 99e6769554SRui Paulonor already loaded as a module: 100e6769554SRui Paulo.Bd -literal -offset indent 101e6769554SRui Pauloif ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then 102e6769554SRui Paulo kldload linux > /dev/null 2>&1 103e6769554SRui Paulofi 104e6769554SRui Paulo.Ed 105e6769554SRui Paulo.Pp 106e6769554SRui PauloNote that dynamically linked Linux executables 107e6769554SRui Paulowill require a suitable environment in 108e6769554SRui Paulo.Pa /compat/linux . 109e6769554SRui PauloSpecifically, the Linux run-time linker's hints files 110e6769554SRui Pauloshould be correctly initialized. 111e6769554SRui PauloFor this reason, it is common to execute the following commands 112e6769554SRui Pauloto prepare the system to correctly run Linux executables: 113e6769554SRui Paulo.Bd -literal -offset indent 114e6769554SRui Pauloif [ -x /compat/linux/sbin/ldconfig ]; then 115e6769554SRui Paulo /compat/linux/sbin/ldconfig -r /compat/linux 116e6769554SRui Paulofi 117e6769554SRui Paulo.Ed 118e6769554SRui Paulo.Pp 119e6769554SRui PauloFor information on loading the 120e6769554SRui Paulo.Nm 121e6769554SRui Paulokernel loadable module automatically on system startup, 122e6769554SRui Paulosee 123e6769554SRui Paulo.Xr rc.conf 5 . 124e6769554SRui PauloThis information applies 125e6769554SRui Pauloregardless of whether the 126e6769554SRui Paulo.Nm 127e6769554SRui Paulomodule is statically linked into the kernel 128e6769554SRui Pauloor loaded as a module. 129e6769554SRui Paulo.Sh FILES 13077d3337cSDmitry Chagin.Bl -tag -width /compat/linux/dev/fd -compact 131e6769554SRui Paulo.It Pa /compat/linux 132e6769554SRui Paulominimal Linux run-time environment 13377d3337cSDmitry Chagin.It Pa /compat/linux/dev/fd 13477d3337cSDmitry Chaginlimited Linux file-descriptor file system 135e6769554SRui Paulo.It Pa /compat/linux/proc 136e6769554SRui Paulolimited Linux process file system 137e6769554SRui Paulo.It Pa /compat/linux/sys 138e6769554SRui Paulolimited Linux system file system 139e6769554SRui Paulo.El 140e6769554SRui Paulo.Sh SEE ALSO 141e6769554SRui Paulo.Xr brandelf 1 , 142*fd2ced61SEdward Tomasz Napierala.Xr pty 4 , 143e6769554SRui Paulo.Xr elf 5 , 14477d3337cSDmitry Chagin.Xr fdescfs 5 , 145e6769554SRui Paulo.Xr linprocfs 5 , 146e6769554SRui Paulo.Xr linsysfs 5 147e6769554SRui Paulo.Sh HISTORY 148e6769554SRui PauloLinux ABI support first appeared in 149e6769554SRui Paulo.Fx 2.1 . 150