How kaansenol5/vibeos works
1. Overall shape
VibeOS is a monolithic hobby OS for ARM64, split into a small boot chain, a kernel, a platform-specific hardware layer, and a substantial user space. It runs in QEMU and on Raspberry Pi Zero 2W, with most runtime behavior determined by the kernel plus bundled apps in the root filesystem.
2. Boot and image layout
Startup begins in assembly boot code under boot/, then transfers into the kernel via the linker scripts (linker.ld, linker-pi.ld). The build produces a disk image rooted at vibeos_root/, which contains boot config, help docs, binaries, assets, and temporary/runtime directories.
3. Kernel core
The kernel/ tree is the OS heart: process management, cooperative multitasking with preemptive fallback, interrupt handling, memory allocation, logging, and system APIs. Files like process.c, context.S, irq.c, memory.c, tls.c, and kapi.c define the kernel’s execution model and the interface exposed to user programs.
4. Platform abstraction boundary
Hardware-specific code is isolated under kernel/hal/, with separate backends for qemu/ and pizero2w/. This is the main portability boundary: the kernel logic stays mostly shared, while framebuffer, keyboard, serial, DMA, IRQ, and storage drivers differ by target.
5. Device and I/O subsystems
The kernel owns drivers for framebuffer, console, keyboard, mouse, RTC, USB, networking, and virtual block devices. On the Pi, USB is handled through the DWC2 stack; on QEMU, simplified platform drivers provide the same abstractions. These drivers feed the higher-level console, GUI, shell, and networking code.
6. Filesystem and storage path
Persistent storage flows through FAT32 and VFS code in kernel/fat32.c, kernel/vfs.c, and related modules. The OS also has initramfs support, plus a root filesystem image in vibeos_root/ that holds /bin, /etc, /lib, /tmp, and documentation/assets. User programs are loaded from this filesystem rather than being baked into the kernel.
7. User/kernel interface
User programs are built separately under user/ and link against user/lib/, which provides startup code and the VibeOS API headers. The boundary is the kernel API exposed via vibe.h and the kernel-side kapi implementation; this is how apps access files, graphics, input, network, audio, and process services.
8. Desktop and interactive shell
The primary interactive environment is split between a GUI desktop and a terminal shell. The kernel provides low-level console and framebuffer services, while user-space apps like desktop, term, files, textedit, and vim build the actual UI. The boot config in /etc/boot.cfg can choose whether the system starts in desktop or shell mode.
9. Networking stack
Networking is implemented inside the kernel with its own TCP/IP stack: Ethernet, ARP, IP, ICMP, UDP, and TCP. Higher-level user applications like the browser and ping consume this stack through kernel APIs. TLS/HTTPS support depends on the vendored TLSe library mentioned in the README.
10. Graphics and media pipeline
Graphics flow from kernel framebuffer support into the UI and apps. The browser, image viewers, desktop, and games render through VibeOS graphics APIs; font and text rendering are supported by font.c and ttf.c. Audio is similarly kernel-backed through sound drivers and exposed to apps like music, play, and DOOM.
11. Bundled user-space applications
user/bin/ is the application layer: coreutils-style commands, GUI apps, games, editors, network tools, and demos. Several apps are notable integration points: doom wraps doomgeneric, vibecode and vim provide editing environments, browser exercises networking plus rendering, and micropython/tcc expose programming environments inside the OS.
12. Embedded third-party subsystems
The repo vendors large external codebases as architectural subsystems, not just libraries: MicroPython, TinyCC, DoomGeneric, and support libraries like minimp3 and stb. These are integrated as separate trees because they provide whole runtimes or feature domains—scripting, compilation, game porting, and media/graphics decoding.
13. Build and deployment
The top-level build produces both kernel and user-space artifacts, then stages them into vibeos_root/ and a bootable image. Separate targets exist for QEMU and Pi. The build layout makes the OS easy to diagram as: bootloader → kernel → device abstractions → user-space programs → root filesystem assets.
14. Diagram takeaway
If you’re drawing the architecture, the key boundaries are: boot vs kernel, kernel vs HAL, kernel vs user space, and local filesystem vs bundled runtime/assets. The main data flows are input/device events into kernel services, kernel services into GUI/shell/apps, and user apps back into kernel-managed storage, networking, graphics, and audio.
Main entry points: kernel.c Kernel core · desktop.c Apps · vibe.h User lib · boot.cfg Root image
Components 20
Boot
Startup code and image entrypoint
- Boot code · Early ARM64 boot entry for QEMU and Pi targets
boot - Link scripts · Kernel and user-space memory layout definitions
linker.ld
Kernel
Core OS services and drivers
- Kernel core · Main execution model, process management, scheduling, and syscalls
kernel/kernel.c - Proc model · Processes, context switching, TLS, and shell-facing execution control
kernel/process.c - Memory · Kernel memory management and low-level allocation
kernel/memory.c - Interrupts · Vectoring, IRQ handling, and preemption-related control flow
kernel/irq.c - Console I/O · Framebuffer console, cursor, fonts, keyboard, mouse, and terminal-facing I/O
kernel/console.c - Storage · Filesystem, initramfs, ELF loading, and persistent storage path
kernel/vfs.c - Networking · Kernel networking stack and virtual device integration
kernel/net.c - Audio · Kernel-backed sound output for user-space media apps
kernel/virtio_sound.c - QEMU HAL · QEMU-specific device implementations
kernel/hal/qemu/platform.c - Pi HAL · Raspberry Pi Zero 2W hardware implementations including USB and storage
kernel/hal/pizero2w/platform.c
User space
Applications and user libraries
Vendors
Embedded third-party runtimes and ports
- MicroPython · Vendored Python runtime ported to VibeOS
micropython/ports/vibeos/main.c - TinyCC · Vendored C compiler and VibeOS port
tinycc/vibeos/tcc_main.c - DoomGeneric · Vendored Doom engine adapted to the OS
user/bin/doom/doomgeneric_vibeos.c
Root FS
Staged filesystem image and bundled assets
- Root image · Staged boot config, help docs, binaries, temp areas, and sample content
vibeos_root/etc/boot.cfg - Help docs · Bundled system and program documentation served from the root filesystem
vibeos_root/etc/help/index.html
Connections 27
- Boot code → Link scripts: linked by · Boot code hands off according to the memory layout
- Boot code → Kernel core: enters · Early startup transfers into the kernel
- Kernel core → Proc model: runs · Kernel execution model and process control
- Kernel core → Memory: allocates · Memory management supports kernel subsystems
- Kernel core → Interrupts: handles · Interrupts drive scheduling and device events
- Kernel core → Console I/O: exposes · Console, framebuffer, input, and text rendering services
- Kernel core → Storage: mounts · Filesystem services load programs and assets
- Kernel core → Networking: routes · Network stack is implemented in the kernel
- Kernel core → Audio: drives · Kernel sound services feed media apps
- QEMU HAL → Kernel core: backs · QEMU-specific platform support underpins the shared kernel
- Pi HAL → Kernel core: backs · Pi-specific platform support underpins the shared kernel
- Pi HAL → Storage: storage · Pi backend includes eMMC and USB storage path
- User lib → Kernel core: calls · User apps reach kernel services through VibeOS API
- Shell → User lib: links · Shell and desktop apps use the shared user library
- Apps → User lib: links · Bundled applications depend on the user-space runtime layer
- Apps → Storage: loaded from · Applications are staged into the root filesystem
- Apps → Networking: uses · Browser and network tools consume kernel networking
- Apps → Console I/O: renders via · GUI apps and terminal tools use console/graphics/input services
- Apps → Audio: plays via · Media apps rely on kernel-backed audio
- MicroPython → User lib: bridges · Python runtime is integrated through the VibeOS user interface
- TinyCC → User lib: bridges · Compiler tooling is exposed as a user-space program
- DoomGeneric → Console I/O: renders via · Doom port consumes graphics and input services
- Root image → Apps: contains · Root image stages the executable set
- Root image → Help docs: contains · Documentation and program help live in the filesystem image
- Root image → Shell: configures · Boot configuration can start desktop or shell mode
- Storage → Root image: serves · Kernel loads from the staged root image
- Help docs → Apps: documents · Help pages describe bundled programs and services