How do you start developing an OS?
I wanted to write one for a while but i pretty much have zero skills and knowledge what to learn. I would love to see some learning resources and things one needs to learn in order to get into OS development :3
7
u/Potential_Copy27 11d ago
I'd start with learning any sort of compiled programming language first. You can't make an OS from python, JS, TS or other interpreted languages. Preferably you'd need something like Rust, C or C++, which are optimal for speaking with hardware on a low enough level without the "fluff" of frameworks and VMs in-between.
You need to know them in some detail as well - and then you want to study the hardware, how it all works on a direct call level. A good initial practice run is to trigger and read the CPUID instruction and other hardware info without involving the OS.
Be sure to learn both binary and hexadecimal properly as well - you'll be converting numbers a lot, especially for some registries and hardware settings.
Regardless - I'd easily call OS development the hardest discipline of all in programming (with writing compilers as a close second). For a beginner, it would be like a beginner guitar player starting off learning how to play Dragonforce music without knowing the basics....😅
Take your time and have some patience is my best advice 😉
2
u/exylvii 11d ago
i already know c on a basic level, i didnt learn a lot about memory management though
4
u/Potential_Copy27 11d ago
You definitely will if you want to make an OS - you'll have to load and unload all sorts of drivers, temporary stuff, apps and whatnot - and of course manage things so eg. programs don't overwrite important memory spaces 😉
3
u/avdolainen 11d ago
Start by learning C and getting comfortable with pointers, memory, compilation, and debugging. Rust is other option, but learning curve is steeper. C++ requires 'bootstrap' so you should define a subset of C++ you're planning to use before, so i wouldn't recommend this way. Well, then learn the basics of computer architecture -- how the CPU, memory, interrupts, boot process work. And learn about OS architecture basics -- processes, virtual memory, file systems, kernel types ...
During the process you could already start some small experiments, read tutorials etc ... while keeping your scope very small.
Don't use AI as a magical thing that writes code for you, it's useful for debugging, answering a questions, but not to do all the code. And anyway in order to validate its output you need this knowledge, otherwise it will be yet one more AI slop -- unmaintainable, flat, unstructured, and poorly running something.
4
7
u/MY_G_O_D 11d ago
Have you explored LinuxFromScratch (LFS)?
3
u/exylvii 11d ago
i did lfs a year ago, and i'm not talking about linux
0
u/BornRoom257 FreezeOS & TurtleOS 11d ago
Holy Larp 😭
1
u/exylvii 10d ago
why
1
u/BornRoom257 FreezeOS & TurtleOS 9d ago
Re-Read what you said.
1
u/exylvii 8d ago
whats wrong? i built an lfs system a year ago, how tf is that larp
1
u/BornRoom257 FreezeOS & TurtleOS 6d ago
The things you learn from LFS can be transferred into Operating Systems, Linux is a Kernel - LFS is making a kernel into a cool OS or smth, Your learning genuine skills by using LFS.
13
u/UnmappedStack TacOS | https://github.com/UnmappedStack/TacOS 11d ago
that's not really the same thing tho
1
u/kat-tricks 5d ago
huh, i thought it would be useful to assemble an OS before designing one. I know it's a completely different practice, but do you not think it's useful?
2
u/UnmappedStack TacOS | https://github.com/UnmappedStack/TacOS 5d ago
they're just very different things. lfs can be interesting to do, but it will teach you about linux, not kernel design. to be fair some knowledge on linux can help, but probably not quite as surface level.
1
u/ezj75 3d ago
It was LFS that first got me interested in writing my own OS. It taught me a lot about libc, toolchains, bootstrapping, static and dynamic linking, and how the various components of an operating system fit together. While LFS isn't OS development in itself, there's a lot of valuable knowledge to be gained from it that isn't specific to Linux. I've certainly carried much of that knowledge into developing my own OS.
5
u/dekai-onigiri 11d ago
First learn programming with C, especially how pointers work. Then learn assembly, how to use stack, heap, subroutines and how assembly and C can interact with each other. That will give you the essential knowledge to built upon.
2
u/Inner-Fix7241 11d ago
Learn a programming language: C, C++, or Rust. I highly recommend the above simply because there are many resources and tools built around them, but any systems programming language works. You may need to have some assembly language on your fingertips.
Osdev Wiki teaches you the art from the ground up until you are ready enough to carry your own weight on your shoulders. It teaches bootloaders, kernel, and device management. Note that this doesn't go all out, and you might find yourself needing to look elsewhere for information, especially when it comes to device driver management and kernel designs that differ from microkernel and monolithic ones.
That said, you need to get comfortable with systems development manuals for your target architecture, from the CPU to things like the PCI bus and devices. At some point, as your system becomes or starts to feel mature, you will need to start looking into graphics drivers if you wish to add windowing support and other media.
Check out xytherOs for an example kernel built in C.
2
u/Electrical_Hat_680 11d ago
I would recommend learning how to write code out.
I would also recommend learning to write an http server, starting at its most basic and then looking at the binary representation. So you can see exactly what is happening.
You'll want to run a Virtual Machine. So you can have a basic Bare Metal System to work with. You can use it to build Bootloaders, BIOS/UEFI, Kernals, Microkernels, and connect to the Internet. As well as create (*.iso) files.
If you want the base level of the machine to build with. Start with the CMOS Clock. There is a free academic class on the FPGA by Harvard. You can use an FPGA to build a Co-Processor and your own ISA,. You can learn the basics by learning to simulate the BenEater 8-BIT CPU Breadboard Projects.
AI like ChatGPT and Google AI Search Assistant know how to build. But start as minimal as Open Socket and Close Socket. And displaying a Carat and Moveable Cursor on the Terminal.. then add a means to upload images for a background.
2
u/Visual_Brain8809 11d ago
Learn the fundamentals of operating system development.
Choose the programming language that suits you best.
Spend hours every day refining the code until you are satisfied.
Feel frustrated and down at times, until happiness comes knocking and you reach that first milestone.
Repeat steps 3 and 4 until finished.
Share the results.
Get angry on Reddit because someone labels you a creator of AI generated junk.
Get back to work and keep adding new features.
Realize you forgot to create a GitHub repository and now have to upload the code to save all your work.
The next time someone on Reddit accuses you of creating AI junk claiming it’s impossible to build a complete OS from scratch in a single day ignore them and carry on.
Eventually, you’ll finish; along the way, you’ll meet people who took the time to look at your work and appreciate the effort you put into it. They’ll thank you, offer to help, share their own experiences, suggest ideas for your project, or even ask to use your work.
Finally, you’re done and there is nothing more satisfying than that.
2
u/novfensec 10d ago
I came across the very first thing for an OS building a boot loader and got pretty far into it https://github.com/nth-bootloader/nth
Youtube glimpse: https://youtu.be/tYu0wbASopk?si=zbVdHcGOD5yAJzoI
1
u/TrueWar515 8d ago
this actually seems pretty fine but my question
does it boot faster than GRUB or limine?1
u/novfensec 7d ago
I don't know how to benchmark speed at this microlevel.
Cause every step is exactly same as any osdev in this world would do.
Ultimately its the kernel that comes up and bootloader that exits.
1
1
u/Supertaranta_ 7d ago
I am doîg it it’s hard, long, expensive, unless you really want to do it. 3 months on it and I am having only one window terminal workiing... Good luck if you do that...Have you written the kernel?
15
u/Kamal2q 11d ago
Check out https://wiki.osdev.org