From 395414bb0775c14685d5656dc9135e71cf0e3ba1 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Thu, 29 Aug 2024 14:06:21 +0200 Subject: [PATCH] examples: aarch64-virt-base: fix display support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix display support. Switch to disabled by default if no display backend is set. $GUEST_DISPLAY configures QEMU -display 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 --- examples/vm/aarch64-virt-base.conf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/vm/aarch64-virt-base.conf b/examples/vm/aarch64-virt-base.conf index 7d66b77..7be1be9 100644 --- a/examples/vm/aarch64-virt-base.conf +++ b/examples/vm/aarch64-virt-base.conf @@ -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') @@ -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"}" @@ -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")