Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto use the "Kernel support for MISC binaries" w
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Fri Sep 19, 2003 7:23 pm    Post subject: Howto use the "Kernel support for MISC binaries" w Reply with quote

Introduction
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.

Step 1.
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:
Code:
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.

Step 2.
Now run the following command
Code:
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
Code:
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.

Step 3.
Just type
Code:
mount /proc/sys/fs/binfmt_misc


Step 4.
Open /etc/conf.d/local.start with your favorite editor and add the following two lines:
Code:
# 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.
Code:
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).

Step 5.
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
Code:
# Windows programs locations
WINE=~/.wine/fake_windows/Program\ Files
PATH=$PATH:$WINE/Adobe/Photoshop
PATH=$PATH:$WINE/Halflife
export PATH


The End
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)
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Mon Jun 05, 2017 3:36 am    Post subject: Reply with quote

Moved from Documentation, Tips & Tricks to Duplicate Threads in, perhaps belated, deference to "Howto use the "Kernel support for MISC binaries" w".
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum