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
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.
I·2 RV32I Base Integer Instruction Set, Version 2.1 I·4 RV64I Base Integer Instruction Set, Version 2.1 I·5 "Zifencei" Extension for Instruction-Fetch Fence, Version 2.0 I·6 "Zicsr" Extension for Control and Status Register (CSR) Instructions, Version 2.0 I·7 "Zicntr" and "Zihpm" Extensions for Counters, Version 2.0 - 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
The memory model
RVWMO — the rules every load, store, fence, and atomic obeys. Get the ordering right before multicore, or debugging is impossible.
- 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
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
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
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.
- I·1 1.1-6 Platform, Harts, Memory & the Shape of the ISA
- I·1 1.7 UNSPECIFIED Behaviors and Values
- I·2 2.1-4 Programmers' Model, Instruction Formats & Integer Computation
- I·2 2.5-8 Control Transfer, Loads & Stores, FENCE, and Environment Calls
- I·2 2.9 HINT Instructions
- I·4 4.1-4 RV64I: Widening the Base to 64 Bits
- I·5 "Zifencei": The Instruction-Fetch Fence
- I·6 6.1 "Zicsr": CSR Instructions
- I·7 7.1-2 "Zicntr" & "Zihpm": Counters and Timers
- I·12 "M": Integer Multiplication and Division
- I·13 13.1-4 "A": Atomic Instructions — LR/SC and AMOs
- I·18 18.1-2 RVWMO: The Memory Consistency Model
- I·18 18.3 Source & Destination Register Listings
- I·21 21.1-8 "F": Single-Precision Floating-Point
- I·21 21.9 FCLASS: The Classify Instruction
- I·22 22.1-7 "D": Double-Precision Floating-Point & NaN-Boxing
- I·28 28.1-4 "C": Compressed Instructions — Formats, Loads/Stores, Control Transfer
- I·28 28.5-8 RVC: Computation, Code-Point Reuse & the Opcode Map
- I·36 RV32/64G Instruction Set Listings
- I·37 37.1-11 ISA Extension Naming Conventions
- I·A A.5-6 Porting Maps & Implementation Guidelines
- II·1 The Privileged Architecture: Stacks, Modes & Traps
- II·2 2.1 CSR Address Mapping Conventions
- II·2 2.2 The CSR Listing
- II·2 2.3-7 CSR Field Behaviors: WPRI, WLRL, WARL & the Modulation Rules
- II·3 3.1.1-5 M-Mode CSRs I: misa & the Identity Registers
- II·3 3.1.6 mstatus: The Hart Operating-State Register
- II·3 3.1.7-14 M-Mode CSRs II: Vectoring, Delegation, Interrupts & Counters
- II·3 3.1.15-18 M-Mode CSRs III: mcause, Exception Priority, mtval & menvcfg
- II·3 3.1.19-5 mseccfg, the Platform Timer, Privileged Instructions, Reset & NMI
- II·3 3.6 Physical Memory Attributes (PMAs)
- II·3 3.7 Physical Memory Protection (PMP)
- II·12 12.1.1-8 Supervisor CSRs I: sstatus, stvec, sip/sie, Counters, scause
- II·12 12.1.9-12 Supervisor CSRs II: stval, senvcfg, satp, stimecmp
- II·12 12.2 SFENCE.VMA: The Memory-Management Fence
- II·12 12.3-5 Sv32, Sv39, Sv48: Page Tables & the Translation Algorithm
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.
- I·29 29.1-2 "Zc*": The Code-Size Family — Taxonomy and Formats
- I·29 29.12.3-10 Zcb: The Simple Code-Size Instructions
- I·A A.1-4 RVWMO Explained: Litmus Notation & the Axioms at Work
- I·A A.3.5-8 PPO Rules 1–8: Overlaps, Fences & Synchronization, Explained
- I·A A.3.9-4 PPO Rules 12–13 & Beyond Main Memory
- II·6 "Smepmp": Locking Machine Mode Down
- II·12 12.6-12 Sv57 & the Sv* Extensions: NAPOT, PBMT, Svinval, Svadu, Svvptc
- II·13 "Sstc": Supervisor-mode Timer Interrupts
- II·14 "Sscofpmf": Count Overflow & Mode-Based Filtering
- II·19 Privileged Instruction Set Listings
- I·9 "Zihintpause": The PAUSE Hint
- I·20 20.1-4 CMO I: Coherent Agents, Ordering, and Traps
- I·20 20.5-7 CMO II: CSR Controls & Instruction Encodings
- I·30 30.1-1 Bitmanip I: The Zb* Family & Zba Address Generation
- I·30 30.9.2-9 Bitmanip II: andn — bset (Reference)
- I·30 30.9.10-17 Bitmanip III: bseti — cpopw (Reference)
- I·30 30.9.18-25 Bitmanip IV: ctz — orn (Reference)
- I·30 30.9.26-33 Bitmanip V: pack — ror (Reference)
- I·30 30.9.34-41 Bitmanip VI: rori — sh2add (Reference)
- I·30 30.9.42-49 Bitmanip VII: sh2add.uw — xperm4 (Reference)
- I·30 30.9.50-51 Bitmanip VIII: zext.h, zip & the Family Scorecard
- I·31 31.1-2 V I: The Vector Extension & Its Two Parameters
- I·31 31.3 V II: The Programmer's Model — CSRs, vtype, LMUL
- I·31 31.4 V III: Mapping Elements to Register State
- I·31 31.5 V IV: Instruction Formats, Masking & Element Taxonomy
- I·31 31.6-3 V V: vsetvli & the Load/Store Encoding
- I·31 31.7.4-8 V VI: Unit-Stride, Strided, Indexed, FOF & Segment Memory Ops
- I·31 31.7.9-2 V VII: Whole-Register Ops, Memory Model & Arithmetic Formats
- I·31 31.11.3-10 V VIII: Integer Arithmetic — Extension to Multiply
- I·31 31.11.11-6 V IX: Divide, MAC, Merge & Fixed-Point
- I·31 31.13.7-9 V X: Floating-Point Arithmetic & FMAs
- I·31 31.13.10-15 V XI: FP Min/Max, Compares, Merge & Type Converts
- I·31 31.13.16-14 V XII: Reduction Operations
- I·31 31.15 V XIII: Mask Instructions
- I·31 31.16 V XIV: Permutation — Moves, Slides, Gather, Compress
- I·31 31.17-19 V XV: Exception Handling & the Standard Sub-Extensions
- I·31 31.20 V XVI: The Instruction Listing — an Orientation Map
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.