Skip to main content

Custom-Machine-Types

qqX CUSTOM BOOTING, including Arm, Risc-V and other machine & system types

ADVANCED USERS

Make sure that you have familiarized yourself with the standard Custom Boot procedure detailed on the other wiki page.

This section is probably more useful if your CPU is already Arm or Risc-V or other, and that you are already running a Linux distro on that.

For users with X86, you should expect a slower performance as most of the CPU functions will have to be as software instead of as native pass-through.

Below are examples of running on X86 and how to achieve them.

deb-arm-sdl-mate-cropped

tumbleweed-run-cropped

The OpenSuse Risc-V was based on the pages and methods here https://en.opensuse.org/openSUSE:RISC-V

Of note, the 'virt-copy-out' should be run as sudo.

There is no need of the given ssh command as quickemu can generate a more sophisticated SDL one for you.

These were the Custom Args:

#  openSUSE TumbleWeed RiscV

# in qqX

/usr/bin/qemu-system-riscv64

-name TumbleWeed,process=TumbleWeed
-pidfile TumbleWeed/TumbleWeed.pid

-machine virt,usb=on

-device usb-ehci,id=input
-device usb-kbd,bus=input.0
-device usb-mouse,bus=input.0
-m 4G

-device virtio-balloon
-vga none

-device virtio-vga,xres=1920,yres=1080
-display sdl,gl=on

-device virtio-rng-pci,rng=rng0
-object rng-random,id=rng0,filename=/dev/urandom

-rtc base=localtime,clock=host

-device qemu-xhci,id=spicepass
-chardev spicevmc,id=usbredirchardev1,name=usbredir

-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1
-chardev spicevmc,id=usbredirchardev2,name=usbredir

-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2
-chardev spicevmc,id=usbredirchardev3,name=usbredir

-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3

-device pci-ohci,id=smartpass

-device usb-ccid
-chardev spicevmc,id=ccid,name=smartcard

-device ccid-card-passthru,chardev=ccid

-device virtio-blk-device,drive=SystemDisk

-drive file=TumbleWeed/disk.qcow2,format=qcow2,id=SystemDisk

-device virtio-net,netdev=nic

-device virtio-mouse

-netdev user,hostname=TumbleWeed,hostfwd=tcp::22220-:22,smb=/home/xxx/Public,id=nic

-fsdev local,id=fsdev0,path=/home/xxx/Public,security_model=mapped-xattr

-device virtio-9p-pci,fsdev=fsdev0,mount_tag=Public-xxx

-monitor unix:TumbleWeed/TumbleWeed-monitor.socket,server,nowait
-serial unix:TumbleWeed/TumbleWeed-serial.socket,server,nowait

-kernel TumbleWeed/boot/u-boot.bin

The Risc-V is a more straight forward build than that for ARM / aarch64. This may be due to the self contained boot but also to clear instructions from OpenSuse.

Below are two methods for Arm64. The Debian is easier and more runs much faster. The fedora test remains only as proof-of-concept for now. If any Fedora/Arm enthusiasts manage to getting a reasonable running speed, then please share.

All Arm distros will require the file "/usr/share/AAVMF/AAVMF_VARS.fd" to be copied to the VM folder. qqX now has a util [rtv] that can be used to refresh these Tiano Variables is the boot sequence gets stuck. The initial boot and install has to be carried out using Spice. When changing to the superior SDL you will need to run the VAR refresh routine.

The Custom Script needs heavy modifying. Use TCG instead of KVM. The main start point for guidance was here https://linaro.atlassian.net/wiki/spaces/QEMU/pages/29094969399/Setting+up+Debian+on+a+virtual+QEMU+Aarch64+machine

The Debian script is currently as follows:

  # This file may be used as the basis for a qqX Custom Boot File

# qqX wil ignore any comments and blank lines:

# https://www.qemu.org/docs/master/system/target-arm.html

# https://github.com/qemu/qemu/blob/master/scripts/qmp/qmp-shell

