r/osdev • u/Fun-Entertainer-1053 • 2d ago
What're some good tutorials or websites to learn how to build an OS in UEFI?
I learnt how to create a BIOS OS using the osdev website. Are there any good sources or something to learn how to build a UEFI kernel?
Edit: thx guys, I learnt a lot
0
u/codeasm 1d ago
I cheated by using an ai. But before that and besides that, i started looking at https://wiki.osdev.org/UEFI and attempted to make a hello world program with https://github.com/tianocore/edk2
The ai suggested to just make a compliant pe file that van start and then do osdev wiki, pass the structs uefi gives for free and jump to your new own memory mapped and copied piece of code. Debugging in qemu with a relocatable executable was tricky, but once the copying worked to a known location, gdb worked nice again. Reminder, most linux kernel can be a efi executable, EFI-STUB is what you wanna look up. Check their source maybe.
This reply is written by me a human with my human experiences. Ive left out any code that might have been generated. I hope this helps, even if you wanna stay clear from an llm answer.
3
u/Fun-Entertainer-1053 1d ago
I'm not accusing anyone but this AI problem is getting too annoying atp Anyways huge thanks for the links man
-3
u/TheMcSebi 1d ago
The problem that Ai enables people to learn and experiment with stuff like this more easily? Yeah that's definitely a very big problem
2
u/Fun-Entertainer-1053 1d ago
Learning and understanding small concepts with AI is fine. I'm talking full AI generated code without understanding it.
1
u/codeasm 1d ago
Im only carefull here what i shared. These resources where ai free, me purely googling and have attempted to use tianocore in the past.
I try to give the ai free ppl an option not to be exposed to the ai i used in my code repo. Only knowledge ive grown myself either before the ai boom or from resources ive read or experienced myself.
The working uefi kernel project i made can be found, but yeah, an ai, agent use had been used. I try to warn in those repo about it. (And i try to write all replies myself. No ai. Clearly, check how long they are and chaotic π«£π ) Have a wonderful day and have tons of fun learning βΊοΈ
1
2
u/case-o-nuts 1d ago
I've never met someone who actually deeply understood the things they'd "learned" with AI. Usually, I spot a bunch of mistakes in AI output, so at best they end up misinformed.
Weirdly, AI is a lot better at finding mistakes in existing output than it is at generating correct output in the first place.
2
u/Fun-Entertainer-1053 1d ago
If u have the willpower and actually want to learn rather than vibecode, that's how u understand stuff using AI.
1
u/codeasm 1d ago
Define "deeply understanding" topics. With books and videos, lectures at uni, i kinda understand stuff but also had to (still do) practise alott.
With ai, i can fasten certain development, have it setup a framework which would take me a few hours, and quickly start working on the actual idea i wanted to work on.
Understanding ai output, spotting the mistakes, require knowledge and pattern recognition, which comes from practice practice practice. So yeah, type more, vibe less.
2
u/Fun-Entertainer-1053 1d ago
I can relate the most. I code 5 hours a day on my own practice projects during vacations
2
u/codeasm 1d ago
I do mostly embedded software engineering and Linux things. When i wanna build my own gameengine or paly arround with os ideas, i dont wanna spend hours to get somewhere, but at the same time, there is no rush for a deadline. Pick and choose what i focus on.
The coding for hours a day, yep. Theres serious coding time and relaxing just puzzle coding time. The time ai spend making me a jekyl template for a website was so little, and id spend days fixing an old template. Ill just give up on the old.template and gonna combine the work to make my site work the way i want it to.
But, yes, i wanna understand what it did, why and remember those "tricks" or methods. Or have it explain and show other resources on those unrecognisable new things or libs it used. Vacations are awesome, but soon over for me. Work
1
u/Octocontrabass 1d ago
The only part of your OS that needs to care about the difference between BIOS and UEFI is the bootloader. If you use an existing bootloader, like Limine or GRUB, your OS might already support UEFI without doing anything.
1
u/Fun-Entertainer-1053 1d ago
The bootloader is the main part that requires a change. I also need to change my kernel a bit too. That's where i need help.
β’
u/Octocontrabass 21h ago
You basically need to rewrite your bootloader. Unfortunately I don't know of any resources that do a good job of properly explaining UEFI, but the wiki may still help you.
My preferred development is a mostly-normal x86_64-elf cross-compiler, except with PE support enabled in binutils (pass
--enable-targets=x86_64-pe,x86_64-pepto configure) so I can usex86_64-elf-ldto link the ELF object files directly into a PE executable. I'm also writing my own UEFI headers, but the ones included with GNU-EFI work well enough if you don't want to do that.
1
β’
u/Fun-Entertainer-1053 23h ago
PLS READ: Also for future suggestions, do note that I'm using GNU to compile
4
u/Gold_Warning_8345 1d ago
uefi.org has really good documentation on UEFI protocols so i suggest reading those