71 lines · plain
1Mono(tm) Binary Kernel Support for Linux2-----------------------------------------3 4To configure Linux to automatically execute Mono-based .NET binaries5(in the form of .exe files) without the need to use the mono CLR6wrapper, you can use the BINFMT_MISC kernel support.7 8This will allow you to execute Mono-based .NET binaries just like any9other program after you have done the following:10 111) You MUST FIRST install the Mono CLR support, either by downloading12 a binary package, a source tarball or by installing from Git. Binary13 packages for several distributions can be found at:14 15 https://www.mono-project.com/download/16 17 Instructions for compiling Mono can be found at:18 19 https://www.mono-project.com/docs/compiling-mono/linux/20 21 Once the Mono CLR support has been installed, just check that22 ``/usr/bin/mono`` (which could be located elsewhere, for example23 ``/usr/local/bin/mono``) is working.24 252) You have to compile BINFMT_MISC either as a module or into26 the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.27 If you choose to compile it as a module, you will have28 to insert it manually with modprobe/insmod, as kmod29 cannot be easily supported with binfmt_misc.30 Read the file ``binfmt_misc.txt`` in this directory to know31 more about the configuration process.32 333) Add the following entries to ``/etc/rc.local`` or similar script34 to be run at system startup:35 36 .. code-block:: sh37 38 # Insert BINFMT_MISC module into the kernel39 if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then40 /sbin/modprobe binfmt_misc41 # Some distributions, like Fedora Core, perform42 # the following command automatically when the43 # binfmt_misc module is loaded into the kernel44 # or during normal boot up (systemd-based systems).45 # Thus, it is possible that the following line46 # is not needed at all.47 mount -t binfmt_misc none /proc/sys/fs/binfmt_misc48 fi49 50 # Register support for .NET CLR binaries51 if [ -e /proc/sys/fs/binfmt_misc/register ]; then52 # Replace /usr/bin/mono with the correct pathname to53 # the Mono CLR runtime (usually /usr/local/bin/mono54 # when compiling from sources or CVS).55 echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register56 else57 echo "No binfmt_misc support"58 exit 159 fi60 614) Check that ``.exe`` binaries can be ran without the need of a62 wrapper script, simply by launching the ``.exe`` file directly63 from a command prompt, for example::64 65 /usr/bin/xsd.exe66 67 .. note::68 69 If this fails with a permission denied error, check70 that the ``.exe`` file has execute permissions.71