30.11.2020: Updated with the new patchseries and instructions for Windows
- Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters)
- Apply the patchseries by Alexander Graf https://patchwork.kernel.org/project/qemu-devel/list/?series=392975
curl https://patchwork.kernel.org/series/392975/mbox/ | git am
- Install required packages for building:
brew install libffi gettext pkg-config autoconf automake pixman
- Run the following commands to build qemu:
mkdir build
cd build
../configure --target-list=aarch64-softmmu
make
sudo make install
- For some reason, the qemu binary is modified during
make install
. You need to resign it with the correct entitlements, otherwise you will get anUnknown Error
:
sudo codesign --entitlements /path/to/qemu/accel/hvf/entitlements.plist --force -s - `which qemu-system-aarch64`
- Download Ubuntu Server for ARM https://ubuntu.com/download/server/arm
- Create a hard disk:
qemu-img create -f qcow2 disk.qcow2 10G
- Run qemu with the following command-line arguments:
qemu-system-aarch64 \
-accel hvf \
-m 2048 \
-cpu cortex-a57 -M virt,highmem=off \
-bios edk2-aarch64-code.fd \
-serial telnet::4444,server,nowait \
-drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \
-device virtio-blk-device,drive=hd0,serial="dummyserial" \
-device virtio-net-device,netdev=net0 \
-netdev user,id=net0 \
-vga none -device ramfb \
-cdrom /path/to/ubuntu.iso \
-device usb-ehci -device usb-kbd -device usb-mouse -usb \
-monitor stdio
- You should be able to install Ubuntu as normal
- If you want a desktop environment, you can install it using
sudo apt-get install ubuntu-desktop
- Download Windows for ARM from here
- For Windows, we need to replace the VirtIO block device with something that is supported natively by the OS. Otherwise, the command-line is almost unchanged
- You may want to pass multiple cores to the VM using
-smp X
:
qemu-system-aarch64 \
-accel hvf \
-m 2048 -smp 2 \
-cpu cortex-a72 -M virt,highmem=off \
-bios edk2-aarch64-code.fd \
-serial telnet::4444,server,nowait \
-drive if=none,file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,format=vhdx,id=hd0 \
-device nvme,drive=hd0,serial="dummyserial" \
-device virtio-net-device,netdev=net0 \
-netdev user,id=net0 \
-vga none -device ramfb \
-device usb-ehci -device usb-kbd -device usb-mouse -usb \
-monitor stdio
Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this gist for a guide (be sure to use version 0.1.190 instead of 0.1.185)
The resolution is set to 800x600 by default. To change it, hit Esc at the immediately after starting the VM, while you see the tianocore logo, to get into the OVMF config menu. Choose Device Manager
-> OVMF Platform Configuration
-> Change Preferred
-> Select 1024x768
-> Commit Changes and Exit
-> Esc -> Reset
. This change will not persist, you have to repeat the same steps after every boot.