From 3f8b6388f7516e3be8908b0ba71d9bc4d5ef74a5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 17 Jan 2024 15:00:19 +0100 Subject: [PATCH] Boot OpenSBI without compressed instructions --- run-visionfive-nix-vm.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/run-visionfive-nix-vm.sh b/run-visionfive-nix-vm.sh index 1e0f94c..f573ead 100755 --- a/run-visionfive-nix-vm.sh +++ b/run-visionfive-nix-vm.sh @@ -1,9 +1,10 @@ #! /nix/store/r4vxljid3iq94jp7qvd639sps0fscwy3-bash-5.2-p15/bin/bash -set -e +set -ex export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH +CDIR=$(readlink -f "$PWD") NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./visionfive-nix.qcow2}") if ! test -e "$NIX_DISK_IMAGE"; then @@ -26,22 +27,34 @@ system=$(readlink -f ./current-system) echo $system sleep 1 - cd "$TMPDIR" #QEMU_KERNEL_PARAMS="boot.debug1devices" #QEMU_KERNEL_PARAMS="boot.trace boot.debug1" +# Trap the CPU on compressed instructions? +TRAP_COMPRESSED="-cpu rv64,c=false" + +#CUSTOM_BIOS="-bios $CDIR/bios-nc.bin" +CUSTOM_BIOS="-bios $CDIR/bios.bin" +#CUSTOM_BIOS="-bios opensbi-1.4-rv-bin/share/opensbi/lp64/generic/firmware/fw_payload.bin" +#DEBUG_GDB="-s -S" +DEBUG_CPU="-d cpu_reset" +#DEBUG_CPU="-d in_asm,cpu,cpu_reset" # Start QEMU. exec qemu-system-riscv64 \ + $DEBUG_GDB \ + $DEBUG_CPU \ -name visionfive-nix \ -m 1024 \ -smp 1 \ -nographic \ -machine virt \ -device virtio-rng-pci \ + $TRAP_COMPRESSED \ + $CUSTOM_BIOS \ -netdev user,id=net0,hostfwd=tcp::60022-:22 -device virtio-net-device,netdev=net0 \ -virtfs local,path=/nix/store,security_model=none,mount_tag=nix-store \ -virtfs local,path="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \