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