parch-riscv/startqemu.sh
Felix Yan 0220aa7859
Fix startqemu.sh for new QEMU (#20)
Latest QEMU (9.1.0 here) breaks here without this change:

> Drive 'hd0' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?)
2024-09-24 15:12:39 +08:00

30 lines
772 B
Bash
Executable file

#!/usr/bin/bash
#
# SPDX-FileCopyrightText: 2022 Celeste Liu <coelacanthus@outlook.com>
# SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=1091
. /usr/share/makepkg/util.sh
colorize
parse-args() {
local OPTIND=1
shift "$(( OPTIND-1 ))"
file=${1:-archriscv-$(date --rfc-3339=date).qcow2}
}
parse-args "$@"
msg "Starting qemu"
qemu-system-riscv64 \
-nographic \
-machine virt \
-smp 8 \
-m 4G \
-netdev user,id=n0 -device virtio-net,netdev=n0 \
-bios ./opensbi_fw_payload.bin \
-device virtio-blk-device,drive=hd0 \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-drive file="$file",format=qcow2,id=hd0,if=none \
-monitor unix:/tmp/qemu-monitor,server,nowait