/usr/bin/qemu-system-aarch64

-name debian-12,process=debian-12
-pidfile debian-12/debian-12.pid

#-enable-kvm

-accel tcg

#-machine q35,smm=off,vmport=off

# -machine virt

-machine type=virt,virtualization=on,pflash0=rom,pflash1=efivars

#-machine type=virt,virtualization=on

#cpu max,kvm=on

# -cpu max

-cpu max,pauth-impdef=on

#-cpu cortex-a53

-smp cores=4,threads=2,sockets=1

# -smp 8

-m 8G

#-object memory-backend-memfd,id=mem,size=8G,share=on

-device virtio-balloon
#-vga none

#-device virtio-vga,xres=2611,yres=1468

#-device virtio-gpu,xres=1920,yres=1080

-device virtio-gpu,xres=2611,yres=1468

-display sdl,gl=on

#-display spice-app,gl=on

# May be TOGGLED here, between SDL & Spice

#-display gtk,gl=on

#-audiodev pa,id=audio0

#-device intel-hda

#-device hda-duplex,audiodev=audio0

-rtc base=localtime,clock=host

-device virtio-rng-pci,rng=rng0
-object rng-random,id=rng0,filename=/dev/urandom

-device qemu-xhci,id=spicepass
-chardev spicevmc,id=usbredirchardev1,name=usbredir

-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1
-chardev spicevmc,id=usbredirchardev2,name=usbredir

-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2
-chardev spicevmc,id=usbredirchardev3,name=usbredir

-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3

#-device pci-ohci,id=smartpass

#-device usb-ccid
#-chardev spicevmc,id=ccid,name=smartcard

-#device ccid-card-passthru,chardev=ccid

#-device usb-ehci,id=input

#-device usb-kbd,bus=input.0
#-k en-us

#-device usb-tablet,bus=input.0

-device usb-kbd

-device qemu-xhci

-device usb-mouse

-device virtio-net,netdev=nic

-netdev user,hostname=debian-12,hostfwd=tcp::22220-:22,smb=/home/xxx/Public,id=nic

#-global driver=cfi.pflash01,property=secure,value=on

# Caution OVMF needs replacing with AAVMF

# Needs adapting but see https://linaro.atlassian.net/wiki/spaces/QEMU/pages/29094969399/Setting+up+Debian+on+a+virtual+QEMU+Aarch64+machine

# blockdev can be more stable than -drive ?

#-drive if=pflash,format=raw,unit=0,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly=on
#-drive if=pflash,format=raw,unit=1,file=debian-12/AAVMF_VARS.fd

-blockdev node-name=rom,driver=file,filename=/usr/share/AAVMF/AAVMF_CODE.fd,read-only=true
-blockdev node-name=efivars,driver=file,filename=debian-12/AAVMF_VARS.fd

#-blockdev node-name=rom,driver=file,filename=(pwd)/pc-bios/edk2-aarch64-code.fd,read-only=true
#-blockdev node-name=efivars,driver=file,filename=$HOME/images/qemu-arm64-efivars

#-drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE.fd,readonly=on
#-drive if=pflash,format=raw,unit=1,file=debian-12/OVMF_VARS.fd

# https://wiki.ubuntu.com/UEFI/OVMF


-drive media=cdrom,index=0,file=debian-12/debian-12.4.0-arm64-DVD-1.iso

-device virtio-blk-pci,drive=SystemDisk

#-device virtio-scsi-pci,drive=SystemDisk

-drive id=SystemDisk,if=none,format=qcow2,file=debian-12/disk.qcow2

#-fsdev local,id=fsdev0,path=/home/xxx/Public,security_model=mapped-xattr

#-device virtio-9p-pci,fsdev=fsdev0,mount_tag=Public-xxx

-monitor unix:debian-12/debian-12-monitor.socket,server,nowait
-serial unix:debian-12/debian-12-serial.socket,server,nowait

