I kicked off this little project on 9th March this year, right in the middle of my board exams (probably not the smartest timing, I know, TT). It's been an amazing ride!
It all began with the question, "how hard could it be?" and just yesterday I finally hit the ultimate milestone:
IT RUNS DOOM!I posted about it on X yesterday and the response was insane, so I thought I'd share the technical details here!
- Github repo: https://github.com/thatmagicalcat/magicalos
- Architecture: x86_64
- Language: Rust (with two C dependencies)
- Bootloader: Limine (initially I was using GRUB/multiboot2 and later realised it was a pain in the back)
- C standard Library: mlibc https://github.com/thatmagicalcat/magicalos-mlibc
Porting DOOM:
- VESA Framebuffer: Linear Framebuffer (LFB) initialized via the bootloader
- Virtual Device: Created a device node in my Virtual File System so userspace programs can access the framebuffer and keyboard
- Rendering: The program opens `/dev/fb0` and mmap's it to get a pointer to the LFB. Implemented `DG_DrawFrame()` from doomgeneric, which copies pixel data to the mmap'ed LFB
- Input: Added a PS/2 keyboard driver and created a keyboard event device in the VFS that the user program can open via `/dev/kbd`
It's still a work in progress, but seeing DOOM run flawlessly on a kernel I wrote myself in Rust is an unmatched feeling. I'd love to hear your thoughts or any questions!
Board exams?
Wow, bro, I feel so behind the competition and I'm just finishing my 12th grade too.
Hey, what a small world!
I'm a YC founder working on operating systems - do you happen to know how to write drivers?
As someone my age with the same interest, how should I get started? I know a bit about Linux, kernels, and a little bit of everything. I've been thinking about diving in for a while but don't know where to begin. Your project is a real inspiration.
How long did it take you to get here - from learning the basics to actually implementing it? Have a good day!
That's freakin' awesome!
Hey, you're doing amazing work even though this isn't my area - I'm an iOS developer. If I want to start developing OSes and drivers, how tough is it to pick up Rust first and then move on to the other parts?
Sharma ji's son, lol. Great work, dude - keep it up!
Neovim for the win! I don't know much about OS development, just that it's tough. All the best for your future.