summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/runqemu37
1 files changed, 22 insertions, 15 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 310d79fdc5..7eb7a9c7b4 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -420,6 +420,23 @@ class BaseConfig(object):
420 logger.error("%s not a directory valid DEPLOY_DIR_IMAGE" % deploy_dir_image) 420 logger.error("%s not a directory valid DEPLOY_DIR_IMAGE" % deploy_dir_image)
421 self.set("MACHINE", arg) 421 self.set("MACHINE", arg)
422 422
423 def set_dri_path(self):
424 # As runqemu can be run within bitbake (when using testimage, for example),
425 # we need to ensure that we run host pkg-config, and that it does not
426 # get mis-directed to native build paths set by bitbake.
427 try:
428 del os.environ['PKG_CONFIG_PATH']
429 del os.environ['PKG_CONFIG_DIR']
430 del os.environ['PKG_CONFIG_LIBDIR']
431 del os.environ['PKG_CONFIG_SYSROOT_DIR']
432 except KeyError:
433 pass
434 try:
435 dripath = subprocess.check_output("PATH=/bin:/usr/bin:$PATH pkg-config --variable=dridriverdir dri", shell=True)
436 except subprocess.CalledProcessError as e:
437 raise RunQemuError("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.")
438 os.environ['LIBGL_DRIVERS_PATH'] = dripath.decode('utf-8').strip()
439
423 def check_args(self): 440 def check_args(self):
424 for debug in ("-d", "--debug"): 441 for debug in ("-d", "--debug"):
425 if debug in sys.argv: 442 if debug in sys.argv:
@@ -440,15 +457,19 @@ class BaseConfig(object):
440 self.kernel_cmdline_script += ' console=ttyS0' 457 self.kernel_cmdline_script += ' console=ttyS0'
441 elif arg == 'sdl': 458 elif arg == 'sdl':
442 if 'gl' in sys.argv[1:]: 459 if 'gl' in sys.argv[1:]:
460 self.set_dri_path()
443 self.qemu_opt_script += ' -vga virtio -display sdl,gl=on' 461 self.qemu_opt_script += ' -vga virtio -display sdl,gl=on'
444 elif 'gl-es' in sys.argv[1:]: 462 elif 'gl-es' in sys.argv[1:]:
463 self.set_dri_path()
445 self.qemu_opt_script += ' -vga virtio -display sdl,gl=es' 464 self.qemu_opt_script += ' -vga virtio -display sdl,gl=es'
446 else: 465 else:
447 self.qemu_opt_script += ' -display sdl' 466 self.qemu_opt_script += ' -display sdl'
448 elif arg == 'gtk': 467 elif arg == 'gtk':
449 if 'gl' in sys.argv[1:]: 468 if 'gl' in sys.argv[1:]:
469 self.set_dri_path()
450 self.qemu_opt_script += ' -vga virtio -display gtk,gl=on' 470 self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
451 elif 'gl-es' in sys.argv[1:]: 471 elif 'gl-es' in sys.argv[1:]:
472 self.set_dri_path()
452 self.qemu_opt_script += ' -vga virtio -display gtk,gl=es' 473 self.qemu_opt_script += ' -vga virtio -display gtk,gl=es'
453 else: 474 else:
454 self.qemu_opt_script += ' -display gtk' 475 self.qemu_opt_script += ' -display gtk'
@@ -456,22 +477,8 @@ class BaseConfig(object):
456 # These args are handled inside sdl or gtk blocks above 477 # These args are handled inside sdl or gtk blocks above
457 pass 478 pass
458 elif arg == 'egl-headless': 479 elif arg == 'egl-headless':
480 self.set_dri_path()
459 self.qemu_opt_script += ' -vga virtio -display egl-headless' 481 self.qemu_opt_script += ' -vga virtio -display egl-headless'
460 # As runqemu can be run within bitbake (when using testimage, for example),
461 # we need to ensure that we run host pkg-config, and that it does not
462 # get mis-directed to native build paths set by bitbake.
463 try:
464 del os.environ['PKG_CONFIG_PATH']
465 del os.environ['PKG_CONFIG_DIR']
466 del os.environ['PKG_CONFIG_LIBDIR']
467 del os.environ['PKG_CONFIG_SYSROOT_DIR']
468 except KeyError:
469 pass
470 try:
471 dripath = subprocess.check_output("PATH=/bin:/usr/bin:$PATH pkg-config --variable=dridriverdir dri", shell=True)
472 except subprocess.CalledProcessError as e:
473 raise RunQemuError("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.")
474 os.environ['LIBGL_DRIVERS_PATH'] = dripath.decode('utf-8').strip()
475 elif arg == 'serial': 482 elif arg == 'serial':
476 self.kernel_cmdline_script += ' console=ttyS0' 483 self.kernel_cmdline_script += ' console=ttyS0'
477 self.serialconsole = True 484 self.serialconsole = True