How grisuno/minios works
Purpose and Entry Points
MiniOS is a bootable 64-bit x86 teaching OS that includes a ramdisk, interactive shell/editor, executable loaders, network stack, TLS client, and prebuilt self-hosting toolchain artifacts. Build orchestration is in Makefile; bootable output is os.img. Primary runtime entry is the BIOS boot path, while mcp/minios_mcp.py is a host-side MCP/stdio JSON-RPC entry point for agents.
Boot and Kernel Bring-up
The disk image boots through a two-stage BIOS loader. Stage 1 performs LBA reads to load stage 2; stage 2 loads the kernel above 1 MB and enters x86-64 long mode. Shared layout constants coordinate these boundaries.
• stage1.S
• stage2.S
• bootdefs.h
• bootloader.c
• kernel.c
• kernel.ld
Kernel Runtime and User Interaction
The monolithic kernel owns console I/O, memory/heap behavior, ramdisk access, shell, line editor, program loading, and syscall-compatible execution support. The shell is the main control plane: it reads and writes ramdisk files, invokes toolchain objects, runs ELF or CVM content, redirects output, and exposes network commands.
• kernel.c
• kernel.h
• ramdisk_data.c
Ramdisk and Self-Hosted Development Loop
progs/ is packaged into an in-memory filesystem at image-build time. It supplies source files, demos, utilities, and compiled toolchain modules. Inside MiniOS, users edit C, execute minigcc.o to produce assembly, execute ld.o to link it, then run the resulting ELF. Full source regeneration depends on sibling miniGCC, ld, and CVM repositories; prebuilt artifacts allow a standalone checkout to build an image.
• mkramdisk.py
• progs/minigcc.o
• progs/ld.o
• progs/cvm.o
• progs/bin/cp.c
Program Loading and Execution Boundary
MiniOS supports three execution formats: relocatable objects dynamically linked against kernel-exported libc symbols; Linux ET_EXEC/ET_DYN binaries using the x86-64 syscall ABI; and CVM bytecode interpreted through the ramdisk-supplied CVM object. This is the principal compatibility boundary between kernel services and guest programs.
• kernel.c
• cvm_host.c
• progs/fib.cvm
Networking and HTTPS
The kernel directly drives an rtl8139 NIC under QEMU user-mode networking. It implements Ethernet through TCP, including DNS, then layers a TLS 1.2 client with ECDHE RSA/ECDSA, AES-128-GCM, certificate-chain validation, and hostname verification. Embedded CA roots are generated from DER sources. Networked user programs consume these kernel facilities through TLS syscalls.
• net.c
• net.h
• tls.c
• tls_crypto.c
• tls_x509.c
• tls_roots_src/
External Runtime and Validation
QEMU is the material execution environment for graphical, serial, and behavioral runs; its rtl8139/slirp setup provides guest networking. Host TLS validation uses Python and OpenSSL-driven servers. The freedom program is the key HTTPS client/browser workload, while MCP launches and supervises QEMU over a PTY serial console.
• progs/bin/freedom
• test_http_server.py
• tls_test.py
• mcp/minios_mcp.py
Agent Integration Boundary
The MCP bridge owns QEMU lifecycle and translates validated stdio JSON-RPC requests into serial-console interactions. It exposes boot, send/expect, filesystem-oriented, snapshot, status, and shutdown operations; the skill documents the intended in-guest development workflow.
• mcp/minios_mcp.py
• mcp/minios_addons.py
• skills/minios/SKILL.md
Main entry points: kernel.c Monolithic kernel · stage2.S BIOS stage 2 · Makefile Build orchestration · stage1.S BIOS stage 1
Components 20
Image Build
- Build orchestration · Builds the bootable image and packages runtime artifacts.
Makefile - Ramdisk packer
mkramdisk.py - Packaged programs · Sources, utilities, demos, and prebuilt self-hosting modules.
Boot Path
- BIOS stage 1 · Reads stage 2 using LBA.
stage1.S - BIOS stage 2 · Loads the kernel above 1 MB and enters long mode.
stage2.S - Boot layout
bootdefs.h - Boot loader support
bootloader.c - Kernel linker layout
kernel.ld
Kernel Runtime
- Monolithic kernel · Owns console, memory, ramdisk, shell, loaders, and syscall-compatible execution.
kernel.c - In-memory filesystem
ramdisk_data.c - Program execution · Runs relocatable objects, ELF ET_EXEC/ET_DYN binaries, and CVM bytecode.
kernel.c - CVM host adapter
cvm_host.c - Network stack · Drives rtl8139 and implements Ethernet through TCP plus DNS.
net.c - TLS 1.2 client · Provides authenticated HTTPS for guest programs through TLS syscalls.
tls.c - CA root sources
Host Control & Validation
- QEMU runtime · Runs the image with rtl8139 and slirp guest networking.
- MCP bridge · Supervises QEMU and translates agent requests to serial-console interactions.
mcp/minios_mcp.py - Host TLS validation · Python and OpenSSL-driven HTTPS validation.
tls_test.py - Freedom HTTPS client
progs/bin/freedom - MiniOS workflow skill
skills/minios/SKILL.md
Connections 24
- Build orchestration → Ramdisk packer: packages
- Ramdisk packer → Packaged programs: reads
- Ramdisk packer → In-memory filesystem: generates
- Build orchestration → BIOS stage 1: builds image
- Build orchestration → BIOS stage 2: builds image
- Build orchestration → Monolithic kernel: links
- Boot layout → BIOS stage 1: defines layout
- Boot layout → BIOS stage 2: defines layout
- BIOS stage 1 → BIOS stage 2: LBA loads
- BIOS stage 2 → Boot loader support: uses
- BIOS stage 2 → Monolithic kernel: loads and enters long mode
- Kernel linker layout → Monolithic kernel: places
- In-memory filesystem → Monolithic kernel: mounted by
- Monolithic kernel → Program execution: provides
- Program execution → CVM host adapter: interprets CVM via
- Packaged programs → Program execution: supplies tools and guests
- Monolithic kernel → Network stack: owns
- Network stack → TLS 1.2 client: transport for
- CA root sources → TLS 1.2 client: trust inputs
- Freedom HTTPS client → TLS 1.2 client: uses TLS syscalls
- QEMU runtime → BIOS stage 1: boots
- MCP bridge → QEMU runtime: launches and controls
- MiniOS workflow skill → MCP bridge: documents workflow
- Host TLS validation → Freedom HTTPS client: validates HTTPS workload