#!/bin/bash

# issue "zstd -d xxxxxx.zst" to decompress the disk image
# issue "sh ./start-qemu-riscv64.sh" to run this script
# default "root" passwd is "Slack1@#$5" (without quotation marks)
# login with "ssh root@localhost -p 51550" (or configured port)
# issue "nano /etc/resolv.conf" to edit DNS nameserver
# issue "poweroff" to shutdown normally and "reboot" to reboot
# press Ctrl-A and then press X in QEMU console to force poweroff

qemu-system-riscv64 \
  -nographic -machine virt \
  -smp 8 -m 8G \
  -bios fw_payload.bin \
  -device virtio-net-device,netdev=usernet \
  -netdev user,id=usernet,hostfwd=tcp::51550-:22 \
  -drive file=slackware-riscv64-15.0.20220725-alfa.rawimg,format=raw,if=virtio \
