diff options
Diffstat (limited to 'Documentation/binfmt_misc.txt')
-rw-r--r-- | Documentation/binfmt_misc.txt | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Documentation/binfmt_misc.txt b/Documentation/binfmt_misc.txt index 35eec1284..0adcf7185 100644 --- a/Documentation/binfmt_misc.txt +++ b/Documentation/binfmt_misc.txt @@ -9,7 +9,7 @@ To achieve this you must tell binfmt_misc which interpreter has to be invoked with which binary. Binfmt_misc recognises the binary-type by matching some bytes at the beginning of the file with a magic byte sequence (masking out specified bits) you have supplied. Binfmt_misc can also recognise a filename extension -(aka .com) and optionally strip it off. +aka '.com' or '.exe'. To actually register a new binary type, you have to set up a string looking like :name:type:offset:magic:mask:interpreter: (where you can choose the ':' upon @@ -18,44 +18,46 @@ Here is what the fields mean: - 'name' is an identifier string. A new /proc file will be created with this name below /proc/sys/fs/binfmt_misc - 'type' is the type of recognition. Give 'M' for magic and 'E' for extension. - Give the corresponding lowercase letter to let binfmt_misc strip off the - filename extension. - 'offset' is the offset of the magic/mask in the file, counted in bytes. This defaults to 0 if you omit it (i.e. you write ':name:type::magic...') - 'magic' is the byte sequence binfmt_misc is matching for. The magic string may contain hex-encoded characters like \x0a or \xA4. In a shell environment you will have to write \\x0a to prevent the shell from eating your \. If you chose filename extension matching, this is the extension to be - recognised (the \x0a specials are not allowed). Extension matching is case - sensitive! + recognised (without the '.', the \x0a specials are not allowed). Extension + matching is case sensitive! - 'mask' is an (optional, defaults to all 0xff) mask. You can mask out some bits from matching by supplying a string like magic and as long as magic. The mask is anded with the byte sequence of the file. - 'interpreter' is the program that should be invoked with the binary as first argument (specify the full path) + There are some restrictions: - the whole register string may not exceed 255 characters - the magic must resist in the first 128 bytes of the file, i.e. offset+size(magic) has to be less than 128 - the interpreter string may not exceed 127 characters + You may want to add the binary formats in one of your /etc/rc scripts during boot-up. Read the manual of your init program to figure out how to do this right. +Think about the order of adding entries! Later added entries are matched first! + A few examples (assumed you are in /proc/sys/fs/binfmt_misc): - enable support for em86 (like binfmt_em86, for Alpha AXP only): - echo ":i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:" > register - echo ":i486:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:" > register + echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register + echo ':i486:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register - enable support for packed DOS applications (pre-configured dosemu hdimages): - echo ":DEXE:M::\x0eDEX::/usr/bin/dosexec:" > register + echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register - enable support for DOS/Windows executables (using mzloader and dosemu/wine): - echo ":DOSWin:M::MZ::/usr/sbin/mzloader:" > register - echo ":DOScom:E::com::/usr/sbin/mzloader:" > register - echo ":DOSexe:E::exe::/usr/sbin/mzloader:" > register + echo ':DOSWin:M::MZ::/usr/sbin/mzloader:' > register + echo ':DOScom:E::com::/usr/sbin/mzloader:' > register + echo ':DOSexe:E::exe::/usr/sbin/mzloader:' > register You can enable/disable binfmt_misc or one binary type by echoing 0 (to disable) @@ -71,11 +73,11 @@ Emulating binfmt_java: To emulate binfmt_java the following register-strings could be used: for compiled Java programs use - ":Java:M::\xca\xfe\xba\xbe::/usr/local/java/bin/javawrapper:" + ':Java:M::\xca\xfe\xba\xbe::/usr/local/java/bin/javawrapper:' for simple applet support use - ":Applet:E::html::/usr/local/java/bin/appletviewer:" + ':Applet:E::html::/usr/local/java/bin/appletviewer:' for more selective applet support (like binfmt_java) use - ":Applet:M::\<\!--applet::/usr/local/java/bin/appletviewer:" + ':Applet:M::<!--applet::/usr/local/java/bin/appletviewer:' Note, that for the more selective applet support you have to modify existing html-files to contain <!--applet--> in the first line to @@ -94,7 +96,7 @@ CLASS=$1 if [ -L "$1" ] ; then CLASS=`ls --color=no -l $1 | tr -s '\t ' ' ' | cut -d ' ' -f 11` fi -CLASSN=`basename $CLASS | sed s/\.class$//` +CLASSN=`basename $CLASS .class` CLASSP=`dirname $CLASS` FOO=$PATH |