The starting point is that we have two operating systems, Mac OS X 10.6 and Windows 7 Professional installed properly according to Apple recommendations through the Boot Camp technology. In my case, Windows has been successfully activated with the native hardware (as I remember, before I installed Boot Camp drivers). I have also VirtualBox 4.0.4 installed in Mac OS X host as well. So, the first step is the creation of the new virtual machine named BootCamp in my case (create without any disks) and the creation of the disk image to run Boot Camp partition. It can be done with the following commands
Code: Select all
sudo diskutil unmount /dev/disk0s3
sudo VBoxManage internalcommands createrawvmdk -filename /DefaultMachineFolder/BootCamp/BootCamp.vmdk -rawdisk /dev/disk0 -partitions 3
Code: Select all
cd /DefaultMachineFolder/BootCamp
file BootCamp-pt.vmdkCode: Select all
hexdump BootCamp-pt.vmdkCode: Select all
00001c0 ff ff ee fe ff ff 01 00 00 00 27 40 06 00 00 fe
00001d0 ff ff af fe ff ff 28 40 06 00 00 00 20 19 80 fe
Code: Select all
sudo echo -en "\x2d" | dd of=BootCamp-pt.vmdk bs=1 count=1 seek=450 conv=notrunc
sudo echo -en "\x2d" | dd of=BootCamp-pt.vmdk bs=1 count=1 seek=466 conv=notrunc
Code: Select all
sudo chown username BootCamp.vmdk
sudo chown username BootCamp-pt.vmdk
sudo chgrp staff BootCamp.vmdk
sudo chgrp staff BootCamp-pt.vmdk
Code: Select all
sudo chgrp admin /dev/disk0s3
sudo chmod 660 /dev/disk0s3
This is sufficient to run Windows in the newly created virtual machine. I recommend to configure it, so that it has ICH6 IDE controller and attached BootCamp.vmdk. I also recommend for the first run to create the empty SATA controller to allow Windows to install the proper software for it. Windows should launch properly in this step but you probably lose your activation. The reason is that the native hardware is in drastic contrast to the virtual machine. So, if you reboot your computer back to BootCamp, it should be activated.
Last step is to collect the information about the native hardware, which Windows determines. I recommend to run dmidecode utility in Windows Power Shell to collect it. All you need is to write into the peace of paper the BIOS and System info according to 9.11 paragraph of the VirtualBox Manual and, after that, to write this information to the BootCamp virtual machine properties. After that, the reconnection of BootCamp.vmdk to the SATA interface allows one to reflect the hard disk vendor information (see 9.7.2 of the VirtualBox Manual for details). The information on native hard drive can be found in 'About This Mac'. The correct data allows Windows to run properly avoiding the re-activation process, at least if you allow VirtualBox to run as many processor cores as at the native running, in my case.
Finally, I hope that future releases of VirtualBox will allow users to run BootCamp partition in more user-frendly way. At least, it should allow to run it without changing the permissions for running the device. I think, the best way is to ask user for the sudo password before starting the virtual machine. I also would like to see automatic unmounting the BootCamp disk before running the virtual machine and automatic mounting after shutdown. I believe, the described procedure can be coded easily and hope to see the official BootCamp support very soon.