Archive for the ‘KVM’ Category

Injecting VirtIO drivers into Windows 2012 R2 (wim and ISO)

Monday, June 2nd, 2014

Hello,

Recently I have begun toying around with Openstack and as soon as I got everything working the first thing I wanted to do was create a VM with Windows 2012 R2 on it, just to see if I could get it working.

I quickly realized that Microsoft had opted not to include the VirtIO drivers required for KVM into the Windows 2012 R2 install media.

After searching around and finding several different approaches to resolving this problem (most of which required me to purchase an ISO editor for Windows for some reason) I came up with my own solution that costs nothing and I am happy to share it with you.

Preparations:

  • Install the Microsoft ADK from here: http://www.microsoft.com/en-us/download/details.aspx?id=30652
  • Download the latest VirtIO drivers from here: http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/
  • Extract the VirtIO drivers to a temp folder (all commands will assume c:\tmp\virtio)
  • Extract Windows 2012 R2 ISO to c:\tmp\dist (we will assume that your ISO includes standardcore, datacentercore, standard, and datacenter editions)
  • Open the ‘Deployment and Imaging Tools environment’ as Administrator (this is very important).

#make some temporary folders to hold stuff

mkdir c:\tmp\iso
mkdir c:\tmp\mount

#update the boot images

imagex /mountrw c:\tmp\dist\sources\boot.wim 1 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

imagex /mountrw c:\tmp\dist\sources\boot.wim 2 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

#update the install images

imagex /mountrw c:\tmp\dist\sources\install.wim 1 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

imagex /mountrw c:\tmp\dist\sources\install.wim 2 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

imagex /mountrw c:\tmp\dist\sources\install.wim 3 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

imagex /mountrw c:\tmp\dist\sources\install.wim 4 c:\tmp\mount
dism /image:c:\tmp\mount /add-driver /driver:c:\tmp\virtio\WIN8 /Recurse /ForceUnsigned
imagex /unmount /commit c:\tmp\mount

#create the new ISO using Microsoft’s own tool which they likely use to master their own ISOs…

oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,b”c:\tmp\dist\boot\etfsboot.com”#pEF,e,b”c:\tmp\dist\efi\microsoft\boot\efisys.bin” C:\tmp\dist C:\tmp\iso\windows2012r2virtio.iso