Linux on Windows using VMware Player
Last updated: 13/05/07
There are many ways to run Linux applications
on top of Windows, if you have access to the source then you can recompile the
application under Cygwin/Msys(Mingw), if not then you can try the excellent
Colinux.
There is also the free VMware Player which works so well that I might consider
removing the dual partition from my laptop and use VMware Player exclusively
for any Linux work!
Installing WMware player is like any windows application,
just double click on the installer and off you go. However, setting up Linux
might take some time and this page described the install procedure and command
sequence I used to install Gentoo 2006.0 as a guest on my Win2K PC.
Installing WMware Player
1) Download the latest VMware Player executables and install under Administrator.
2) Download one of the Gentoo Virtual Appliances, you have the choice of a barebone installation without X or a full version which includes X, KDE and seamonkey. I went for the barebone one since I wanted to use Xfce4 which is a lighter and possibly better suited for emulation environment than the heavy KDE. The barebone installation is provided by Jay, you can find his blog here.
3) After downloading Gentoo.zip unzip it into a suitable directory.
4) Open gentoo.vmx in a text editor and add the following 2 lines (you can change the resolution later in Xfce4)
svga.maxWidth = "1600"
svga.maxHeight
= "1200"
you might also want to increase the memory a bit,
memsize = "768"
remove the floppy if you don't have one
floppy0.present = "FALSE"
synchronise the guest OS clock to the host
tools.syncTime = "TRUE"
5) Invoke vmplayer and select gentoo.vmx, you should now see Gentoo Linux boot process. Note it checks the root filesystem first followed by a reboot.
6) Login using "root", password="gentoo"
7) From this point onwards you can follow any Gentoo installation and setup guide assuming your network is up and running and you don't change any hardware settings :-). If your network is not working then try changing VMWare Player from the default Bridged to NAT and see if that works. If all is OK then the first thing to do is to update the portage (available software) database
emerge --sync
emerge portage

8) After the update you are asked to update some config files in /etc, the easiest way to do this is to use the etc-update utility, use the -5 option unless you have modified any of the listed files.
etc-update
9) The Gentoo image from Jay is based on the 2006.0 profile which will be deprecated after June 1 2007, to update to the latest (at the time of writing this page) do the following (as root).
mv /etc/make.profile /etc/make.profile.old
ln
-s /usr/portage/profiles/default-linux/x86/2007.0/desktop /etc/make.profile
10) The next step is to update the system files to the latests version. You can easily do this with the emerge system command. In our case we have one blocker package (see Gentoo manual) which needs to be uninstalled first before we can update our system. The -p is the pretend argument on emerge, if you issue this command you can see the blocking package
emerge -p system

The blocker is pam-login which you cannot simply un-install because pam-login is used for the login process. The correct sequence according to the Gentoo forum is as follows
emerge --buildpkgonly --nodeps shadow && emerge -C pam-login && emerge --usepkgonly shadow
etc-update
11) With the blocker removed you can update your Gentoo system, note this will take several hours (6 hours on my 3GHz laptop!)
emerge system
You can also update everything using the emerge world command but this is going to take even longer.
After emerge system you have a fully up2date text based Gentoo Linux system. I would advice to make a backup at this point, simply zip/gzip/rar/bzip2 the whole directory from Windows. This is also going to take some time, the compressed file will be about 1GByte.
12) Next install a desktop, as mentioned in the beginning, I went for Xfce4 which is a lightweight desktop environment. Xfce4 might provide a more responsive environment than KDE or Gnome although I haven't verified this.
emerge xfce4
This is going to take even longer than the previous emerge system command so you might want to run this overnight. For some reason the build failed mid-way with a compile error, however X worked fine. I then rebooted Gentoo and on the second run of emerge xfce4 it continued and completed OK. If you do get stuck try one of the many Gentoo forums or mailing lists.

13) Open up /etc/rc.conf in a text editor and change the default manager
nano -w /etc/rc.conf
XSESSION="startxfce4"
14) Start Xfce4 and enjoy the wonderful world of the Xfce desktop.
startx

