The Road to Linux Boot

Building a Linux-bootable RISC-V hart, stage by stage

The RISC-V spec is a menu, not a recipe. This is the recipe: the order in which a hardware team implements the architecture to reach a hart that boots Linux, then a hart that is RVA23-conformant. Each page in the book carries a Linux boot tag — required, recommended, or optional — and this roadmap threads them into a build order.

  1. 1

    Fetch, decode, execute: the base integer core

    RV64I plus the M (multiply/divide), A (atomics), and C (compressed) extensions, CSR access (Zicsr), and FENCE.I (Zifencei). This is a hart that runs bare-metal RV64GC code.

  2. 2

    Floating point & counters

    F and D single/double-precision floating point (the ABI assumes them), the Zicntr time/cycle/instret counters, and Zihpm performance monitors.

  3. 3

    The memory model

    RVWMO — the rules every load, store, fence, and atomic obeys. Get the ordering right before multicore, or debugging is impossible.

  4. 4

    Machine mode: traps, CSRs, the boot mode

    M-mode is where the hart resets. mstatus/mtvec/mepc/mcause, delegation (medeleg/mideleg), the interrupt architecture, and PMP for isolating firmware from the OS.

  5. 5

    Supervisor mode & virtual memory

    The register file Linux lives in: the supervisor CSRs, SFENCE.VMA, and the Sv39/48/57 page-table walker. This is the single biggest hardware block — the MMU.

  6. 6

    The timer & the SBI contract

    Sstc (stimecmp) gives S-mode its own timer without an SBI round trip on every scheduler tick; the counter-overflow interrupt (Sscofpmf) makes perf work.

  7. 7

    Profile-complete: the RVA23 application core

    The bit-manipulation B extension, vectors (V), and the CFI/pointer-masking security features that a modern distro binary now assumes. Optional to boot, mandatory to be conformant.

Every required page, in order

The 36 pages tagged required to boot Linux — the irreducible core.

Then the recommended pages

37 pages that a practical Linux system wants — Sstc, Sscofpmf, the B extension, CMOs, PAUSE — but that a minimal boot can defer.

Everything else — the whole of Part III (vectors, crypto, Zfa/Zfh, Zicond, and the rest) — is the optional side-shelf: full-depth, RVA23-relevant, but not on the critical path to a booting kernel. Build the core first; reach for these when the workload demands them.