The Rux Kernel
Rux - An x86_64 toy operating system kernel written in Rust. Rux is a port of the Hux kernel, my x86 32-bit single-CPU toy kernel written in C, following the OSTEP book structure and terminology.
Author | Kernel Src LoC (temp) | Dev Doc LoC (temp) |
---|---|---|
Guanzhou Hu | Rust + x86 ASM | Markdown |
Jan. 2022 | ??? | ??? |
Development Doc
I document the porting process from Hux to Rux, especially the unique challenges and design choices exposed by porting a legacy C kernel to a modern memory-safe programming language, in the WIKI pages
It is recommended to also take a look at the wiki pages of Hux to know about its basic design and structure.
If there are any typos / mistakes / errors, please raise an issue!
Playing with Rux
Requires a Linux host development environment. Tested on Ubuntu Focal.
Clone the repo, set up the Rust development toolchain following this wiki page, then build Rux by:
$ make [debug|release] # defaults to debug
To run Rux in QEMU >= v6.2.0, install QEMU & GRUB following this wiki section, then do:
$ make qemu # opens a VGA GUI window
If you are in a non-GUI environment, it is recommended to redirect VGA output to built-in VNC server, and connect to that server from a VNC client:
$ make qemu_vnc # redirects VGA output to VNC server
# from VNC client, connect to 'hostname:5901'
You will see the QEMU GUI popping up with GRUB loaded. Choose the "Rux
" option with Enter to boot into Rux.
For a taste of what a minimal C kernel looks like, please check out the wiki pages of Hux (recommended). I have every single detail documented there.
References
Main references:
- The OSDev Wiki (IMPORTANT ✭)
- Writing an OS in Rust by Philipp (IMPORTANT ✭, still updating...)
- The Hux Kernel by me, an x86 32-bit toy kernel in C
OS conceptual materials:
- Operating Systems: Three Easy Pieces (OSTEP) by Prof. Arpaci-Dusseaus
- My reading notes on OSTEP book & lectures
Check the "References" section of Hux here for the full list. You will also need some understanding of and a passion for the Rust language, a great next-gen system programming language.
TODO List
- Dev setup following Philipp's blog
- Enter long mode in
boot.s
(w/ dummy paging) - Start the porting of Hux kernel