diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 69cd44864e..3d77046972 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -468,9 +468,11 @@ class BaseConfig(object): | |||
468 | self.set("IMAGE_LINK_NAME", image_link_name) | 468 | self.set("IMAGE_LINK_NAME", image_link_name) |
469 | logger.debug('Using IMAGE_LINK_NAME = "%s"' % image_link_name) | 469 | logger.debug('Using IMAGE_LINK_NAME = "%s"' % image_link_name) |
470 | 470 | ||
471 | def set_dri_path(self): | 471 | def set_mesa_paths(self): |
472 | drivers_path = os.path.join(self.bindir_native, '../lib/dri') | 472 | drivers_path = os.path.join(self.bindir_native, '../lib/dri') |
473 | if not os.path.exists(drivers_path) or not os.listdir(drivers_path): | 473 | gbm_path = os.path.join(self.bindir_native, '../lib/gbm') |
474 | if not os.path.exists(drivers_path) or not os.listdir(drivers_path) \ | ||
475 | or not os.path.exists(gbm_path) or not os.listdir(gbm_path): | ||
474 | raise RunQemuError(""" | 476 | raise RunQemuError(""" |
475 | qemu has been built without opengl support and accelerated graphics support is not available. | 477 | qemu has been built without opengl support and accelerated graphics support is not available. |
476 | To enable it, add: | 478 | To enable it, add: |
@@ -479,6 +481,7 @@ DISTRO_FEATURES_NATIVESDK:append = " opengl" | |||
479 | to your build configuration. | 481 | to your build configuration. |
480 | """) | 482 | """) |
481 | self.qemu_environ['LIBGL_DRIVERS_PATH'] = drivers_path | 483 | self.qemu_environ['LIBGL_DRIVERS_PATH'] = drivers_path |
484 | self.qemu_environ['GBM_BACKENDS_PATH'] = gbm_path | ||
482 | 485 | ||
483 | def check_args(self): | 486 | def check_args(self): |
484 | for debug in ("-d", "--debug"): | 487 | for debug in ("-d", "--debug"): |
@@ -1192,19 +1195,22 @@ to your build configuration. | |||
1192 | raise RunQemuError("a new one with sudo.") | 1195 | raise RunQemuError("a new one with sudo.") |
1193 | 1196 | ||
1194 | gid = os.getgid() | 1197 | gid = os.getgid() |
1195 | uid = os.getuid() | ||
1196 | logger.info("Setting up tap interface under sudo") | 1198 | logger.info("Setting up tap interface under sudo") |
1197 | cmd = ('sudo', self.qemuifup, str(gid)) | 1199 | cmd = ('sudo', self.qemuifup, str(gid)) |
1198 | try: | 1200 | for _ in range(5): |
1199 | tap = subprocess.check_output(cmd).decode('utf-8').strip() | 1201 | try: |
1200 | except subprocess.CalledProcessError as e: | 1202 | tap = subprocess.check_output(cmd).decode('utf-8').strip() |
1201 | logger.error('Setting up tap device failed:\n%s\nRun runqemu-gen-tapdevs to manually create one.' % str(e)) | 1203 | except subprocess.CalledProcessError as e: |
1202 | sys.exit(1) | 1204 | logger.error('Setting up tap device failed:\n%s\nRun runqemu-gen-tapdevs to manually create one.' % str(e)) |
1203 | lockfile = os.path.join(lockdir, tap) | 1205 | sys.exit(1) |
1204 | self.taplock = lockfile + '.lock' | 1206 | lockfile = os.path.join(lockdir, tap) |
1205 | self.acquire_taplock() | 1207 | self.taplock = lockfile + '.lock' |
1206 | self.cleantap = True | 1208 | if self.acquire_taplock(): |
1207 | logger.debug('Created tap: %s' % tap) | 1209 | self.cleantap = True |
1210 | logger.debug('Created tap: %s' % tap) | ||
1211 | break | ||
1212 | else: | ||
1213 | tap = None | ||
1208 | 1214 | ||
1209 | if not tap: | 1215 | if not tap: |
1210 | logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.") | 1216 | logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.") |
@@ -1295,6 +1301,10 @@ to your build configuration. | |||
1295 | elif drive_type.startswith("/dev/hd"): | 1301 | elif drive_type.startswith("/dev/hd"): |
1296 | logger.info('Using ide drive') | 1302 | logger.info('Using ide drive') |
1297 | vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format) | 1303 | vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format) |
1304 | elif drive_type.startswith("/dev/mmcblk"): | ||
1305 | logger.info('Using sdcard drive') | ||
1306 | vm_drive = '-drive id=sdcard0,if=none,file=%s,format=%s -device sdhci-pci -device sd-card,drive=sdcard0' \ | ||
1307 | % (self.rootfs, rootfs_format) | ||
1298 | elif drive_type.startswith("/dev/vdb"): | 1308 | elif drive_type.startswith("/dev/vdb"): |
1299 | logger.info('Using block virtio drive'); | 1309 | logger.info('Using block virtio drive'); |
1300 | vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0%s' \ | 1310 | vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0%s' \ |
@@ -1454,7 +1464,7 @@ to your build configuration. | |||
1454 | self.qemu_opt += ' -display ' | 1464 | self.qemu_opt += ' -display ' |
1455 | if self.egl_headless == True: | 1465 | if self.egl_headless == True: |
1456 | self.check_render_nodes() | 1466 | self.check_render_nodes() |
1457 | self.set_dri_path() | 1467 | self.set_mesa_paths() |
1458 | self.qemu_opt += 'egl-headless,' | 1468 | self.qemu_opt += 'egl-headless,' |
1459 | else: | 1469 | else: |
1460 | if self.sdl == True: | 1470 | if self.sdl == True: |
@@ -1464,10 +1474,10 @@ to your build configuration. | |||
1464 | self.qemu_opt += 'gtk,' | 1474 | self.qemu_opt += 'gtk,' |
1465 | 1475 | ||
1466 | if self.gl == True: | 1476 | if self.gl == True: |
1467 | self.set_dri_path() | 1477 | self.set_mesa_paths() |
1468 | self.qemu_opt += 'gl=on,' | 1478 | self.qemu_opt += 'gl=on,' |
1469 | elif self.gl_es == True: | 1479 | elif self.gl_es == True: |
1470 | self.set_dri_path() | 1480 | self.set_mesa_paths() |
1471 | self.qemu_opt += 'gl=es,' | 1481 | self.qemu_opt += 'gl=es,' |
1472 | self.qemu_opt += 'show-cursor=on' | 1482 | self.qemu_opt += 'show-cursor=on' |
1473 | 1483 | ||
@@ -1483,7 +1493,7 @@ to your build configuration. | |||
1483 | # If no serial or serialtcp options were specified, only ttyS0 is created | 1493 | # If no serial or serialtcp options were specified, only ttyS0 is created |
1484 | # and sysvinit shows an error trying to enable ttyS1: | 1494 | # and sysvinit shows an error trying to enable ttyS1: |
1485 | # INIT: Id "S1" respawning too fast: disabled for 5 minutes | 1495 | # INIT: Id "S1" respawning too fast: disabled for 5 minutes |
1486 | serial_num = len(re.findall("-serial", self.qemu_opt)) | 1496 | serial_num = len(re.findall("(^| )-serial ", self.qemu_opt)) |
1487 | 1497 | ||
1488 | # Assume if the user passed serial options, they know what they want | 1498 | # Assume if the user passed serial options, they know what they want |
1489 | # and pad to two devices | 1499 | # and pad to two devices |
@@ -1503,7 +1513,7 @@ to your build configuration. | |||
1503 | 1513 | ||
1504 | self.qemu_opt += " %s" % self.get("QB_SERIAL_OPT") | 1514 | self.qemu_opt += " %s" % self.get("QB_SERIAL_OPT") |
1505 | 1515 | ||
1506 | serial_num = len(re.findall("-serial", self.qemu_opt)) | 1516 | serial_num = len(re.findall("(^| )-serial ", self.qemu_opt)) |
1507 | if serial_num < 2: | 1517 | if serial_num < 2: |
1508 | self.qemu_opt += " -serial null" | 1518 | self.qemu_opt += " -serial null" |
1509 | 1519 | ||
@@ -1669,6 +1679,9 @@ to your build configuration. | |||
1669 | if multiconfig: | 1679 | if multiconfig: |
1670 | multiconfig = "mc:%s" % multiconfig | 1680 | multiconfig = "mc:%s" % multiconfig |
1671 | 1681 | ||
1682 | if self.rootfs and not target: | ||
1683 | target = self.rootfs | ||
1684 | |||
1672 | if mach: | 1685 | if mach: |
1673 | cmd = 'MACHINE=%s bitbake -e %s %s' % (mach, multiconfig, target) | 1686 | cmd = 'MACHINE=%s bitbake -e %s %s' % (mach, multiconfig, target) |
1674 | else: | 1687 | else: |