1212
1313QEMU_AUDIO_DRV=" none"
1414GDB_PORT_BASE=1234
15+
16+ # Parse our own options (currently just -d) out of the argument list before
17+ # what's left is forwarded to QEMU as USR_OPTION.
18+ WITH_DISPLAY=0
19+ POSARGS=()
20+ for _a in " $@ " ; do
21+ case " $_a " in
22+ -d) WITH_DISPLAY=1 ;;
23+ -h|--help)
24+ echo " Usage: $( basename " $0 " ) [-d] [qemu-option]"
25+ echo " -d graphical: open the QEMU GTK window showing the guest PL111/LVGL screen"
26+ echo " (default: headless, serial console only)"
27+ exit 0 ;;
28+ * ) POSARGS+=(" $_a " ) ;;
29+ esac
30+ done
31+ set -- " ${POSARGS[@]} "
1532USR_OPTION=$1
1633# QEMU_BIN is selected per IB_PLATFORM below (qemu-system-aarch64 for
1734# virt64, qemu-system-arm for virt32).
@@ -46,6 +63,24 @@ launch_qemu() {
4663 SO3_ITS=$( grep -E " ^IB_TARGET_ITS:so3:${IB_PLATFORM} \b" build/conf/local.conf | awk -F' "' ' {print $2}' | tail -1)
4764 LINUX_ITS=$( grep -E " ^IB_TARGET_ITS:linux:${IB_PLATFORM} \b" build/conf/local.conf | awk -F' "' ' {print $2}' | tail -1)
4865
66+ # Display mode. Default: headless (serial console only, -display none). With
67+ # -d: open the QEMU GTK window that presents the guest PL111 CLCD (the LVGL
68+ # screen). SO3 drives PL111 + PL050 (wired unconditionally into '-M virt' by
69+ # the so3 QEMU patch) and has no virtio-gpu, so no extra device flags are
70+ # needed — just switch the display backend. Use GTK, not SDL: SDL leaves the
71+ # PL111 console black, GTK presents it (and its View menu lists every
72+ # console). On a fractionally-scaled HiDPI Wayland panel, route GTK through
73+ # XWayland (GDK_BACKEND=x11) so the so3,absmouse absolute pointer maps 1:1
74+ # onto the guest surface; harmless on a real X11 session.
75+ if [ " $WITH_DISPLAY " == " 1" ]; then
76+ DISPLAY_OPT=" -display gtk,zoom-to-fit=off"
77+ export GDK_BACKEND=x11
78+ export GDK_SCALE=1
79+ export GDK_DPI_SCALE=1
80+ else
81+ DISPLAY_OPT=" -display none"
82+ fi
83+
4984 if [ " $IB_PLATFORM " == " virt64" ]; then
5085 QEMU_BIN=" $IB_ROOT_DIR /qemu/build/qemu-system-aarch64"
5186 echo Starting on virt64
@@ -97,7 +132,7 @@ launch_qemu() {
97132 -device virtio-blk-device,drive=hd0 \
98133 -drive if=none,file=filesystem/sdcard.img.virt64,id=hd0,format=raw,file.locking=off \
99134 -m 1024 \
100- -display none \
135+ ${DISPLAY_OPT} \
101136 -netdev user,id=n1,hostfwd=tcp::2222-:22 \
102137 -device virtio-net-device,netdev=n1,mac=${QEMU_MAC_ADDR} \
103138 -gdb tcp::${GDB_PORT}
@@ -120,7 +155,7 @@ launch_qemu() {
120155 -device virtio-blk-device,drive=hd0 \
121156 -drive if=none,file=filesystem/sdcard.img.virt32,id=hd0,format=raw,file.locking=off \
122157 -m 1024 \
123- -display none \
158+ ${DISPLAY_OPT} \
124159 -netdev user,id=n1,hostfwd=tcp::2222-:22 \
125160 -device virtio-net-device,netdev=n1,mac=${QEMU_MAC_ADDR} \
126161 -gdb tcp::${GDB_PORT}
0 commit comments