Requirements: qemu, 32- or 64-bit RISC V gcc toolchain
on Arch Linux install:
sudo pacman -S qemu-system-riscv qemu-system-riscv-firmware riscv64-elf-binutils riscv64-elf-gcc riscv64-elf-gdb riscv64-elf-newlib xxd
on Ubuntu 24.04 install:
sudo apt update
sudo apt install make git gcc gcc-riscv64-unknown-elf build-essential qemu-system-riscv64 gdb-multiarch clang-format xxd
Build all:
make
Build only the kernel:
make kernel
Run in qemu:
make qemu
Run in qemu waiting for a debugger:
make qemu-gdb
In MakefileCommon.mk
some options can get selected, e.g. debug vs. release build, and the architecture to build for. Currently only RISC V is supported.
Architecture specific setting, e.g. 32 vs 64-bit etc. can be found in kernel/arch/<architecture>/MakefileArch.mk
.
For RISC V either 32-bit or 64-bit target can get selected in MakefileArch.mk
. 64-bit kernel can only run 64-bit applications. Both versions have the same features. make qemu
will automatically run the right variant of qemu, but in VSCode the matching debug targets must get selected manually. For VSCode two settings for syntax highlighting are provided: one per bit width. They set the correct defines which are defined by the Makefiles.
The use of the RISC V compressed instruction extension can be disabled by setting RV_ENABLE_EXT_C=no
.
When RV_ENABLE_EXT_SSTC
is set, the timer will be based on this extension instead of using the SBI or M-mode timers.
VIMIX can run bare-metal (booting in M-mode) or via a SBI compatible environment in S-mode. See SBI_SUPPORT
in MakefileCommon.mk
.
The root file system can be on a ramdisk, either embedded in the kernel binary or loaded by the boot loader from a file. On qemu it can also be a virtio device. See make file variables VIRTIO_DISK
, RAMDISK_EMBEDDED
and RAMDISK_BOOTLOADER
.
The file param.h
sets various system values like the maximum supported CPUs or processes. It also contains debug switches which enable additional runtime tests.
Some user space apps compile on the host (tested on Linux).
make host
The binaries end up in build_host/root/usr/bin
. See .vscode/launch.json
on how to debug them running on the host.
Up: README
build_instructions | debugging | run_on_qemu | run_on_spike | run_on_visionfive2 | overview_directories | architectures | kernel | user space