Back to home page

OSCL-LXR

 
 

    


0001 Mono(tm) Binary Kernel Support for Linux
0002 -----------------------------------------
0003 
0004 To configure Linux to automatically execute Mono-based .NET binaries
0005 (in the form of .exe files) without the need to use the mono CLR
0006 wrapper, you can use the BINFMT_MISC kernel support.
0007 
0008 This will allow you to execute Mono-based .NET binaries just like any
0009 other program after you have done the following:
0010 
0011 1) You MUST FIRST install the Mono CLR support, either by downloading
0012    a binary package, a source tarball or by installing from Git. Binary
0013    packages for several distributions can be found at:
0014 
0015         https://www.mono-project.com/download/
0016 
0017    Instructions for compiling Mono can be found at:
0018 
0019         https://www.mono-project.com/docs/compiling-mono/linux/
0020 
0021    Once the Mono CLR support has been installed, just check that
0022    ``/usr/bin/mono`` (which could be located elsewhere, for example
0023    ``/usr/local/bin/mono``) is working.
0024 
0025 2) You have to compile BINFMT_MISC either as a module or into
0026    the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.
0027    If you choose to compile it as a module, you will have
0028    to insert it manually with modprobe/insmod, as kmod
0029    cannot be easily supported with binfmt_misc.
0030    Read the file ``binfmt_misc.txt`` in this directory to know
0031    more about the configuration process.
0032 
0033 3) Add the following entries to ``/etc/rc.local`` or similar script
0034    to be run at system startup:
0035 
0036    .. code-block:: sh
0037 
0038     # Insert BINFMT_MISC module into the kernel
0039     if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
0040         /sbin/modprobe binfmt_misc
0041         # Some distributions, like Fedora Core, perform
0042         # the following command automatically when the
0043         # binfmt_misc module is loaded into the kernel
0044         # or during normal boot up (systemd-based systems).
0045         # Thus, it is possible that the following line
0046         # is not needed at all.
0047         mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
0048     fi
0049 
0050     # Register support for .NET CLR binaries
0051     if [ -e /proc/sys/fs/binfmt_misc/register ]; then
0052         # Replace /usr/bin/mono with the correct pathname to
0053         # the Mono CLR runtime (usually /usr/local/bin/mono
0054         # when compiling from sources or CVS).
0055         echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
0056     else
0057         echo "No binfmt_misc support"
0058         exit 1
0059     fi
0060 
0061 4) Check that ``.exe`` binaries can be ran without the need of a
0062    wrapper script, simply by launching the ``.exe`` file directly
0063    from a command prompt, for example::
0064 
0065         /usr/bin/xsd.exe
0066 
0067    .. note::
0068 
0069       If this fails with a permission denied error, check
0070       that the ``.exe`` file has execute permissions.