Linux on Windows in 2021

Having recently got Back in to OS Development, I found myself needing to set up my development environment, having not touched a cross-compiler or Linux for many years. I use Windows 10 for my day-to-day computing (and will be among those switching to Windows 11 on any of my PC’s that are compatible), but I’ve found that GCC on Linux is by far my preferred toolchain for OS Development. Yes, I know you can do this without Linux at all (, but that just doesn’t “do it” for me.

Just prior to stopping OS development last time, I had switched from using Cygwin to WSL. The close to native Ubuntu distro was perfect for my needs. This time, I’ve switched to WSL2 and I’m impressed.

So, how to start? Well, in the “old days” (a couple of months ago…) WSL 2 required patching windows, Powershell commands, adding Windows Features, enabling hyper-v and so on. No more! Now, after checking a couple of prerequisites, WSL2 is one command away!


This is really easy now. You no longer have to install the Hyper-V platform or go in to “Programs and Features”. All you need to do is enable the ONE change that Windows is unable to – a BIOS setting. So enter your your BIOS setting and, on Intel processors ensure that VT-x is enabled. On AMD processors ensure that AMD-V is enabled. I’ve found that generally on Intel motherboards, this setting quite high up and easy to find in the BIOS (sorry, UEFI!) settings page. For AMD, I often had to do some scratching around in advanced CPU settings subpages. But that’s it – one setting change and you’re ready!

Oh – perhaps one more thing. May be a good idea to check Windows is up to date…

Activating and installing WSL2

Now you have your CPU’s virtualisation enabled, there’s just one thing to do. Open Powershell as an administrator (Start –> right click on Powershell –> Run as Administrator) and type the following:

wsl –install

That’s it! Windows will now install hyper-v, set WSL2 as the default and install the default Ubuntu distro! My PC didn’t even reboot, but YMMV depending on whether you were already using hyper-v or not.

Once that’s complete, fire up Ubuntu. It will do some initial config which takes a while and will then ask for your new username and password. You’ll find yourself dumped in to your home directory. As always with these things, you may now like to:

sudo apt-get update

sudo apt-get upgrade

For a nice easy way to access your files from the Windows filesystem, take a look at the very short article, Accessing WSL Filesystem from Windows.

And you’re ready to go with the next step – Setting up the GCC Toolchain.

Back in to OS Development

A description of getting back in to OS Development and what will be in the next few posts.

After a long break, I recently decided to get back in to hobby operating system development. I’ve done plenty of C# application programming over the past few years – I have a patient administration system at my workplace, written as a C# desktop app with an Azure SQL backend. But I’ve always thought that there’s nothing more of a challenge with programming than operating system and game development. The latter is a problem for me as I’m really no artist – any game I create is likely to end up as a mash-up of free Unity store assets! Although my OS is unlikely to be used by anyone in the real world, I can’t bring myself to develop a game that would be so generic.

So, I got out the old Git repo, reinstalled WSL (now version 2!) and prepared my dev environment. My development is split over 4 PC’s, depending on the day of the week. No worries – creating that cross compiler and setting up a bootloader would, no doubt, remind me of the processes involved in OS Dev!

After a few years away from system programming, it was amazing how much I’d forgotten. I’ve therefore decided to create a number of posts – if only for my own reference. That’s what will be appearing on this site next.