DEV Community

Cover image for I made my own Bootloader at 16. It was horrible. It was worth it.
Mehdi BR
Mehdi BR

Posted on

I made my own Bootloader at 16. It was horrible. It was worth it.

Why I even did it

I have this obsession of wanting to understand every little thing on my computer. Every wire, every line of code, every register, I always wanted to know it all.

How I started

About 2 days before, I learned about Bootloaders and how they are the first program to run on a computer. The description alone sparked a feeling I never knew existed. I started imagining my own bootloader, my own program to be run first thing by my machine. That thought alone put me to work.

The story

That night, I started digging through UEFI documentation. I found a few videos detailing how Bootloaders speak to the firmware, I even followed a step by step tutorial video. Nothing worked, everything crashed the QeMu simulation. I couldn't even print a simple Hello World. I decided to keep pushing a few more hours before fully giving up, until i found this paper. It pointed out such a specific problem that I felt only I had. Nothing on the internet described my problem and solved it, except this paper. I couldn't tell what exactly clicked, it wasn't a grand explanation, just a small snippet of code that made me look at mine in confusion. I was doing it all wrong. I finally printed my very own hello world!

This sight alone made me the happiest person in the world at 4 in the morning. I went back to the step by step tutorial and debugged every little thing that didn't work from the video. AI couldn't help, it was just me and poorly made, horrible looking documentation: the pinnacle of computer development. Slowly, I understood how everything worked. Sure there were some parts that took 12 hours to debug, but that was all part of the ride. At the end of all that, I got to see my 3 line kernel be loaded by my own custom bootloader.

That little 123 you see at the end, that's printed from my kernel. Seeing that 123 print was the best moment of my life. I decided to run it on my real machine, not a QeMu emulator, I had to see my own Bootloader run on my machine, and for the first time ever, it worked first try. It was beautiful, seeing everything go as it should've could've made a grown man cry.

Tools I used

Making this project, I used multiple tools I made beforehand to help.
GitHub repos:

  • NUB (Novus UEFI Builder)
  • NovusDeploy
  • NCC (Novus C Compiler)
  • All made by me in C/C++. Star them if you wanna support!

Where to find the kernel/bootloader

You can find them at this GitHub repo, star it if you wanna support me and follow my journey!

Top comments (0)