2021-07-09 22:53:28 +00:00
|
|
|
# Setting up a development environment on Windows
|
|
|
|
|
|
|
|
SerenityOS can be built and run under WSL Version 2.
|
|
|
|
WSL Version 1 is not supported since Version 1 does not support ext2, which is needed for the setup.
|
|
|
|
|
|
|
|
WSL Version 2 requires Windows 10 version 2004 or higher, with OS Build 19041 or greater. Here is a guide on how to
|
|
|
|
[get WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
|
|
|
|
|
|
|
|
Once installed, you will need to make sure the distribution you want to use (and the new default) is using Version 2:
|
|
|
|
- `wsl -l -v` lists distros and versions,<br/>
|
|
|
|
- `wsl --set-version <distro> <version>` is used to convert a distro to another version, and<br/>
|
|
|
|
- `wsl --set-default-version 2` will set the default version for all new distros (if desired.)<br/>
|
|
|
|
|
2021-09-10 13:52:11 +00:00
|
|
|
Next, go to [BuildInstructions.md](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md#prerequisites)
|
|
|
|
and follow the instructions for your chosen Linux environment, to get the needed build tools.
|
|
|
|
|
2021-07-12 09:09:17 +00:00
|
|
|
## Note on filesystems
|
|
|
|
|
|
|
|
WSL2 filesystem performance for IO heavy tasks (such as compiling a large C++ project) on the host Windows filesystem is
|
|
|
|
pretty bad. See [this issue on the WSL GitHub project](https://github.com/microsoft/WSL/issues/4197#issuecomment-604592340)
|
|
|
|
for details.
|
|
|
|
|
|
|
|
The recommendation from the Microsoft team on that issue is:
|
|
|
|
|
|
|
|
> If it's at all possible, store your projects in the Linux file system in WSL2.
|
|
|
|
|
2021-09-10 13:52:11 +00:00
|
|
|
In practice, this means cloning and building the project to somewhere such as `/home/username/serenity`. You can then
|
|
|
|
access the linux filesystem at `\\wsl$`, so for example, the project would be at `\\wsl$\home\username\serenity`.
|
2021-07-09 22:53:28 +00:00
|
|
|
|
|
|
|
## Setting up QEMU
|
|
|
|
|
2021-07-12 09:09:17 +00:00
|
|
|
Grab the latest QEMU binaries from [here](https://www.qemu.org/download/#windows) and install them. At a minimum you
|
2022-12-01 04:27:25 +00:00
|
|
|
will need to install the tools, the system emulators for i386 and x86_64, and
|
|
|
|
the DLL libraries.
|
2021-07-09 22:53:28 +00:00
|
|
|
|
2021-07-10 11:46:36 +00:00
|
|
|
![QEMU Components](QEMU_Components.png)
|
|
|
|
|
2021-07-12 09:09:17 +00:00
|
|
|
Run `Meta/serenity.sh run` to build and run SerenityOS as usual.
|
2021-07-09 22:53:28 +00:00
|
|
|
|
|
|
|
### Hardware acceleration
|
|
|
|
|
2021-07-12 09:09:17 +00:00
|
|
|
The steps above will run QEMU in software virtualization mode, which is very slow.
|
2021-07-10 12:02:02 +00:00
|
|
|
QEMU supports hardware acceleration on Windows via the [Windows Hypervisor Platform](https://docs.microsoft.com/en-us/virtualization/api/)
|
2021-07-12 09:09:17 +00:00
|
|
|
(WHPX).
|
2021-07-09 22:53:28 +00:00
|
|
|
|
2021-07-12 09:09:17 +00:00
|
|
|
Enable the Windows Hypervisor Platform feature, either using "Turn Windows features on or off", or by running the
|
|
|
|
following command in an elevated PowerShell session: \
|
2021-07-09 22:53:28 +00:00
|
|
|
`dism /Online /Enable-Feature /All /FeatureName:HypervisorPlatform`
|
|
|
|
|
2021-07-10 12:39:02 +00:00
|
|
|
![WHPX Windows Feature](WHPX_Feature.png)
|
|
|
|
|
2021-08-03 23:39:14 +00:00
|
|
|
You may have to reboot after enabling the WHPX feature.
|
2021-07-09 22:53:28 +00:00
|
|
|
|
2021-08-03 23:39:14 +00:00
|
|
|
Afterwards you can start the VM with `Meta/serenity.sh run` as usual.
|