Getting Started

Install the toolchain, build the Helix kernel from source, and run it in QEMU.

Documentation

Prerequisites

Before building Helix, you need several tools installed on your system. Helix targets bare-metal x86_64 and requires a nightly Rust toolchain with specific components.

Required Tools

ToolVersionPurpose
Rust (nightly)nightly-2024-xxKernel compiler — uses #![no_std], allocator_api, naked_fn
cargolatestWorkspace and dependency management
QEMU7.0+x86_64 system emulator for testing
NASM2.15+Assembly for boot stubs (optional, Limine handles most)
xorriso1.5+ISO image creation for BIOS/UEFI boot
git2.30+Source control
make4.0+Build orchestration (Makefile + justfile)

Operating System Support

Helix development is supported on:

  • Linux (Ubuntu 22.04+, Fedora 38+, Arch) — primary development platform
  • macOS (with Homebrew) — fully supported, QEMU via brew install qemu
  • Windows (WSL2) — use Ubuntu WSL, native Windows not directly supported

Install Rust Nightly

Helix uses Rust nightly features extensively: allocator_api, naked_functions, abi_x86_interrupt, negative_impls, and more. The exact nightly version is pinned in rust-toolchain.toml.

# Install rustup if you don't have it
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# The rust-toolchain.toml in the repo auto-selects the correct nightly
# Just clone and cargo will handle the rest

The workspace's rust-toolchain.toml specifies:

[toolchain]
channel = "nightly"
components = ["rust-src", "rustfmt", "clippy", "llvm-tools-preview"]
targets = ["x86_64-unknown-none"]

Install System Dependencies

# Ubuntu / Debian
sudo apt update
sudo apt install -y qemu-system-x86 xorriso mtools grub-pc-bin \
  grub-efi-amd64-bin nasm build-essential curl git

# Fedora
sudo dnf install -y qemu-system-x86 xorriso mtools nasm gcc make curl git

# Arch Linux
sudo pacman -S qemu-system-x86 xorriso mtools nasm base-devel curl git

# macOS (Homebrew)
brew install qemu xorriso nasm

Optional Tools

ToolPurpose
justModern command runner — justfile provided
objdumpDisassemble kernel binary
gdb / lldbKernel debugging with QEMU GDB stub
cargo-expandExpand macros for debugging
DockerReproducible builds via docker-compose.yml
NixReproducible environment via flake.nix

Installation

Clone the Repository

git clone https://github.com/helix-os/helix.git
cd helix

Repository Layout

The Helix workspace is a Cargo workspace containing 20+ crates:

