Attention

You are viewing an older version of the documentation. The latest version is v3.3.

Create Windows Image

This section explains the procedure to create a new Windows VM image.

Download Windows and Install Media and Drivers

Download the following assets before proceeding:

Install Windows 10 on VM

The following section is applicable to:

../../_images/target_generic.png

To install Windows 10 on VM:

Create Raw Image File

Create an empty raw image named win10.img of size 60G. For example:

$ qemu-img create -f raw win10.img 60G

Install Windows into Image

  1. Run the following command:

    $ sudo -E qemu-system-x86_64 --enable-kvm -bios OVMF.fd \
       -smp cores=2 -m 4G \
       -rtc base=localtime,clock=host -usb -device usb-tablet \
       -cdrom ${WIN_ISO} \
       -drive driver=raw,file=win10.img,if=virtio \
       -drive file=${VIRT_IMG},index=3,media=cdrom \
       -net nic,model=virtio -net user,smb=${graphics_driver_path} \
       -netdev user,id=net0,hostfwd=tcp::8082-:8082 -device virtio-net-pci,netdev=net0
    

    Where,

    • ${WIN_ISO} is the path of the pre-downloaded Win10 LTSC ISO image.

    • ${VIRT_IMG} is the path of the pre-downloaded VirtIO driver ISO.

    • ${directory_of_graphics_driver} is the absolute path of the directory which contains pre-downloaded Intel graphics driver.

  2. Use samba to share the driver with the Windows VM. Make sure that samba is installed in the host OS. For example, use sudo apt install samba in Debian.

  3. In the QEMU window that appears, click Next to install Windows.

  4. When prompted to select the type of installation, choose Custom: Install Windowns only (advanced).

    ../../_images/install-1.png
  5. Click Load driver.

    ../../_images/install-2.png
  6. Browse and select the virtio SCSI driver to detect the raw win10.img. For example, the driver (virtio-win.iso) may locates in E:\viostor\w10\amd64\viostor.inf of the CD-ROM.

    ../../_images/install-3.png
  7. Select the loaded driver. Click Next.

    ../../_images/install-4.png
  8. Once the driver is loaded, a disk will be discovered for the Windows installation. Click Next to continue.

    ../../_images/install-5.png

    Once the installation is complete, a Windows 10 desktop will be displayed in the QEMU window.

  9. Open the Windows Device Manager, and install the virtio-net driver from the CDROM (virtio-win.iso).

    ../../_images/install-virtio-net.png

Install Media and Drivers

This section explains the procedure to:

Copy IGD Driver

In previous QEMU commands, the pre-downloaded graphics driver is shared by samba.

In the Windows Explorer, follow the menu path File > This PC > Add Network Location to add the shared folder.

The path is \\10.0.2.4\qemu.

../../_images/samba.png

Copy the graphics driver (for example, igfx_win10_100.9316.exe) to a local folder for later use.

Enable Remote Desktop

Search for Remote Desktop in the Windows Settings. Turn ON Enable Remote Desktop. Note down This PC name under How to connect to this PC for later use.

Now, shutdown the Windows VM.

Install IGD Driver

To install the graphics driver, a GPU needs to be passed through.

Follow Set up QEMU Command to Boot Windows VM to passthrough a graphics device and a NIC device to the Windows VM. Boot the Windows VM.

There will not be any display on the monitor yet, as the GPU driver is not yet installed.

Connect the NIC device, which was passed through to the Windows VM, directly to the second Windows machine. Run a Remote Desktop Conncetion on the second machine and connect to the computer with the PC name from the previous step.

After logging in remotely, run the graphics driver installation program, which you copied to the local folder.

After installing the graphics driver, the local display from the Windows VM will appear on the monitor.