diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 86 |
1 files changed, 55 insertions, 31 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 842509eb14..df4ee21d53 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -174,6 +174,13 @@ class BaseConfig(object): | |||
174 | self.nfs_running = False | 174 | self.nfs_running = False |
175 | self.serialconsole = False | 175 | self.serialconsole = False |
176 | self.serialstdio = False | 176 | self.serialstdio = False |
177 | self.nographic = False | ||
178 | self.sdl = False | ||
179 | self.gtk = False | ||
180 | self.gl = False | ||
181 | self.gl_es = False | ||
182 | self.egl_headless = False | ||
183 | self.novga = False | ||
177 | self.cleantap = False | 184 | self.cleantap = False |
178 | self.saved_stty = '' | 185 | self.saved_stty = '' |
179 | self.audio_enabled = False | 186 | self.audio_enabled = False |
@@ -460,38 +467,19 @@ class BaseConfig(object): | |||
460 | if arg in self.fstypes + self.vmtypes + self.wictypes: | 467 | if arg in self.fstypes + self.vmtypes + self.wictypes: |
461 | self.check_arg_fstype(arg) | 468 | self.check_arg_fstype(arg) |
462 | elif arg == 'nographic': | 469 | elif arg == 'nographic': |
463 | if ('sdl' in sys.argv): | 470 | self.nographic = True |
464 | raise RunQemuError('Option nographic makes no sense alongside the sdl option.' % (arg)) | ||
465 | if ('gtk' in sys.argv): | ||
466 | raise RunQemuError('Option nographic makes no sense alongside the gtk option.' % (arg)) | ||
467 | self.qemu_opt_script += ' -nographic' | ||
468 | elif arg == 'sdl': | 471 | elif arg == 'sdl': |
469 | if 'gl' in sys.argv[1:]: | 472 | self.sdl = True |
470 | self.set_dri_path() | ||
471 | self.qemu_opt_script += ' -vga virtio -display sdl,gl=on,show-cursor=on' | ||
472 | elif 'gl-es' in sys.argv[1:]: | ||
473 | self.set_dri_path() | ||
474 | self.qemu_opt_script += ' -vga virtio -display sdl,gl=es,show-cursor=on' | ||
475 | else: | ||
476 | self.qemu_opt_script += ' -display sdl,show-cursor=on' | ||
477 | elif arg == 'gtk': | 473 | elif arg == 'gtk': |
478 | if 'gl' in sys.argv[1:]: | 474 | self.gtk = True |
479 | self.set_dri_path() | 475 | elif arg == 'gl': |
480 | self.qemu_opt_script += ' -vga virtio -display gtk,gl=on,show-cursor=on' | 476 | self.gl = True |
481 | elif 'gl-es' in sys.argv[1:]: | 477 | elif 'gl-es' in sys.argv[1:]: |
482 | self.set_dri_path() | 478 | self.gl_es = True |
483 | self.qemu_opt_script += ' -vga virtio -display gtk,gl=es,show-cursor=on' | ||
484 | else: | ||
485 | self.qemu_opt_script += ' -display gtk,show-cursor=on' | ||
486 | elif arg == 'gl' or arg == 'gl-es': | ||
487 | # These args are handled inside sdl or gtk blocks above | ||
488 | if ('gtk' not in sys.argv) and ('sdl' not in sys.argv): | ||
489 | raise RunQemuError('Option %s also needs gtk or sdl option.' % (arg)) | ||
490 | elif arg == 'egl-headless': | 479 | elif arg == 'egl-headless': |
491 | self.set_dri_path() | 480 | self.egl_headless = True |
492 | self.qemu_opt_script += ' -vga virtio -display egl-headless,show-cursor=on' | ||
493 | elif arg == 'novga': | 481 | elif arg == 'novga': |
494 | self.qemu_opt_script += ' -vga none' | 482 | self.novga = True |
495 | elif arg == 'serial': | 483 | elif arg == 'serial': |
496 | self.serialconsole = True | 484 | self.serialconsole = True |
497 | elif arg == "serialstdio": | 485 | elif arg == "serialstdio": |
@@ -1319,13 +1307,48 @@ class BaseConfig(object): | |||
1319 | raise RunQemuError("Failed to boot, QB_SYSTEM_NAME is NULL!") | 1307 | raise RunQemuError("Failed to boot, QB_SYSTEM_NAME is NULL!") |
1320 | self.qemu_system = qemu_system | 1308 | self.qemu_system = qemu_system |
1321 | 1309 | ||
1310 | def setup_vga(self): | ||
1311 | if self.nographic == True: | ||
1312 | if self.sdl == True: | ||
1313 | raise RunQemuError('Option nographic makes no sense alongside the sdl option.') | ||
1314 | if self.gtk == True: | ||
1315 | raise RunQemuError('Option nographic makes no sense alongside the gtk option.') | ||
1316 | self.qemu_opt += ' -nographic' | ||
1317 | return | ||
1318 | |||
1319 | if self.novga == True: | ||
1320 | self.qemu_opt += ' -vga none' | ||
1321 | return | ||
1322 | |||
1323 | if (self.gl_es == True or self.gl == True) and (self.sdl == False and self.gtk == False): | ||
1324 | raise RunQemuError('Option gl/gl-es needs gtk or sdl option.') | ||
1325 | |||
1326 | if self.sdl == True or self.gtk == True or self.egl_headless == True: | ||
1327 | self.set_dri_path() | ||
1328 | self.qemu_opt += ' -vga virtio -display ' | ||
1329 | if self.egl_headless == True: | ||
1330 | self.qemu_opt += 'egl-headless,' | ||
1331 | else: | ||
1332 | if self.sdl == True: | ||
1333 | self.qemu_opt += 'sdl,' | ||
1334 | elif self.gtk == True: | ||
1335 | self.qemu_opt += 'gtk,' | ||
1336 | |||
1337 | if self.gl == True: | ||
1338 | self.qemu_opt += 'gl=on,' | ||
1339 | elif self.gl_es == True: | ||
1340 | self.qemu_opt += 'gl=es,' | ||
1341 | self.qemu_opt += 'show-cursor=on' | ||
1342 | |||
1343 | self.qemu_opt += ' %s' %self.get('QB_GRAPHICS') | ||
1344 | |||
1322 | def setup_serial(self): | 1345 | def setup_serial(self): |
1323 | # Setup correct kernel command line for serial | 1346 | # Setup correct kernel command line for serial |
1324 | if self.serialstdio == True or self.serialconsole == True or re.search("-nographic", self.qemu_opt) or self.tcpserial_portnum: | 1347 | if self.serialstdio == True or self.serialconsole == True or self.nographic == True or self.tcpserial_portnum: |
1325 | for entry in self.get('SERIAL_CONSOLES').split(' '): | 1348 | for entry in self.get('SERIAL_CONSOLES').split(' '): |
1326 | self.kernel_cmdline_script += ' console=%s' %entry.split(';')[1] | 1349 | self.kernel_cmdline_script += ' console=%s' %entry.split(';')[1] |
1327 | 1350 | ||
1328 | if self.serialstdio == True or re.search("-nographic", self.qemu_opt): | 1351 | if self.serialstdio == True or self.nographic == True: |
1329 | self.qemu_opt += " -serial mon:stdio" | 1352 | self.qemu_opt += " -serial mon:stdio" |
1330 | else: | 1353 | else: |
1331 | self.qemu_opt += " -serial mon:vc" | 1354 | self.qemu_opt += " -serial mon:vc" |
@@ -1364,7 +1387,7 @@ class BaseConfig(object): | |||
1364 | if not os.access(qemu_bin, os.X_OK): | 1387 | if not os.access(qemu_bin, os.X_OK): |
1365 | raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin) | 1388 | raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin) |
1366 | 1389 | ||
1367 | self.qemu_opt = "%s %s %s %s %s %s" % (qemu_bin, self.get('NETWORK_CMD'), self.get('QB_RNG'), self.get('QB_GRAPHICS'), self.get('ROOTFS_OPTIONS'), self.get('QB_OPT_APPEND')) | 1390 | 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')) |
1368 | 1391 | ||
1369 | for ovmf in self.ovmf_bios: | 1392 | for ovmf in self.ovmf_bios: |
1370 | format = ovmf.rsplit('.', 1)[-1] | 1393 | format = ovmf.rsplit('.', 1)[-1] |
@@ -1389,6 +1412,7 @@ class BaseConfig(object): | |||
1389 | self.qemu_opt += " -snapshot" | 1412 | self.qemu_opt += " -snapshot" |
1390 | 1413 | ||
1391 | self.setup_serial() | 1414 | self.setup_serial() |
1415 | self.setup_vga() | ||
1392 | 1416 | ||
1393 | def start_qemu(self): | 1417 | def start_qemu(self): |
1394 | import shlex | 1418 | import shlex |