This is a microkernel created at the University of Bamberg as part of a Bachelor/Master project at the chair for system-oriented programming under the supervision of Professor Michael Engel and scientific assistant Timo Renk.
The simplest way to run the microkernel is to use the Visual Studio Dev Containers. You only need to have Docker and the Dev Container Extension installed. All required tools will be installed using the post-install script ( .devcontainer/postinstall.sh). Since those tools are not shipped directly with the docker image at the moment, the post-install script might take some time to complete.
If you do not want to take the docker route, you will need:
- Rustup for installing the Rust language itself and for toolchain management
- Cargo for building and package management
- The Qemu emulator, in which the kernel will be run
- GDB-Multiarch for debugging
- Cargo-Binutils for invoking the LLVM tools You will also need to:
- Install the
riscv64gc-unknown-none-elf
target usingrustup target add riscv64gc-unknown-none-elf
- Add the
llvm-tools-preview
usingrustup component add llvm-tools-preview
You can also check out the .devcontainer/postinstall.sh
for the commands used to install those tools in the container.
On Windows it's not as straightforward to install some of those tools and you may need to use something like MSYS2. Therefore I would recommend either using the dev containers or WSL on Windows.
Once all the required tools are installed, the project can be compiled and run using the provided tasks (Shortcut Strg+Alt+R
).
- Use
Build riscv_rust_os
to build the binaries for the kernel. - Use
Build user binaries
to build the binaries for the user processes to be run - Finally, use
Debug riscv_rust_os
to fire up qemu with the compiled kernel
Now qemu is running with the given binary! But to get anything from the emulator, the visual studio debugger needs to connect to the debug server.
How to connect to the server is already set up in launch.json, so simply pressing F5
should suffice to connect to the debug server.
To see what instruction is executed at the moment, you can open the Disassembly View
using the Command Palette (Keyboard Shortcut: F1
).
For convenience, there is also the Build all and Debug
task, which combines all of the above steps into one.
- Michael Engel ([email protected]) provided invaluable guidance and knowledge about microkernels, operating systems, hardware and so much more.
- Timo Renk ([email protected]) provided a very solid foundation of an operating system already running in qemu. This foundation enabled us to dive right into the development of the microkernel, without first having to figure out how to run the kernel in qemu. He also held a series of tutorials on the rust programming language, which was very useful since it was completely new for the rest of us.
- Fabian Adam ([email protected])
- Leonhard Kohn ([email protected])
- Tobias Treuheit ([email protected])
- Max Meidinger ([email protected])
Here are some resources that were either used for the development of the kernel or might be useful for some further development. This list will be expanded as development progresses.
[Register]https://en.wikichip.org/wiki/risc-v/registers https://github.com/riscv-non-isa/riscv-sbi-doc/blob/master/riscv-sbi.adoc#system-reset-extension-eid-0x53525354-srst https://github.com/riscv/riscv-isa-manual/#readme https://github.com/rust-embedded/riscv [Register]
https://osblog.stephenmarz.com/ch0.html https://os.phil-opp.com/ https://github.com/sgmarz/osblog/blob/master/risc_v/src/lds/virt.lds https://github.com/skyzh/core-os-riscv/blob/master/kernel/src/uart.rs https://docs.rust-embedded.org/book/start/qemu.html https://www.lammertbies.nl/comm/info/serial-uart
https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc