summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-13 15:45:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-13 22:23:49 +0100
commit8fabe92b77e6ef8fd53e45d3cfca66019262d1a0 (patch)
treeefaca7861c5eec0e3f84c68e71085f9aa3c828ca
parentdc836bf9ee13e505bbfb412b7a173e24cf75f601 (diff)
downloadpoky-8fabe92b77e6ef8fd53e45d3cfca66019262d1a0.tar.gz
runqemu: Allow auto detection of the correct graphics options
Running "runqemu qemux86 kvm" when qemu is configured for sdl and/or gtk display output currently leads to a poor user experience with no cursor and corrupted fonts in the gtk case. This is due to no options being passed to qemu which leads to the loss of the font envirornment variable and the show-cursor option. If the user hasn't specified a display type, grep the output of "qemu-system-xxx --help" for the display types and pick the "best" which ensures our config is passed in. That resolves the gtk font issue and the cursor issue with both sdl and gtk. (From OE-Core rev: 92f14a63ce8fccc4f441127894b2524026a3160f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/runqemu21
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 2f77a7bd0f..664a073807 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1363,6 +1363,18 @@ class BaseConfig(object):
1363 if (self.gl_es == True or self.gl == True) and (self.sdl == False and self.gtk == False): 1363 if (self.gl_es == True or self.gl == True) and (self.sdl == False and self.gtk == False):
1364 raise RunQemuError('Option gl/gl-es needs gtk or sdl option.') 1364 raise RunQemuError('Option gl/gl-es needs gtk or sdl option.')
1365 1365
1366 # If we have no display option, we autodetect based upon what qemu supports. We
1367 # need our font setup and show-cusor below so we need to see what qemu --help says
1368 # is supported so we can pass our correct config in.
1369 if not self.nographic and not self.sdl and not self.gtk and not self.egl_headless == True:
1370 output = subprocess.check_output([self.qemu_bin, "--help"], universal_newlines=True)
1371 if "-display gtk" in output:
1372 self.gtk = True
1373 elif "-display sdl" in output:
1374 self.sdl = True
1375 else:
1376 self.qemu_opt += '-display none'
1377
1366 if self.sdl == True or self.gtk == True or self.egl_headless == True: 1378 if self.sdl == True or self.gtk == True or self.egl_headless == True:
1367 if self.gl or self.gl_es or self.egl_headless: 1379 if self.gl or self.gl_es or self.egl_headless:
1368 self.qemu_opt += ' -device virtio-vga-gl ' 1380 self.qemu_opt += ' -device virtio-vga-gl '
@@ -1415,7 +1427,7 @@ class BaseConfig(object):
1415 if serial_num < 2: 1427 if serial_num < 2:
1416 self.qemu_opt += " -serial null" 1428 self.qemu_opt += " -serial null"
1417 1429
1418 def setup_final(self): 1430 def find_qemu(self):
1419 qemu_bin = os.path.join(self.bindir_native, self.qemu_system) 1431 qemu_bin = os.path.join(self.bindir_native, self.qemu_system)
1420 1432
1421 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't 1433 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't
@@ -1434,8 +1446,13 @@ class BaseConfig(object):
1434 1446
1435 if not os.access(qemu_bin, os.X_OK): 1447 if not os.access(qemu_bin, os.X_OK):
1436 raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin) 1448 raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin)
1449 self.qemu_bin = qemu_bin
1450
1451 def setup_final(self):
1452
1453 self.find_qemu()
1437 1454
1438 self.qemu_opt = "%s %s %s %s %s" % (qemu_bin, self.get('NETWORK_CMD'), self.get('QB_RNG'), self.get('ROOTFS_OPTIONS'), self.get('QB_OPT_APPEND').replace('@DEPLOY_DIR_IMAGE@', self.get('DEPLOY_DIR_IMAGE'))) 1455 self.qemu_opt = "%s %s %s %s %s" % (self.qemu_bin, self.get('NETWORK_CMD'), self.get('QB_RNG'), self.get('ROOTFS_OPTIONS'), self.get('QB_OPT_APPEND').replace('@DEPLOY_DIR_IMAGE@', self.get('DEPLOY_DIR_IMAGE')))
1439 1456
1440 for ovmf in self.ovmf_bios: 1457 for ovmf in self.ovmf_bios:
1441 format = ovmf.rsplit('.', 1)[-1] 1458 format = ovmf.rsplit('.', 1)[-1]