- setup a ubuntu 21.4 desktop box in VMware/VirtualBox with minimum setup chosen.
- follow instructions here https://pdos.csail.mit.edu/6.828/2020/tools.html
You do not need to apply the hack of qemu on ubuntu 21.4
engineer@vm-ubuntu:~$ sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu
engineer@vm-ubuntu:~$ riscv64-linux-gnu-gcc --version
follow up https://pdos.csail.mit.edu/6.828/2020/xv6.html
git clone git://github.com/mit-pdos/xv6-riscv.git
cd xv6-riscv
make qemu
ctrl+a x to quit
echo set auto-load safe-path / > ~/.gdbinit
make qemu-gdb
in another console:
gdb-multiarch
file kernel/kernel
or
gdb-multiarch
file user/_echo
b main
Also verified on WSL2 (Windows 10 + Ubuntu). It works great!