You can change the screen resolution and VMware Player will resize the window automatically, nice! If you change the resolution to the native host resolution then you need to maximise the VMware Player window.
Some general Gentoo setup
1) Change the hostname to something meaningful (instead of localhost):
nano -w /etc/conf.d/hostname
If you get a "Could not look up internet address for..." message when you start Xfce4 then add your hostname + IP address to /etc/hosts
2) Fix the keyboard if required (look for the KEYMAP variable)
nano -w /etc/conf.d/keymaps
4) Change the root password if required
passwd
5) Add a new user (you don't want to work as root)
useradd -m -G users,wheel,audio
-s /bin/bash hans
passwd hans
6) Create an database (as root) of all files so you can search them quickly using the locate command
locate -u
7) If the time is incorrect then open /etc/conf.d/clock in a text editor and change CLOCK to local, you should also update the TIMEZONE variable if required
CLOCK="local"
TIMEZONE="Europe/London"
8) Change the grub timeout to boot immediately, open /boot/grub/grub.conf in a texteditor and change the timeout value to 0 :
timeout = 0
9) To stop VMware Player you can either use the shutdown command (under root) or simply close VMware Player which is the same as suspend.
shutdown -h now
More Gentoo commands and configuration options can be found in the Gentoo handbook and documentation.
Installing Samba
1) Unfortunately I couldn't get the sharing folder option to work (not sure if it can with the free version), however, it is very simple to set up a shared directory using samba. Downloading and installing Samba using Gentoo is as easy as....
emerge samba
2) Copy the smb.conf.example file to smb.conf.
cp /etc/samba/smb.conf.example /etc/samba/smb.conf
3) Next open smb.conf and modify as required. For a quick setup I corrected the workgroup name and uncommented the [tmp] section.
4) Create some samba passwords, I use the same password as for my user login, this will make your home directory shareable
smbpasswd -a hans
5) Configure samba to start at bootup
rc-update add samba default
6) Start or restart the samba task
/etc/init.d/samba restart
7) You should now be able to see your home directory in Windows explorer
Note that smbfs is not compiled into the kernel so you can not mount shared directories using smbmount. There are lots of good samba howto's on the web if you get stuck.
You now have a full binary compatible Linux desktop on Windows, again I would advice to zip/rar/bzip2 up the whole Windows directory.
Benchmark
In order to get a feeling on the performance of VMWare Player I installed Modelsim SE 6.2g and compared the simulation runtime of my AES core against the same simulation running natively on the host under Windows and Linux. To my amazement the simulation time was actually faster under VMware Player than running natively under Win2K! I am not sure I fully understand this but I do know the famous saying "Lies, Damn Lies and Benchmarks" :-)

Gentoo Native: Modelsim 6.2g, 64bits version, default compile/run settings
#
{{elab memory} 145076} {{elab working set} 9156} {{elab time} 0.363871} {{elab
cpu time} 0.092006}
{{elab context} 45} {{elab page faults} 1466}{memory
145076} {{working set} 9940} {time 366.562}
{{cpu time}
366.539} {context 4} {{page faults} 50}
VMWare Player: Modelsim 6.2g, 32bits version, default compile/run settings
#
{{elab memory} 30848} {{elab working set} 7668} {{elab time} 0.01914} {{elab
cpu time} 0.016001}
{{elab context} 32} {{elab page faults} 81} {memory
30848} {{working set} 7688} {time 386.025}
{{cpu time}
384.836} {context 5} {{page faults} 2}
Windows 2000: Modelsim 6.2g, 64bits version, default compile/run settings
#
{{elab memory} 0} {{elab working set} 10326016} {{elab time} 0.952094} {{elab
cpu time} 0.1875}
{{elab context} 0} {{elab page faults} 3268} {memory 0}
{{working set} 12193792} {time 440.061}
{{cpu time} 439.437}
{context 0} {{page faults} 306}
