This is an extremely basic "operating system" boilerplate. Expand upon it to build your own operating system, without all the hassle of setting up a compiler, directory structure, makefile etc.
The template is designed to be modern: It utilises UEFI and builds for x86_64.
- Compiles and runs a simple UEFI application, which can be expanded into a bootloader.
- Pretty much everything. It doesn't exit the UEFI boot services, so it is technically a UEFI application and not a bootloader.
While any code I've written is in the public domain, some components have been "borrowed" from other sources. This means other license conditions may apply. Most notably:
- Topmost makefile and kernel.c: https://wiki.osdev.org/User:No92/UEFI_Bare_Bones
- Bootloader makefile: https://stackoverflow.com/a/48267562
- Zircon UEFI Headers (MIT License) (Mirror): https://github.com/vineyard-os/zircon-uefi
- maybe other things...
To be honest, the makefile structure modifications I have made aren't all that good. The kernel makefile blatantly compiles all source files rather than relevant ones inferred from the #included headers. (Could perhaps use makefile/GCC dependencies, .d files) Feeling productive, may refactor later idk.
Expect to see this template improve and become more comprehensive over time.
You'll need the following tools installed:
- clang and lld (specifically lld-link)
- qemu-system-x86_64
- make, git, wget
(If you're on Windows, try using Windows Subsystem for Linux or Cygwin.)
Then, run the build system: make
. The OS will be built and QEMU will launch.
To boot this on a real computer, you could probably copy the "efi" folder under "Build/HDD/efi" to the EFI partition on a USB device or hard disk. Likewise, an ISO image could be created from the "HDD" folder, and then be booted on a virtual machine or distributed.