Meta: Auto-detect where QEMU is installed on Windows

This commit is contained in:
Gunnar Beutner 2021-08-04 01:04:08 +02:00 committed by Andreas Kling
parent ffee3d6c5d
commit 5445155dba
Notes: sideshowbarker 2024-07-18 07:29:06 +09:00
2 changed files with 11 additions and 9 deletions

View file

@ -34,12 +34,6 @@ will need to install the tools as well as the system emulators for i386 and x86_
![QEMU Components](QEMU_Components.png)
Locate the `qemu-system-x86_64.exe` executable in WSL.
By default this will be at `/mnt/c/Program Files/qemu/qemu-system-x86_64.exe`.
Set the `SERENITY_QEMU_BIN` environment variable to that location. For example: \
`export SERENITY_QEMU_BIN='/mnt/c/Program Files/qemu/qemu-system-x86_64.exe'`
Run `Meta/serenity.sh run` to build and run SerenityOS as usual.
### Hardware acceleration

View file

@ -38,13 +38,21 @@ PATH="$SCRIPT_DIR/../Toolchain/Local/i686/bin:$PATH"
SERENITY_RUN="${SERENITY_RUN:-$1}"
if [ -z "$SERENITY_QEMU_BIN" ]; then
if command -v qemu-system-x86_64 >/dev/null; then
SERENITY_QEMU_BIN="qemu-system-x86_64"
if command -v wslpath >/dev/null; then
QEMU_INSTALL_DIR=$(reg.exe query 'HKLM\Software\QEMU' /v Install_Dir /t REG_SZ | grep '^ Install_Dir' | sed 's/ / /g' | cut -f4- -d' ')
if [ -z "$QEMU_INSTALL_DIR" ]; then
die "Could not determine where QEMU for Windows is installed. Please make sure QEMU is installed or set SERENITY_QEMU_BIN if it is already installed."
fi
QEMU_BINARY_PREFIX="$(wslpath -- "${QEMU_INSTALL_DIR}" | tr -d '\r\n')/"
QEMU_BINARY_SUFFIX=".exe"
fi
if command -v "${QEMU_BINARY_PREFIX}qemu-system-x86_64${QEMU_BINARY_SUFFIX}" >/dev/null; then
SERENITY_QEMU_BIN="${QEMU_BINARY_PREFIX}qemu-system-x86_64${QEMU_BINARY_SUFFIX}"
else
if [ "$SERENITY_ARCH" = "x86_64" ]; then
die "Please install the 64-bit QEMU system emulator (qemu-system-x86_64)."
fi
SERENITY_QEMU_BIN="qemu-system-i386"
SERENITY_QEMU_BIN="${QEMU_BINARY_PREFIX}qemu-system-i386${QEMU_BINARY_SUFFIX}"
fi
fi