Page 1 of 1

Any drawbacks using WSL 1/2?

Posted: Tue Apr 21, 2020 2:46 am
by greenote440
I started to use the new Windows Linux Subsystem 2 to follow the os01 book, and have already run into quite some problems to setup an X-server in order to see graphical applications like qemu. Now that this problem is addressed, I wonder if there are any other drawbacks in using WSL for os dev, like compiler setup etc. As this is my first os project I'm working for 32 bits mode, and I'm not quite sure if I have the correct configuration of gcc, gdb etc.

Are there any known limitations I may encounter by using WSL2 as my developping platform? Is it generally considered a better idea/practice to setup a vm?

Re: Any drawbacks using WSL 1/2?

Posted: Mon May 04, 2020 10:51 am
by eekee
I always find setting up an X server to be a pain in any setup. It's only ever okay when it's installed by your Linux distribution, where startx and/or some display manager should all be configured to work together with the rest of the system. Trying to set up the server separately to the system makes you realize how back-to-front the whole design of X is.

Gcc is complex in itself, but setting it up should be the same everywhere. I don't think expects much at all from the OS; just file operations. Setting it up as a cross-compiler looks like a huge pain in itself, but there are over 9000 tutorials for it these days. (Most other compilers are easier.) When Windows programs expect Unix file semantics, file access gets slow, but I think it should work well enough for Gcc.

I know it's too late to say this, but Qemu doesn't strictly need a display; it can be a VNC server showing the console. That can be nicer than it's built-in display in some ways, but I think it means you need a long timeout (or infinite wait) on any "press this key at boot" routines.

Re: Any drawbacks using WSL 1/2?

Posted: Mon May 04, 2020 1:03 pm
by MichaelPetch
I have used WSL1 and WSL2 (and still do). WSL doesn't support block devices so writing directly to a USB drive like /dev/sd? can't be done. WSL doesn't support running 32-bit programs (just 64-bit). The only program I have encountered that this was a problem (possibly related to OSDev) was that FASM didn't run. I had to download the fasm tarball and install fasm.x64 to replace the 32-bit fasm.

Setting up an X-Server I have always found to be easy. Install X-Ming (an X-Server for Windows). Next login to your WSL shell prompt and modify ~/.bashrc and add this line to the end:

Code: Select all

export DISPLAY=:0 
Then close your WSL prompt and relaunch it for the change to take effect. That should allow you to run things like QEMU, bochs, and most X11 software.

Re: Any drawbacks using WSL 1/2?

Posted: Thu May 14, 2020 3:47 am
by eekee
MichaelPetch wrote:Setting up an X-Server I have always found to be easy. Install X-Ming (an X-Server for Windows). Next login to your WSL shell prompt and modify ~/.bashrc and add this line to the end:

Code: Select all

export DISPLAY=:0 
Then close your WSL prompt and relaunch it for the change to take effect. That should allow you to run things like QEMU, bochs, and most X11 software.
Thanks for the link. It stands to reason that an X server designed for Windows would be easy. For one thing, it doesn't have to resort to weird nonsense to know when to shut down.