1054 points by ingve 2 weeks ago | 121 comments
nuta 2 weeks ago
I wrote this book so you can spend a boring weekend writing an operating system from scratch. You don’t have to write it in C - you can use your favorite programming language, like Rust or Zig.
I intentionally made it not UNIX-like and kept only the essential parts. Thinking about how the OS differs from Linux or Windows can also be fun. Designing an OS is like creating your own world—you can make it however you like!
BTW, you might notice some paragraphs feel machine-translated because, to some extent, they are. If you have some time to spare, please send me a PR. The content is written in plain Markdown [1].
Hope you enjoy :)
[1] https://github.com/nuta/operating-system-in-1000-lines/tree/...
sesm 2 weeks ago
Or like building your temple so you can talk to God directly
sohang 2 weeks ago
6510 2 weeks ago
pronoiac 2 weeks ago
* https://rhodesmill.org/brandon/2012/one-sentence-per-line/
nuta 1 week ago
pronoiac 1 week ago
johndoe0815 2 weeks ago
nuta 1 week ago
Rochus 1 week ago
jb_briant 2 weeks ago
Making video game is also like creating your own world!
And it's order of magnitude less hard than making an OS...
Bonus point, you have a chance to make a living from it!
leonewton253 1 week ago
jb_briant 1 week ago
Also I'm not speaking about making a game engine along with the game.
Having a kernel dev job is different than making your own kernel, speaking on a "world builder" perspective.
66yatman 1 week ago
exDM69 2 weeks ago
QEMU contains a built-in GDB server, you'll need a GDB client built for the target architecture (riscv in this case) and connecting to the QEMU GDB server over the network.
quruquru 2 weeks ago
1) Record & Replay: Record an execution and replay it back. You can even attach GDB while replaying, and go back in time while debugging with "reverse-next" and "reverse-continue": https://qemu-project.gitlab.io/qemu/system/replay.html
2) The QEMU monitor, especially the "gva2gpa" and "xp" commands which are very useful to debug stuff with virtual memory
3) "-d mmu,cpu_reset,guest_errors,unimp": Basically causes QEMU to log when your code does something wrong. Also check "trace:help", there's a bunch of useful stuff to debug drivers
kotborealis 2 weeks ago
jannesan 2 weeks ago
o11c 2 weeks ago
Thankfully, GDB has a multiarch build these days which should work for all well-behaved targets in a single build.
(the place it is known to fail is for badly-behaved (embedded?) targets where there are configuration differences but no way to identify them)
ramon156 2 weeks ago
I tried it again 2-3 years later and took the time to go over each subject. I even planned in advance to make sure I was going to finish it.
12345hn6789 1 week ago
quibono 2 weeks ago
khaledh 2 weeks ago
Shameless plug: I've written hobby OS (well, a kernel actually) in Nim for x86-64[0] and it's all documented as well. I put its development on hold until I create a JetBrains plugin for Nim (in heavy development right now).
elvis70 2 weeks ago