For your first boot and install, which is slow and CPU intensive, use qqX maximized at full screen. The Spice display is transparent and needs a plain dark background in order to view it. The mouse is VERY difficult. If you can manage to get to the mouse controls this can help.

debian-arm-spice-gl

Do a basic install, close down and edit to SDL. Run [rtv]. Boot and select UEFI from the menu. Select the Tiano device manager and create a raw 1000 ram disk which is key to getting SDL to work ...

SDL has a solid background and the mouse works. You may need to tweak the mouse speed a tad though.

Similar process for Fedora but it is VERY hard on the system and VERY slow.

fedora-arm-bash

fedora-arm-with-sdl

  # This file may be used as the basis for a qqX Custom Boot File

# Comments and blank lines may be safely used & will be ignored.

/usr/bin/qemu-system-aarch64

-name fedora-39,process=fedora-39
-pidfile fedora-39/fedora-39.pid

-accel tcg


#-enable-kvm
#-machine q35,smm=off,vmport=off
#-cpu host,kvm=on

#-machine virt

-machine type=virt,virtualization=on,pflash0=rom,pflash1=efivars

-cpu max,pauth-impdef=on,sve=on,sme=on

#-cpu cortex-a57

#-cpu max

# https://github.com/qemu/qemu/blob/master/docs/system/arm/cpu-features.rst

-smp cores=4,threads=2,sockets=1
-m 12G

-device virtio-balloon
-vga none

#-device virtio-vga-gl,xres=2611,yres=1468

-device virtio-gpu-gl,xres=2611,yres=1468

-display sdl,gl=on

#-display spice-app,gl=on

-audiodev pa,id=audio0

-device intel-hda

-device hda-duplex,audiodev=audio0
-rtc base=localtime,clock=host

# ,driftfix=slew

-device virtio-rng-pci,rng=rng0
-object rng-random,id=rng0,filename=/dev/urandom

-device qemu-xhci,id=spicepass
-chardev spicevmc,id=usbredirchardev1,name=usbredir


-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1
-chardev spicevmc,id=usbredirchardev2,name=usbredir

-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2
-chardev spicevmc,id=usbredirchardev3,name=usbredir

-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3

-device pci-ohci,id=smartpass

-device usb-ccid

#-chardev spicevmc,id=ccid,name=smartcard
#-device ccid-card-passthru,chardev=ccid

#-device usb-ehci,id=input

#-device usb-xhci,id=input

#-device usb-kbd,bus=input.0
#-k en-us

#-device usb-tablet,bus=input.0

-device qemu-xhci

-device usb-kbd

-device usb-mouse

-device virtio-net,netdev=nic
-netdev user,hostname=fedora-39,hostfwd=tcp::22220-:22,id=nic

#,smb=/home/xxx/Public,id=nic

-drive media=cdrom,index=0,file=fedora-39/Fedora-Workstation-Live-aarch64-39-1.5-respin.iso

-device virtio-blk-pci,drive=SystemDisk
-drive id=SystemDisk,if=none,format=qcow2,file=fedora-39/disk.qcow2

-blockdev node-name=rom,driver=file,filename=/usr/share/AAVMF/AAVMF_CODE.fd,read-only=true
-blockdev node-name=efivars,driver=file,filename=fedora-39/AAVMF_VARS.fd

#-fsdev local,id=fsdev0,path=/home/xxx/Public,security_model=mapped-xattr

#-device virtio-9p-pci,fsdev=fsdev0,mount_tag=Public-xxx

-monitor unix:fedora-39/fedora-39-monitor.socket,server,nowait
-serial unix:fedora-39/fedora-39-serial.socket,server,nowait

#-device virtio-blk-pci,drive=SharedDrive -drive id=SharedDrive,if=none,format=qcow2,file=/media/xxx/Files/VMQs/SharedDrive/shared.qcow2

The Fedora docs are bit sparse & some are very out-of-date. They tend to focus on Red Hat Enterprise setup too, rather than generic desktop.

Further Reading

See: https://www.qemu.org/docs/master/about/emulation.html and the notes on ABI's