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. The default LINUX_BUILD_VERSION is v6.18.22.

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 NPC with NEMU difftest reference
make linux-boot-rv32-difftest ARGS="-b -n"

# RV32 Linux on the KU15P FPGA through LiteX BIOS + MIG DDR4
make -C fpga/litex linux-fpga-e2e UART_PORT=/dev/ttyUSB0

# RV64 prebuilt payload path is available; the top-level device helper is NEMU-only today
make linux-download-rv64
make linux-boot-nemu64-device

Useful overrides:

make linux-boot-rv32 LINUX_BUILD_VERSION=v6.18.22 MAX_INST=100000000 ARGS="-b -n"
make linux-boot-rv32 LINUX_RV32_PAYLOAD=/path/to/fw_payload.bin ARGS="-b -n"

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 payloads Payload download + NEMU device helper Available in tooling
RV64 xv6 smoke path Sv39 PTW/TLB + A/D writeback Available via app/tinyos helpers

See linux/README.md and app/tinyos/README.md for the lower-level payload and xv6/egos helpers.

Payload Paths

The downloaded payloads live under linux/build/:

linux/build/linux-riscv-qemu-rv32-m-<version>/fw_payload.bin
linux/build/linux-riscv-qemu-rv64-m-<version>/fw_payload.bin

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:

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.

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.22.tar.xz

tar -xf linux-6.18.22.tar.xz
cd linux-6.18.22

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.

References