Linux Kernel Boot
Raptor boots Linux through an OpenSBI fw_payload.bin image:
reset/MROM -> OpenSBI (M-mode) -> Linux (S-mode) -> init/userspace
The top-level Makefile is the preferred entry point. It downloads prebuilt
OpenSBI + Linux payloads from Kingfish404/linux-build and keeps NEMU/NPC
configuration in sync. By default it fetches v6.18.51 assets from the
rv-v6.18.51 release.
Quick Commands
# Download prebuilt RV32 + RV64 payloads
make linux-download
# RV32 Linux through NEMU / NPC
make linux-boot-nemu32 ARGS="-b -n"
make linux-boot-rv32 ARGS="-b -n"
# RV32 Linux on the KU15P FPGA through LiteX BIOS + MIG DDR4
make -C fpga/litex linux-fpga-rv32-e2e UART_PORT=/dev/ttyUSB0
# RV64 prebuilt payload and NPC paths
make linux-download-rv64
make linux-boot-rv64 ARGS="-b -n"
make linux-boot-nemu64-device
# Hard-float F/D Buildroot payloads (downloaded automatically)
make linux-boot-rv32gc
make linux-boot-rv64gc
# Complete RV32GC Buildroot payload used by the FPGA flow
make linux-download-rv32gc-fpga
Useful overrides:
make linux-boot-rv32 LINUX_BUILD_RELEASE=rv-v6.18.51 LINUX_BUILD_VERSION=v6.18.51 MAX_INST=100000000 ARGS="-b -n"
make linux-boot-rv32 LINUX_RV32_PAYLOAD=/path/to/fw_payload.bin ARGS="-b -n"
All NPC Linux boot targets use the matching RV32/RV64 NEMU difftest reference
by default, including the hard-float rv32gc and rv64gc targets. For focused
simulator diagnosis, pass DIFF_REF_SO= explicitly to disable comparison.
Supported Modes
| Mode | RTL path | Status |
|---|---|---|
| RV32 Linux | Sv32 PTW/TLB + PMP + CLINT/PLIC | Primary NPC/NEMU flow |
| RV32 KU15P FPGA | LiteX BIOS + MIG DDR4 + OpenSBI/Linux | Hardware flow; serialboot or FAT32 SD-card boot.bin |
| RV64 Linux | Sv39 PTW/TLB + NPC/NEMU helpers | Build and boot targets are wired; current boot result should be checked per commit |
| RV32/RV64 hard-float | *gc DTB + Buildroot F/D payload |
NPC targets are wired; payloads are built separately |
| RV64 xv6 smoke path | Sv39 PTW/TLB + Svade (software-managed A/D) | Available via app/tinyos helpers |
The presence of an RV64 or hard-float target documents integration and build wiring, not a reproduced full boot result for every checkout. Use a dated boot log or the corresponding verification target when recording validated status.
See linux/README.md and app/tinyos/README.md for the lower-level payload and xv6/egos helpers.
Payload Paths
Prebuilt qemu/NEMU payloads live under linux/build/. Distro/sim kernels from
make -C linux build-rv* land under linux/build/raptor/<version>/:
linux/build/linux-riscv-qemu-rv32-fast-<version>/fw_payload.bin
linux/build/linux-riscv-qemu-rv64-m-<version>/fw_payload.bin
linux/build/raptor/v6.18.51/rv32-buildroot-sim/
linux/build/raptor/v6.18.51/rv64-alpine-sim/
Use the linux/Makefile helpers when another flow needs the exact path:
make -C linux print-rv32-payload
make -C linux print-rv64-payload
Device Tree
NPC/NEMU Linux payloads use the platform device-tree data packaged with the payload and simulator ROM flow. The RTL-visible platform devices are:
- CLINT at
0x0200_0000(standard 0x000c_0000 window) - PLIC at
0x0c00_0000(16 MB window, 31 sources, M/S contexts) - UART/peripheral window at
0x1000_0000 - Memory at
0x8000_0000and related platform windows documented in Ecosystem
RAPT_MTIME_FREQ_MHZ / RAPT_MTIME_DIV must match the device-tree
timebase-frequency, because CSR time and CLINT mtime are paced together.
The KU15P Linux DT advertises zicbom and riscv,cbom-block-size using the
selected RTL preset’s RAPT_CACHE_LINE_BYTES. LiteSDCard DMA is non-coherent;
the BIOS calls the CPU cache-maintenance hook after DMA, and Raptor currently
implements that hook as a conservative whole-L1D cbo.flush operation.
The NEMU RV32GC/RV64GC configurations inject a fresh 256-bit host-random seed
into the external DTB /chosen/rng-seed property before each boot. This matches
QEMU’s early-boot entropy handoff and works even when a pre-built guest kernel
does not contain a hardware RNG driver. They also expose a virtio-mmio entropy
device at 0x10003000 on PLIC source 3 for ongoing entropy. Guest kernels must
enable CONFIG_HW_RANDOM=y and CONFIG_HW_RANDOM_VIRTIO=y to use that device;
Buildroot then sees virtio_rng.0 as /dev/hwrng.
Build From Source
Get the Linux Kernel source code from The Linux Kernel Archives:
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.51.tar.xz
tar -xf linux-6.18.51.tar.xz
cd linux-6.18.51
See more details in linux/README.md.
The repository also keeps source-build helpers in linux/Makefile:
make -C linux build_linux
make -C linux opensbi-with-kernel
For day-to-day RTL validation, prefer the top-level linux-boot-* targets so
the simulator config, payload path, and difftest reference stay aligned.