Setup xv6-riscv Development Environment
This article introduces how to set up the development environment of xv6-riscv.
Introduction
xv6 is a re-implementation of Dennis Ritchie’s and Ken Thompson’s Unix Version 6 (v6). The main purpose of xv6 is as a teaching operating system for MIT’s 6.1810[1].
Environment
The system environment I use:
- Ubuntu 24.04.1 LTS
Installation
We need to install related cross-compilation tools, as well as QEMU to simulate the RISC-V chip. The following commands are modified from mmikaitis/xv6-tools-container/xv6-tools-container.def[2]。
1 |
|
Download xv6-riscv
1 |
|
Compile and Run
1 |
|
Now you can see the following output, which means the compilation and running are successful:
1 |
|
To exit QEMU, you can press Ctrl + A
, then press X
.
QEMU No Response After Startup
I encountered the problem of no response after starting make qemu
when setting up the environment. Finally, I found this issue. The solution provided by the related PR works. After my attempt, I can also update the system and QEMU to the latest version. I finally used Ubuntu 24.04.1 LTS
and QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.2)
.
IDE Remote Connection
The project is located on a remote Linux server. If we want to develop using a powerful IDE locally instead of using vim and other text editors on the server, we can use Clion to connect to the server via SSH for development.
After the remote connection is established, you can develop as if you were working on a local project. Run make qemu
in the terminal to run xv6-riscv.
References
- xv6-riscv. Archived on 2024-07-23. Retrieved 2024-10-15. ↩
- xv6-tools-container.def. Retrieved 2024-10-15. ↩
- 【99%环境搭建系列】xv6-riscv内核调试教程. Retrieved 2024-10-15. ↩