These are the steps I used to get Ubuntu ARM aarch64 running with QEMU latest 5.0.0
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:
MacOS,
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
Linux,
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(redir is deprecated):
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 \
-device virtio-net-device,netdev=user0 \
-netdev user,id=user0,hostfwd=tcp::2222-:22
Ssh:
ssh -p2222 oznu@localhost
Now you can access the internet in the arm VM! (ping not work)
Install OS from CDROM/iso image