Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"Kernel support for MISC binaries" & Wine
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Fri Sep 19, 2003 7:29 pm    Post subject: "Kernel support for MISC binaries" & Wine Reply with quote

Introduction
Wine is such a nice tool. It finally allows me to run Photoshop 7 (Screenshot) (and many 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, many people create weird shellscripts or aliases 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 is also quite anoying, but there is a 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 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)


Last edited by rojaro on Fri Aug 12, 2005 12:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
aLEczapKA
Apprentice
Apprentice


Joined: 13 Jun 2003
Posts: 192

PostPosted: Sat Sep 20, 2003 12:21 am    Post subject: Reply with quote

Great tutorial!

One remark: I had Photoshop under:
Code:
.wine/fake_windows/Program Files/Adobe/Photoshop 7.0

_________________
while true; do eject /dev/cdrom; eject -t /dev/cdrom; done
Back to top
View user's profile Send private message
TheWart
Guru
Guru


Joined: 10 May 2002
Posts: 432
Location: Nashville,TN - USA

PostPosted: Sat Sep 20, 2003 3:04 am    Post subject: Reply with quote

wow

Nice tutorial.....very helpful tip.
_________________
Face it, we are all noobs.

On the box it said it was designed for Win XP or better, so why won't it work with Linux?
Back to top
View user's profile Send private message
Ian
l33t
l33t


Joined: 28 Oct 2002
Posts: 834
Location: Somerville, MA

PostPosted: Sat Sep 20, 2003 5:10 pm    Post subject: Reply with quote

This would be great, if I could ever get WINE to work in the first place...
Back to top
View user's profile Send private message
Jamon
Apprentice
Apprentice


Joined: 03 May 2002
Posts: 173

PostPosted: Sat Sep 20, 2003 6:08 pm    Post subject: Reply with quote

Just to help others wondering, this does work exactly as specified under kernel 2.4.20-gaming-r5, and probably other 2.4 kernels as well. Great tutorial! Thanks for this great bit of insight!

Jamon
_________________
Looking for a Linux PC? Check us out at
http://www.progresssystemsinc.com!
Back to top
View user's profile Send private message
alsh
n00b
n00b


Joined: 21 Apr 2003
Posts: 60
Location: Glen Allen, VA

PostPosted: Sun Sep 21, 2003 3:59 am    Post subject: Reply with quote

I found this to be a very handy tip. I tend to use winex a lot to play a few certian games I can't seem to live without. Its a good way to save me time from my old method. Not to mention just cool in general :) I use a 2.6 kernel so it worked as specified. Thanks!
Back to top
View user's profile Send private message
aLEczapKA
Apprentice
Apprentice


Joined: 13 Jun 2003
Posts: 192

PostPosted: Sun Sep 21, 2003 12:24 pm    Post subject: Reply with quote

Ian wrote:
This would be great, if I could ever get WINE to work in the first place...


don't know what the problem is, but here you'll find tutorial on how to run Photoshop under wine
http://lindows.prodigydigital.com/tutorials/photoshop7.html

Maybe this help ya.
_________________
while true; do eject /dev/cdrom; eject -t /dev/cdrom; done
Back to top
View user's profile Send private message
TinheadNed
Guru
Guru


Joined: 05 Apr 2003
Posts: 339
Location: Farnborough, UK

PostPosted: Wed Sep 24, 2003 12:53 pm    Post subject: Other binaries? Reply with quote

I like being able to run windows binaries without specifically calling wine, I remember Redhat being able to do it with a specific wineserver script - presumably it was doing something like this. Very nice!

I'd like to look at adding more binary type support - how do I find the mask of the binary to recognise it? Or is it easier, say, to look by extensions, as binfmt_misc appears to allow you to do?

If anyone's interested, http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html is the link to the website for it, but it doesn't much more that isn't in the docs.
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Wed Sep 24, 2003 1:58 pm    Post subject: Re: Other binaries? Reply with quote

TinheadNed wrote:
I'd like to look at adding more binary type support - how do I find the mask of the binary to recognise it?

The "mask" are the so called "magic bits" which you find in any mime-magic file. You probably have already several files on your harddrive you can consult. You might also want to check google :)
TinheadNed wrote:
Or is it easier, say, to look by extensions, as binfmt_misc appears to allow you to do?

Well, you can use both, extension and/or magic bits, although i think it would be best to always use magic bit's if possible, but if you have fileformats that dont ave identifying bits at all, just use the extension.
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
was auch immer
n00b
n00b


Joined: 05 Sep 2004
Posts: 17

PostPosted: Sun Jul 03, 2005 11:54 am    Post subject: Reply with quote

hi,
i've tried and treid but without any success ...
i have binfmt_misc compiled into my kernel and it seems to work so far

Code:

grep binfmt_misc < /proc/filesystems
nodev   binfmt_misc


but there is no /proc/sys ...

i don't know, where i can find it in order to mount it, can anyone of you help me ?
i appreciate any help i can get

so long
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Mon Jul 04, 2005 7:53 am    Post subject: Reply with quote

was auch immer wrote:
but there is no /proc/sys ...

That's really weird, as the /proc/sys/fs/binfmt_misc should be there if you have binfmt_misc support enabled in your kernel (even if you dont have it mounted). But whats even more weird is the absence of the /proc/sys directory. It should be available as soon as you have the /proc directory mounted. I think something is really wrong with your Kernel.

However i am using kernel 2.6.12 now, binfmt_misc just works perfectly and i am using it for much more than just windows binaries (e.g. Java & Mono Programms).
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
ChojinDSL
l33t
l33t


Joined: 07 Jul 2003
Posts: 784

PostPosted: Mon Jul 04, 2005 3:48 pm    Post subject: Reply with quote

Just wondering, would this perhaps create a security risk? e.g. if your surfing the web and a malicous html site tries to auto-execute a exe file or something. What about viruses? Or would they only affect your wine installation?
Back to top
View user's profile Send private message
desertstalker
Apprentice
Apprentice


Joined: 18 Sep 2004
Posts: 209

PostPosted: Tue Jul 05, 2005 8:22 am    Post subject: Reply with quote

I dont see how a wiondows virus could escape a wine environment. I though that wine runs everything as a non-priverliged user so the worst you could do is stuff up the fake windows install.
Back to top
View user's profile Send private message
ChojinDSL
l33t
l33t


Joined: 07 Jul 2003
Posts: 784

PostPosted: Tue Jul 05, 2005 1:49 pm    Post subject: Reply with quote

Well, if it is possible to access your user files via wine, wouldnt a virus be able to as well? Theoretically at least?

Another question, what about dialers? Some webpages automatically try to load a dialer, would that work through wine?
Back to top
View user's profile Send private message
genneth
Apprentice
Apprentice


Joined: 24 Mar 2003
Posts: 152
Location: UK

PostPosted: Tue Jul 05, 2005 1:54 pm    Post subject: Reply with quote

ChojinDSL wrote:
Well, if it is possible to access your user files via wine, wouldnt a virus be able to as well? Theoretically at least?

Another question, what about dialers? Some webpages automatically try to load a dialer, would that work through wine?


http://os.newsforge.com/article.pl?sid=05/01/25/1430222&from=rss

The day that we can run viruses is the day that we've got an opensource windows implementation.
_________________
[img]http://www.kordix.com/rpi/?u=genneth[/img]
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Thu Aug 11, 2005 7:04 pm    Post subject: Reply with quote

... and since somebody just asked ... yes, this still works very well :mrgreen:
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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