How differrari/redactedos works
Project type and purpose
– This is a monolithic, hobby operating system targeting 64-bit ARM hardware, currently running in QEMU.
– It consists of three main “layers”:
• Kernel (drivers, scheduler, syscalls, built-in processes)
• Shared library (static std, UI, math, syscalls wrappers)
• User processes (statically linked .elf binaries loaded from a disk image)
File structure
Top‐level:
• kernel/ – everything under the kernel executable: boot loader, subsystems (memory, filesystem, graphics, input, networking, PCI/virtio, process & syscall handling), built-in kernel processes
• shared/ – static library code (std containers, UI primitives, math, syscall stubs) used by both kernel processes and user processes
• user/ – sample user processes, linker script, Makefile; linked with shared/libshared.a into user.elf
• createfs, run, debug, rundebug scripts & Makefile – orchestrate build, disk image creation (fs/ → disk.img), QEMU invocation, GDB attachment
Extract architectural insights from the README
– Boot: boot.S + linker.ld → set up stack & memory map → jump to kernel_main in kernel/kernel.c
– Kernel_init in kernel_main sets up drivers (GPU via virtio, XHCI USB, console, timer/IRQ, memory allocator, filesystem layer), then spawns initial “kernel processes” (boot, monitor, window manager).
– User processes: built into fs image via createfs, loaded at runtime via ELF loader in kernel/process/loading
– Shared library is statically linked; syscalls form the ABI boundary between user and kernel.
a. Main components (use rectangular blocks):
1. Host Environment (macOS/Linux)
– ARM toolchain, Makefile, createfs/run/debug scripts
2. Build Pipeline
– gcc-aarch64 for kernel & user, linker (linker.ld), ar → libshared.a, createfs → disk.img
3. QEMU Virtual Hardware
– Emulated ARM64 CPU, RAM, PCI bus, virtio-blk, virtio-gpu, virtio-net, XHCI, serial console
4. Boot Loader
– kernel/boot.S + aboutboot.txt (DTB parsing)
5. Kernel (monolithic)
– Subsystems: Memory (MMU, page allocator, DMA), Filesystem (virtio_blk, exFAT driver), Graphics (framebuffer, GPU driver), Input (XHCI managers), Networking (virtio_net), PCI, Process & Syscall interface
6. Kernel Processes
– bootprocess, monitor, window_manager, desktop, login_screen, etc. (all under kernel/kernel_processes)
7. Shared Library (libshared.a)
– std containers & allocators, lightweight UI, math, syscall stubs
8. User Processes
– default_process and any .elf in fs/redos/user/ loaded by kernel at runtime
– Build Pipeline → kernel.elf & libshared.a & user.elf → QEMU
– QEMU → Boot Loader → Kernel_init
– Kernel → hardware subsystems (Memory, PCI/virtio, console, GPU, USB, network)
– Kernel ↔ Kernel Processes (invocation + in‐kernel scheduling)
– Kernel → ELF loader → User Processes
– User Processes → Syscall interface → Kernel
– Shared Library is linked at compile time into both kernel processes and user processes
c. Architectural patterns & design principles
– Monolithic kernel: all drivers & core services compiled into one image
– Single address space for kernel, strict syscall ABI boundary for userland
– Static linking for shared code → simple deployment on bare metal
– Use of Device Tree Blob (virt.dtb) for hardware description
d. Key technologies & frameworks
– ARM GNU toolchain (gcc, ld, as, objcopy)
– QEMU (ARM virtualization)
– VirtIO drivers for block, GPU, network
– ELF format for executables & dynamic loading
– exFAT filesystem driver
– C + C++ (kernel is predominantly C with some C++ drivers; shared & user use C++)