Poor man’s virtualization (a rich experience!)

April 24, 2009 at 8:44 am Leave a comment

As computers are becoming more and more powerful, a mere laptop is able to virtualize complete computer systems. With technology like VMWare and Sun’s Virtualbox one can create so-called virtual machines that have an entirely different setup (hardware / operating system) than the host system. As I am finding myself using virtualization more and more, I decided to write an article about it. I won’t be giving an in depth overview of all available technologies and setup tricks, but an overview of how I am using it today. Furthermore, this article will only focus on freely available virtualization software.

A microcontroller development station (Virtualbox)

When looking for a free solution, Virtualbox is the obvious choice as it is available as open source software (GNU GPL) . Just download it from their site (it is available for a myriad of host systems: Win/Linux/Mac/Solaris) and install it to your computer.

virtualbox

I have recently formated my laptop and I am intending to keep it clean and uncluttered for a while. That’s why I decided to put all software and tools needed for my microcontroller activities in a dedicated virtual machine.

The setup:

The host system is my personal laptop I bought a year ago (core 2 duo 2GHz, 2GB RAM, Windows Vista). The guest operating system is a Windows XP machine. I chose XP because it runs faster than Vista and I didn’t need any of the Vista features. Make sure you install the Virtualbox guest tools on your guest system for optimal performance.

The bright side:

  • No polluting of my host environment by all the software needed for my PIC (that’s the microcontroller) programming, as it is contained in the virtual machine: compiler, two IDE’s (Eclipse and MPLAB), programming tools, …
  • All my projects and documentation (datasheets, user guides, …) are available in the virtual machine.
  • I can backup the virtual machine so the software setup and my projects are safe.
  • When I have to format my host environment again, I won’t have to reinstall all the microcontroller software and find my projects back. I’ll just have to reinstall Virtualbox and put the virtual machine back.
  • I only have time in my weekends for this microcontroller hobby. At the end of my weekend I just save the state of my virtual machine (I just leave all windows open) and at the beginning of the next weekend I can pick up exactly where I left off!
  • I usually work with a dual monitor setup (laptop screen + external monitor). It is possible to put the Virtual machine on one monitor and on the other monitor just work in the host operating system.
  • A shared folder allows to share files between the host and guest system.
  • My host is a Vista machine, but it could as well have been a Linux OS, thus giving a solution to hardcore Linux users wanting to program PICs (the Microchip compiler is not available on Linux).

The dark side:

  • As everything is virtualized, things tend to run a tad slower. I don’t find this annoying while developing (it doesn’t require a fast PC), but you wouldn’t want to run games in a virtual machine!
  • For the actual programming of a PIC microcontroller, I use a USB device. It is possible to forward the USB device to the virtual machine so it is recognized over there, but I found this to be rather buggy in Virtualbox (it crashed a few times). So for the actual programming I still use the host system.

Conclusion:

Virtualbox is really, really cool software. I almost can’t believe something like this is just available as open source software. It is ideal for quickly testing some new software / platform or for separating a certain environment from the rest of your system (as I did for my microcontroller environment).

A research platform (VMWare server)

At work we are constantly testing new setups and trying out new technologies. We also have some powerfull servers, but we prefer to do our tests in a vacuum environment (not influenced by other installed components we might not have thought about). That’s why we decided to put VMWare on our server and run our little test setups inside Virtual Machines.

vmware-logo

VMWare offers a lot of products, most of which are paying solutions. They do however offer a free player and a free server virtualization product: VMware Server. The player can be used to run an existing virtual machine on your desktop machine. Vmware Server is a very powerfull solution for creating / managing / running virtual machines on the server. Creating virtual machines is done in a browser application which is really handy. By installing the VMware console plugin one can remotely take over the screen of a virtual machine and run it as you would run a local virtual machine.

The setup:

The actual installation is described over here by my colleague. We installed VMware Server on a Linux host system (2 quad cores and 32GB RAM) [sidenote: I think VMWare Server can only be installed on a Linux host]. Once installed you can open up Firefox on your client computer and point it to port 8333 of your host computer. You should see a login screen. I advise you to use Firefox2 Portable because the console plugin doesn’t work too good with Firefox3. Below are some screenshots of the browser application:

Overview of the available virtual machines and used resources

Overview of the available virtual machines and details of one of them

Creating a new virtual machine

Creating a new virtual machine

Remotely taking over a virtual machine

Remotely taking over a virtual machine

More setup goodness:

I’m not going into details about the actual setup but I’ll give some pointers to what is possible:

  • Configure the dhcp to asssign static IP adresses to your virtual machines. Put an apache http server on your host machine and use proxypass / proxypassreverse / virtualhost to forward a browser to a virtual machine. I.e., we can point the client browser to a url like http://hudson.dunamis, our client host file says that hudson.dunamis is found at the IP adress of our host system so our call is forwarded to the host. The apache http server on the host system has a configuration that says that hudson.dunamis  is to be forwarded to the local IP of the virtual machine to a certain port. So the client is immediately forwarded to the virtual machine, as if it is connected to the actual network.
    [sidenote: you could also use the bridged network setup of VMware for this, but this wasn’t possible in our setup]
  • In this way you can also forward your ssh access: checkout jedi.

The bright side:

  • Once set up, it becomes very easy to create new machines. By copying the vmdk (=virtual harddrive) of another machine you can skip the installation of the operating system and focus on what you really want to test.
  • The different machines can access each other via the network so complex setups are possible.
  • It is possible to copy and paste virtual machines. E.g. you can also create virtual machines locally using VMware Desktop (this is a paying solution) and copy them later to the server. You can also grab a machine from the server and play it locally using VMware player.
  • You can make a snapshot (or just copy) virtual machines so you can return to a certain state later.

The dark side:

  • Because we have to work with the NAT networking setup, it is sometimes difficult to get things running that have to communicate with machines outside the virtual domain..

Conclusion:

This is ideal for a research environment where you have to test all sorts of different setups. Creating and deleting virtual machines is really easy and succesful setups can be copied so you can always return to them.

Advertisements

Entry filed under: Uncategorized. Tags: , , , .

File uploads… Flash or Silverlight? PIC servocontroller (in C)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Feeds

Articles to be written…

Twitter – kr3l

my del.icio.us

RSS Google Reader Shared Stuff

  • An error has occurred; the feed is probably down. Try again later.

RSS Listening to..

  • An error has occurred; the feed is probably down. Try again later.

%d bloggers like this: