This repository will demonstrate how to set up a basic portable 64-bit kernel in C using Limine.
This project can be built using the host GCC toolchain on most Linux distros on x86_64 when targetting x86_64 (KARCH=x86_64
), but it is recommended to set up an *-elf
cross compiler for the chosen target, or use a native cross toolchain such as Clang/LLVM.
It is also recommended to cross reference the contents of this repository with the Limine Bare Bones OSDev wiki page.
It is recommended to build this project using a standard Linux distro, using a Clang/LLVM toolchain capable of cross compilation.
The KARCH
make variable determines the target architecture to build the kernel and image for. The all
target (the default one) builds the kernel for the given architecture, and a bootable .iso
image containing it. The all-hdd
target builds a flat hard disk/USB image instead.
For example, to build for aarch64
run:
make KARCH=aarch64 KCC="clang" KLD="ld.lld"
The image can then be tested with the one of the run
or run-hdd
targets.
make KARCH=aarch64 KCC="clang" KLD="ld.lld" run