Boot OpenSBI without compressed instructions

This commit is contained in:
Rodrigo Arias 2024-01-17 15:00:19 +01:00
parent a6a958a9df
commit 3f8b6388f7

View File

@ -1,9 +1,10 @@
#! /nix/store/r4vxljid3iq94jp7qvd639sps0fscwy3-bash-5.2-p15/bin/bash #! /nix/store/r4vxljid3iq94jp7qvd639sps0fscwy3-bash-5.2-p15/bin/bash
set -e set -ex
export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH 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}") NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./visionfive-nix.qcow2}")
if ! test -e "$NIX_DISK_IMAGE"; then if ! test -e "$NIX_DISK_IMAGE"; then
@ -26,22 +27,34 @@ system=$(readlink -f ./current-system)
echo $system echo $system
sleep 1 sleep 1
cd "$TMPDIR" cd "$TMPDIR"
#QEMU_KERNEL_PARAMS="boot.debug1devices" #QEMU_KERNEL_PARAMS="boot.debug1devices"
#QEMU_KERNEL_PARAMS="boot.trace boot.debug1" #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. # Start QEMU.
exec qemu-system-riscv64 \ exec qemu-system-riscv64 \
$DEBUG_GDB \
$DEBUG_CPU \
-name visionfive-nix \ -name visionfive-nix \
-m 1024 \ -m 1024 \
-smp 1 \ -smp 1 \
-nographic \ -nographic \
-machine virt \ -machine virt \
-device virtio-rng-pci \ -device virtio-rng-pci \
$TRAP_COMPRESSED \
$CUSTOM_BIOS \
-netdev user,id=net0,hostfwd=tcp::60022-:22 -device virtio-net-device,netdev=net0 \ -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=/nix/store,security_model=none,mount_tag=nix-store \
-virtfs local,path="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \ -virtfs local,path="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \