RISC-V Emulator and Linux System from Scratch
Summary
This repository provides source code for a RISC-V emulator and a tutorial to build a minimal Linux system from scratch, including device emulation and WebAssembly support.
View Cached Full Text
Cached at: 09/11/26, 02:24 PM
WerWolv/riscv-emulator
Source: https://github.com/WerWolv/riscv-emulator
RISC-V Emulator and Linux System from Scratch
This repo contains all the source code required to follow the blog post at https://werwolv.net/posts/linux_bringup/
Source Code
/libcontains the entire rv32ima instruction set emulator code as well as a minimal set of emulated devices/maincontains the configuration for our machine and functions exposed for WebAssembly use
Configuration
All the config files required to build Linux can be found in /boot. The main executable also expects all the built binaries to be in the boot folder.
riscv32-unknown-linux-gnu.configis the crosstool-ng toolchain config fileriscv_emulator_defconfigis the Linux Kernel config filedevice_tree.dtsis the minimal device tree- Can be compiled to a dtb using
dtc -I dts -O dtb device_tree.dts -o device_tree.dtb
- Can be compiled to a dtb using
init.cis the init program- Can be compiled using
riscv32-unknown-linux-gnu-gcc -static init.c -o init
- Can be compiled using
initramfs.txtis thegen_init_cpioconfig file to generate the initramfs- Can be compiled to a cpio using
usr/gen_init_cpio initramfs.txt -o initramfs.cpio
- Can be compiled to a cpio using
Similar Articles
How to bring up the Linux Kernel on a new platform
This article explains how to bring up the Linux kernel on a new platform, using an emulated RISC-V CPU as an example, with step-by-step guidance and code implementation for setting up minimal hardware components.
Pushing the limits of RISC-V emulation
This blog post explores how to make RISC-V execution faster on non-RISC-V machines using an ahead-of-time recompiler that connects basic blocks with tail calls and leverages Clang's preserve_none calling convention, as part of the OpenVM project at Axiom.
Book: RISC-V System-on-Chip Design
A textbook covering the detailed design of RISC-V microprocessors and system-on-chip, including open-source SystemVerilog code and test cases for single-issue, superscalar, and multicore implementations.
RISCBoy is an open-source portable games console, designed from scratch
RISCBoy is an open-source portable gaming console built with a RISC-V CPU and raster graphics pipeline, implemented on an iCE40 FPGA. The project includes the processor design, graphics hardware, PCB layout, and is fully open-source.
8086 Emulator Inside Scratch
A developer built an 8086 CPU emulator inside Scratch, demonstrating retro hardware emulation in a visual programming environment.