Add run-emulator.sh for one-command QEMU launch#337
Conversation
| GPU_DEVICE="" | ||
|
|
||
| if echo "${DISPLAY_BACKENDS}" | grep -q '^gtk$'; then | ||
| DISPLAY_OPT="-display gtk,gl=on,show-cursor=on" |
There was a problem hiding this comment.
How does that all overlap with the changes you introduced in https://github.com/AsteroidOS/meta-smartwatch/pull/299/changes ?
There was a problem hiding this comment.
emulator.conf sets QB_GRAPHICS and QB_OPT_APPEND which are used by Yocto's runqemu script. This run-emulator.sh is a standalone launcher that doesn't source the OE environment, so it needs the same GPU/display flags directly. Added a comment explaining this -- the flags intentionally mirror emulator.conf so behavior is the same either way.
|
|
||
| if [ ! -f "${OE_INIT}" ]; then | ||
| error "OE init script not found at ${OE_INIT}" | ||
| error "Run prepare-build.sh emulator first to fetch sources." |
There was a problem hiding this comment.
why not run prepare-build.sh instead of OE_INIT ?
There was a problem hiding this comment.
Done -- build_image() now runs prepare-build.sh emulator first, which handles fetching sources and setting up build/conf. Then sources oe-init-build-env and runs bitbake.
| LAUNCH_ONLY=false | ||
|
|
||
| case "${1:-}" in | ||
| --build) FORCE_BUILD=true ;; |
There was a problem hiding this comment.
I think those flags would be a lot more explicit if they were named --force-build and --launch-only.
Otherwise I'd expect ./run-emulator.sh --build --launch to build and launch
There was a problem hiding this comment.
Done -- renamed to --force-build and --launch-only.
|
@FlorentRevest thanks a lot for good comments and questions, Yes I did use a lot of examples, and copied things, sorry I'm just learning things so thank you for pointing things out. I will go through them today when I come back from work. |
Builds the emulator image if needed and launches it with the right QEMU flags so it boots straight into the AsteroidOS watch UI. Detects the best available display backend (GTK or SDL with virgl), enables KVM when possible, and forwards SSH to localhost:2222. Usage: ./run-emulator.sh
5e05702 to
c7158da
Compare
|
Addressed all review comments and force-pushed:
Tested: emulator boots, SSH works on port 2222. |
|
I'm a bit surprises the emulated image is i386. @casept iirc you looked into this last, do you remember why that's the case ? |
|
@KonTy could you explain better why you think this script is necessary and yocto's "runqemu" script isn't enough ? |
I think there's no good reason, just historical I guess. I left it as found, but it'd probably be trivial to make it 64-bit. |
|
Okay let's keep the x86_64 conversion for later but I think we probably want to do that |
@FlorentRevest runqemu lacks SSH port forwarding in slirp mode and doesn't handle post-boot KMS patching. If we really want to make QEMU iamges useful for developement this is really needed. I can see if I can refactor the scrpt to delegate QEMU flags to runqemu where possible, ŭt the rapper is still needed for networking and KMS. |
Adds a script that builds the emulator image if needed and launches it with the right QEMU flags so it boots straight into the AsteroidOS watch UI.
It detects the best available display backend (GTK or SDL with virgl), enables KVM when possible, and forwards SSH to localhost:2222.
The key thing it does is use virtio-vga-gl as the sole GPU instead of the default setup which creates two display devices and ends up showing a text login instead of the UI.
Usage: ./run-emulator.sh
Related PRs: