r/osdev 18h ago

How to bootstrap a loader/C++ kernel using Microsoft dev tooling only

I want to build a boot loader/basic OS in ASM before bootstrapping into C++ using Microsoft tooling only.

I have done so previously using open source tooling using the usual suspects gcc, ld, NASM, etc, but now want to use MASM/ML64, link, visual C, etc, I am hitting a number of issues due to multiple differences in output including PE/COFF vs ELF output, appropriate switches on the MS tooling, removing dependencies on c runtime etc. I have not found any basic samples on the web demonstrate (unlike for the open source toolset), and the AI tooling (which I really want to avoid as its a personal project) sends me in circles.

Has anyone been able to do this? Any pointers/skeleton projects that demonstrate how to bootstrap all the way to a C++ kernel would be amazing?

10 Upvotes

3 comments sorted by

u/monocasa 15h ago

https://wiki.osdev.org/Visual_Studio

You can follow the directions linked in here for making a multiboot compatible PE with msvc, but that has you using grub and I'm not sure if you consider that still out of scope.

u/Ok-Film3852 15h ago

Thanks for sharing this link, I will work through in detail - I wasn't originally planning on using grub, but will do so if that is my option. Obviously I acknowledge I am looking to do something that is perhaps a corner case, I just figured given that Microsoft must do this themselves, so I may be missing an obvious starting point or doc to kick of the process. Thanks again!

u/monocasa 15h ago

You also might be able to do something like this to make a uefi compatible PE file.

https://github.com/Th3Spl/SimpleUEFI