2016-09-23 19:52:05 +03:00
|
|
|
Mono(tm) Binary Kernel Support for Linux
|
|
|
|
-----------------------------------------
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
To configure Linux to automatically execute Mono-based .NET binaries
|
|
|
|
(in the form of .exe files) without the need to use the mono CLR
|
|
|
|
wrapper, you can use the BINFMT_MISC kernel support.
|
|
|
|
|
|
|
|
This will allow you to execute Mono-based .NET binaries just like any
|
|
|
|
other program after you have done the following:
|
|
|
|
|
|
|
|
1) You MUST FIRST install the Mono CLR support, either by downloading
|
2017-12-09 19:21:04 +03:00
|
|
|
a binary package, a source tarball or by installing from Git. Binary
|
2005-04-17 02:20:36 +04:00
|
|
|
packages for several distributions can be found at:
|
|
|
|
|
2020-05-26 09:05:44 +03:00
|
|
|
https://www.mono-project.com/download/
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
Instructions for compiling Mono can be found at:
|
|
|
|
|
2020-05-26 09:05:44 +03:00
|
|
|
https://www.mono-project.com/docs/compiling-mono/linux/
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
Once the Mono CLR support has been installed, just check that
|
2016-09-23 19:52:05 +03:00
|
|
|
``/usr/bin/mono`` (which could be located elsewhere, for example
|
|
|
|
``/usr/local/bin/mono``) is working.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
2) You have to compile BINFMT_MISC either as a module or into
|
2016-09-23 19:52:05 +03:00
|
|
|
the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.
|
2005-04-17 02:20:36 +04:00
|
|
|
If you choose to compile it as a module, you will have
|
|
|
|
to insert it manually with modprobe/insmod, as kmod
|
2016-09-23 19:52:05 +03:00
|
|
|
cannot be easily supported with binfmt_misc.
|
|
|
|
Read the file ``binfmt_misc.txt`` in this directory to know
|
2005-04-17 02:20:36 +04:00
|
|
|
more about the configuration process.
|
|
|
|
|
2016-09-23 19:52:05 +03:00
|
|
|
3) Add the following entries to ``/etc/rc.local`` or similar script
|
2016-11-03 12:43:29 +03:00
|
|
|
to be run at system startup:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2016-09-23 19:52:05 +03:00
|
|
|
# Insert BINFMT_MISC module into the kernel
|
|
|
|
if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
2005-04-17 02:20:36 +04:00
|
|
|
/sbin/modprobe binfmt_misc
|
|
|
|
# Some distributions, like Fedora Core, perform
|
|
|
|
# the following command automatically when the
|
2012-03-31 00:37:16 +04:00
|
|
|
# binfmt_misc module is loaded into the kernel
|
|
|
|
# or during normal boot up (systemd-based systems).
|
2005-04-17 02:20:36 +04:00
|
|
|
# Thus, it is possible that the following line
|
2012-03-31 00:37:16 +04:00
|
|
|
# is not needed at all.
|
|
|
|
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
2016-09-23 19:52:05 +03:00
|
|
|
fi
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2016-09-23 19:52:05 +03:00
|
|
|
# Register support for .NET CLR binaries
|
|
|
|
if [ -e /proc/sys/fs/binfmt_misc/register ]; then
|
2005-04-17 02:20:36 +04:00
|
|
|
# Replace /usr/bin/mono with the correct pathname to
|
|
|
|
# the Mono CLR runtime (usually /usr/local/bin/mono
|
|
|
|
# when compiling from sources or CVS).
|
|
|
|
echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
|
2016-09-23 19:52:05 +03:00
|
|
|
else
|
2005-04-17 02:20:36 +04:00
|
|
|
echo "No binfmt_misc support"
|
|
|
|
exit 1
|
2016-09-23 19:52:05 +03:00
|
|
|
fi
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2016-09-23 19:52:05 +03:00
|
|
|
4) Check that ``.exe`` binaries can be ran without the need of a
|
|
|
|
wrapper script, simply by launching the ``.exe`` file directly
|
|
|
|
from a command prompt, for example::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/usr/bin/xsd.exe
|
|
|
|
|
2016-09-23 19:52:05 +03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
If this fails with a permission denied error, check
|
|
|
|
that the ``.exe`` file has execute permissions.
|