OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 4:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: OS dev on WSL/CLion
PostPosted: Fri Nov 27, 2020 11:31 pm 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 154
I started off with RedHat and then Ubuntu as my dev env. Dual boot with windows & ubuntu and developing my OS on ubuntu with VIM as the editor/IDE

In the last few months, I have changed my OS dev env. I develop on Windows using WSL2(Ubuntu), with CLion (IDE), CMAKE (build toolchain), and QEMU (using Xming on Windows)

Except for some boot/init stuff which is in assembly, the rest of the code is in C and C++(11). I am quite impressed with the latest CLion which lets me use cmake build toolchain and seamlessly integrate with WSL2

On WSL2 (Ubuntu) - which I think is pretty much like a VM - I am able to create/mount loop devices (for disk images), build gcc/g++ cross compiler with C++11 support.

Curious to know if anyone is using a similar configuration for their OS dev env. Please share what's your OS dev env setup looks like :)

_________________
complexity is the core of simplicity


Top
 Profile  
 
 Post subject: Re: OS dev on WSL/CLion
PostPosted: Sat Nov 28, 2020 3:22 am 
Offline

Joined: Sun May 13, 2018 9:44 pm
Posts: 2
That's close to what I use.
  • I use WSL 1 (because WSL 2 has regressed network performance, and I use qemu in graphics mode for testing)
  • My IDE is Visual Studio Code, which has built in WSL integration.
  • My build system is using CMake with Clang.

CMake has integration with VSCode as well, so I'm able to CMake build / launch my kernel using the shortcuts, and even switch build configurations.


Top
 Profile  
 
 Post subject: Re: OS dev on WSL/CLion
PostPosted: Sat Nov 28, 2020 3:55 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1590
I develop on Linux. My "IDE": vim. I use vim for everything. I use it at work, and at home, I have used it for C, C++, C# (on Windows, with the csc command line compiler), shell scripting, config files, Java (when I was younger), everything.

My build system: Shell script that creates a makefile. I eventually happened to land on that when I read someone describe that GNU Make essentially just tries to marry POSIX Make with POSIX sh. So why not just use sh? So I have a POSIX sh script that creates a POSIX make file. That stuff should be portable to anything POSIX, and even to Windows with nmake, but I don't want to make assumptions.Dependency tracking is done by the shell script (i.e. dependencies are not automatically updated). This (like everything else) has drawbacks and advantages. With GCC, spitting out the dependencies can be done on the fly, but at work I have a compiler where generating dependencies requires a second pass over the file, and it takes about as long as actually compiling it.

I might improve the script to create a ninja file instead in future. That's the nice thing about this setup: I haven't sunk so much time into a Makefile that switching to ninja is utterly unthinkable.

I typically run my OS against bochs, but I periodically try QEMU as well. A real hardware test has yet to happen. Partially because I put all my debug messages on serial line instead of the main screen, so the screen is free for userspace to use (and so I don't need a font renderer in kernel space). But it does mean I can only debug it if the computer I use has a serial line (and it has to be an ISA COM port, none of that USB rubbish ;-) ), and I have a terminal handy. The problem with USB serial adapters is that, ironically, USB has no standard for serial adapters, despite being called the Universal Serial Bus. So USB serial adapters usually use one of a handful of chips to do the translation, and each works completely differently, and in both cases, I have not seen data sheets detailing the use. So in the end, I would have to poach the drivers from elsewhere (like Linux), and then there's that legal stuff again.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: OS dev on WSL/CLion
PostPosted: Sat Nov 28, 2020 4:04 pm 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 148
I used to use an Ubuntu dual-booted with Windows 7, but recently I got a laptop with Windows 10, so I decided to try out WSL (Ubuntu 20.04).
It worked pretty well, so I use it as my main Linux for now. I had to update to WSL2 because I needed to be able to mount loopback devices.

I also run XLaunch (VcXsrv) so I can run graphical QEMU/Bochs, but it is a bit glitchy. For instance, it used to work without having to tick the "Disable access control" box every time. Also, it fails to change the mouse cursor or switch to free-look mode.
It is nice to not have to reboot every time I want to play Windows-only Steam games though, or use Windows Movie Maker (still), or run Unity (because the Linux version is pretty glitchy).

Unfortunately, WSL2 does not have support for lsusb (or USB pass-thru in general), so I can't test my USB code very well, and occasionally have to go back to booting a Linux VM.

For my "IDE", I usually just use Notepad++ (another benefit of using WSL2). I really like most of its key shortcuts, like Ctrl+D to duplicate a line (vs other IDEs which DELETE the line), Ctrl+Shift+↑/↓ to move a line upwards/downwards, etc.
I also like the ability to do a "search all in workspace" thing.
I know these features are probably available in other IDEs, but A) I really don't like terminal-only IDEs and B) Other IDEs are often slower and C) I like Notepad++.
If there were a fast IDE that had the Ctrl+D and Ctrl+Shift+↑/↓ shortcuts (or a way to remap something to them) and the "search all in workspace" thing, then I'd consider trying it.

I just use Make/GCC for my build system.

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
 Post subject: Re: OS dev on WSL/CLion
PostPosted: Tue Dec 01, 2020 6:41 pm 
Offline
Member
Member
User avatar

Joined: Sun Oct 11, 2020 9:46 pm
Posts: 363
Location: United States
foliagecanine wrote:
I also run XLaunch (VcXsrv) so I can run graphical QEMU/Bochs, but it is a bit glitchy. For instance, it used to work without having to tick the "Disable access control" box every time.

Use a config file.

_________________
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".


Top
 Profile  
 
 Post subject: Re: OS dev on WSL/CLion
PostPosted: Tue Dec 01, 2020 8:38 pm 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 148
rizxt wrote:
Use a config file.

That's what I do now.

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group