Add qemu support for Lagarto Ox

The network is still not working automatically, but the eth0 device is
present in the host.

Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
2024-10-14 14:26:59 +02:00
committed by Rodrigo Arias Mallo
parent ccf41b441d
commit 8da3468ee2
4 changed files with 71 additions and 22 deletions

15
boot.sh
View File

@@ -27,7 +27,7 @@ fi
# Create a directory for exchanging data with the VM.
mkdir -p "$TMPDIR/xchg"
system="$NIXOS_SYSTEM_TOPLEVEL"
system="$TOPLEVEL"
echo "Booting $system"
cd "$TMPDIR"
@@ -37,7 +37,7 @@ cd "$TMPDIR"
#QEMU_KERNEL_PARAMS="boot.trace boot.debug1"
# Trap the CPU on compressed instructions?
TRAP_COMPRESSED="-cpu rv64,c=false"
#TRAP_COMPRESSED="-cpu rv64,c=false"
CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_payload.bin"
#CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_jump.elf"
@@ -45,11 +45,10 @@ CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_payload.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 cpu_reset"
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
# Start QEMU.
exec qemu-system-riscv64 \
$DEBUG_GDB \
$DEBUG_CPU \
@@ -60,18 +59,16 @@ exec qemu-system-riscv64 \
-machine virt \
-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="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \
-virtfs local,path="$TMPDIR"/xchg,security_model=none,mount_tag=xchg \
-device virtio-keyboard \
-drive "file=$NIX_DISK_IMAGE,if=none,id=hd0" \
-device virtio-blk-device,drive=hd0 \
-device loader,addr=0x84000000,file=$system/kernel \
-kernel $system/kernel \
-initrd $system/initrd \
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS"
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS" \
$QEMU_OPTS \
"$@"