Art by miwashiiba
a monolithic x86_64 kernel written in rust, a continuation of riria.
it also natively (somewhat) supports x86_64's musl ELFs.
a thought experiment, just wanted to see if its possible to make a kernel in rust and also to learn rust.
- a good kernel, please don't use this as a reference for writing your own kernel.
- a kernel that will ever be used in production, this is just a toy project.
you will need:
- git
- make
- qemu
- rust
- xorriso
- x86_64-linux-musl-native toolchains
to get a clue as to how to compile the kernel, run make.
available targets:
- kernel // compiles the kernel
- initrd // compiles the initrd
- ports // compiles the ports
- run // compiles the kernel and runs in qemu w/ kvm
- clean // deletes build artifacts
- gdt/idr/irq/isr
- GDT INIT .... OK! /j
- these came free with the x86_64 crates, atp this is just like building a software lol.
- pmm/vmm/paging/heap
- works i guess, still waiting for a rewrite, but it works:tm: for now.
- vfs
- devfs (
/dev/), tarfs (/init/) - basic operations like open/read/write/close work, but that's it for now.
- devfs (
- apic/lapic
- acpi_pmt
- tsc
- lapic
- pci
- basic ac97 driver, exposed thru
/dev/audio- expects 48khz of pcm stream
- basic ac97 driver, exposed thru
- scheduling
- it works, single-thread only.
- syscalls
- here are the supported syscalls.
- elf
- it runs, no dynamic linking.
- supports fork and execve
- vfs
- ext2 would be nice to have
- fat would be nice to have
- pipe would be nice to have
- smp
- only single core is supported
- process
- signals, etc.
- dynamic linking
and thousands other stuff that i don't remember or know yet.
well, i did try it, mlibc is very nice to use, the problem was that, i need to set up the tooling, which is just a PITA to get it to work and portable. there were solutions such [jinx] and others but i'm too lazy to set it up. in the end i ended up using musl because during one of my random attempts to port libc, it just sorta works (albeit with slight syscall hacking) as is, so thats why. sorry to the OSDEV peeps who probably think this is a very terrible idea.
these were the projects that i used for reference:
ISC License, see [LICENSE] for more details.
