Qemu 2.0 includes arm64 support, and Debian 8 (and above) fully supports it.
In October 2013 the arm64 (aarch64) qemu port became publicly available. It is a user-space emulation, so it may not be applicable to all development tasks. It is fine for building software, and it is _much_ faster and often easier to use than ARM's proprietary (free beer) Foundation Model. In 2020, qemu-system-arm 5.1 and linux-image-arm64 5.9 Debian packages enable the KVM acceleration. Add -enable-kvm -cpu host to qemu-system-aarch64. For 32-bit emulation on 64-bit ARM, use qemu-system-aarch64 -enable-kvm -cpu host,aarch64=off. The emulation becomes several times faster! (Is it available in Buster?)
The development was done by folks at SUSE Linux, so kudos to them. This code was incorporated into Qemu 2.0 in March 2014 by Linaro, and there is no longer a need to build arm64 from the development branch.
Use prebuild Arm64 image
You can download a prebuild Arm64 image from https://cdimage.debian.org/cdimage/openstack/current/
The following steps use debian-9.9.0-openstack-arm64.qcow2 as an example.
prerequisite: verify public ssh key on the host
If you have not already done so, generate your ssh key:
Ensure that the public ssh key(s) you wish to be placed on the client VM are active within your authentication agent. You can check which ones are active by running:
step1: install packages
sudo apt-get install qemu-utils qemu-efi-aarch64 qemu-system-arm
step2: add ssh key to the image
sudo modprobe nbd sudo qemu-nbd -c /dev/nbd0 debian-9.9.0-openstack-arm64.qcow2 sudo mount /dev/nbd0p2 /mnt ssh-add -L > /mnt/home/debian/.ssh/authorized_keys sudo umount /mnt sudo qemu-nbd -d /dev/nbd0
step3: boot the image
qemu-system-aarch64 -m 2G -M virt -cpu max \ -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ -drive if=none,file=debian-9.9.0-openstack-arm64.qcow2,id=hd0 -device virtio-blk-device,drive=hd0 \ -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:5555-:22 \ -nographic
(Add -enable-kvm if your host CPU is a 64-bit ARM.)
(Add -device virtio-gpu-pci to enable a graphic card.)
(Add -device usb-ehci -device usb-kbd to enable USB keyboard.)
(Add -device intel-hda -device hda-output to enable audio.)
step4: use ssh to login
ssh email@example.com -p 5555
Build your own Arm64 (or armhf or armel) QEMU image
A shell script building a bootable QEMU image is available at https://github.com/emojifreak/qemu-arm-image-builder The script can be run on Debian like Linux of any CPU.
Use Qemu user mode
You can verify support by checking for the availability of the aarch64 interpreter:
# update-binfmts --display | grep -i aarch qemu-aarch64 (enabled): interpreter = /usr/bin/qemu-aarch64-static
Since Debian supports arm64, installation is as simple as as the following.
The first task is to elevate to root:
$ su - password: #
The second step is to configure locales so your Qemu Chroots have access to them. Otherwise, you will have to configure each Chroot's locale individually.
# From the host # dpkg-reconfigure locales (complete the process)
The third step is to install the requisite packages. They are qemu, qemu-user-static, binfmt-support and debootstrap.
# From the host apt-get install qemu qemu-user-static binfmt-support debootstrap
The fourth step uses debootstrap to create the Chroot environment. In the command below, the Chroot will be named debian-arm64. You can change it to suit your taste.
# From the host # qemu-debootstrap --arch=arm64 --keyring /usr/share/keyrings/debian-archive-keyring.gpg \ --variant=buildd --exclude=debfoster jessie debian-arm64 http://ftp.debian.org/debian ... I: Retrieving Release I: Retrieving Release.gpg I: Checking Release signature I: Valid Release signature (key id 75DDC3C4A499F1A18CB5F3C8CBF8D6FD518E17E1) I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... ... I: Checking component main on http://ftp.debian.org/debian... I: Retrieving acl 2.2.52-2 I: Validating acl 2.2.52-2 I: Retrieving apt 18.104.22.168.1 I: Validating apt 22.214.171.124.1 ...
The fifth step enters the arm64 Chroot:
# From the host # chroot debian-arm64/ # Now in the guest # uname -a Linux core2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5 (2015-10-09) aarch64 GNU/Linux
The final steps installs the Debian Ports keyring and installs some software to use in the environment:
# In the guest # apt-get install debian-ports-archive-keyring ... apt-get install locales build-essential gcc g++ gdb make subversion git curl zip unzip ...