![Sam Atkins](/assets/img/avatar_default.png)
People seem to easily miss the "Setting up build tools" section, so I have moved that step above the filesystem information and linked directly to BuildInstructions.md to hopefully make it harder to skip. Also, added mention of `\\wsl$` since that regularly comes up in Discord.
2.6 KiB
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.
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,wsl --set-version <distro> <version>
is used to convert a distro to another version, andwsl --set-default-version 2
will set the default version for all new distros (if desired.)
Next, go to BuildInstructions.md and follow the instructions for your chosen Linux environment, to get the needed build tools.
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 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.
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
.
Setting up QEMU
Grab the latest QEMU binaries from here and install them. At a minimum you will need to install the tools as well as the system emulators for i386 and x86_64.
Run Meta/serenity.sh run
to build and run SerenityOS as usual.
Hardware acceleration
The steps above will run QEMU in software virtualization mode, which is very slow. QEMU supports hardware acceleration on Windows via the Windows Hypervisor Platform (WHPX).
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:
dism /Online /Enable-Feature /All /FeatureName:HypervisorPlatform
You may have to reboot after enabling the WHPX feature.
Afterwards you can start the VM with Meta/serenity.sh run
as usual.