Building a kernel for Qemu's riscv virtual machine from scratch in Rust.
- uses OpenSBI, a sort of BIOS that Qemu defaults to, to simplify some peripheral interactions
- I am trying to use as few dependencies and as little assembly as possible
- Rust
- riscv64 target:
rustup target add riscv64gc-unknown-none-elf qemu-system-riscv64(e.gsudo dnf install qemu-system-riscvon Fedora)riscv64-unknown-elftoolchain (providing gdb and binutils)
To compile the latter from source see riscv-gnu-toolchain
make buildto build the kernel ELF imagemake textdump dissassembled text sectionmake qemuto run in qemumake qemu-gdbto run in debuggable qemu sessionmake gdbto debug running debuggable qemu session
OpenSBI selects a hart as boot core and jumps to kernel. Kernel has to start up other harts by itself.
- https://github.com/mit-pdos/xv6-riscv
- https://osblog.stephenmarz.com/
- many more, TODO: add