Skip to content

Commit 81b9a24

Browse files
committed
content: Add documentation for preparing QEMU for CH
CH is abbreviated from Cloud-Hypervisor, this document is used to prepare the development environment for CH on RISC-V 64-bit. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
1 parent ccb22e0 commit 81b9a24

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Heterogeneous Runner
2+
3+
RISC-V SoC with H ext. and AIA equipped is not available at the time of writing
4+
(Oct 22nd 2024), so I conduct my development of RISC-V virtualization software
5+
stack on virtual machines emulated by QEMU (v9.1.0), on x86_64 hosts.
6+
7+
## Setup
8+
9+
### Host
10+
11+
Output of `neofetch`:
12+
13+
```
14+
❯ neofetch
15+
.-/+oossssoo+/-. root@cloud-hypervisor-riscv64
16+
`:+ssssssssssssssssss+:` -----------------------------
17+
-+ssssssssssssssssssyyssss+- OS: Ubuntu 24.04.1 LTS x86_64
18+
.ossssssssssssssssssdMMMNysssso. Host: MS-7E16 1.0
19+
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 6.8.0-47-generic
20+
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 3 days, 21 hours, 26 mins
21+
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 909 (dpkg)
22+
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: bash 5.2.21
23+
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Terminal: /dev/pts/0
24+
ossyNMMMNyMMhsssssssssssssshmmmhssssssso CPU: AMD Ryzen 9 9950X (32) @ 7.487GHz
25+
ossyNMMMNyMMhsssssssssssssshmmmhssssssso GPU: AMD ATI 15:00.0 Device 13c0
26+
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Memory: 3444MiB / 61876MiB
27+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
28+
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
29+
+sssssssssdmydMMMMMMMMddddyssssssss+
30+
/ssssssssssshdmNNNNmyNMMMMhssssss/
31+
.ossssssssssssssssssdMMMNysssso.
32+
-+sssssssssssssssssyyyssss+-
33+
`:+ssssssssssssssssss+:`
34+
.-/+oossssoo+/-.
35+
```
36+
37+
I'm using Ubuntu 24.04 LTS so I guess there would not be any serious blockers if
38+
you use this version or any version above that. And I suggest you to pick a CPU
39+
with high frequency, since we are going to emulate a heterogeneous virtual
40+
machine, you are going to need it :)
41+
42+
#### QEMU
43+
44+
Generally we need to check against the upstream QEMU for features/fixes we need,
45+
since RISC-V is still under heavy development, bugs like passing the wrong
46+
`hart id` could happen, and features like `aia` or `iommu` which we very much
47+
interested could develop, just visit https://github.com/qemu/qemu to find out
48+
which version meets your requirement.
49+
50+
Below is the steps took to install QEMU manually:
51+
52+
```sh
53+
# Install dependencies to build and run QEMU
54+
DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \
55+
git python3 python3-pip ninja-build build-essential pkg-config curl bc jq \
56+
libslirp-dev libfdt-dev libglib2.0-dev libssl-dev libpixman-1-dev \
57+
flex bison
58+
59+
# Clone QEMU source code repository
60+
git clone --depth 1 --branch v9.1.0 https://gitlab.com/qemu-project/qemu.git
61+
62+
63+
pushd qemu
64+
# Prepare directory to for QEMU to be installed
65+
mkdir -p /opt/qemu
66+
# Build and install QEMU
67+
./configure --prefix=/opt/qemu && make -j$(nproc)
68+
# This requires root privilege
69+
sudo make install
70+
popd
71+
# Clean up
72+
rm -rf qemu
73+
74+
# Add line below to your .bashrc (.zshrc or scripts in profile.d/ whatever)
75+
export PATH=$PATH:/opt/qemu/bin
76+
. .bashrc
77+
```

0 commit comments

Comments
 (0)