BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


FreeBSD Basics

Running Windows Applications on FreeBSD

09/21/2001

In the last article, we looked at using VNC for accessing other desktops in a network. This week, I'd like to continue in this vein by looking at running Windows applications from within your FreeBSD system.

One of the neatest things about FreeBSD is that if it is running on a dual-boot computer, you don't have to exit FreeBSD to access data contained on the other operating system's partition. It is a simple matter to mount the other partition and to then read, write, or even delete the files contained on that partition. Ah, but what about running executable files, you may ask? If that other operating system is made by Microsoft and you're running the Windows emulator (Wine) on your FreeBSD system, it is possible to run many Windows applications from your FreeBSD system.

In today's article, I want to demonstrate building and using Wine. If things go well, I'll push my luck by also attempting to run some Windows applications on a computer totally dedicated to FreeBSD -- it does not contain a Microsoft partition anywhere on its hard drive.

I'll start by building the Wine port on two of the machines in my network. The first machine dual-boots Windows 98 and FreeBSD 4.3-Release. The second machine has been totally and dangerously dedicated to FreeBSD 4.3-Release. I'll become the superuser and start the port's build on each machine:

su
Password:
cd /usr/ports/emulators/wine
make install clean

Once the builds are finished, I need to check each machine's kernel configuration file to ensure it contains all of the options needed to run Wine. While still the superuser, I'll type:

cd /usr/src/sys/i386/conf
cp GENERIC WINE

I'll then use my favorite text editor to open up WINE and ensure that the following options are listed:

options		USER_LDT
options		SYSVSHM
options		SYSVSEM
options		SYSVMSG

On my 4.3-Release, the three SYS* options were already there, I only had to add the USER_LDT option. If you have to add any options, save your changes and recompile the kernel like so:

/usr/sbin/config WINE
cd ../../compile/WINE
make depend && make && make install && reboot

With that last command, I'm actually invoking four separate commands; the && ensures that the next command will only be run if the previous command was successful. If you decide to include the reboot command, make sure that no other users are doing anything on your FreeBSD box as it will reboot once the kernel has been installed.

When the Wine port is built, documentation is installed into man 1 wine and /usr/local/share/doc/wine. I also found the how-to article to be very helpful in setting up Wine for the first time.

Let's start by trying to run Wine on the system that dual-boots FreeBSD 4.3-Release and Windows 98. To run Wine on this machine, I'll have to:

  1. Find and mount the Windows partition.

  2. Double-check Wine's configuration file.

  3. Test the configuration by seeing if I can run a Windows application.

It's been a while since I set up this computer, so I'll use sysinstall to double check my partitioning scheme. As the superuser:

/stand/sysinstall
Configure
Fdisk
spacebar ad0

and I see something that looks like this:

Offset		Size(ST)	End	Name	PType	Desc
       0              63         62        -       6   unused
      63         4176837    4176899    ad0s1       2      fat
 4176900         4016250    8193149    ad0s2       3  freebsd 

When I'm finished, I use q to quit this screen, and cancel my way out of sysinstall. It looks like Windows is on the fat partition known to FreeBSD as ad0s1. In order to mount this partition, I first have to create a mount point which I'll call dos:

mkdir /dos

I should also check the permissions of the mount point:

ls -l  / | grep dos
drwxr-xr-x  2 root  wheel   512 Aug 31 13:07 dos

This looks good as all users have "read" and "execute" permissions, but only the root user has "write" permission.

Pages: 1, 2, 3

Next Pagearrow





Sponsored by: