Any drawbacks using WSL 1/2?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
greenote440
Posts: 1
Joined: Tue Apr 21, 2020 12:53 am

Any drawbacks using WSL 1/2?

Post 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?
User avatar
eekee
Member
Member
Posts: 892
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Any drawbacks using WSL 1/2?

Post 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.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Any drawbacks using WSL 1/2?

Post 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.
User avatar
eekee
Member
Member
Posts: 892
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Any drawbacks using WSL 1/2?

Post 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.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply