sudo pacman -S qemu unzip qemu-arch-extra
  • Extract the image
unzip <revpi-image>.zip
  • Convert .img to .qcow2
qemu-img convert -f raw -O qcow2 <revpi-image>.img <revpi-image>.qcow2

Adjust the size of the image as needed

qemu-img resize <revpi-image>.qcow2 4GB
  • Boot it up with QEMU
sudo qemu-system-arm -kernel kernel-qemu-4.19.50-buster \
   -dtb versatile-pb-buster.dtb \
   -m 256 -cpu arm1176 \
   -machine versatilepb \
   -hda 2020-06-25-revpi-stretch.qcow2 \
   -append "root=/dev/sda2"

As a side note, versatilepb machine only allows for 256 MB of RAM.

touch /home/pi/.revpi-factory-reset

You can learn more about the process by observing piserial package

dpkg -l piserial
  • Change the hostname
sudo hostnamectl set-hostname revpi
  • Edit /etc/hosts manually and and the hostname there
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

# set local hostname here
127.0.1.1       revpi

Interacting with the guest

  • Back on the host, install virt-manager
sudo pacman -S virt-manager ebtables dnsmasq bridge-utils openbsd-netcat
  • Add yourself to the necessary groups
sudo usermod -aG kvm,libvirt username
user = "username"
group = "kvm"
sudo virsh net-define /etc/libvirt/qemu/networks/default.xml
sudo virsh net-autostart default
sudo virsh net-start default

Check that the network virbr0 is present

brctl show # virbr0
  • Logout and log back in, then start the daemon
sudo systemctl start libvirtd.service
  • Create a domain file /tmp/revpi.xml, a courtesy of kim tinh
<domain type='qemu'>
  <name>rpi</name>
  <uuid>da70087f-7142-42dc-9975-00b7fa5c8435</uuid>
  <memory unit='KiB'>262144</memory>
  <currentMemory unit='KiB'>262144</currentMemory>
  <os>
    <type arch='armv6l' machine='versatilepb'>hvm</type>
    <kernel>/path/to/kernel-qemu-4.19.50-buster</kernel> <!--update path here-->
    <cmdline>root=/dev/sda2</cmdline>
    <dtb>/path/to/versatile-pb-buster.dtb</dtb>          <!--update path here-->
    <boot dev='hd'/>
  </os>
  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>arm1176</model>
  </cpu>
  <devices>
    <emulator>/usr/bin/qemu-system-arm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/path/to/.qcow2'/>                   <!--update path here-->
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='bridge'>
      <mac address='52:54:00:ed:eb:c7'/>
      <source bridge='virbr0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
      <image compression='off'/>
      <gl enable='no' rendernode='/dev/dri/by-path/pci-0000:00:02.0-render'/>
    </graphics>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </video>
  </devices>
</domain>

Change the path of kernel-qemu-4.19.50-buster, versatile-pb-buster.dtb and .qcow2 file to the correct absolute path

  • Create a new domain for RevPi
sudo virsh define /tmp/revpi.sh
  • Start the domain
sudo virsh start revpi
  • Make sure the avahi-daemon is started
sudo systemctl start avahi-daemon
  • Copy ssh credentials over, the password is raspberry
ssh-copy-id [email protected]
  • Interact with the emulated image
ssh [email protected]

Installing latest Node

The guest has node 10.19.0 present via RevPi backports:

node -v # 10.19.0

Check the architecture

uname -m # armv6l

Emulated arm1176 CPU is unfortunately an armv6l architecture, which is not officially supported by node

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash

Make sure that installation was successful

command -v nvm
NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release nvm install 14.9

Done!