CrisOS v2 uses a straightforward Makefile-based build system. All C source files are compiled withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CRISTOP-bot/cris-os-v2/llms.txt
Use this file to discover all available pages before exploring further.
-ffreestanding -m32 -nostdlib, linked with a custom linker script (linker.ld), and packaged into a bootable GRUB ISO using grub-mkrescue. The entire process — from a clean checkout to a running VM — is handled by a handful of make targets.
Prerequisites
The following tools must be available on yourPATH before building:
| Tool | Purpose | Notes |
|---|---|---|
i686-elf-gcc | Cross-compiler (recommended) | Falls back to system gcc if not found |
i686-elf-ld | Cross-linker (recommended) | Falls back to system ld if not found |
make | Build orchestration | GNU Make required |
python3 | Rootfs image builder | Invoked as python by default; override with PYTHON=python3 |
grub-mkrescue + grub-pc-bin | ISO generation | Required for make echo-iso and make run |
qemu-system-i386 | Testing | Required for make run |
Cross-Compiler Auto-Detection
The Makefile probes fori686-elf-gcc at the start of every build. If the cross-compiler toolchain is present it is used exclusively; otherwise the build falls back to the system gcc/ld. The exact detection block from the Makefile is:
i686-elf cross-compiler is strongly recommended. It eliminates host-ABI contamination and ensures the output is always a clean 32-bit ELF binary regardless of whether your host is 32-bit or 64-bit.
Compiler and Linker Flags
These flags are defined at the top of the Makefile and applied to every translation unit:-ffreestanding— tells GCC the standard library is not available andmainis not the entry point.-m32— emit 32-bit i386 code regardless of the host architecture.-nostdlib— do not link against libc or the GCC startup files.-std=c99— enforce the C99 standard throughout.-I src— addsrc/to the include search path so headers can be included without path prefixes.
Source Files
The Makefile organises sources into three variables: Kernel C sources (SRCS)
DRV_SRCS)
ASMS)
drv_ in build/ (e.g. build/drv_console.o) to avoid name collisions with same-named kernel sources.
Build Targets
make — compile and link the kernel
Compiles every The linker script places the Multiboot header at
.c and .S file listed above into build/*.o, then links them with linker.ld to produce build/kernel.bin.0x00100000 and lays out .text, .rodata, .data, and .bss sections in order.make iso — build rootfs and stage boot files
Runs the
all target, then invokes tools/build_rootfs.py to pack the contents of rootfs/ into a CRFS image at iso/boot/rootfs.bin. Finally it copies build/kernel.bin to iso/boot/kernel.bin.make echo-iso — generate the bootable ISO
Runs the
iso step, then calls grub-mkrescue to assemble everything under iso/ into a bootable hybrid ISO at os.iso. If grub-mkrescue is not installed, a warning is printed instead.make run — launch in QEMU
Runs the full
echo-iso pipeline and then boots the resulting image with 512 MB of RAM:Build Output Structure
After a successfulmake echo-iso the working tree looks like this:
Complete Makefile
View full Makefile
View full Makefile