Blame view

Documentation/admin-guide/mono.rst 2.55 KB
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
1
2
  Mono(tm) Binary Kernel Support for Linux
  -----------------------------------------
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
5
6
7
8
9
10
11
  
  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
51e028e44   Jonathan Neuschäfer   Documentation: mo...
12
     a binary package, a source tarball or by installing from Git. Binary
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
     packages for several distributions can be found at:
93431e060   Alexander A. Klimov   Replace HTTP link...
14
  	https://www.mono-project.com/download/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
  
     Instructions for compiling Mono can be found at:
93431e060   Alexander A. Klimov   Replace HTTP link...
17
  	https://www.mono-project.com/docs/compiling-mono/linux/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
  
     Once the Mono CLR support has been installed, just check that
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
20
21
     ``/usr/bin/mono`` (which could be located elsewhere, for example
     ``/usr/local/bin/mono``) is working.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
  
  2) You have to compile BINFMT_MISC either as a module or into
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
24
     the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
     If you choose to compile it as a module, you will have
     to insert it manually with modprobe/insmod, as kmod
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
27
28
     cannot be easily supported with binfmt_misc.
     Read the file ``binfmt_misc.txt`` in this directory to know
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
     more about the configuration process.
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
30
  3) Add the following entries to ``/etc/rc.local`` or similar script
07a37ba58   Jani Nikula   Documentation/adm...
31
32
33
     to be run at system startup:
  
     .. code-block:: sh
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34

9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
35
36
      # Insert BINFMT_MISC module into the kernel
      if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
          /sbin/modprobe binfmt_misc
  	# Some distributions, like Fedora Core, perform
  	# the following command automatically when the
970e24864   Lucas De Marchi   Documentation: re...
40
41
  	# binfmt_misc module is loaded into the kernel
  	# or during normal boot up (systemd-based systems).
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
  	# Thus, it is possible that the following line
970e24864   Lucas De Marchi   Documentation: re...
43
44
  	# is not needed at all.
  	mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
45
      fi
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46

9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
47
48
      # Register support for .NET CLR binaries
      if [ -e /proc/sys/fs/binfmt_misc/register ]; then
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
51
52
  	# 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
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
53
      else
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
          echo "No binfmt_misc support"
          exit 1
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
56
      fi
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57

9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
58
59
60
  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::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
  
  	/usr/bin/xsd.exe
9cdda3d23   Mauro Carvalho Chehab   Documentation/mon...
63
64
65
66
     .. note::
  
        If this fails with a permission denied error, check
        that the ``.exe`` file has execute permissions.