?ueCpG>5P%o_
1. 环境安装好vmware ,里面装个linux系统,比如ubuntu
2. 虚拟机里面安装qemu
sudo apt update
sudo apt install qemu qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
3. 虚拟机里面git下载Xv6
git clone https://github.com/mit-pdos/xv6-riscv.git
4. 进入xv6-riscv,执行make qemu命令,就可以直接跑起来xv6系统了
如果报错,就安装对应的包
sudo apt install binutils-riscv64-linux-gnu
sudo apt install gcc-riscv64-linux-gnu
sudo apt install gdb-multiarch
sudo apt install qemu-system-misc opensbi u-boot-qemu qemu-utils
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -global virtio-mmio.force-legacy=false -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
make: qemu-system-riscv64: Command not found
Makefile:172: recipe for target 'qemu' failed
make: *** [qemu] Error 127
配置编译 RISC-V 支持:
./configure --target-list=riscv64-softmmu
make -j$(nproc)
sudo make install
https://stackoverflow.com/questions/33277246/qemu-system-riscv-command-not-found
https://nn0310.xn--8stx8olrwkucjq3b.com/link/8s81fB84wOfPwEFh?clash=1
①qemu: wget https://download.qemu.org/qemu-9.1.1.tar.xz tar xvJf qemu-9.1.1.tar.xz cd qemu-9.1.1 sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ gawk build-essential bison flex texinfo gperf libtool patchutils bc \ zlib1g-dev libexpat-dev git \ libglib2.0-dev libfdt-dev libpixman-1-dev \ libncurses5-dev libncursesw5-dev ./configure --prefix=/opt/qemu --target-list=riscv64-softmmu,riscv64-linux-user (如果缺少包报错,就把包安装就行) make -j $(nproc) sudo make install qemu-system-riscv64 -version (这里可能输出的是6.2.0版本的) /opt/qemu/bin/qemu-system-riscv64 --version (这个测试以下,看qemu版本是不是9.1.1) export PATH=/opt/qemu/bin:$PATH qemu-system-riscv64 -version (执行这一条,重新看版本是不是变了) ②RISC-V 工具链 sudo apt install gcc-riscv64-unknown-elf (我是ubuntu22.04,可以用这个直接下载。可以问一下gpt看能不能用这个,不能的话就很麻烦,先省略) ③xv6-riscv(先确定前面的qemu版本是对的) git clone https://github.com/mit-pdos/xv6-riscv.git cd xv6-riscv make make qemu