VirtualBox

From Wildsong
Jump to navigationJump to search

VirtualBox for software development

I run Windows XP in virtual machines, so that I can work on many platforms

  • My desktop at work runs Windows 7, the most useless operating system
  • My laptop runs Mac OS/X "Snow Leopard", the best commercial operating system
  • My desktop and server at home run Linux, the best available operating system

XP Serial ports

I wanted to be able to use a GPS device on XP. The GPS connects to the Macintosh via bluetooth, which sees it as /dev/tty.BTGPS3333330C4837-Seria (that's a mouthful.)

I created a connection in VirtualBox using "Host Device" and putting that device string into the device box in the GUI. It works fine except XP can't see it! I put it at COM1 in the GUI (that is, XP should see the BT GPS at COM1)

The problem is that XP plug and play is not working. You have to manually configure the serial port.

  1. Control Panel->Add hardware
  2. Click "next" to start discovery.
  3. Select "yes..." then click next.
  4. Select "add new hardware device" from the end of the list, click next.
  5. Select "Search for"... and it should find the communications port.
  6. In my case it thought the GPS was a MS Serial Mouse, so I went into the hardware manager and disabled the serial mouse.

VirtualBox for legacy applications

I need to set up a MSDOS virtual machine to run a program that talks to my vintage Magnavox GPS reference station.

I've done it in the past with VMWare but have pretty much switched over to VirtualBox now.

The problem is, at the moment the server connected to the GPS station is in the garage. I moved put the Magnavox in the garage because that's where the antenna wire is right now. Both antennas. The GPS antenna and the 420 MHz transceiver that will transmit DGPS corrections.

Anyway more on that later / elsewhere. The whole point of this page is to describe how to set up a virtual machine to run on a server, using VirtualBox.

I intend to try to get it going from the command line. In theory I should be able to open a VNC session to see the DOS window, let's see if the theory pans out.

Here we go.

Create a machine.

One CPU with 640K would be enough but I have to give it a minimum of 4MB! No network card. Minimum video RAM. No CDROM drive. This is so easy.

VBoxManage createvm --name MSDOS --ostype DOS --register
VBoxManage modifyvm MSDOS --memory 1 --nic1 none --audio none
VBoxManage modifyvm MSDOS --bioslogodisplaytime 1

The whole point is to talk to a Magnavox GPS receiver, and that happens on COM1

VBoxManage modifyvm MSDOS --uart1 0x3F8 4 --uartmode1 /dev/ttyS0

Show the results of our labours

VBoxManage showvminfo MSDOS

Create virtual hard disk.

It does not have to be big. 20 megabytes should be plenty.

VBoxManage createhd --filename MSDOS_20MB.vdi --size 20

Connect the hard disk to the machine.

VBoxManage storagectl MSDOS --name IDE0 --add ide
VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 0 --type hdd --medium MSDOS.vdi

Put the (virtual) MSDOS installer floppy into the (virtual) floppy drive

You can still download the installer from Microsoft MSDN! So I thought. It's an UPGRADER, you have to have MSDOS installed already. Microsoft, once again I spit on you. What are you thinking?

So instead I turned to FreeDOS from http://www.freedos.org/

# Register the FreeDos disc image
VBoxManage openmedium dvd `pwd`/fdfullcd.iso
# Attach the disc to the machine
VBoxManage storageattach MSDOS --storagectl IDE0 --port 0 --device 1 --type dvddrive --medium `pwd`/fdfullcd.iso

# Add a floppy drive to the machine
VBoxManage storagectl MSDOS --name FD0 --add floppy
# Register the floppy disk image
VBoxManage openmedium floppy `pwd`/Magnavox.IMG
# Attach it
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.IMG

Fire it up.

VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1
Oracle VM VirtualBox Headless Interface 3.2.8
(C) 2008-2010 Oracle Corporation
All rights reserved.

Listening on port 5000.

YAY! On the Macintosh now I can use the Microsoft RDP client that I downloaded from http://www.microsoft.com/mac/products/remote-desktop/default.mspx

After running through the FreeDOS installation, I remove the virtual CD, change the boot order, and attach the Magnavox floppy disk image.

VBoxManage modifyvm MSDOS --boot1 disk
VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium `pwd`/Magnavox.img
VBoxHeadless -s MSDOS --vrdp on --vrdpport 5000 --vrdpaddress 192.168.123.1

I copied the one little file that I needed to the virtual hard disk and disconnected the virtual floppy.

VBoxManage storageattach MSDOS --storagectl FD0 --port 0 --device 0 --type fdd --medium none

Install the Magnavox command program.

Mount the image of the floppy drive and copy the contents to the virtual hard drive.

Settings