| You are no longer restricted to native executable file formats (ELF,
a.out, etc), in
Linux. With kernel 2.2 onwards, there’s support for multiple file formats, that is,
you can make the kernel recognize any file format provided you’ve an interpreter for
it. These files can then be run just by typing their name at the prompt, like any pure
executable. You could, for instance, associate all text files with the vi editor.
Whenever you type the name of a text file on the shell prompt, the vi editor will
automatically load with this file.
History
Around the time of kernel 2.0 (yes, in Linux circles, you can use kernel version
numbers instead of dates as a new update comes up practically every day), the kernel had
binary support for Java classes. You had to tell the kernel in which directory the Java
runtime environment resided, and from then on you could run a Java class file right off
the shell prompt, just by typing its name instead of "java filename".
If this could be done with Java, why not with other file formats? It was a simple
generalization, and by kernel 2.2, they had "miscellaneous binary format
support". Just tell the kernel what interpreter to run for which binary (such as, the
Java runtime for Java class files), and you could add support for countless binary
formats. And since you are specifying the interpreter, it is not even necessary that the
file "run" as a binary does. It can even be something simpler like viewing text
files in an editor, in which case the editor would be specified as the interpreter.
Getting the kernel ready
To use this feature, you need a kernel with support for miscellaneous binaries. To
check if your kernel already has miscellaneous binary support compiled in, type "%
cat /proc/sys/fs/binfmt_misc/status".
If the file has the word "enabled", then your kernel does have support for
miscellaneous binaries. Otherwise, you’ll have to get the 2.2 kernel source
(it’s available on the March PCQ CD) and recompile the kernel, this time making sure
that "kernel support for MISC binaries" under "General setup" is
selected.
| Running DOS and Windows files in Linux If you have WINE (a Windows
emulator for *nix) installed, you can
register Windows executables
as a file type in Linux. These files then run seamlessly—right off the prompt.
We’ll use magic numbers
for identification. The magic number for EXE files is the string, MZ. To register it,
type:
% cd /proc/sys/fs/binfmt_misc
% echo
‘:DOSWin:M::MZ::/usr/local/bin/wine:’ > register
That’s it. So if you have Windows
Solitaire, go ahead and run sol.exe! |
Page(s) 1 2 3 | |