These are the steps I used to get Ubuntu ARM aarch64 running with QEMU on OSX.
Get Ubuntu Image and QEMU EFI:
wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-arm64-uefi1.img
wget https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd
Create EFI volumes:
dd if=/dev/zero of=flash0.img bs=1m count=64
dd if=QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1m count=64
Create a cloud.txt
file replacing the username, here shown as oznu
, and the ssh-rsa value with the values appropriate for you:
#cloud-config
users:
- name: oznu
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
Create a cloud-config disk image:
cloud-localds --disk-format qcow2 cloud.img cloud.txt
cloud-localds
is part of the cloud-utils
package which is not is not available on OSX. I used an Ubuntu docker image to run the command.
docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) ubuntu
apt-get update && apt-get -y install cloud-utils
cloud-localds --disk-format qcow2 cloud.img cloud.txt
Backup your image:
cp ubuntu-16.04-server-cloudimg-arm64-uefi1.img ubuntu-16.04-server-cloudimg-arm64-uefi1.img.original
Launch QEMU Guest:
qemu-system-aarch64 -m 1024 -smp 2 -cpu cortex-a57 -M virt -nographic \
-pflash flash0.img \
-pflash flash1.img \
-drive if=none,file=ubuntu-16.04-server-cloudimg-arm64-uefi1.img,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-blk-device,drive=cloud \
-netdev user,id=user0 -device virtio-net-device,netdev=user0 \
-redir tcp:2222::22