Repository Layout12N · 11E
helix/Cargo workspace root11core/helix-core — kernel …1hal/helix-hal — hardware…1boot/Limine, Multiboot2, …1subsystems/7 subsystems1modules/Module system framew…1modules_impl/Concrete implementat…1fs/HelixFS — CoW filesy…1drivers/gpu/magma/Magma GPU driver (52…1graphics/Lumina graphics engi…1profiles/minimal/Minimal bootable OS1benchmarks/Performance benchmar…1
100%
☝ Drag to pan·🤏 Pinch to zoom·Tap a node

Verify Your Setup

# Check Rust nightly is available
rustc --version
# Should show: rustc 1.xx.0-nightly (...)

# Check QEMU
qemu-system-x86_64 --version

# Make build scripts executable
chmod +x scripts/*.sh

Using Docker (Alternative)

Helix ships with a Dockerfile and docker-compose.yml for reproducible builds:

docker-compose build
docker-compose run helix-dev

Using Nix (Alternative)

A flake.nix is provided for Nix users:

nix develop

Building the Kernel

Quick Build

./scripts/build.sh

This compiles the helix-minimal-os profile targeting x86_64-unknown-none, links it into a bootable ELF binary, and places the output at build/output/helix-kernel.

Build with Cargo Directly

cargo build --package helix-minimal-os \
  --target x86_64-unknown-none --release

Build Variants

CommandDescription
./scripts/build.shRelease build (default)
./scripts/build.sh --debugDebug build with symbols
./scripts/build.sh --isoBuild + create bootable ISO
make buildSame as ./scripts/build.sh
just buildUsing justfile runner

Understanding the Build Pipeline

  1. Cargo compiles the workspace with target x86_64-unknown-none
  2. The profiles/minimal/ crate is the binary entry point (kernel_main)
  3. It links against helix-core, helix-hal, helix-execution, helix-memory, helix-modules, helix-userspace, helix-fs, helix-relocation, and helix-nexus
  4. A custom linker script positions the kernel at the correct virtual address
  5. The Limine bootloader protocol provides the initial handoff
  6. Output: build/output/helix-kernel (ELF64)

Check Kernel Size

size build/output/helix-kernel
# Or: objdump -h build/output/helix-kernel

Running in QEMU

Quick Run

./scripts/run_qemu.sh

Builds the kernel (if needed) and launches QEMU.

Manual QEMU Command

qemu-system-x86_64 \
  -machine q35 \
  -cpu qemu64 \
  -m 256M \
  -serial stdio \
  -no-reboot \
  -kernel build/output/helix-kernel

QEMU Flags Reference

FlagPurpose
-machine q35Modern chipset (PCIe, AHCI)
-cpu qemu64Standard x86_64 CPU model
-m 256M256 MB RAM
-serial stdioSerial console to terminal
-no-rebootStop on triple fault
-d int,cpu_resetDebug: log interrupts and resets
-s -SGDB stub (port 1234), wait for debugger

Expected Boot Output

[BOOT] Helix OS v0.1.0 - Minimal Profile
[BOOT] CPU: x86_64, cores: 1
[BOOT] Memory: 256 MiB total
[HEAP] Kernel heap initialized (4 MiB)
[MEM]  Physical memory manager ready
[INT]  IDT installed, interrupts enabled
[SCHED] Round-robin scheduler active
[FS]   HelixFS initialized
[NEXUS] NEXUS AI framework active
[KERN] === Helix Kernel Started ===
helix>

Debug Mode with GDB

Terminal 1:

./scripts/run_qemu.sh --debug

Terminal 2:

gdb build/output/helix-kernel
(gdb) target remote :1234
(gdb) break kernel_main
(gdb) continue

First Modification

Add a Custom Boot Message

Open profiles/minimal/src/main.rs and find kernel_main. Add:

profiles/minimal/src/main.rs
rust
1
kprintln!("[CUSTOM] Hello from my Helix kernel!");

The kprintln! macro writes to serial port COM1 — QEMU redirects this to your terminal.

Rebuild and Test

./scripts/build.sh && ./scripts/run_qemu.sh

Ideas for Further Exploration

  • Change heap size — modify the HEAP_SIZE constant in main.rs (default: 4 MB)
  • Add a shell command — implement ShellCommand in subsystems/userspace/src/shell.rs
  • Write a kernel module — use the v2 module API (see Module Development docs)
  • Enable NEXUS features — toggle feature flags in profiles/minimal/Cargo.toml

Project Structure

Layered Architecture

Layered Architecture6N · 5E
profiles/minimal/Binary entry point1modules_impl · benchmarks · scriptsImplementations2SubsystemsServices layer2modules/ · core/Frameworks2hal/Hardware Abstraction…2boot/Boot protocols1
100%
☝ Drag to pan·🤏 Pinch to zoom·Tap a node

Crate Reference

CrateLinesDescription
helix-core~2,800Kernel orchestrator, IPC, syscalls, interrupts, self-heal
helix-hal~51,000Hardware abstraction for 3 architectures
helix-execution~2,500Scheduler framework, threads, processes
helix-memory~2,200Physical + virtual memory, allocators
helix-dis~11,600Dynamic Intent Scheduling engine
helix-init~4,500Subsystem init with dependency phases
helix-userspace~3,500ELF64 loader, shell, syscall table
helix-nexus~90,000+AI framework — prediction, healing, optimization
helix-modules~3,800Module system v1+v2, hot-reload
helix-fs~12,000CoW B-tree filesystem
Magma GPU~15,000+GPU driver with Vulkan 1.3
Lumina~25,000+Graphics engine, SPIR-V, PBR, ray tracing

Configuration Files

FilePurpose
Cargo.tomlWorkspace root with members and shared deps
rust-toolchain.tomlNightly version + required components
rustfmt.tomlCode formatting rules
deny.tomlDependency audit (cargo-deny)
MakefileBuild, test, CI targets
justfileModern build runner
flake.nixNix development environment

Development Workflow

VS Code Integration

The repository includes full VS Code support:

  • tasks.json — Build, Run QEMU, Tests, Format, Clippy, Docs
  • launch.json — GDB debug configurations
  • Recommended extensions — rust-analyzer, CodeLLDB

Common Commands

TaskCommand
BuildCtrl+Shift+B (default build task)
Run QEMUTask: "Run QEMU"
Unit testscargo test --target x86_64-unknown-linux-gnu --lib
Formatcargo fmt --all
Lintcargo clippy --all-targets --all-features -- -D warnings
Docscargo doc --no-deps --document-private-items --open

Testing Strategy

  1. Unit tests — run on host Linux/macOS, test pure logic:

    cargo test --target x86_64-unknown-linux-gnu --lib
    
  2. Integration tests — run inside QEMU:

    ./scripts/test.sh
    

Pre-Commit Checks

make pre-commit
# Runs: fmt check → clippy → unit tests → build

Next Steps

You now have Helix building and running. Continue with:

  • Architecture — the modular kernel design philosophy
  • Core — kernel orchestrator, IPC, and syscall framework
  • Modules — writing hot-reloadable kernel modules
  • Subsystems — scheduling, memory management, and DIS