I was able to successfully virtualize Windows 10 for ARM on M1 with Alexander Graf's QEMU hypervisor patch.
Screenshot:
How to virtualize Windows 10 on M1:
1. Download qemu-m1.zip from https://mega.nz/file/QYB0QTrC#p6IMBJlFqqNKuGonwrDkPOVKQj8yHCVgiLOYVaGvs4M or this forum attachment. It contains pre-built versions of qemu-system-aarch64, efi-virtio.rom, and QEMU_EFI.fd. (All of these are open-source, and you can build them yourself by following instructions in the next section.)2. Double click qemu-m1.zip to unzip it.
3. Download Windows Insider Preview ARM64 from Microsoft at https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64, which will get you a VHDX image.
4. Using Finder, move the downloaded VHDX image into the unzipped qemu-m1 folder.
5. Open Terminal and navigate to the qemu-m1 folder. Copy and paste the code below to Terminal, and press return.
Code:
cd ~/Downloads/qemu-m1
Code:
DYLD_LIBRARY_PATH=. \
./qemu-system-aarch64 \
-M virt \
-accel hvf \
-m 5G \
-smp 4 \
-cpu max \
-device ramfb \
-serial stdio \
-drive file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,if=none,id=NVME1 \
-device nvme,drive=NVME1,serial=nvme-1 \
-device nec-usb-xhci \
-device usb-kbd \
-device usb-tablet \
-device intel-hda -device hda-duplex \
-drive file=vars-template-pflash.raw,if=pflash,index=1 \
-bios QEMU_EFI.fd
How to increase resolution to 1024x768:
1. Shut down Windows.2. qemu-system-aarch64 > Quit QEMU > Quit.
3. Start the virtual machine with the same command line argument as listed in step 6 of the previous section.
4. When QEMU shows "Start boot option", press the escape key on your keyboard.
5. Use the arrow down key to move selection to "Device Manager", press return, then move down to "OVMF Platform Configuration", and press return. Changing selection may take a while to update after pressing the arrow key. It is normal.
6. Highlight <640x480> or <800x600> next to "Change Preferred", press the return key, and change selection to 1024x768.
7. Press both fn and F10 on your keyboard to save the changes. (If you're using a PC keyboard, just press F10).
8. Press esc to go back to the main menu.
9. Press down arrow a few times to move selection to "Continue", then press return on your keyboard.
10. After Windows has booted, shut down Windows.
11. qemu-system-aarch64 > Quit QEMU > Quit.
12. Start the virtual machine with the same command line argument as listed in step 6 of the previous section.
How to get internet access in the virtual machine:
1. Download the virtio driver ISO from https://fedorapeople.org/groups/vir...o/virtio-win-0.1.190-1/virtio-win-0.1.190.iso2. Move the downloaded ISO to the qemu-m1 folder.
3. In Windows 10, right click on the Start menu, then choose “Command Prompt (Admin)”.
4. Click “Yes” in the UAC prompt.
5. Allow drivers that are test-signed.
Code:
bcdedit -set TESTSIGNING ON
7. qemu-system-aarch64 > Quit QEMU > Quit.
8. Boot QEMU again with updated arguments.
Code:
DYLD_LIBRARY_PATH=. \
./qemu-system-aarch64 \
-M virt \
-accel hvf \
-m 5G \
-smp 4 \
-cpu max \
-device ramfb \
-serial stdio \
-drive file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,if=none,id=NVME1 \
-device nvme,drive=NVME1,serial=nvme-1 \
-device nec-usb-xhci \
-device usb-kbd \
-device usb-tablet \
-device intel-hda -device hda-duplex \
-drive file=vars-template-pflash.raw,if=pflash,index=1 \
-drive file=virtio-win-0.1.190.iso,media=cdrom,if=none,id=cdrom -device usb-storage,drive=cdrom \
-net nic,model=virtio \
-net user \
-bios QEMU_EFI.fd
10. In the “Other devices” section, scroll all the way to the end.
11. Right click on the last “Unknown device” > Update drivers > Browse my computer for drivers > Browse.
12. Choose the virtual CD Drive (D virtio-win > OK > Next > Allow.
13. You should now have internet in the Windows 10 virtual machine.
Tips:
If you're getting any GateKeeper warnings, remove the Quarantine extended attribute (preferred) or temporarily turn off GateKeeper (not recommended):
Code:
xattr -rd com.apple.quarantine ~/Downloads/qemu-m1
How to build and run QEMU on M1 from source:
This section is for advanced users who are comfortable using Terminal.1. If you already installed Homebrew or required dependencies using Rosetta 2, follow https://github.com/homebrew/install#uninstall-homebrew to uninstall the Intel version of Homebrew and other dependencies.
2. Install the native arm64 version of Homebrew on Apple Silicon. Follow https://soffes.blog/homebrew-on-apple-silicon, and look for the “Multiple Homebrews” section, then add /opt/homebrew/bin to your path.
3. Download the python3.9 Homebrew formula from https://github.com/Homebrew/homebrew-core/raw/master/Formula/python@3.9.rb. Open it in any text editor, then edit line 124 into the following, and save the edited Ruby file.
Code:
args << "MACOSX_DEPLOYMENT_TARGET=11.0"
Code:
brew install ~/Downloads/python@3.9.rb
Code:
brew install pkg-config glib pixman ninja
6. Checkout QEMU, then cd into it.
Code:
git clone https://git.qemu.org/git/qemu.git
cd qemu
Code:
git apply ~/Downloads/hvf-Implement-Apple-Silicon-Support.patch
Code:
int hvf_arch_init_vcpu(CPUState *cpu)
{
ARMCPU *arm_cpu = ARM_CPU(cpu);
CPUARMState *env = &arm_cpu->env;
env->aarch64 = 1;
hv_return_t ret;
ret = hv_vcpu_set_sys_reg(cpu->hvf_fd, HV_SYS_REG_SCTLR_EL1,
arm_cpu->reset_sctlr);
return ret;
}
Code:
./configure --cpu=aarch64 --target-list=aarch64-softmmu
Code:
make
Code:
cd build
12. Extract EDK2.
Code:
tar -xf ~/Downloads/edk2.git-aarch64-0-20201023.1506.gf69a2b9a42.noarch.rpm
Code:
mv ./usr/share/edk2.git/aarch64/* ./
Code:
./qemu-system-aarch64 \
-M virt \
-accel hvf \
-m 5G \
-smp 4 \
-cpu max \
-device ramfb \
-serial stdio \
-drive file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,if=none,id=NVME1 \
-device nvme,drive=NVME1,serial=nvme-1 \
-device nec-usb-xhci \
-device usb-kbd \
-device usb-tablet \
-device intel-hda -device hda-duplex \
-drive file=vars-template-pflash.raw,if=pflash,index=1 \
-bios QEMU_EFI.fd
Source:
https://patchwork.kernel.org/project/qemu-devel/list/?series=391797
Attachments
Last edited: