Tingwei
Posted on June 7, 2021
There're three parts:
- riscv-gnu-toolchain installation
- qemu installation
- build xv6-riscv
Part1: riscv-gnu-toolchain installation
Env: macOS Catalina
10.15.7
Step1:
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
Although it doesn't need
--recursive
in README, this issue still happened on mac.
Step2:
brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat
Step3:
cd riscv-gnu-toolchain
./configure --prefix=/opt/riscv --enable-multilib
To build either cross-compiler with support for both 32-bit and 64-bit
Step4: find your .zshrc
, append this line
export PATH="$PATH:/opt/riscv/bin"
and then
source .zshrc
Part2: qemu installation
After installing riscv-gnu-toolchain, I chose to building qemu for macOS first and installed qemu.
Step 1: install prerequisites
brew install libffi gettext glib pkg-config autoconf automake pixman ninja
Step2: pull the source of qemu
curl -L https://download.qemu.org/qemu-5.2.0.tar.xz > qemu-5.2.0.tar.xz
Step3: unzip
tar xf qemu-5.2.0.tar.xz
Step4: build and install qemu
cd qemu-5.2.0
and
mkdir build && cd build
../confgiure`
make
make install
Part3: build xv6-riscv
After installing
qemu
sucessfully, let's start to build xv6-riscv
Step1: Pull the source of xv6-riscv
git clone git://github.com/mit-pdos/xv6-riscv-fall19.git
Step2:
cd xv6-riscv-fall19
and
make
make qemu
That's it!
Thanks for your reading~
💖 💪 🙅 🚩
Tingwei
Posted on June 7, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.