Tools guide

We’ll be using 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 xv6.

CSE-provided host

For this quarter we have arranged for a Linux machine to be made available to you: umnak.cs.washington.edu. You can use ssh to connect to this machine using your CSE credentials just like attu.

The CSE support has installed the tools required to build and run xv6 on umnak, so that you can use it for development and testing. To enable the toolchain and add the programs to your path, you can (in bash) run

$ export PATH=$PATH:/opt/riscv/bin

You may find it useful to add this to your .bash_profile.

Testing your installation

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

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.10):

$ 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.15 Catalina). 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"