Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pastaboy12345/SilverOS/llms.txt

Use this file to discover all available pages before exploring further.

SilverOS uses a straightforward GNU Make build system. A single make invocation compiles every Assembly and C source file, links the kernel binary, formats the SilverFS virtual disk image, and optionally wraps everything into a bootable GRUB2 ISO — all without any configure step or external build framework. The Makefile is self-contained and documents every compiler and linker flag it uses.

Prerequisites

You will need a standard Linux host with the following packages installed. All are available in the default repositories of any Debian/Ubuntu-based distribution.
sudo apt install \
    gcc \
    nasm \
    binutils \
    grub-pc-bin \
    grub-common \
    xorriso \
    qemu-system-x86
PackageRole
gccC compiler — builds all .c sources with -std=gnu11
nasmNASM assembler — builds boot/boot.asm and the two kernel Assembly helpers
binutils (ld)GNU linker — links all objects using boot/linker.ld
grub-pc-bin + grub-commonProvides grub-mkrescue and grub-file for ISO creation and header verification
xorrisoRequired by grub-mkrescue to produce a hybrid El Torito ISO
qemu-system-x86QEMU x86_64 emulator for running SilverOS locally

Build targets

TargetCommandOutput
Default buildmake or make allbuild/silveros.bin (kernel ELF binary) + build/disk.svd (SilverFS disk image)
Bootable ISOmake isobuild/silveros.iso — GRUB2 hybrid ISO containing the kernel and GRUB config
Disk image onlymake diskbuild/disk.svd — formatted SilverFS virtual disk, created by the host tool build/mkfs_svd
Run in QEMUmake runBuilds ISO + disk, then launches QEMU with KVM enabled; automatically falls back to software emulation if KVM is unavailable
Run without KVMmake run-nokvmSame as make run but always uses software emulation — useful on systems without hardware virtualization
Flash to USBmake usb DEV=/dev/sdXWrites the ISO to the target block device at offset 0, then appends the SilverFS disk at a 64 MB offset
Cleanmake cleanRemoves the entire build/ directory
Verify headermake checkRuns grub-file --is-x86-multiboot2 against the kernel binary to confirm the Multiboot2 header is valid
make usb DEV=/dev/sdX uses dd to write directly to a block device with sudo. It will destructively and permanently overwrite all data on the target drive. Double-check your device path before running this command.

Compiler flags

The Makefile toolchain variables are:
ASM      = nasm
CC       = gcc
LD       = ld
GRUB_MK  = grub-mkrescue

ASMFLAGS = -f elf64
CFLAGS   = -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-sse2 \
           -mcmodel=kernel -Wall -Wextra -O2 -I include -std=gnu11 \
           -fno-stack-protector -fno-pic -fno-pie -c
LDFLAGS  = -T boot/linker.ld -nostdlib -z max-page-size=0x1000
Here is what each non-obvious flag does:
FlagReason
-ffreestandingTells GCC not to assume a hosted C environment — no libc, no crt0, no startup files
-mno-red-zoneDisables the x86_64 “red zone” (128-byte scratch area below RSP). Required in kernel code because hardware interrupts can fire at any time and would corrupt an active red zone
-mno-mmx -mno-sse -mno-sse2Prevents the compiler from emitting SSE/MMX instructions. The kernel does not save or restore the FPU/SIMD register state on context switches, so SSE use in kernel code would silently corrupt those registers
-mcmodel=kernelSelects the kernel code model, which assumes the kernel is mapped in the upper 2 GB of the 64-bit address space and generates appropriate relocations
-fno-stack-protectorDisables stack canary insertion — there is no __stack_chk_fail symbol in a freestanding build
-fno-pic -fno-pieDisables position-independent code generation. The kernel is linked at a fixed physical address and does not use a GOT/PLT
-O2 -Wall -WextraStandard optimization level with full warnings enabled
-std=gnu11C11 with GNU extensions (used for typeof, statement expressions, and similar GCC-specific constructs)
-nostdlib (linker)Do not link against any standard libraries or startup files
-z max-page-size=0x1000Sets the maximum ELF segment alignment to 4 KB, preventing the linker from over-aligning sections and wasting physical address space

Build output

After a successful build the build/ directory contains:
build/
├── silveros.bin       # Linked kernel binary (Multiboot2 ELF)
├── silveros.iso       # Bootable GRUB2 hybrid ISO  (make iso)
├── disk.svd           # SilverFS virtual disk image
├── mkfs_svd           # Host-side disk formatter (native Linux binary)
├── boot/
│   └── boot.o         # Compiled boot stub
├── kernel/
│   └── *.o            # Compiled kernel objects
├── drivers/
│   └── *.o
├── fs/
│   └── silverfs.o
├── net/
│   └── *.o
└── desktop/
    └── *.o
The kernel binary build/silveros.bin is what GRUB loads via the multiboot2 directive in boot/grub.cfg. The ISO embeds this binary alongside the GRUB configuration at boot/grub/grub.cfg inside the ISO filesystem.

Build docs developers (and LLMs) love