How dotcorr/oscortex works
1. High-level shape
OSCortex is a custom operating system repo split into four major layers: a Rust kernel, a small Rust PID 1 init process, a Flutter-based system shell and apps, and build/release tooling that assembles bootable images. The key architectural boundary is that Flutter owns UI, while the kernel owns hardware and policy.
2. Boot and startup flow
The boot path is Limine → kernel → userspace/init (PID 1) → oscortex-host Flutter embedder → shell rendering. The kernel does not host the UI directly; it launches a userspace supervisor first, then the embedder that connects Flutter to kernel services.
3. Kernel core
kernel/ is a no_std Rust OS kernel. It includes memory management, process and scheduler logic, syscall dispatch, IPC, security, filesystem support, networking, and a compositor/window manager. This is the central subsystem that owns all privileged operations and mediates access to hardware.
4. Architecture-specific hardware layer
The kernel has explicit per-architecture code under kernel/src/arch/, with x86_64 the primary bring-up target and aarch64/riscv64 scaffolding present. x86_64 contains ACPI, APIC, GDT/IDT, interrupts, SMP, paging, PCI, port I/O, and syscall setup, which indicates the OS is designed around a traditional bare-metal hardware abstraction boundary.
5. Display and input pipeline
The visible UI path is kernel compositor/window manager → framebuffer/scanout driver → Flutter surface in the embedder → shell UI in Dart. Driver modules like fb, ps2, usb, usb_hid, and xhci_runtime provide input and output plumbing into the compositor and higher-level UI.
6. Process and app model
The repository is built around one process per app. Kernel-side code under process/, sched/, syscall/, ipc/, isolate/, and app_registry/ suggests a managed application lifecycle with isolation, launch, waiting/reaping, file descriptors, and IPC as the primary interfaces between shell, init, and apps.
7. Cortex subsystem
kernel/src/cortex/ is a distinct AI-oriented kernel subsystem. It includes context, inference, driver generation, healing, observer, and PID-0 logic, implying a privileged service layer that can inspect runtime state and influence recovery or driver behavior. This is a kernel-internal capability, not a userspace AI service.
8. Storage, filesystems, and app distribution
Filesystem support is split between ext2, initramfs, and ramdisk, with disk/storage drivers such as nvme and virtio_blk. The README indicates .osx bundles are the intended installable app format, so app deployment is meant to happen at runtime rather than by reflashing the ISO.
9. Userspace init and shell
userspace/init/ is the PID 1 supervisor responsible for spawning the shell and reaping children. apps/oscortex_app/ is the Flutter-based system shell, currently slimmed for fast startup in QEMU. This keeps the desktop/application layer fully separated from the kernel.
10. Flutter embedding boundary
tools/flutter-embedder/ is the host binary that binds the Flutter engine to kernel syscalls for surfaces, vsync, and input. This is the main bridge between the Dart/Flutter world and the OS kernel, and the repo treats it as a dedicated runtime component rather than a general-purpose Linux-style window system.
11. Engine patching and build artifacts
tools/flutter-engine/ contains patching logic for libflutter_engine.so, indicating the Flutter runtime is customized for OSCortex’s boot and rendering path. The repo also contains scripts/build-iso.sh, scripts/run-qemu.sh, and scripts/embed-flutter-engine.sh, which are the assembly points for producing and booting a full OS image.
12. Testing and validation
tests/kernel/ contains bare-metal unit tests for low-level subsystems such as PCI BARs, NVMe registers, USB HID, vring, and xHCI caps, while tests/integration/ covers kernel build and QEMU driver behavior. There is also a harness/verify_engine_patches.py check, showing that engine patch correctness is part of the system’s validation boundary.
13. Release and CI/CD
.github/workflows/ci.yml and release.yml, plus the tools/xtask/ command surface, handle build/test/release automation. The repo is structured to produce bootable ISOs and versioned releases from the main branch, with the development branch carrying integration work before promotion.
14. Useful diagram boundaries
If you draw the architecture, the most important boundaries are: hardware vs kernel, kernel vs userspace init, init vs Flutter host, Flutter host vs shell/apps, and kernel-internal service layers such as compositor, syscalls, drivers, and Cortex. The key data flows are input events into the kernel, framebuffer/surface output back to the display, and process/syscall/IPC traffic between kernel-managed user processes.
Main entry points: src/main.rs Kernel core · src/main.rs Flutter host · build-iso.sh Build tools · mod.rs Drivers
Components 19
Kernel
Privileged Rust OS kernel and hardware-facing subsystems
- Kernel core · Top-level kernel runtime and privileged control plane
kernel/src/main.rs - Arch layer · Architecture-specific boot, interrupt, memory, and syscall setup
kernel/src/arch/mod.rs - Memory · Frame allocation, heap, and paging management
kernel/src/mm/mod.rs - Processes · Process loading, ELF handling, and user process support
kernel/src/process/mod.rs - Scheduler · Execution scheduling and run-queue control
kernel/src/sched/mod.rs - Syscalls · Syscall dispatch, tables, wait/poll, and POSIX-facing handlers
kernel/src/syscall/mod.rs - IPC · Kernel message-passing and isolation boundaries
kernel/src/ipc/mod.rs - Drivers · Platform, storage, input, networking, and runtime device drivers
kernel/src/drivers/mod.rs - Filesystems · Initramfs, ramdisk, and ext2 support
kernel/src/fs/mod.rs - Networking · Kernel networking and TCP support
kernel/src/net/mod.rs - Compositor · Kernel-side compositor and window management
kernel/src/wm/mod.rs - Cortex · Privileged runtime inspection, inference, and healing subsystem
kernel/src/cortex/mod.rs - Embedder ABI · Kernel ABI exposed to the Flutter host for surfaces, input, and timing
kernel/src/embedder/mod.rs
Userspace
PID 1 and shell runtime
- PID 1 · Supervisor that starts and reaps user processes
userspace/init/src/main.rs
Tooling
Build, embedder, and release automation
- Flutter host · Native host that connects Flutter to kernel services
tools/flutter-embedder/src/main.rs - Build tools · Image assembly, engine patching, and workflow automation
scripts/build-iso.sh
Apps
Flutter application layer
- Shell app · System shell and application UI written in Dart
apps/oscortex_app/lib/main.dart
Tests
Kernel and integration validation
- Kernel tests · Low-level kernel unit tests for drivers and core hardware abstractions
tests/kernel/unit/main.rs
Other components
- Limine · Bootloader entry that hands off to the OS kernel
iso_root/limine.conf
Connections 24
- Limine → Kernel core: boots · Bootloader transfers control to the kernel
- Kernel core → Arch layer: bring-up · Kernel initializes architecture-specific hardware support
- Kernel core → Memory: manages · Kernel owns memory management
- Kernel core → Processes: spawns · Kernel loads and manages user processes
- Kernel core → Scheduler: schedules · Kernel schedules runnable tasks
- Kernel core → Syscalls: exposes · Kernel dispatches syscalls into privileged handlers
- Kernel core → IPC: routes · Kernel mediates inter-process communication
- Kernel core → Drivers: drives · Kernel initializes and uses hardware drivers
- Kernel core → Filesystems: mounts · Kernel provides filesystem access
- Kernel core → Networking: networking · Kernel owns network protocol support
- Kernel core → Compositor: renders · Kernel compositor manages display composition
- Kernel core → Cortex: hosts · Kernel contains the Cortex privileged subsystem
- Kernel core → Embedder ABI: bridges · Kernel exposes embedder ABI for Flutter host integration
- Processes → PID 1: launches · Kernel starts PID 1 as the first userspace process
- PID 1 → Flutter host: spawns · Init supervises the Flutter host process
- Flutter host → Shell app: runs · Native host embeds the Flutter shell UI
- Compositor → Embedder ABI: surface path · Compositor output is presented through the embedder boundary
- Drivers → Compositor: feeds input · Input and framebuffer drivers feed compositor state
- Embedder ABI → Flutter host: abi · Host talks to kernel through embedder ABI
- Build tools → Kernel core: builds · Tooling assembles kernel and bootable images
- Build tools → Flutter host: patches · Tooling customizes the Flutter engine/host integration
- Build tools → PID 1: packages · Tooling includes init and runtime artifacts in the image
- Kernel tests → Drivers: validates · Tests cover low-level driver and hardware abstractions
- Kernel tests → Kernel core: checks · Tests exercise bare-metal kernel behavior