4/25/2024
Contents
When I was in undergrad, I took an operating systems course.. This course was widely feared, but I actually quite enjoyed it. I spent the rest of undergrad chasing the dragon of bare metal programming, but, for understandable reasons, there aren't many courses by that description.
After I graduated, I realized that I could, in fact, learn things without being graded for them. Why not just write my own OS for fun?
I usually start new projects with a prolonged period of procrastination research. If you want to learn about OS programming, the premier place is the OSDev forum and wiki. Many thanks to the people who maintain that site.
I also decided I would use Rust, because there are two things I love in life: following trends, and sum types. If you want to learn about OS programming in Rust, Philipp Opperman's OS tutorial is the place to be. His tutorial doesn't cover writing a bootloader, but his implementation on GitHub was the primary source for what I'll be writing about here. Thanks to Philipp and all the contributors on that repo.
One of the first things I learned during my procrastination research is that operating systems start in two parts:
Why can't we have the kernel setup its own environment? As you'll see throughout this, a freshly powered on computer is a special place with its own rules, which makes it hard to write a operating system there. The difference between the boot environment and the kernel environment is so large that the initialization code would, essentially, be a separate program anyway.
A lot of the OS development tutorials/guides tell you not to write your own bootloader, for some very good reasons:
My counterpoints:
You can guess which side won the argument.
That's about it. With the introduction out of the way, I'll see you in part 1.