Created
May 17, 2026 20:01
-
-
Save a3f/898bfa892daa21ac0380334f34f64781 to your computer and use it in GitHub Desktop.
Start QEMU interactively from a labgrid env YAML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """Start QEMU interactively from a labgrid env YAML | |
| Usage: | |
| qemu-interactive.py <env.yaml> [extra qemu args] | |
| """ | |
| import subprocess | |
| import sys | |
| from labgrid import Environment | |
| qemu = Environment(config_file=sys.argv[1]).get_target("main").get_driver("QEMUDriver") | |
| cmd = qemu.get_qemu_base_args() + sys.argv[2:] | |
| cmd += ["-serial", "mon:stdio", "-trace", "file=/dev/null"] | |
| cmd += sys.argv[2:] | |
| with open("/dev/tty", "r+b", buffering=0) as tty: | |
| sys.exit(subprocess.run(cmd, stdin=tty, stdout=tty, stderr=tty).returncode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment