MIT6.S081-实验环境搭建
结合Tools和Lab Utilities
-
Download VMware Player (free for Linux and Windows, registration required)
-
Download a boot disk image for Ubuntu Desktop
-
This will download a file named something like ubuntu-18.04.3-desktop-amd64.iso. Start up your virtualization platform and create a new (64-bit) virtual machine.Use the downloaded Ubuntu image as a boot disk; the procedure differs among VMs but is pretty simple.
-
Make sure you are running either “bullseye” or “sid” for your debian version (on ubuntu this can be checked by running cat /etc/debian_version), then run:
sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu
-
克隆源码
$ git clone git://g.csail.mit.edu/xv6-labs-2020
-
At this moment in time, it seems that the package qemu-system-misc has received an update that breaks its compatibility with our kernel. If you run make qemu and the script appears to hang after
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
you’ll need to uninstall that package and install an older version:$ sudo apt-get remove qemu-system-misc $ sudo apt-get install qemu-system-misc=1:4.2-3ubuntu6
-
验证测试
$ riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc (GCC) 10.1.0
…
$ qemu-system-riscv64 --version
QEMU emulator version 5.1.0
# in the xv6 directory
$ make qemu
# … lots of output …
init: starting sh
$
-
To quit qemu type: Ctrl-a x(按Ctrl-a松开后,再按x)