2016-09-24 00:52:05 +08:00
|
|
|
Mono(tm) Binary Kernel Support for Linux
|
|
|
|
-----------------------------------------
|
2005-04-17 06:20:36 +08: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-10 00:21:04 +08:00
|
|
|
a binary package, a source tarball or by installing from Git. Binary
|
2005-04-17 06:20:36 +08:00
|
|
|
packages for several distributions can be found at:
|
|
|
|
|
2017-12-10 00:21:04 +08:00
|
|
|
http://www.mono-project.com/download/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
Instructions for compiling Mono can be found at:
|
|
|
|
|
2017-12-10 00:21:04 +08:00
|
|
|
http://www.mono-project.com/docs/compiling-mono/linux/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
Once the Mono CLR support has been installed, just check that
|
2016-09-24 00:52:05 +08:00
|
|
|
``/usr/bin/mono`` (which could be located elsewhere, for example
|
|
|
|
``/usr/local/bin/mono``) is working.
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
2) You have to compile BINFMT_MISC either as a module or into
|
2016-09-24 00:52:05 +08:00
|
|
|
the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.
|
2005-04-17 06:20:36 +08:00
|
|
|
If you choose to compile it as a module, you will have
|
|
|
|
to insert it manually with modprobe/insmod, as kmod
|
2016-09-24 00:52:05 +08:00
|
|
|
cannot be easily supported with binfmt_misc.
|
|
|
|
Read the file ``binfmt_misc.txt`` in this directory to know
|
2005-04-17 06:20:36 +08:00
|
|
|
more about the configuration process.
|
|
|
|
|
2016-09-24 00:52:05 +08:00
|
|
|
3) Add the following entries to ``/etc/rc.local`` or similar script
|
2016-11-03 17:43:29 +08:00
|
|
|
to be run at system startup:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-09-24 00:52:05 +08:00
|
|
|
# Insert BINFMT_MISC module into the kernel
|
|
|
|
if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
2005-04-17 06:20:36 +08:00
|
|
|
/sbin/modprobe binfmt_misc
|
|
|
|
# Some distributions, like Fedora Core, perform
|
|
|
|
# the following command automatically when the
|
2012-03-31 04:37:16 +08:00
|
|
|
# binfmt_misc module is loaded into the kernel
|
|
|
|
# or during normal boot up (systemd-based systems).
|
2005-04-17 06:20:36 +08:00
|
|
|
# Thus, it is possible that the following line
|
2012-03-31 04:37:16 +08:00
|
|
|
# is not needed at all.
|
|
|
|
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
2016-09-24 00:52:05 +08:00
|
|
|
fi
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-09-24 00:52:05 +08:00
|
|
|
# Register support for .NET CLR binaries
|
|
|
|
if [ -e /proc/sys/fs/binfmt_misc/register ]; then
|
2005-04-17 06:20:36 +08: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-24 00:52:05 +08:00
|
|
|
else
|
2005-04-17 06:20:36 +08:00
|
|
|
echo "No binfmt_misc support"
|
|
|
|
exit 1
|
2016-09-24 00:52:05 +08:00
|
|
|
fi
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-09-24 00:52:05 +08: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 06:20:36 +08:00
|
|
|
|
|
|
|
/usr/bin/xsd.exe
|
|
|
|
|
2016-09-24 00:52:05 +08:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
If this fails with a permission denied error, check
|
|
|
|
that the ``.exe`` file has execute permissions.
|