Thursday, May 7, 2020

RISC-v emulator

Changes are based on https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html

For Ubuntu/Debian, in addition to

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

You will need the development headers for

sudo apt-get install libglib2.0-dev libpixman-1-dev libncurses-dev


Before building Busybear Linux, you will need to softlink riscv-pk into busy bear-linux because git checkout put riscv-pk into the riscv64-linux.


cd riscv64-linux/busybear-linux
rm -rf src/riscv-pk
ln -s ../riscv-pk src/


You need to enable the following modules within .config in the linux folder.

CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y


Start the QEMU emulator with the following command:

  sudo qemu-system-riscv64 \
        -nographic \
        -machine virt \
        -kernel riscv-pk/build/bbl \
        -append "root=/dev/vda ro console=ttyS0" \
        -drive file=busybear-linux/busybear.bin,format=raw,id=hd0 \
        -device virtio-blk-device,drive=hd0 \
        -netdev type=tap,script=./ifup,downscript=./ifdown,id=net0 \
        -device virtio-net-device,netdev=net0


RISC-v emulator

Changes are based on https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html For Ubuntu/Debian, in addition to sud...