In ASU's Advanced Operating System course (CSE 536), we are using the xv6 Operating System for programming assignments. xv6 is a teaching-focused OS designed by some incredible folks at MIT (link). This README explains how to setup QEMU and a GNU RISC-V toolchain, needed for running xv6, as well how to boot up a QEMU VM with xv6.
- Boot Rom and Bootloader
- Process Memory Management
- User-Level Thread Management
- Trap and Emulate Virtualization
Follow the below steps to setup necessary dependencies for developing xv6 OS.
Please reach out to the TAs if you have any installation issues.
- Navigate to the install/linux-wsl folder
- Install RISC-V QEMU:
./linux-qemu.sh
- Install RISC-V toolchain:
./linux-toolchain.sh
- Add installed binaries to path:
source .add-linux-paths
- Navigate to the install/mac folder
- Install RISC-V QEMU:
./mac-qemu.sh
- Install RISC-V toolchain:
./mac-toolchain.sh
- Add installed binaries to path:
source .add-mac-paths
If installing QEMU and the toolchain from source does not work for you, then do the following steps:
- Linux/WSL
- sudo apt-get update
- sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu
- Mac (work in progress)
- xcode-select --install
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
- eval "$(/opt/homebrew/bin/brew shellenv)"
- brew tap riscv/riscv
- brew install riscv-tools
- Write the follwing line to ~/.zshrc " export PATH="/opt/homebrew/Cellar/riscv-gnu-toolchain/main/bin:$PATH" "
- source ~/.zshrc
- brew install qemu
- brew link qemu
- brew link --overwrite qemu (Run this if you can't link qemu due to any conflicts)
-
Navigate back to main folder and clone the xv6 OS using
git clone https://github.com/mit-pdos/xv6-riscv.git
-
Navigate to xv6-riscv and run
make qemu
- While running linux-qemu.sh, if you run into
ERROR: glib-2.48 gthread-2.0 is required to compile QEMU
, then :
- Run this command in the terminal.
sudo apt install libglib2.0-dev
. This is caused due to a newer version of your linux distro(link).
- linux-qemu.sh :
../meson.build:328:2: ERROR: Dependency "pixman-1" not found, tried pkgconfig
- Can be resolved by running
sudo apt install libpixman-1-dev
(link)