Tools guide

You’ll use two sets of tools in this class: QEMU, a machine emulator for running your kernel; and a compiler toolchain, including assembler, linker, C compiler, and debugger, for compiling and testing your kernel.

If you want to work on the Attu cluster, we have set up these tools there. You can log into Attu with ssh attu.cs.washington.edu. Run the following command or add it to your shell’s startup file (e.g., .bashrc for bash), and you’re all set:

export PATH="/cse/courses/csep551/19au/riscv/bin:$PATH"

Labs will be graded on Attu, so make sure that your code works there.

Installing on Linux

If you want to work on your own Linux, a recent version of Debian/Ubuntu/Fedora/Arch should work.

Ubuntu (tested on 19.04):

$ apt-get install git build-essential gdb-multiarch
$ apt-get install qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu

Arch:

$ pacman -S riscv64-linux-gnu-binutils riscv64-linux-gnu-gcc riscv64-linux-gnu-gdb qemu-arch-extra

Check that the tools on your Linux are up-to-date (QEMU 4.1, Bintuils 2.32, and GCC 9.2 recommended). If necessary, update your Linux distribution, or build QEMU and the RISC-V compiler toolchain from source code.

Running a Linux VM

If you are using other operating systems, an easier option is to run a Linux virtual machine, in two steps. First, install a virtualization platform, such as QEMU, VirtualBox, VMware Player, or VMware Fusion. Next, create a VM to install a Linux distribution of your choice.

We do not recommend using the CSE VM (CentOS), as its toolchains are out-of-date (unless you want to build them from source code yourself).

Installing on macOS

It is possible to install the toolchains on macOS (tested on 10.14 Mojave). First, install Homebrew. Then, type the following commands:

$ brew tap riscv/riscv
$ brew install qemu riscv-tools

If the brew formula doesn’t link into /usr/local, you will need to run the following command or add it to your shell’s startup file (e.g. .bashrc for bash):

export PATH="$PATH:/usr/local/opt/riscv-gnu-toolchain/bin"

Testing your installation

Proceed to the first lab to fetch the xv6 source and run xv6.