Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!
NOTE: that this is current, 10/1/2021 state.
-
Install Xcode from App Store or install Command Line Tools on your Mac running on Apple Silicon.
xcode-select --install
-
Install ARM64 Homebrew and QEMU dependencies.
If you already installed x86_64 Homebrew in
/usr/local
, please uninstall it. It’s not possible to build QEMU with x86_64 Homebrew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install ninja pkgconfig glib pixman
-
Clone the latest QEMU source code
The latest
master
at 10/1/2021 has Apple Silicon support.git clone --depth 1 https://git.qemu.org/git/qemu.git
-
Build QEMU.
In
qemu
directory, run following commands.mkdir build cd build ../configure --target-list=aarch64-softmmu --enable-cocoa make -j
It creates
qemu-img
,qemu-system-aarch64
etc, which we use later. -
Download pre-build EDK II OVMF EFI image for QEMU.
This EFI image is built from
stable202011
tag with additional resolutions inQemuRamfb.c
.To build it from the source code for adding more resolutions, see the following section.
-
Prepare pflash for non-volatile variable store, such as screen resolution.
Create a working directory and run following command.
tar xzvf QEMU_EFI-*.tar.gz dd if=/dev/zero of=pflash0.img bs=1m count=64 dd if=/dev/zero of=pflash1.img bs=1m count=64 dd if=QEMU_EFI.fd of=pflash0.img conv=notrunc dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
- Please use each path to where you download it.
- This step is optional, you can use
-bios QEMU_EFI.fd
instead of-drive ...if=pflash
lines in the next step, but in that case, any changes in EFI will not be persistent.
-
Download Windows 10 on ARM Insider Preview
https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
-
Convert VHDX downloaded Windows image to raw format
It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to raw format before using it. Using raw format makes the disk image file a sparse file on APFS disk. See "Compact raw disk image" section below for the details.
qemu-img convert -p -O raw Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX Windows10.raw
- Please use each path to where you download it.
-
Run Windows 10
qemu-system-aarch64 \ -monitor stdio \ -M virt,highmem=off,virtualization=on \ -accel hvf \ -cpu host \ -smp 4 \ -m 4096 \ -drive file=pflash0.img,format=raw,if=pflash,readonly=on \ -drive file=pflash1.img,format=raw,if=pflash \ -device ramfb \ -device qemu-xhci \ -device usb-kbd \ -device usb-tablet \ -device intel-hda \ -device hda-duplex \ -nic user,model=virtio \ -drive file=Windows10.raw,format=raw,if=none,id=boot \ -device nvme,drive=boot,serial=boot
- Please modify each path to the image depends on your environment.
- Hit
ESC
while you see TianoCore, thenDevice Manager
,OVMF Platform Configuration
,Change Preferred Resolution for Next Boot
to change screen resolution. - To add more resolutions, follow "Build EDK II OVMF EFI image from
the source code" below and modify
OvmfPkg/QemuRamfbDxe/QemuRamfb.c
then build newQEMU_EFI.fd
. - Use
-device usb-tablet
instead of-device usb-mouse
allows transparently moving mouse cursor. -device intel-hda -device hda-duplex
to enable audio.-nic user,model=virtio
is the network interface. To enable it, see the following section.
VirtIO NIC is not enabled by default. To make it works, you need to install a device driver.
-
Download VirtIO device drivers ISO from Fedora Project.
-
Mount device drivers ISO
Add next options to
qemu-system-aarch64
.-drive file=virtio-win-0.1.190.iso,media=cdrom,if=none,id=drivers \ -device usb-storage,drive=drivers
Please modify each path to the image depends on your environment.
-
Disable device driver signature enforcement
Boot Windows, then right click Windows Start button, then select Command Prompt (Admin).
Use bcdedit to enable test-signed device drivers.
bcdedit.exe -set TESTSIGNING ON
Then reboot Windows.
See here for the details.
-
Install driver
Once Windows booted again, then right click Windows Start button, then select Device Manager.
In Device Manager, select View menu then Devices by Connection.
Navigate in the device tree, select
ACPU ARM64-based PC
,Microsoft ACPI-Compliant System
,PCI Express Root Complex
, then you will see oneUnknown device
there. (There are manyUnknown device
in tree but the one underPCI Express Root Complex
is the VirtIO NIC.)Right click
Unknown device
then select Update Drivers, then Browse my computer for drivers, then selectD:\NetKVM\w10\ARM64
.Click Next to install
Red Hat VertIO Ethernet Adapter
.
If you use ls
or similar tool, you will notice that Windows10.raw
is using
large like 64GB disk space, however, it is not actually using that space.
By using Finder, you will see in info panel of that file, that shows the actual disk usage is much lower than that, like 10GB. Or, you can see actual size on disk by using the following command.
$ du -h Windows10.raw
10G Windows10.raw
This is because APFS is using a sparse file format automatically and doesn’t actually allocate the space until it is used. However, even though, the actual size on disk can be getting bigger as using Windows, especially after Windows Update, even if you delete files.
If the disk image is too big, you may want to compact it to release free space
by using Defragment and Optimize Drives coming with Windows 10 and optimize C:
drive, then use my HolePunch tool
to reduce the actual disk usage.
$ git clone https://github.com/niw/HolePunch.git
$ ce HolePunch
$ swift build -c release
$ .build/release/holepunch --show-progress /path/to/Windows10.raw
Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Server for ARM64 and install it.
-
Follow previous steps from 1. to 6. to prepare QEMU.
-
Create an empty disk image.
qemu-img create -f raw ubuntu.raw 40G
-
Download Ubuntu Server for ARM64
-
Install Ubuntu Server for ARM
qemu-system-aarch64 \ -monitor stdio \ -M virt,highmem=off,virtualization=on \ -accel hvf \ -cpu host \ -smp 4 \ -m 4096 \ -drive file=pflash0.img,format=raw,if=pflash,readonly=on \ -drive file=pflash1.img,format=raw,if=pflash \ -device virtio-gpu-pci \ -display default,show-cursor=on \ -device qemu-xhci \ -device usb-kbd \ -device usb-tablet \ -device intel-hda \ -device hda-duplex \ -drive file=ubuntu.raw,format=raw,if=virtio,cache=writethrough \ -cdrom ubuntu-20.04.1-live-server-arm64.iso
- Follow instruction to install Ubuntu Server. Once it’s installed,
-cdrom
argument is not needed.
- Follow instruction to install Ubuntu Server. Once it’s installed,
Follow the previous instructions to run Ubuntu Server for ARM64.
-
Checkout EDK II source code.
git clone --depth 1 --branch edk2-stable202011 https://github.com/tianocore/edk2.git cd edk2 git submodule update --init --recursive
You may want to disable xHCI due to current Hypervisor.framework patch limitation. Comment out
MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
in/ArmVirtPkg/ArmVirtQemu.dsc
and/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
. Probably this is no longer needed. -
Build it.
sudo apt install iasl python3 python3-distutils uuid-dev make g++ source edksetup.sh make -C BaseTools build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
Then, you will get
QEMU_EFI.fd
andQEMU_VARS.fd
inBuild/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV
.-
The easiest way to take these files to the host macOS, run Remote Login on macOS then
scp
these to10.0.2.2
. -
To build these on x86_64 environment, use following toolchain to cross compile.
sudo apt install gcc-aarch64-linux-gnu env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
-
I tried following this with OracleLinux-R8-U3-aarch64 and it boots up and then when trying to install I got: synchronous exception. The same happened in Parallels. Is this due to the RedHat kernel?