|
Homepage: webng.com/linuxhelp Qemu/KVM and Vista I wrote this article a couple of years ago, but never got around to finishing it. I have added the driver ISO, but otherwise it is little changed. I used the Kernel Virtual Machine (KVM) version 28, rather than QEMU itself, but what works for KVM, will usually work for QEMU, as KVM has QEMU as its foundation. If time permits, I will add a section on which CPUs are KVM capable and how to compile the latest version of KVM. Until then, I will point you to: http://kvm.qumranet.com/kvmwiki and http://fabrice.bellard.free.fr/qemu/ Copy your Vista installation disk to an iso image with: dd if=/dev/cdrom of=vista.iso Create a raw image with: /usr/local/kvm/bin/qemu-img create -f raw vista.img 10G The reason for using the raw format is that you can use ntfs-3g to mount the image. This makes copying files into the image a breeze. However, do not boot the image when it is mounted, or mount it when booted, as this will probably fry it. You need one of the following kvm kernel modules: /sbin/modprobe kvm-amd /sbin/modprobe kvm-intel Vista does not produce valid boot sector information, so partition and format the image, vista.img, with XP or Linux. For example, use: qemu-system-x86_64 -boot d -m 512 vista.img -cdrom xp.iso to format the image using an XP install disk (xp.iso). Stop after the partition is formated (with NTFS). KVM doesn't make a distinction between i386 and x86_64 so, even if your architecture is i386, you should use qemu-system-x86_64. If your system cannot find qemu-system-x86_64, you might need to use the full path: /usr/local/bin/qemu-system-x86_64 (newer versions of KVM), /usr/local/kvm/bin/qemu-system-x86_64 (older versions of KVM). Now install Vista with: qemu-system-x86_64 -boot d -m 512 vista.img -cdrom vista.iso You may need to adjust the amount of memory provided to KVM (the default is -m 128). The installation runs much faster from the iso image, but, you can also install from the CD with: qemu-system-x86_64 -boot d -m 512 vista.img -cdrom /dev/cdrom Now mount vista.img and copy the drivers into the image: mkdir /1; mount -t ntfs-3g -o loop,offset=$((63*512)) vista.img /1 mkdir /1/drivers; cp -r ES1370 RTL8029 /1/drivers $((63*512)) = 32256, i.e., 63 sectors of 512 bytes. Or, use the tiny iso image, drivers.iso: bunzip2 drivers.iso.bz2 qemu-system-x86_64 -m 512 -soundhw es1370 -usb -usbdevice tablet vista.img -cdrom drivers.iso The option -soundhw es1370 has qemu emulate an Ensoniq AudioPCI ES1370 sound card. Previous to QEMU 0.9.1, the default network hardware was an NE2000 PCI card. The Realtek 8029 driver for works fine with this card. To use the NE2000 card use the option -net nic,model=ne2k_pci. In QEMU 0.9.1 the default network hardware was changed to -net nic,model=rtl8139. Drivers for both, are on drivers.iso. Install them by right-clicking on the .inf files and choosing install from the menu. The default networking option is -net user (the use of a second -net variable is unfortunate). It allows you to get onto the internet and is naturally fire-walled. The -net user option sets up a SLIRP connection. It is not a true network connection, e.g., ping does not work. The SLIRP connection comes with its own DHCP server. Setting a static IP address will cause things not to work. Previous to QEMU 0.9.1, the complete default network option was -net nic,model=ne2k_pci -net user. Post QEMU 0.9.1, it became -net nic,model=rtl8139 -net user. Qemu can also emulate the Realtek 8139 Ethernet Card (now the default) for which Vista does have a driver, however, previous to QEMU 0.9.1, this did not recognize the SLIRP connection, the DHCP server, or the tap devices (so was essentially useless to you). As claimed here the rtl8139 now works correctly with recent versions of QEMU. You need version 0.9.1 or later (check, qemu/VERSION, in the source code of KVM). If you are still using QEMU 0.9.0, then you will need the rtl8029 driver. It should be noted, that the rtl8139 driver, always "worked", you just couldn't connect to the internet, or do anything useful with it. Now run Vista with the command: qemu-system-x86_64 -m 512 -localtime -soundhw es1370 -usb -usbdevice tablet vista.img The -usb -usbdevice tablet option allows your mouse to escape from Vista to Linux by just moving outside the Vista window (without this, you have to press Ctrl-Alt to escape the mouse). The -m 512 option allocates 512 MB of RAM to KVM. Using the -no-acpi option can result in much faster installation and performance. |