UEFI Manual ARM for Libvirt/KVM

craig arm-based netbook running debian

Overview

  • Create an UEFI (newish) ARM Hard Float (32-bit) virtual machine for Libvirt/KVM using a traditional interactive Debian install.
  • See Four ARMs for Libvirt/KVM Virtualisation for prerequisites, why, and other alternatives.

Get the Installer Image

  1. Get Debian Buster armhf CD#1 image

Prepare to Use the Debian-Installer Image

Open the download location in a terminal.

Copy the CD image

  1. sudo cp debian-10.6-buster-armhf-complete-image.img /var/lib/libvirt/images on the machine where you will host the ARM VM.

OR upload CD image using virsh

  1. virsh -c qemu+ssh://user@host/system vol-create-as --pool default --name debian-10.6.0-armhf-xfce-CD-1.iso --format raw --allocation <size-from-ls> --capacity <size-from-ls>
  2. virsh -c qemu+ssh://user@host/system vol-upload --pool default --vol debian-10.6.0-armhf-xfce-CD-1.iso --file debian-10.6.0-armhf-xfce-CD-1.iso

Create the ARM VM using Virtual Machine Manager

  1. Launch “Virtual Machine Manager” (virt-manager from the command line).
  2. Select ‘File|New Virtual Machine’
  3. Select ‘Import existing disk image’
  4. Change ‘Architecture options’ to Architecture: ‘arm’, Machine Type: ‘virt-2.12’. (virt-3.0 and virt-3.1 are known to not work with this guide; newer and older versions likely will work).
  5. Select ‘Browse…’, create a virtual hard disk for the new VM, and select ‘Choose Volume’.
  6. Set the operating system to ‘Debian10’
  7. Select ‘Forward’
  8. Configure the amount of memory and cpus (max 4) and select ‘Forward’
  9. Set the VM name and check ‘Customize configuration before install`
  10. Select the appropriate network device for your virtual hosting setup.
  11. Click ‘Finish’
  12. Change ‘Firmware’ to ‘Custom: /usr/share/AAVMF/AAVMF32_CODE.fd’ and click ‘Apply’.
  13. Select ‘Add Hardware’, and add a Controller of ‘Type: SCSI’ and ‘Model: VirtIO SCSI’.
  14. Select ‘Add Hardware’, and add Storage (CD-ROM) for the CD ISO image (use SCSI as the bus type).
  15. Under ‘Boot Options’ make sure ‘SCSI CD-ROM 1’ is checked and second (after VirtIO Disk 1)
  16. Select ‘Begin installation’
  17. Make sure to select the VM console when it appears otherwise random errors may occur.

Perform Debian Installation

I won’t cover this in detail as it’s a fairly standard Debian install except:

  1. Installation will complete and the VM will reboot into the installer. (This misbehaviour may depend on the version of libvirt you are using; if you are fortunate the VM will simply boot into Debian directly).
  2. Force off the VM (e.g. in VMM with ‘Virtual Machine|Force Off’)
  3. Remove the CD image from the CD-ROM (optionally remove the virtual CD-ROM device too; you won’t need it).

Enable VM (domain) Boot into Debian

  1. Boot the VM (e.g. using ‘Virtual Machine|Run’).
  2. It will drop to a UEFI shell.
  3. Execute bcfg add 0 FS0:EFI\debian\grubarm.efi "Linux"
  4. Execute reset
  5. VM should reboot into Debian GNU/Linux.

Boot at Will

Your UEFI ARM Hard Float Virtual Machine is now ready for use.

By Daniel F. Dickinson

Daniel Dickinson has been using and exploring computer and electronic technologies for over three decades. He is proficient with various flavours of Linux (including varieties of desktop, server, and embedded systems) as well as modern Windows. Daniel still enjoys software and firmware development, but prefers integration and extending existing open source solutions to quickly achieve desired goals. Fo more details see https://www.wildtechgarden.com/about/about-daniel-f

Leave a comment

Your email address will not be published. Required fields are marked *