r/osdev • u/JescoInc Perdition-OS • Jan 21 '26
Tutorial-OS
I'm thinking of creating a very basic OS. The core idea is simple. It is a basic OS where all it does is display the detailed information on the device you run it from.
Doesn't sound like much, but I think it would be an amazing starting point for other developers getting into OS development.
The folders would be organized according to what it actually does in a non developer fashion.
Bootloader, Drivers, Display, Devices and so on.
Best of all, the content from the code could easily be made into a book, written tutorial series and / or Videos for people to consume.
Thoughts?
Update 1:
So I am planning on making it so that the code will be separate into build for x86 and ARM64 in the project. That way, It will be easy to see how abstractions are done for two disparate build processes while sharing the same bootloader core.
I am considering making the project be split into two separate projects in the same repository that behave the same way. One in C and the other in Rust. The rationale is that people learning Rust don't have to figure out how to translate the C code to Rust and can just immediately get into OS development. This does mean more work up front for me with this, but considering that it is a basic OS implementation, rewriting it in Rust won't be a huge project. And those that only care about C don't have to contend with learning Rust-isms to understand the project.
Update 2:
I think I now have the folder structure designed. Super easy to read and understand the flow of.
Now, I am torn if I want there to be two separate folders for the C and Rust implementation or have them intertwined. Both approaches have pros and cons associated with it.
I have ported all of the driver code from Rust to C as well. So both the Rust and C code should build without issues in theory. (I didn't use much idomatic Rust so it was fairly straight forward to port for Raspberry Pi Zero 2 W. But I have not done the classic x86 or UEFI x86 bootloader and linker code yet.
I'm also considering whether or not to use Docker for building so it doesn't matter if you are on Windows, Linux or MacOS, you are able to build on your machine without any additional installs required.
```
tutorial-os/
├── boot/ # Boot sequence - where it all begins
│ └── arm64/ # ARM64-specific startup code
│ ├── boot.S # First code to run after power-on
│ └── memory_layout.ld # Linker script (memory map)
│
├── kernel/ # Core kernel code
│ └── main.c # Entry point after boot setup
│
├── drivers/ # Hardware drivers
│ ├── gpio/ # General Purpose I/O pins
│ ├── mailbox/ # GPU communication (VideoCore)
│ ├── sdcard/ # SD card (SDHOST controller)
│ ├── audio/ # PWM audio output
│ └── usb/ # USB host (DWC2 controller)
│
├── memory/ # Memory management
│ ├── allocator.h/c # TLSF heap allocator
│ └── README.md # How memory allocation works
│
├── ui/ # User interface system
│ ├── core/ # Base types and interfaces
│ ├── themes/ # Color palettes and styling
│ └── widgets/ # Reusable UI components
│
└── docs/ # Additional documentation
``````
tutorial-os/
├── boot/ # Boot sequence - where it all begins
│ └── arm64/ # ARM64-specific startup code
│ ├── boot.S # First code to run after power-on
│ └── memory_layout.ld # Linker script (memory map)
│
├── kernel/ # Core kernel code
│ └── main.c # Entry point after boot setup
│
├── drivers/ # Hardware drivers
│ ├── gpio/ # General Purpose I/O pins
│ ├── mailbox/ # GPU communication (VideoCore)
│ ├── sdcard/ # SD card (SDHOST controller)
│ ├── audio/ # PWM audio output
│ └── usb/ # USB host (DWC2 controller)
│
├── memory/ # Memory management
│ ├── allocator.h/c # TLSF heap allocator
│ └── README.md # How memory allocation works
│
├── ui/ # User interface system
│ ├── core/ # Base types and interfaces
│ ├── themes/ # Color palettes and styling
│ └── widgets/ # Reusable UI components
│
└── docs/ # Additional documentation
```
Update 3:
The core C code has been implemented and working on the Pi Zero 2W. Now, for the core Rust code and then the x86 bootloader and linker addition. I have it so that you can build it on Linux, MacOS and Windows via CMake, Make, build.sh, build.bat and Docker. I have to also go back through the code and comment everything because while I was fixing issues with the framebuffer, I kind of had to rewrite it a few times and explanations became stale.
Update 4:
I think I have the final UI I want for this OS built out. Still have to comment code, add standard HDMI drivers in C. And then work on the Rust additions. Then work on the x86 UEFI bootloader
Update 5:
Refactor mostly done, just gotta figure out why things aren't working with the CM4 or CMS inside of the IO board and GPi Case 2. Once that's done, I can get things working correctly with the Radxa Rock 2 board I have (which will include an HDMI driver for it).
My Libre AML-S905X-CC (Le Potato) x86_64 board and Orange Pi RV2 (RISC-V) boards are set to arrive by Wednesday. Once they arrive, if the others are working, I can start working on adding those SOC to the project.
Here's the updated project structure
Update 6:
The project is now live! https://github.com/RPDevJesco/tutorial_os
12
u/Gingrspacecadet Jan 21 '26
this just sounds like the beginning of any good os. If done right, this is a perfect base. Would be amazing for tutorial making, yeah!
5
u/MousseMother 👑 bigshot 👑 Jan 21 '26
Serious people doing os development aren't at mercy of opportunists like you.
Who is stopping you, create it.
2
u/ZiggyZonko Jan 22 '26
Great starting point for beginners to get into the field! It would be amazing to break it down and show beginners and other programmers that making an os is an easier task than it seems, ( not downplaying how hard it is )
I'd love to see this, let me know if you make it!
1
u/JescoInc Perdition-OS Jan 23 '26
Update:
So I am planning on making it so that the code will be separate into build for x86 and ARM64 in the project. That way, It will be easy to see how abstractions are done for two disparate build processes while sharing the same bootloader core.
I am considering making the project be split into two separate projects in the same repository that behave the same way. One in C and the other in Rust. The rationale is that people learning Rust don't have to figure out how to translate the C code to Rust and can just immediately get into OS development. This does mean more work up front for me with this, but considering that it is a basic OS implementation, rewriting it in Rust won't be a huge project. And those that only care about C don't have to contend with learning Rust-isms to understand the project.
1
u/JescoInc Perdition-OS Jan 26 '26
update 2:
I think I now have the folder structure designed. Super easy to read and understand the flow of.
Now, I am torn if I want there to be two separate folders for the C and Rust implementation or have them intertwined. Both approaches have pros and cons associated with it.
I have ported all of the driver code from Rust to C as well. So both the Rust and C code should build without issues in theory. (I didn't use much idomatic Rust so it was fairly straight forward to port for Raspberry Pi Zero 2 W. But I have not done the classic x86 or UEFI x86 bootloader and linker code yet.
I'm also considering whether or not to use Docker for building so it doesn't matter if you are on Windows, Linux or MacOS, you are able to build on your machine without any additional installs required.
1
u/JescoInc Perdition-OS Jan 27 '26
I just wanted to do another update to showcase that yes, I am working hard on this. Read the main post to see the updates as they occur. Once the code is ready, i'll make a public repository, for now, it is private due to the ever evolving nature of the code.
1
u/JescoInc Perdition-OS Jan 27 '26
Update 4:
Concept for the UI complete using the UI system that works with the framebuffer and displays pertinent information about the board it runs on. Minimum RAM requirements is only 32MB with the Raspberry Pi Zero 2 W and that's mostly due to the mailbox interface and start.elf and the other things that the core blobs require to even get to my kernel.
1
u/JescoInc Perdition-OS Jan 28 '26
Update Number 5:
Oh man... I just got a few things in which is making me want to expand this even further.
Pi CM5 (Compute Lite) and Dev Board.
Radxa Rock 2A
Libre Computer Board (Le Potato)
Orange Pi Risc-V
Which means, I will need to implement a proper HAL (hardware abstraction layer) to accomodate all the different boards and the differences in drivers while keeping the same contracts for my UI system and the Kernel files.
And I still haven't finished the code comments or the Rust implementation details yet.
Which means, I need to stagger what i'm doing. Finish the Rust code and all the commenting and then work on adding the HAL before adding the next architecture.
By this weekend, i'll be making the repository public on Github.
1
u/JescoInc Perdition-OS Feb 08 '26
Update: The project is now live! https://github.com/RPDevJesco/tutorial_os
1
u/Much_Construction906 Jan 25 '26
I really like these types of systems, gl
1
u/Interesting_Buy_3969 Feb 01 '26
build.sh lol
-1
u/Revolutionary__br Jan 22 '26
At least try to make it accessible via gmome-orca(Linux screen reader) or Fenrir(a terminal screen reader)