Skip to content

Commit

Permalink
examples: aarch64-virt-base: fix display support
Browse files Browse the repository at this point in the history
Fix display support. Switch to disabled by default if no display backend
is set. $GUEST_DISPLAY configures QEMU -display <backend> if configured
(variable not empty). Empty variable will use -nographic.

This also uses -nodefaults regardless of the setting of the display to
replicate the same setup in x86_64 example.
From documentation [1]:
  Don’t create default devices. Normally, QEMU sets the default devices
  like serial port, parallel port, virtual console, monitor device, VGA
  adapter, floppy and CD-ROM drive and others. The -nodefaults option will
  disable all those default devices.

[1] Manual for -nodefaults.
https://www.qemu.org/docs/master/system/qemu-manpage.html
https://www.qemu.org/docs/master/system/invocation.html

This has been tested only on macOS with cocoa as $GUEST_DISPLAY.

qemu-system-aarch -display help
Available display backend types:
none
curses
cocoa
dbus

Display backend types in Debian arm64 machines are:
qemu-system-aarch -display help
Available display backend types:
none
gtk
sdl
egl-headless
curses
spice-app
dbus

Signed-off-by: Daniel Gomez <[email protected]>
  • Loading branch information
dkruces authored and birkelund committed Aug 29, 2024
1 parent b209366 commit 2805ab6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions examples/vm/aarch64-virt-base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Configuration variables
#
# GUEST_DISPLAY Set to '1' to enable graphical output
# GUEST_DISPLAY Display option (QEMU -display parameter).
# GUEST_VIOMMU Set to '1' to add a virtual IOMMU to the machine
# GUEST_CPU CPU model (QEMU -cpu paramater, default: 'host')
# GUEST_SMP SMP configuration (QEMU -smp parameter, default: '4')
Expand All @@ -23,7 +23,7 @@ fi
QEMU_SYSTEM_BINARY=${QEMU_SYSTEM_AARCH64}
: "${GUEST_BOOT_BASE:="img/debian-11-genericcloud-arm64.qcow2"}"

: "${GUEST_DISPLAY:="1"}"
: "${GUEST_DISPLAY:=""}"
: "${GUEST_CPU:="host"}"
: "${GUEST_MEMORY:="2G"}"
: "${GUEST_ACCEL:="kvm"}"
Expand All @@ -35,11 +35,17 @@ QEMU_SYSTEM_BINARY=${QEMU_SYSTEM_AARCH64}
: "${GUEST_KERNEL_CONSOLE:="ttyAMA0"}"

_setup_aarch64_virt_base() {
QEMU_PARAMS+=("-nographic")
QEMU_PARAMS+=("-nodefaults")

if [[ $GUEST_DISPLAY -eq 0 ]]; then
#QEMU_PARAMS+=("-display" "none")
if [[ -z $GUEST_DISPLAY ]]; then
QEMU_PARAMS+=("-nographic")
else
QEMU_PARAMS+=("-device" "virtio-gpu-pci")
QEMU_PARAMS+=("-display" "$GUEST_DISPLAY")
QEMU_PARAMS+=("-device" "virtio-keyboard-pci")
QEMU_PARAMS+=("-device" "virtio-mouse-pci")
QEMU_PARAMS+=("-device" "qemu-xhci")
QEMU_PARAMS+=("-device" "usb-tablet")
fi

QEMU_PARAMS+=("-machine" "virt,accel=$GUEST_ACCEL,kernel-irqchip=split")
Expand Down

0 comments on commit 2805ab6

Please sign in to comment.