How 0nera/synapseos-userspace works
Purpose and Build Surface
This repository supplies SynapseOS user-space programs plus a small C runtime/library for x86_64 OS processes. Applications are built through apps/Makefile; their shared linker layout is defined in apps/apps.ld. The expected output is standalone executables copied into a SynapseOS disk image.
Process Startup and ABI Boundary
User programs enter through custom assembly startup code in synlibc/crt0.asm, which establishes the C runtime before application main. Low-level kernel interaction crosses an assembly syscall boundary in synlibc/syscall.asm, exposed to C consumers through synlibc/include/syscalls.h and higher-level wrappers in synlibc/synapi.c.
Shared Userspace Runtime
synlibc is the common static runtime linked into applications. It provides foundational memory/string and POSIX-like facilities in synlibc/mem.c, synlibc/string.c, and synlibc/posix.c; public APIs are consolidated under synlibc/include/synlibc.h. This layer isolates applications from raw kernel ABI details.
Device and Graphics Interfaces
Hardware-facing APIs are represented as library interfaces rather than per-app drivers. HID input contracts reside in synlibc/include/dev/hid.h; virtual GPU access is defined by synlibc/include/vgpu.h and implemented in synlibc/vgpu.c. Applications using input or graphics should depend on these abstractions and their underlying syscall/API layer.
Application Suite
Each program is an independent userspace executable with its own main:
• System bootstrap/init: apps/init/main.c
• Interactive command environment: apps/shell/main.c
• Minimal validation/demo programs: apps/hello/main.c, apps/tests/main.c
• System-information display: apps/synfetch/main.c
• Additional interactive/game-style applications: apps/doom/main.c, apps/tel/main.c
init is the likely process-control entry application after the OS loads userspace; the shell and other binaries are peer executables deployed under /apps.
Configuration and Deployment Flow
settings.ini is a filesystem-root configuration artifact, parsed through synlibc/ini.c and its API in synlibc/include/ini.h. Build output is generated under apps/apps-bin (via apps/Makefile) and copied into a preexisting x86_64.hdd disk image with mtools; settings are copied separately to the image root. Runtime therefore depends on the SynapseOS kernel/image providing the expected filesystem, executable loader, syscall ABI, HID, and VGPU services.
Tooling and Execution Environment
The development path uses GNU Make, GCC, NASM, and mtools; QEMU is the intended x86_64 emulator/runtime. run.sh is the repository-level execution launcher, while CI is defined in .github/workflows/ci.yml.
Main entry points: synlibc.h synlibc core · Makefile Application build · synapi.c Kernel API wrappers · main.c Doom and tel
Components 19
Shared Runtime
Static userspace library and process ABI boundary.
- Process startup · Establishes C runtime before main.
synlibc/crt0.asm - Syscall ABI
synlibc/syscall.asm - Syscall declarations
synlibc/include/syscalls.h - Kernel API wrappers
synlibc/synapi.c - synlibc core · Memory, strings, and POSIX-like facilities.
synlibc/include/synlibc.h - INI support
synlibc/ini.c - HID and VGPU APIs · Input contract and virtual GPU implementation.
synlibc/vgpu.c
Application Suite
Independent executables deployed under /apps.
- init · Likely first userspace process.
apps/init/main.c - shell
apps/shell/main.c - Utilities and demos · hello, tests, and synfetch executables.
apps/synfetch/main.c - Doom and tel
apps/doom/main.c
Build & Deployment
Builds programs and installs them into the OS image.
- Application build
apps/Makefile - Shared linker layout
apps/apps.ld - Standalone executables · Generated under apps/apps-bin.
- SynapseOS disk image · Executables and root settings are copied here with mtools.
- Root settings
settings.ini - CI
.github/workflows/ci.yml
SynapseOS Platform
Services supplied by the loaded OS image.
- Kernel services · Provides loader, filesystem, syscall ABI, HID, and VGPU.
- QEMU launcher
run.sh
Connections 20
- Application build → Shared linker layout: uses
- Application build → Standalone executables: builds
- Application build → synlibc core: links
- Standalone executables → SynapseOS disk image: copied with mtools
- Root settings → SynapseOS disk image: copied to root
- Process startup → synlibc core: starts
- synlibc core → Kernel API wrappers: uses
- Kernel API wrappers → Syscall declarations: declared by
- Syscall declarations → Syscall ABI: crosses
- INI support → Root settings: parses
- HID and VGPU APIs → Kernel API wrappers: uses kernel API
- init → synlibc core: links
- shell → synlibc core: links
- Utilities and demos → synlibc core: links
- Doom and tel → HID and VGPU APIs: uses input and graphics
- Doom and tel → synlibc core: links
- Syscall ABI → Kernel services: invokes
- SynapseOS disk image → Kernel services: boots with
- QEMU launcher → SynapseOS disk image: runs
- CI → Application build: builds