When Darwin was first ported over to the x86 architecture, I thought I could get it running inside of a VM. I was stopped because QEMU was not quite ready for it. I tried it twice over a period of at least 4 years. I just tried it again and it worked. During the time since then, a patch was made to QEMU to make it work properly — which also got absorbed into releases after v0.10. Another big problem was figuring out the exact install process and that one could not really just boot it off the CD image and expect it to work. There is a specific process. I’m pretty altruistic, so I’ve documented it here.
If you haven’t installed QEMU, please do so. To install Darwin you need to create a disk file to use with QEMU. For this, type:
qemu-img create -f vmdk darwin-disk.vmdk 3G. The release notes recommend 3GB as a minimum hard disk size, but feel free to make it larger if you desire.
When you are ready to start installing Darwin, type:
qemu -hda darwin-disk.vmdk -cdrom darwinx86-801.iso -boot d -m 1024. This will start QEMU and boot from the CD image. It will churn its cogs and then ask you which disk you want to install it on. If you’ve followed my directions, there will only be one disk available to choose from.
Next, it will ask you to partition the drive. Since this is a new disk, make it auto-partition. When it asks you for a volume name, it will fail. Start the machine over again. Choose to use the existing partitions, then continue with installation. When it asks for which partition to use, it should show you two options. Type in the second option. Now, wait for a really long time while it unpacks all of the files.
Once it’s done, it will ask you for a root password. Enter it and confirm it. Then it will ask if you want to create a user, start a shell or restart. Create a user, then restart. It should power the machine down.
When you want to run the disk image type:
qemu -hda darwinx86-801.vmdk -cdrom darwinx86-801.iso -m 1024. This will start the machine from the disk image we just installed Darwin and the installation CD will be available to mount, too. The Network should be up and running. If that doesn’t work right, and it just sits there spinning, try re-installing it. I had to do that. The second install to the image proved flawless.
Interesting associated reading:
- Installing Darwin in a VM <http://althenia.net/wiki/darwin> — I found this after I published this. The instructions given for upgrading the compiler are interesting, also has more detailed steps to follow.
- Help with mounting disk images, especially .dmg files <http://www.puredarwin.org/developers/diskimages>