Running Windows 10 on ARM with KVM acceleration enabled is quite tricky and requires a 64-bit OS with a KVM-enabled kernel (/dev/kvm must exist) - so not sure if the current Pi distros of Debian satisfy those requirements? Best bet is Ubuntu or Gentoo right now.
I'll take you through some of the prerequisites first...
You can install one of the latest versions of Qemu-kvm using a package manager, but it doesn't actually matter if it's version 3 or 4 because the only virtual machine version that works is 2.12 (and below) because of a bug that still hasn't been fixed in maybe 1.5 years.
Code: Select all
sudo apt install qemu-kvm libvirt-daemon-system samba
(The samba is needed if you like to create a shared drive to be accessible from within the guest VM - depends on network access).
You need to pick a folder - say the desktop or downloads folder - and download the following to the same folder:
http://snapshots.linaro.org/components/ ... EMU_EFI.fd
This is the Linaro UEFI bios that exists as a single file - but can be converted to two flash0 and flash1 IMG files if you wanted to save any bios settings - not really necessary though.
https://fedorapeople.org/groups/virt/vi ... noarch.rpm
Above is the latest ARM64 guest drivers for Qemu - comparable to VMware Tools - or VirtualBox guest add-ons, etc. You need to extract the ISO from the RPM file using an archive manager, such as 7-Zip.
Besides the drivers ISO you need to download and build up a Windows 10 on ARM ISO from one of the two main UUP dump sites (best done from an actual windows command line instead of linux terminal):
https://uup.rg-adguard.net/index.php or
https://uupdump.ml/
Only newer versions work with the official Qemu:
Insider 18348.190226-1407 (1st March 2019) or newer i.e. feature upgrade 1903 (April/May 2019) or the latest Insider is recommended.
https://blogs.windows.com/windowsexperi ... ild-18348/
https://www.theregister.co.uk/2019/03/1 ... 10_on_kvm/
If you wish to run an earlier build of Windows 10 then you should use driver1998's Qemu fork - but the CPU speed may be reduced based on how many cores you include in your VM script:
Code: Select all
git clone https://github.com/driver1998/qemu
sudo apt install glib2.0 libpixman-1-dev gcc libsdl2-dev bison flex qemu-kvm libvirt-daemon-system
cd qemu
git checkout woa-kvm
mkdir build
cd build
sudo ../configure --target-list=aarch64-softmmu --disable-werror
sudo make
sudo make install
Lastly, you need to create a VHD or VHDX for your VM - about 13 GB minimum:
Code: Select all
qemu-img create -f vhdx -o subformat=fixed system.vhdx 13G
Ensure the above are all contained in the same folder then you just need to create an SH script to run the VM:
virtio-win-0.1.171.ISO
18362.1.190318-1202.19H1_RELEASE_CLIENTPRO_OEMRET_ARM64FRE_EN-US.ISO
QEMU_EFI.fd
system.vhdx
script.sh - blank for now - see bottom
BTW, if you want to run this on Windows 10 Intel host, without KVM ,in software simulation mode only then you need to install the following and then put the same files listed above under c:\program files\qemu (or move the qemu folder to c:\qemu after installing it):
https://qemu.weilnetz.de/w64/
(and Instead of script.sh it would be named script.bat)
So you see there are two main modes for running a Qemu guest VM:
Software simulation mode
near-native hardware acceleration mode (KVM) - Intel guest on Intel host - or in this case ARM64 guest on ARM64 host.
Software Simulation mode is generally more stable, but runs extremely SLOW - recommended to use an Intel host to try to build up/test/update your VHDX-based VM before copying across to the Pi as it would be quite painful to install the Windows.ISO to the system.vhdx using the Pi in sim mode and take about 3 hours. I can do it in about 30 minutes using an i7-8700K
KVM mode currently has problems with Ethernet drivers because the VirtIO NetKVM driver hasn't been fixed yet - but there are some workarounds.
The script requires about 15 lines to run the VM. Let's start with the first few lines - some subtle differences exit between sim vs. KVM modes:
Software Simulation Mode - Linux
Code: Select all
sudo qemu-system-aarch64 \
-cpu cortex-a57 \
-accel tcg,thread=multi
Software Simulation Mode - Windows
Code: Select all
qemu-system-aarch64.exe ^
-cpu cortex-a57 ^
-accel tcg,thread=multi
KVM mode
Code: Select all
sudo qemu-system-aarch64 \
-cpu host \
-enable-kvm
For sim mode you could choose cortex-a53 instead of a57 if you wish. The rest of the script is the same for both modes:
Code: Select all
-M virt-2.12 \
-smp 2 \
-m 1.5G \
-bios QEMU_EFI.fd \
-device ramfb \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
You must use virt-2.12 or maybe 2.11 or 2.10, etc. You cannot use just -virt (latest version) or even version 3 - due to a bug.
The smp value is the number of CPU cores - can affect CPU speed with driver1998's qemu fork for some reason. I think with the Pi3-4 you should be safe with 2-3. -smp 4 seems to work too - but 1 core is meant to be reserved for the host.
The -m value represents RAM. With the Pi4 you could increase to 2 GB - but 1.5 is a more safe bet.
The bios we spoke about already...
Ramfb allows you to display the guest in a GUI window. In the past, -device VGA was used in Intel contexts - but with ARM KVM there's a bug with the framebuffer so ramfb is used instead. Should you manage to get network/RDP working later (with auto sign in) then you could use the -nographics option and just RDP to the guest.
USB devices must be added, such as keyboard and mouse. I think the tablet helps with cursor problems.
You must choose a USB controller - there are about 5 available - but the most widely used one is ich9:
The CD-ROM is quite straightforward to add:
Code: Select all
-device usb-storage,drive=install \
-drive if=none,id=install,format=raw,media=cdrom,file=18362.1.190318-1202.19H1_RELEASE_CLIENTPRO_OEMRET_ARM64FRE_EN-US.ISO \
NOTE: If you find the CD-ROM doesn't boot for whatever reason (old Windows Server 2016 on ARM or perhaps really new Windows 10 Insiders) then you can extract the contents to a FAT32 VHDX and use that as a source instead (see below for adding VHDX to the script)
To add the VirtIO ISO:
Code: Select all
-device usb-storage,drive=drivers \
-drive if=none,id=drivers,media=cdrom,file=virtio-win-0.1.171.iso \
There's two ways of adding the main hard drive - as a standard USB or VirtIO block device - both require the VioStor drivers generally:
OR
Code: Select all
-device usb-storage,drive=system \
-drive if=none,id=system,format=raw,file=system.vhdx \
OR
Code: Select all
-device virtio-blk,drive=system \
-drive if=none,id=system,format=raw,file=system.vhdx \
This line is only for running old betas of Windows Server 2016 on ARM:
Enabling network access will cause crashes and unidentified network with KVM enabled - otherwise can be used in software simulation mode with RDP connections enabled for 127.0.0.1:5555 and a shared samba drive:
Code: Select all
-device virtio-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::5555-:3389,smb=/home/ubuntu/Desktop
You have to allow blank passwords over RDP via secpol.msc:
Open Local Policies -> Security Options
Change Accounts: Limit local account use of blank passwords to console from Enabled to Disabled
This will allow auto sign in, etc. Or see this page:
https://support.microsoft.com/en-gb/hel ... in-windows
Note: Qemu guest graphics acceleration does not yet exist for ARM64 Windows by the Fedora Project (driver is named QXL) - but if you RDP you should get a better graphical experience than ramfb.
The workarounds that exist for network access inside KVM (I haven't tried them):
https://github.com/virtio-win/kvm-guest ... -522130741
https://github.com/virtio-win/kvm-guest ... -468149012
BTW, Server 2016 betas are a real nightmare to get working since the VioStor drivers only work on Win 10 and not Win Server, so simply extracting the installer ISO to a FAT32 VHD is not enough - you need to use DISM to apply the actual WIM image from the ISO sources folder to a VHDX:
Code: Select all
diskpart
list disk
select disk x (after creating/attaching VHDX in disk management)
clean
convert gpt
create partition efi size=124
format fs=fat32
assign letter s
create partition primary size=13000
format fs=ntfs quick
assign letter w
exit
dism /apply-image /imagefile:c:\wim\install.wim /index:1 /applydir:W:
bcdboot W:\Windows /s s: /f UEFI
bcdedit /store s:\EFI\Microsoft\Boot\bcd /set {default} testsigning on
bcdedit /store s:\EFI\Microsoft\Boot\bcd /set {default} nointegritychecks on
Note: the last 2 lines may not be needed when it comes to the latest drivers.
Anyway, so here's the final script for Windows 10:
Software Simulation Mode
Code: Select all
sudo qemu-system-aarch64 \
-accel tcg,thread=multi \
-M virt-2.12 \
-smp 2 \
-m 1.5G \
-cpu cortex-a53 \
-bios QEMU_EFI.fd \
-device ramfb \
-device ich9-usb-ehci1 \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
-device usb-storage,drive=install \
-drive if=none,id=install,format=raw,media=cdrom,file=18362.1.190318-1202.19H1_RELEASE_CLIENTPRO_OEMRET_ARM64FRE_EN-US.ISO \
-device usb-storage,drive=drivers \
-drive if=none,id=drivers,media=cdrom,file=virtio-win-0.1.171.iso \
-device virtio-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::5555-:3389,smb=/home/ubuntu/Desktop \
-hda system.vhdx
KVM
Code: Select all
sudo qemu-system-aarch64 \
-M virt-2.12 \
-smp 2 \
-m 1.5G \
-cpu host \
-enable-kvm \
-bios QEMU_EFI.fd \
-device ramfb \
-device ich9-usb-ehci1 \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
-hda system.vhdx
Again, you add a NIC and RDP if you get that far by appending the following:
Code: Select all
-device virtio-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::5555-:3389,smb=/home/ubuntu/Desktop
Consider a -nographic option instead of ramfb is fully working with network, RDP and auto sign-in enabled.
Consider a block device too for the main hard drive - original source here using an NEC USB bus instead - but it's up to you:
https://withinrafael.com/2018/02/11/boo ... 0-in-qemu/
When you first start the script it will load the bios then attempt to boot from CD-ROM:
press any key for cd...
Leave default keyboard
install now
skip product key
accept terms
custom: install windows only (advanced)
load driver > browse > CD virtio > viostor > w10 > ARM64
load driver > browse > CD virtio > NetKVM > w10 > ARM64
Select system hard drive > Next to install