This is a small hobbyist kernel for RISC-V. It doesn't try to be compatible with anything, but happens to go along the old Unix ways. It does preemptive multitasking, implements fork+exec system calls, and a bunch of others needed for implementation of a simple shell. It also implements pipes.
It runs in qemu, as well as several physical RISC-V SBC boards:
On Ubuntu, make prereqs
will install the prerequisite software for building.
make build-qemu-image
will build a Docker image for running qemu. This
simplifies running qemu on different versions of Ubuntu and on OSX.
With that done, you should be able to make all
to build all targets, and then
make run-virt
to actually run it in qemu.
The kernel and userland programs are built into a single binary. So the userland programs are actually just functions, located in a separate memory section. The section is isolated from the kernel memory, though, via RISC-V PMP mechanism.
On some targets the kernel supports virtual memory, and in such case the
processes are better isolated. See docs/mmu.md
for details.
Some other targets do not implement virtual memory. This is because the smallest common denominator of supported hardware is an extremely small HiFive microcontroller, with only 16kB of RAM and no MMU. This puts severe limitations. We want to maintain an ability to run in such small environments, as we intend to use this kernel on a small implementation of a RISC-V core on a modestly sized FPGA.
docs/gdb.md
).DBG=1
argument, e.g. make run-virt DBG=1
.make gdb
. Gdb will connect to the above, and
you can use it as usual.The docs/
folder contains a few documents on specific narrow
subjects, like operating a specific SBC board.
Handy RISC-V Quick References: