[Mono-docs-list] Question about EXE binaries and kernels?

Felipe Alfaro Solana felipe_alfaro@linuxmail.org
Tue, 06 Apr 2004 23:31:33 +0200


On Tue, 2004-04-06 at 22:48, Aaron Weber wrote:
> Is the following true? If so, what does it mean-- what will happen if
> I fail to "make the EXE binaries compatible with the kernel?"

You don't make EXE's compatible with the kernel. Instead, you instruct
the kernel to use a wrapper ELF (native) binary to bootstrap (launch)
the EXE program.

That's what BINFMT is for: while trying to launch an EXE, the kernel
detects the file signature is not a native one, looks the BINFMT
registered formats and tries to look for a match. If a match is found,
the corresponding bootstraper native binary is used to launch the
non-native program.

BINFMT can also used to launch EXE files using WINE or .class files
using the JVM.

> You can make your mono .exe files executable by following these steps:
> 
>      1. Enabling binfmt in your kernel. 

This adds support to launch non-native binaries using a bootstrap
loader.

>      1. Adding the line below to your fstab: 
>         binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none

Needed to configure BINFMT support.

>      1. On boot run the command below: 
>         echo ':CLR:M::MZ::/usr/bin/mono:' >
>         /proc/sys/fs/binfmt_misc/register

This adds a new executable format for EXE files. Thus, the next time you
launch a file whose signature matches the "MZ" signature of an EXE file,
/usr/bin/mono will be used to bootstrap the EXE program.