From ee7e9f05a8a19f2126557813b9b272204815709e Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 10 Jul 2021 13:18:39 +0200 Subject: [PATCH] Meta: Automatically use WSL paths on Windows --- Documentation/BuildInstructionsWindows.md | 7 ------- Meta/run.sh | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/BuildInstructionsWindows.md b/Documentation/BuildInstructionsWindows.md index 00f3ba27b25..becb0ec5e60 100644 --- a/Documentation/BuildInstructionsWindows.md +++ b/Documentation/BuildInstructionsWindows.md @@ -27,17 +27,10 @@ By default this will be located at `/mnt/c/Program Files/qemu/qemu-system-i386.e - Set the `SERENITY_QEMU_BIN` environment variable to the location above. For example: \ `export SERENITY_QEMU_BIN='/mnt/c/Program Files/qemu/qemu-system-i386.exe'` -- Locate the _Windows_ path to the SerenityOS disk image, as native QEMU will be accessing it via the Windows filesystem. - If your build tree is located in the WSL2 partition, this will be accessible under the `\\wsl$` network file share - (see [notes below](#note-on-filesystems)). - - Set the `SERENITY_KERNEL_CMDLINE` environment variable to disable VirtIO support (Because it is currently broken on native windows QEMU): `export SERENITY_KERNEL_CMDLINE="disable_virtio"` -- Set the `SERENITY_DISK_IMAGE` environment variable to the full path of the SerenityOS disk image file from above. - For example: `export SERENITY_DISK_IMAGE='\\wsl$\Ubuntu-20.04\home\username\serenity\Build\i686\_disk_image'` - - `ninja run` as usual. ### Hardware acceleration diff --git a/Meta/run.sh b/Meta/run.sh index 0a5219cc4bc..371b707498e 100755 --- a/Meta/run.sh +++ b/Meta/run.sh @@ -57,6 +57,13 @@ fi else SERENITY_DISK_IMAGE="_disk_image" fi + if command -v wslpath >/dev/null; then + case "$SERENITY_QEMU_BIN" in + /mnt/c/*) + SERENITY_DISK_IMAGE=$(wslpath -w "$SERENITY_DISK_IMAGE") + ;; + esac + fi } if ! command -v "$SERENITY_QEMU_BIN" >/dev/null 2>&1 ; then