Build from source
All commands run in the top directory of the source tree, the one with Makefile. Get the tree from Releases; a Git account is not needed.
Always pass ARCH=x86_64. The Makefile defaults to ARCH=aarch64, and the aarch64 port does not work yet.
1. Tools
| Tool | Used for |
|---|---|
clang, ld.lld | the kernel |
musl cross compiler: x86_64-linux-musl-gcc (or aarch64-linux-musl-gcc) | the vDSO (needed even for the kernel alone) and the programs in the initramfs |
make, cpio, curl or wget, tar | the initramfs |
grub-mkrescue (needs xorriso) | make iso |
mkfs.ext2, mkfs.ext4, sgdisk | test disk images |
qemu-system-x86_64, qemu-system-aarch64 | running and testing |
llvm-objcopy | make image (Raspberry Pi only) |
The Makefile looks for the musl compiler in $HOME/opt/x86_64-linux-musl-cross/bin/. If yours is elsewhere, name it with MUSL_CC_X86_64= (or MUSL_CC_AARCH64=), as in the examples below.
On Debian or Ubuntu, for example: clang lld llvm make cpio curl xorriso grub-pc-bin grub-common mtools e2fsprogs gdisk qemu-system-x86. The musl cross compiler is not packaged there; build or fetch one yourself.
2. Pick a config (optional)
make defconfig # full build (used when you skip this step)
make tinyconfig # minimal bootable core
3. Build (x86_64)
make ARCH=x86_64 MUSL_CC_X86_64=/path/to/x86_64-linux-musl-gcc iso
Output: build/ranix.elf (the kernel), build/initramfs.cpio and ranix.iso. Kernel and initramfs only, without an ISO:
make ARCH=x86_64 MUSL_CC_X86_64=/path/to/x86_64-linux-musl-gcc all
The first build needs the network and takes a while. It downloads Alpine, Debian and GNU packages and sources, and cross-builds bash, curl, dropbear and Python into the initramfs. Downloads are kept in .cache/, so later builds are faster.
To add options to the kernel command line of the ISO:
make ARCH=x86_64 ISO_CMDLINE="ranix.noautomount" iso
4. Run in QEMU
QEMU is the safe place to try Ranix: nothing on your real disks is touched.
make ARCH=x86_64 qemu-iso # boots ranix.iso with 512 MB, console on this terminal
make ARCH=x86_64 qemu-disk # same, plus a 32 MB ext2 scratch disk (virtio)
Quit with Ctrl+A, then X. Use qemu-iso, not qemu: the x86_64 kernel boots through GRUB (multiboot2), not through QEMU's -kernel.
On an x86_64 Linux host with KVM, adding -enable-kvm -cpu host to a hand-run QEMU is much faster. The make targets do not add it.
5. Run the test suite
make ARCH=x86_64 test # prints PASS/FAIL lines and a Results: line
TEST_TIMEOUT=600 make ARCH=x86_64 test # default timeout is 180 s
make ARCH=x86_64 flakehunt ITERS=20 # run the suite N times, list anything not always green
make persisttest # x86_64: a disk write and a disk root survive a reboot
The log is in build/serial-test.log. A patch is merged only when the full suite passes.
6. aarch64 and Raspberry Pi 4 (not working yet)
make ARCH=aarch64 BOARD=raspi4 image # kernel8.img
make pi-demo # pi4-dist/: kernel8.img, initramfs.cpio, config.txt
make qemu # QEMU raspi4b
make ARCH=aarch64 BOARD=virt qemu # QEMU virt, with virtio-net
The aarch64 build was last reported failing at the vDSO link step (2026-11-05). Use x86_64.
7. Boot on a real PC, next to Linux
This is how Ranix runs on the tested laptop. There is no installer. You add Ranix to the GRUB menu of a Linux system you already have and boot it once at a time. Linux stays the default, so any crash or reset brings you back to Linux.
Before you start: keep a working Linux and a Linux USB stick for rescue, and back up anything you care about. Ranix keeps every disk read-only unless you name it in ranix.disk.rw=; do not add that option on a machine whose only Linux you need.
Copy the kernel and initramfs
sudo mkdir -p /boot/ranix
sudo cp build/ranix.elf build/initramfs.cpio /boot/ranix/
Add a GRUB entry
Append to /etc/grub.d/40_custom:
menuentry "Ranix" {
search --no-floppy --file --set=root /boot/ranix/ranix.elf
multiboot2 /boot/ranix/ranix.elf ranix.noautomount panic=5
module2 /boot/ranix/initramfs.cpio
}
If /boot is its own partition, drop /boot from the three paths.
ranix.noautomount- Mount no disk at boot. Leaves Linux alone.
panic=5- Reset 5 seconds after a kernel panic instead of freezing.
ranix.deadline=N(optional)- Reset N seconds after boot no matter what. Useful when nobody is at the machine.
ranix.disk.rw=- Disks that may be written:
serial:,gptdisk:orpartuuid:followed by an ID. Names likesata0are refused on purpose, because they can point at another disk on the next boot.
Keep Linux the default, boot Ranix once
In /etc/default/grub set GRUB_DEFAULT=saved, then:
sudo update-grub
sudo grub-reboot "Ranix"
sudo reboot
grub-reboot picks Ranix for the next boot only. To get back, reset the machine (or wait for panic=5 or ranix.deadline); the next boot is Linux. If GRUB still starts Ranix, pick Linux in the menu (hold Shift or press Esc during boot) and run sudo grub-editenv - unset next_entry.
Remove Ranix
sudo rm -r /boot/ranix
Delete the "Ranix" entry from /etc/grub.d/40_custom, then run sudo update-grub.
Not yet
- UEFI-only machines: not tested.
- Booting a systemd distribution (Debian and the like) on Ranix in place of Linux: does not work yet.
- Ranix as the default boot entry, or a real installer.
8. When something goes wrong
x86_64-linux-musl-gcc: not found- Pass
MUSL_CC_X86_64=/path/to/x86_64-linux-musl-gcc. grub-mkrescuefails orranix.isois missingmake isohides its errors. Rungrub-mkrescue -o ranix.iso iso/by hand; it usually needsxorrisoand the GRUB BIOS modules.- Strange errors after switching
ARCH - Objects from the other architecture are left in
build/. Runmake clean(it keeps.cache/). make testfails- Read
build/serial-test.log. If it stops early, the run hit the timeout: raiseTEST_TIMEOUTor use KVM. - Keyboard does not work on a real PC
- Only PS/2 keyboards (and USB keyboards the firmware presents as PS/2) are tested.
- Reading the last kernel log after a crash
- See
docs/watchdog_pstore.mdin the tree:scripts/ranix-lastlog.pyreads it back from Linux.