Joined: 06 May 2002
|Posted: Fri Sep 19, 2003 7:21 pm Post subject: Howto use the "Kernel support for MISC binaries" w
Wine is such a nice tool. It finally allows me to run Photoshop 7 (Screenshot) (and some windoze Games that are not available in a Linux version) on my Linux workstation. But if one wants to run some Windows program with it, one always had to run it like "wine /path/to/program.exe" and if one runs windows programs (like Photoshop or even Counterstrike) with wine very often this procedure is getting quiet anoying.
To run those programs more quickly, one often creates a shellscript or an alias so the program can be run with just one command instead of running the commandline above. But if you have many tools this method also gets quite anoying, but there is an even better alternative :)
How about running Photoshop and any other Windowsprogram just by typing just Photoshop.exe? The following Tutorial shows you how to get it running with Linux 2.6.
Note: The same procedure might apply to older Kernels too, but as i don't have any of them running, i have no easy way to verify this.
Requirements: You need a flavor of wine installed to get this Windows example working.
If you've compiled a Linux Kernel yourself, you've probably noticed the "Executable file formats" submenu in menuconfig with this "Kernel support for MISC binaries" and you've probably left it enabled as it is by default.
To check if you have it enabled just run the following command:
|grep binfmt_misc < /proc/filesystems |
If this results in a line saying "nodev binfmt_misc" then you're ready to go to step two. Otherwise, you have to recompile your kernel and make sure that you have the CONFIG_BINFMT_MISC option enabled (Executable file formats -> Kernel support for MISC binaries). Don't forget to install the kernel properly and reboot.
Now run the following command
|echo 'binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0' >> /etc/fstab |
or open the /etc/fstab file with your favorite editor and add the line
|binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0 |
by hand - just make sure it gets mounted AFTER proc has been mounted.
|mount /proc/sys/fs/binfmt_misc |
Open /etc/conf.d/local.start with your favorite editor and add the following two lines:
|# Enable support for Windows / DOS binaries by running them automatically with wine
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
and then either run the local.start script or just type the following line again at the shell.
|echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register |
This makes it work imediately without rebooting. Now you just give those *.exe files you want to run the executable bit (chmod +x stupid.exe).
Lazy folks like me also might want to add the directories containing the Windows binaries into PATH environment variable ... for convenience i added this to my ~/.bashrc
|# Windows programs locations
The "Kernel support for MISC binaries" really supports all kind of "binaries" even if they are not technically "executable" binaries. For example you can have native support for Java binaries, MP3 files or whatever as long they get the executable bit. A good example besides Java applets are C64 floppy images (*.d64), which when made executeable could be automatically started with an assigned C64 emulator. There is a good example for Java binaries in /usr/src/linux/Documentation/java.txt how to get this working with Java binaries. The official Documentation for the "Kernel support for MISC binaries" is located in /usr/src/linux/Documentation/binfmt_misc.txt.
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)