gizmOS is a minimal RISC-V 64 kernel that provides foundational OS capabilities with a focus on hardware abstraction and memory management.
-
Hardware interfaces
- UART for serial communication
- Framebuffer support with flanterm terminal emulation
- Real-time clock (RTC)
- Platform-Level Interrupt Controller (PLIC)
-
Memory management
- Physical page allocator
- Virtual memory with SV39 paging
- MMIO mapping
-
System facilities
- Formatted output (printf-like functionality)
- String manipulation
- Time functions with sleep capabilities
- Basic math functions
-
Exception and interrupt handling
- Trap framework
- External interrupts
-
Device Tree Blob (DTB) parsing
- Initial loading and parsing via smoldtb
- Hardware detection support
-
Testing framework
- Physical allocator tests
- Trap/exception tests
Prerequisites
- LLVM/Clang toolchain (with RISC-V support)
- GNU Make
- LLD linker
First, download the dependencies:
cd kernel/
chmod u+x get-deps
./get-depsNote
You may need to adjust the compiler path in kernel/GNUmakefile to match your system configuration.
To build the kernel:
makeTo build the kernel and run it in QEMU:
make runIf you desire to enable debugging features, uncomment the DEBUG := 1 line in kernel/GNUmakefile and GNUmakefile. Then, you can use make run and also use ./dbg.sh to automatically attach LLDB to gizmOS and set a breakpoint on the trap handler.
kernel/- Kernel source codesrc/- Main source filesdevice/- Device drivers (UART, framebuffer, console, PLIC, RTC)dtb/- Device Tree Blob parsinglib/- Core libraries (memory, strings, time, math, formatting)extern/- External librariesflanterm/- Framebuffer terminalsmoldtb/- Device tree parser
tests/- Test suites for various components*.c/*.h- Core kernel implementation (memory management, paging, etc.)
gizmOS is a work in progress. Key areas for future development include:
- Advanced memory allocation (beyond basic page allocation)
- Process management
- Filesystem support
- More comprehensive device drivers
- User-space support
Contributions are welcome!