Skip to content

Z-Proj/ZenOS

Repository files navigation

ZenOS  ZenOS Build Check

ZenOS Logo

Warning

There might be dragons and bugs.

Overview

ZenOS is a 64-bit SMP preemptive operating system built from scratch in C and x86_64 assembly, bootstrapped with the Limine bootloader.

The project focuses on clean design, correctness, and real hardware interaction.


Key Features

Kernel

  • 64-bit x86_64 monolithic kernel
  • Symmetric Multiprocessing (SMP)
  • Preemptive round-robin scheduler
  • ELF64 userspace execution
  • Unix-style process model
  • CPU feature detection via CPUID
  • SSE and FPU initialization
  • High-resolution timing via HPET
  • ACPI-based hardware discovery and power management

Syscalls

70+ POSIX-compatible and custom syscalls covering process management, file I/O, memory, signals, pipes, directories, sockets, PTY, time, and networking.

Hardware & Drivers

  • Framebuffer output
  • PS/2 keyboard and mouse
  • PC speaker
  • Serial port for debugging and logging
  • Local APIC and IOAPIC interrupt handling
  • ATA disk driver (DMA/PIO, 28-bit LBA)
  • PCI bus
  • Intel e1000 Ethernet driver
  • RTC, HPET

Networking

  • TCP/IP stack
  • DNS resolution
  • zen — a package manager that fetches and installs packages over HTTP
  • wget — downloads files over HTTP from the command line

Filesystem

  • VFS layer with support for multiple mountpoints
  • FAT32 via a port of FatFs by CHAN
  • Native host-side disk image tooling (fat_man)

Userspace & Libc

  • Newlib C library, fully compiled and integrated for the ZenOS target.
  • ELF64 userspace programs.
  • Currently 70+ Syscalls present. (As of now, ZenOS apps are statically linked.)

Applications

  • Shell & Core Utils — shell, echo, yes, sleep, cat, ls, touch, rm, stat, wc, mkdir, rmdir, pwd
  • Process Utils — ps, kill
  • System Info — uname, time
  • Math — calc, primes, fibonacci, counter
  • Text & UI — terminal (PTY terminal emulator), edit (text editor), clock, beep, mouse, FIGlet.
  • CompilersTinyCC, SmallerC
  • ScriptingLua 5.5.0
  • Networking — wget, zen package manager, nettest
  • Misc — hello, init

The ZenOS.vhd in the repository usually already has these compiled and ready. A separate Storage.vhd is present for storage.

I/O & Display

  • Flanterm for early kernel output
  • Scalable font rendering via SSFN
  • Structured kernel logging with log levels and serial output

Building

Run make help first to see available build commands.

  • Build everything: make all from the repo root
  • Missing dependencies will be reported with clear errors
  • make funcs generates funcs.txt listing all defined functions in the codebase

Contributions

All good contributions are welcome. Check ISSUES.md for open problems, or add a feature, fix a bug, or improve the codebase.


Design Goals

  • Clean, minimal, readable codebase
  • Solid foundation for experimenting with:
    • Kernel subsystems
    • Filesystems
    • Scheduling and SMP
    • Userspace ABI design
    • Unix-compatible process model (fork/exec/signals/pipes/PTY)
    • Networking (TCP/IP, DNS, HTTP)
    • Native C compilation on the OS itself
    • Lightweight everyday utilities
    • Dual-boot support

ZenOS is a learning-oriented project. Understanding the machine comes first.


Toolchain / Prerequisites

clang
ld.lld
nasm
xorriso
qemu-system-x86_64
gdb
socat

Third Party

  • Limine — bootloader
  • Flanterm — early kernel terminal renderer
  • SSFN 2.0 — scalable screen fonts
  • FatFs — FAT32 library by CHAN
  • Newlib — C standard library
  • Lua — lightweight scripting language
  • TinyCC — Tiny C Compiler, ported to ZenOS
  • SmallerC — C to assembly compiler
  • FIGlet — Large ASCII text renderer

Showcase (may be outdated)


ZenOS

About

The ZenOS Operating System: x86_64 Hobby OS

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages