Go to file
Markus Maiwald a0ac0ddb64 feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH
CHECKPOINT 7: Nuke LwIP, Fix Stack

🎯 PRIMARY ACHIEVEMENTS:
-  Interactive Mksh shell successfully boots and accepts input
-  Kernel-side LwIP networking disabled (moved to userland intent)
-  C-ABI handover fully operational (argc, argv, environ)
-  SPEC-130: Sovereign Filesystem Hierarchy formalized

🔧 KERNEL FIXES:
1. **Nuked Kernel LwIP**
   - Disabled membrane_init() in kernel.nim
   - Prevented automatic DHCP/IP acquisition
   - Network stack deferred to userland control

2. **Fixed C-ABI Stack Handover**
   - Updated rumpk_enter_userland signature: (entry, argc, argv, sp)
   - Kernel prepares userland stack at 0x8FFFFFE0 (top of user RAM)
   - Stack layout: [argc][argv[0]][argv[1]=NULL][envp[0]=NULL][string data]
   - Preserved kernel-passed arguments through subject_entry.S

3. **Fixed Trap Return Stack Switching**
   - Added sscratch swap before sret in entry_riscv.zig
   - Properly restores user stack and preserves kernel stack pointer
   - Fixes post-syscall instruction page fault

4. **Rebuilt Mksh with Fixed Runtime**
   - subject_entry.S no longer zeros a0/a1
   - Arguments flow: Kernel -> switch.S -> subject_entry.S -> main()

📐 ARCHITECTURAL SPECS:
- **SPEC-130: Sovereign Filesystem Hierarchy**
  - Tri-State (+1) Storage Model: /sysro, /etc, /run, /state
  - Declarative Stateless Doctrine (inspired by Clear Linux/Silverblue)
  - Ghost Writer Pattern: KDL recipes -> /etc generation
  - Bind-Mount Strategy for legacy app grafting
  - Database Contract for /state (transactional, encrypted)

🛠️ DEVELOPER EXPERIENCE:
- Fixed filesystem.nim to fallback to .nexus/ for local builds
- Prevents permission errors during development

🧪 VERIFICATION:

Syscalls confirmed working: write (0x200, 0x204), read (0x203)

NEXT: Implement proper TTY/PTY subsystem for full job control

Co-authored-by: Forge <voxis@nexus-os.org>
2026-01-05 01:14:24 +01:00
.zig-cache/h feat(rumpk): dignified exit & sovereign vfs 2025-12-31 21:54:44 +01:00
apps feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH 2026-01-05 01:14:24 +01:00
boot Rumpk Stability, NipBox Boot, and Repository Cleanup 2026-01-04 21:39:06 +01:00
core feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH 2026-01-05 01:14:24 +01:00
docs feat(rumpk): Sovereign Ledger - VirtIO Block Driver & Persistence 2025-12-31 22:35:30 +01:00
hal feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH 2026-01-05 01:14:24 +01:00
io Rumpk Stability, NipBox Boot, and Repository Cleanup 2026-01-04 21:39:06 +01:00
libs feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH 2026-01-05 01:14:24 +01:00
npl Rumpk Stability, NipBox Boot, and Repository Cleanup 2026-01-04 21:39:06 +01:00
rootfs Phase 34: Orbital Drop - Fix console echo and eliminate 'R' flood regression 2026-01-03 18:07:18 +01:00
src/npl/system Rumpk Stability, NipBox Boot, and Repository Cleanup 2026-01-04 21:39:06 +01:00
vendor feat(rumpk): Achieve interactive Mksh shell & formalize Sovereign FSH 2026-01-05 01:14:24 +01:00
README.md feat: Initialize Rumpk Modular Unikernel 2025-12-31 20:18:47 +01:00
build.zig Rumpk Stability, NipBox Boot, and Repository Cleanup 2026-01-04 21:39:06 +01:00
run.sh feat(rumpk): First successful Zig+Nim boot on QEMU ARM64 2025-12-31 20:18:47 +01:00

README.md

Rumpk: The Modular Unikernel

"The Kernel is a Library. The App is the OS."

Status: EXPERIMENTAL
Languages: Zig (L0) + Nim (L1)
Design: POSIX-hostile, Military-grade

Directory Structure

rumpk/
├── boot/           [L0] Entry & Architecture (Zig/Asm)
│   ├── start.S     Multiboot2/EFI entry point
│   └── arch/       Architecture-specific code
├── hal/            [L0] Hardware Abstraction (Zig)
│   ├── mm.zig      Physical/Virtual Memory
│   ├── irq.zig     Interrupt handling
│   ├── serial.zig  UART/Early logging
│   └── abi.zig     C-ABI export to Nim
├── core/           [L1] Logic (Nim)
│   ├── kernel.nim  kmain() entry
│   ├── sched.nim   LWKT Scheduler
│   ├── fiber.nim   Fiber/Context management
│   └── ring.nim    Disruptor buffer
├── sys/            [L2] ABI Glue
│   └── syscall.zig System call handlers
├── payload/        [L3] NPL/NPK Loaders
│   └── loader.nim  Signature verification
└── io/             I/O Subsystem
    └── governor.nim Adaptive War/Peace mode

Key Features

  • Adaptive I/O: War Mode (polling) ↔ Peace Mode (interrupts)
  • Disruptor Ring: Lock-free inter-fiber communication
  • SipHash IDs: Collision-resistant process identification
  • Ed25519: Only signed code executes

Specifications

Build (Coming Soon)

cd core/rumpk
zig build          # Build L0 HAL
nimble build       # Build L1 Logic