Using Windows as Guest VM on ACRN¶
This tutorial describes how to launch Windows as a Guest (WaaG) VM on the ACRN hypervisor.
Verified version¶
- Clear Linux version: 32030
- ACRN-hypervisor tag: v1.5 (acrn-2020w01.1-140000p)
- ACRN-kernel tag: acrn-2020w01.1-140000p
- Windows 10 Version:
- Microsoft Windows 10 Enterprise, 10.0.17134 Build 17134
- Microsoft Windows 10 Pro, 10.0.17763 Build 17763
- Windows graphics driver:
- igfx_win10_100.7212.zip
Hardware setup¶
The following Intel Kaby Lake NUCs are verified:
| Platform Model | BIOS Version | BIOS Download Link |
|---|---|---|
| NUC7i7DNHE | DNKBLi7v.86A.0052.2018.0808.1344 | link |
| NUC7i5DNHE | DNKBLi5v.86A.0060.2018.1220.1536 | link |
ACRN Service VM Setup¶
You may refer to the steps in Using SDC Mode on the NUC for the Intel NUC in order to set up ACRN on the KBL NUC. After following the steps in that guide, you should be able to launch the Service VM successfully.
Setup for Using Windows as Guest VM¶
All the patches to support WaaG have been upstreamed; you can download them from the acrn-hypervisor repository.
Build ACRN EFI Images¶
Follow the steps described at Build ACRN from Source to set up the build environment.
Use the
makecommand to compile theacrn.efiandacrn-dm:$ git clone https://github.com/projectacrn/acrn-hypervisor.git $ cd acrn-hypervisor $ make FIRMWARE=uefi BOARD=kbl-nuc-i7
Get the outputs from:
$ build/hypervisor/acrn.efi $ build/devicemodel/acrn-dm
Replace the
acrn.efiandacrn-dmon your NUC:Log in to the ACRN Service VM and then
mountthe EFI partition to/bootscptheacrn.efiandacrn-dmfrom your host:# scp <acrn.efi from your host> /boot/EFI/acrn/ # scp <acrn-dm from your host> /usr/bin/ # chmod +x /usr/bin/acrn-dm && sync
Build Service VM Kernel¶
Follow the steps described at Build ACRN from Source to set up the build environment.
Follow the steps below to build the ACRN kernel:
$ WORKDIR=`pwd`; $ JOBS=`nproc` $ git clone -b master https://github.com/projectacrn/acrn-kernel.git $ cd acrn-kernel && mkdir -p ${WORKDIR}/{build,build-rootfs} $ cp kernel_config_uefi_sos ${WORKDIR}/build/.config $ make olddefconfig O=${WORKDIR}/build && make -j${JOBS} O=${WORKDIR}/build $ make modules_install INSTALL_MOD_PATH=${WORKDIR}/build-rootfs O=${WORKDIR}/build -j${JOBS}
Update Kernel on KBL NUC¶
Copy the new kernel image (bzImage) and its modules to the target machine:
# scp <your host>:$WORKDIR/build/arch/x86/boot/bzImage /boot/bzImage # scp -r <your host>:$WORKDIR/build-rootfs/lib/modules/* /lib/modules/ # cp /boot/loader/entries/acrn.conf /boot/loader/entries/acrngt.conf
Modify
acrngt.confto the content as given below:title The ACRNGT Service VM linux /bzImage options console=tty0 console=ttyS0 root=/dev/sda3 rw rootwait ignore_loglevel no_timer_check consoleblank=0 i915.nuclear_pageflip=1 i915.avail_planes_per_pipe=0x010101 i915.domain_plane_owners=0x011100001111 i915.enable_gvt=1 i915.enable_conformance_check=0 i915.enable_guc=0 hvlog=2M@0x1FE00000
Note
Change
/dev/sda3to your file system partition.rebootthe Service VM and selectThe ACRNGT Service VMfrom the boot menu to apply the ACRN kernel and hypervisor updates.
Create Windows 10 Image¶
Create a Windows 10 image which includes two steps:
- Re-generate an ISO that includes winvirtio or virtio-win drivers and the Windows graphics drivers that were pre-installed from the original Windows ISO.
- Install Windows 10 onto the virtual disk.
Preparations¶
- Download Windows 10 ADK according to your working Windows 10 version.
Note
Win + R to open the Run window. Key in winver to get your working Windows version.
- Download Windows 10 LTSC ISO.
- Download virtio Windows driver
to the Service VM in
/root/img/virtio-win-0.1.141.iso. - Download Intel DCH Graphics Driver.
- Download Oracle Windows driver to Service VM in
/root/img/winvirtio.iso. - Oracle Windows driver.Sign in. If you do not have an oracle account, register one.
- Select “Download Package”, key in “Oracle Linux 7.6” and click “Search”
- Click: DLP: Oracle Linux 7.6, it will be added to your Cart.
- Click “Checkout” at the top right corner
- In the “Platforms/Language”, select “x86 64 bit”, click “Continue”
- Check ” I accept the terms in the license agreement”, click “Continue”
- In the list, right check the item labeled as “Oracle VirtIO Drivers Version for Microsoft Windows 1.x.x, yy MB”, and “Save link as …”. At the time of this wiki, it is named as “V982789-01.zip”
- Click Download, When the download is complete, unzip, you will get one ISO named “winvirtio.iso”
Install Windows 10 ADK¶
Double click
adksetup.exeto start the installation.
Click
Next.
Select
Deployment ToolsandWindows Preinstallation Environment (Windows PE), and clickInstallto continue the installation.Note
You need to install Windows 10 ADK only once.
Pre-install drivers and re-generate Windows ISO¶
Create a folder on the
C:drive calledWIM, so you have a folderC:\WIMCreate a folder on the
C:drive calledMount, so you have a folderC:\MountRight click the downloaded
virtio-win-0.1.141.isoand selectMount. The ISO will be mounted to a drive; for example, driveD:Or used Oracle Driver Right click the downloadedwinvirtio.isoand selectMount. The ISO will be mounted to a drive; for example, driveD:Use
7-zipor similar utility to unzip the downloaded Windows graphics driverigfx_win10_100.7212.zipto a folder, for example, toC:\Dev\Temp\wim\igfx_win10_100.7212Right click the downloaded Windows ISO, for example,
windows10-17763-107-LTSC.iso, selectMount, the ISO will be mounted to a drive; for example, driveE:Copy
E:\sources\boot.wimandE:\sources\install.wimtoC:\WIMDepending on your Windows ISO image, more than one image may be included in the
WIM. Rundism /get-wiminfo /wimfile:C:\WIM\install.wimwith administrator privileges. Select theIndexyou want. Forwindows10-17763-107-LTSC.iso, there is only oneIndex; it is1
Create a batch file named
virtio-inject-boot.bat[1] to modifyboot.wimto inject drivers (using the mounted Windows ISO drive (D:), image Index (1), and folder where the unzipped Windows graphics drivers were placed, from the previous steps (update this batch file as needed):REM virt-inject-boot Set IDX=1 REM Modify boot.wim file to inject drivers dism /Mount-Wim /WimFile:C:\Wim\boot.wim /Index:%IDX% /MountDir:C:\mount dism /image:C:\mount /Add-Driver "/driver:d:\balloon\w10\amd64\balloon.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\NetKVM\w10\amd64\netkvm.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\viorng\w10\amd64\viorng.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioscsi\w10\amd64\vioscsi.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioserial\w10\amd64\vioser.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\viostor\w10\amd64\viostor.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioinput\w10\amd64\vioinput.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\cui_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\HdBusExt.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\iigd_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\DisplayAudio\11.1\IntcDAud.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\msdk.inf" dism /unmount-wim /mountdir:c:\mount /commit REM inject-Oracle-driver-install Set IDX=1 REM Modify boot.wim file to inject drivers dism /Mount-Wim /WimFile:C:\WIM\boot.wim /Index:%IDX% /MountDir:C:\mount dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\netkvmorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioinput.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\viorng.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioscsiorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioserorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\viostororcl.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\cui_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\HdBusExt.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\iigd_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\DisplayAudio\11.1\IntcDAud.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\msdk.inf" dism /unmount-wim /mountdir:c:\mount /commit
Run this
virtio-inject-boot.batscript in a command prompt running as administrator. It may take 4-5 minutes to run, depending on your Windows system performance.Similarly, create another batch file named
virtio-inject-install.bat[1] to modifyinstall.wimto inject drivers (and verify the ISO drive, image Index, and drivers folder):REM virt-inject-install Set IDX=1 REM Modify install.wim to inject drivers dism /Mount-Wim /WimFile:C:\WIM\install.wim /Index:%IDX% /MountDir:C:\mount dism /image:C:\mount /Add-Driver "/driver:d:\balloon\w10\amd64\balloon.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\NetKVM\w10\amd64\netkvm.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\viorng\w10\amd64\viorng.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioscsi\w10\amd64\vioscsi.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioserial\w10\amd64\vioser.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\viostor\w10\amd64\viostor.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:d:\vioinput\w10\amd64\vioinput.inf" /forceunsigned dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\cui_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\HdBusExt.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\iigd_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\DisplayAudio\11.1\IntcDAud.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\msdk.inf" dism /unmount-wim /mountdir:c:\mount /commit REM inject-Oracle-driver-install Set IDX=1 REM Modify install.wim to inject drivers dism /Mount-Wim /WimFile:C:\WIM\install.wim /Index:%IDX% /MountDir:C:\mount dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\netkvmorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioinput.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\viorng.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioscsiorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\vioserorcl.inf" dism /image:C:\mount /Add-Driver "/driver:d:\vio\Win10\amd64\viostororcl.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\cui_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\HdBusExt.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\iigd_dch.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\DisplayAudio\11.1\IntcDAud.inf" dism /image:C:\mount /Add-Driver "/driver:c:\Dev\Temp\wim\igfx_win10_100.7212\Graphics\msdk.inf" dism /unmount-wim /mountdir:c:\mount /commit
Run this script in a command prompt running as administrator. It may also take 4-5 minutes to run, depending on your Windows system performance.
After running these two scripts the files
C:\WIM\boot.wimandC:\WIM\install.wimwill be updated to install these drivers into the image:- Virtio-balloon
- Virtio-net
- Virtio-rng
- Virtio-scsi
- Virtio-serial
- Virtio-block
- Virtio-input
- Windows graphics drivers
Use 7-zip to unzip the downloaded Windows ISO to a folder; for example, into
C:\Dev\Temp\wim\windows10-17763-107-LTSCDelete
C:\Dev\Temp\wim\windows10-17763-107-LTSC\sources\boot.wimandC:\Dev\Temp\wim\windows10-17763-107-LTSC\sources\install.wimCopy
C:\WIM\boot.wimandC:\WIM\install.wimtoC:\Dev\Temp\wim\windows10-17763-107-LTSC\sourcesDownload and unzip cdrtools-3.01.a23-bootcd.ru-mkisofs.7z to a folder; for example, to
C:\Dev\Temp\wim\cdrtools-3.01.a23-bootcd.ru-mkisofsCreate a batch file named
mkisofs_both_legacy_and_uefi.batcontaining (update folder names as needed to reflect where the referenced files are located on your system, andinputdir,outputisoandmkisofs.exepath, downloaded by the previous step):set inputdir=C:\Dev\Temp\wim\windows10-17763-107-LTSC set outputiso=C:\Dev\Temp\wim\mkisofs_iso\windows10-17763-107-LTSC-Virtio-Gfx.iso set label="WIN10_17763_107_LTSC_VIRTIO_GFX" set biosboot=boot/etfsboot.com set efiboot=efi/microsoft/boot/efisys.bin C:\Dev\Temp\wim\cdrtools-3.01.a23-bootcd.ru-mkisofs\mingw\mkisofs.exe \ -iso-level 4 -l -R -UDF -D -volid %label% -b %biosboot% -no-emul-boot \ -boot-load-size 8 -hide boot.catalog -eltorito-alt-boot \ -eltorito-platform efi -no-emul-boot -b %efiboot% -o %outputiso% \ %inputdir%
Run this
mkisofs_both_legacy_and_uefi.batscript. The resulting ISO will be generated inoutputisolocation you specified.
Create Raw Disk¶
Run these commands on the Service VM:
# swupd bundle-add kvm-host
# mkdir /root/img
# cd /root/img
# qemu-img create -f raw win10-ltsc-virtio.img 30G
Install Windows 10¶
Note
Make sure you have configured your monitor and display according to 3 of Boot Windows with GVT-g on ACRN.
Copy
/usr/share/acrn/samples/nuc/launch_win.shtoinstall_win.sh:# cp /usr/share/acrn/samples/nuc/launch_win.sh ~/install_win.shAdd the following lines before the
acrn-dmcommand line ininstall_win.sh. It is used to passthrough USB to WaaG, by which both mouse and keyboard can be used during the Windows installation:echo "8086 9d2f" > /sys/bus/pci/drivers/pci-stub/new_id echo "0000:00:14.0" > /sys/bus/pci/devices/0000:00:14.0/driver/unbind echo "0000:00:14.0" > /sys/bus/pci/drivers/pci-stub/bind
Note
You may need to change the bdf and vid/pid of the USB controller in the above command to match those of your platform. Use
lspciandlspci -nto get this information.Edit the
acrn-dmcommand line ininstall_win.shas follows:- Change
-s 3,virtio-blk,./win10-ltsc-virtio.imgto your path to the Windows 10 image. - Add
-s 6,passthru,0/14/0.
Note
You may need to change 0/14/0 to match bdf of the USB controller of your platform.
- Add
-s 8,ahci,cd:./windows10-17763-107-LTSC-Virtio-Gfx.isoto point to the ISO you re-generated above. - Add
-s 9,ahci,cd:./virtio-win-0.1.141.isoto point to your path to the virtio-win iso.
Or if you used the Oracle driver:
- Add
-s 9,ahci,cd:./winvirtio.isoto point to your path to the winvirtio iso.
- Change
Run
install_win.sh.When the display reads “Press any key to boot from CD or DVD” on the monitor, press any key in the terminal on the Host side.
Click Load driver.
Click Browser and go to the drive which includes the virtio win drivers. Select viostor\w10\amd64\viostor.inf or viostororcl.inf if you are using Oracle virtio drivers and install the virtio block driver.
Select the virtio block drive and click Next.
Continue with the installation.
The system will restart.
Windows will restart several times and then you will be asked to configure your system.
The Windows installation is complete after a few configuation steps, and you get to the Windows desktop.
Boot Windows with GVT-g on ACRN¶
Modify the
/usr/share/acrn/samples/nuc/launch_win.shscript to specify the Windows image generated above.Run the
launch_win.shand you should see the WaaG desktop coming up over the HDMI monitor (instead of the VNC).Note
Use the following command to disable the GNOME Display Manager (GDM) if it is enabled:
# sudo systemctl mask gdm.serviceNote
You must connect two monitors to the KBL NUC in order to launch Windows with the default configurations above.
Note
The second monitor must include the Weston desktop. If you have set up Weston in the Service VM, follow the steps in GPU Passthrough on Skylake NUC to set up Weston as the desktop environment in Service VM in order to experience Windows with the AcrnGT local display feature.
ACRN Windows verified feature list¶
| Items | Details | Status |
|---|---|---|
| IO Devices | Virtio block as the boot device | Working |
| AHCI as the boot device | Working | |
| AHCI cdrom | Working | |
| Virtio network | Working | |
| Virtio input - mouse | Working | |
| Virtio input - keyboard | Working | |
| GOP & VNC remote display | Working | |
| GVT-g | GVT-g without local display | Working with 3D benchmark |
| GVT-g with local display | Working with 3D benchmark | |
| Tools | WinDbg | Working |
| Test cases | Install Windows 10 from scratch | OK |
| Windows reboot | OK | |
| Windows shutdown | OK | |
| Built-in Apps | Microsoft Edge | OK |
| Maps | OK | |
| Microsoft Store | OK | |
| 3D Viewer | OK |
Known Limitations¶
- The cursor is not visible with the GVG-g local display.
- The Windows graphic driver version must be
igfx_win10_100.7212.zip; the latest version1910.1007372.zipcannot be installed correctly.
Device configurations of acrn-dm command line¶
-s 3,ahci,hd:/root/img/win10.img: This is the hard disk onto which to install Windows 10. Make sure that the slot ID 3 points to your win10 img path.
-s 4,virtio-net,tap0: This is for the network virtualization.
-s 5,fbuf,tcp=0.0.0.0:5900,w=800,h=600: This will open a port 5900 on Service VM which can be connected to via vncviewer.
-s 6,virtio-input,/dev/input/event4: This is to passthrough the mouse/keyboard to Windows via virtio. Please change
event4accordingly. You can use the following command to check the event node on your Service VM:<To get the input event of mouse> # cat /proc/bus/input/devices | grep mouse
-s 7,ahci,cd:/root/img/Windows.iso: This is the IOS image used to install Windows 10. It appears as a cdrom device. Make sure that the slot ID 7 points to your win10 ISO path.
-s 8,ahci,cd:/root/img/virtio-win-0.1.141.iso: This is another cdrom device to install the virtio Windows driver later. Make sure it points to your VirtIO ISO path.
–ovmf /usr/share/acrn/bios/OVMF.fd: Make sure it points to your OVMF binary path
Secure boot enabling¶
You may refer to the steps in How to enable secure boot for Windows for secure boot enabling.
Activate Windows 10¶
If you are using a trial version of Windows 10, you may find that some apps and features do not work or that Windows 10 get automatically shut down by the Windows licensing monitoring service. To avoid these issues, obtain a licensed verson of Windows.
For Windows 10 activation steps, refer to “Activate Windows 10”
References¶
| [1] | (1, 2) These virtio drivers injecting batch scripts are based on Derek Seaman’s IT blog about injecting VirtIO Drivers into Windows. |