summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-03-16 10:40:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 14:47:29 +0000
commit44375eccf1f4bcabe3ae6bafa570a869624440df (patch)
treedb57887cfffd89432bbdc451b3214e59c91e252c /scripts
parent04c27888d05e16791cfb5ebc3b51f9f02923775b (diff)
downloadpoky-44375eccf1f4bcabe3ae6bafa570a869624440df.tar.gz
runqemu: direct mesa to use its own drivers, rather than ones provided by host distro
With mesa 23.0, it is not longer possible to use the host drivers, as mesa upstream has added strict checks for matching builds between drivers and libraries that load them. Add a check and a hint to runqemu so that there is a helpful error when there is no native/nativesdk opengl/virgl support. (From OE-Core rev: f0946844df7270fe368858d8929e6b380675b78b) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu34
1 files changed, 10 insertions, 24 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 23bd440cc4..1a378925ce 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -450,30 +450,16 @@ class BaseConfig(object):
450 self.set("MACHINE", arg) 450 self.set("MACHINE", arg)
451 451
452 def set_dri_path(self): 452 def set_dri_path(self):
453 # As runqemu can be run within bitbake (when using testimage, for example), 453 drivers_path = os.path.join(self.bindir_native, '../lib/dri')
454 # we need to ensure that we run host pkg-config, and that it does not 454 if not os.path.exists(drivers_path) or not os.listdir(drivers_path):
455 # get mis-directed to native build paths set by bitbake. 455 raise RunQemuError("""
456 env = os.environ.copy() 456qemu has been built without opengl support and accelerated graphics support is not available.
457 try: 457To enable it, add:
458 del env['PKG_CONFIG_PATH'] 458DISTRO_FEATURES_NATIVE:append = " opengl"
459 del env['PKG_CONFIG_DIR'] 459DISTRO_FEATURES_NATIVESDK:append = " opengl"
460 del env['PKG_CONFIG_LIBDIR'] 460to your build configuration.
461 del env['PKG_CONFIG_SYSROOT_DIR'] 461""")
462 except KeyError: 462 self.qemu_environ['LIBGL_DRIVERS_PATH'] = drivers_path
463 pass
464 try:
465 dripath = subprocess.check_output("PATH=/bin:/usr/bin:$PATH pkg-config --variable=dridriverdir dri", shell=True, env=env)
466 except subprocess.CalledProcessError as e:
467 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.")
468 self.qemu_environ['LIBGL_DRIVERS_PATH'] = dripath.decode('utf-8').strip()
469
470 # This preloads uninative libc pieces and therefore ensures that RPATH/RUNPATH
471 # in host mesa drivers doesn't trick uninative into loading host libc.
472 preload_items = ['libdl.so.2', 'librt.so.1', 'libpthread.so.0']
473 uninative_path = os.path.dirname(self.get("UNINATIVE_LOADER"))
474 if os.path.exists(uninative_path):
475 preload_paths = [os.path.join(uninative_path, i) for i in preload_items]
476 self.qemu_environ['LD_PRELOAD'] = " ".join(preload_paths)
477 463
478 def check_args(self): 464 def check_args(self):
479 for debug in ("-d", "--debug"): 465 for debug in ("-d", "--debug"):