CosmOS (Custom Open-Source Modular Operating System) is a fully custom kernel and bootloader written in Rust and Assembly. It is designed with memory safety and exploit resistance as core principles.

- Target: x86_64 bare-metal (
x86_64-unknown-none) - Language: Rust (10-20-2025 nightly toolchain, Rust edition 2021)
- Boot: Custom two-stage bootloader with BIOS/UEFI support
- Environment: Strict
#![no_std]with selectiveallocusage - Security & memory safety:
- Hardware-enforced privilege separation (Ring 0 / Ring 3)
- Rust ownership model to reduce buffer overflows and use-after-free
- Minimal runtime dependencies to keep the attack surface small
- Rust (nightly)
- NASM assembler
- QEMU or VirtualBox (for testing)
- On Windows,
justuses winget (PowerShell) for setup and execution.
Run the included just tasks to set up, build and run:
# one-line setup, build, and run (PowerShell may be required for setup on Windows)
just
# or run steps individually:
just setup
just build
just run-qemu # QEMU
just run-uefi-qemu # QEMU UEFI Mode
# or
just run-vbox # VirtualBox- Stage 1: 512-byte MBR bootloader (sector 0)
- Stage 2: Extended bootloader (sectors 1–64, ~32 KB)
- Kernel: Flat binary loaded at sector 66+
The BIOS bootloader creates a 64 MB disk image with the kernel embedded, avoiding a separate filesystem for initial boot. UEFI creates a .EFI image.
Dependencies are compiled with default-features = false for no_std compatibility:
x86_64— hardware abstractionsspin— synchronization primitiveslinked_list_allocator— heap management
This project is licensed under the GNU GPL v3.