Lygaen/lygos
An OS made in Zig, targeting only x86-64 systems
refs
An x86_64 OS made with ❤️ in Zig ! All my questions were answered by going through the useful wiki.osdev.org or the osdev.wiki.
Note that this is simply a fun education project and should, in no way, be considered serious and used for any other things than research / education purposes.
AIs will not be allowed in this project, whether it be in PRs or code (aka. in any form). This is meant to be an education project, as such contribute to the project only if you want to learn about OSes by reading through documentation. You are free to fork and do whathever you want with the repo (see LICENSE).
First of all, clone the repository :
git clone https://github.com/Lygaen/lygos
cd lygos
You can then build the project, generating an .iso file, make sure to have xorriso on PATH :
zig build
If you want to run the app on QEMU, make sure to have qemu-system-x86_64 on PATH :
zig build run
If you want to debug the kernel with QEMU, run the following :
zig build run -Ddebug-qemu
Which will open a gdb-compatible server on port 1234, which you can connect to using you favorite debugger.
If you are using GDB, you can use the provided .gdbinit file to automatically connect and set breakpoints :
gdb -x .gdbinit
This is simply to be able to run gdb instead of gdb -x .gdbinit.
Once we're in the directory, if you want to debug the project, you must allow to run the .gdbinit provided by the project in the directory. Add the following line to your gdbinit config file :
add-auto-load-safe-path DIRECTORY_WHERE_CLONE/lygos
The searched locations for gdbinit config file are the following :
$XDG_CONFIG_HOME/gdb/gdbinit (Windows / Linux)$HOME/.config/gdb/gdbinit (Windows / Linux)$HOME/Library/Preferences/gdb/gdbinit (Mac Os)$HOME/.gdbinitSimply creating a file statisfying one of the above locations for your platforms containing the said line will allow gdb to run the .gdbinit file.
If you installed the gdbinit config file correctly, all you must do is simply run gdb in an another instance / window :
gdb
The library, for the time being, depends on Limine for the bootloader of the OS. When time comes, I will replace Limine with my own bootloader, written in Zig as well.
However, to not waste time on this, I will simpy use limine as a bootloader, letting the framebuffers and such to it.
All of limine's logic is self-contained in src/limine.zig. The entrypoint is in src/kernel.zig.