"${o_qemu_extra[@]}"
}
+start_qemu_riscv() {
+ local is64
+ local qemu_exe
+ local rootfs="$o_rootfs"
+ local kernel="$o_kernel"
+ local mach="${o_mach:-virt}"
+
+ # o_subtarget can be xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, etc..
+ is64="$(echo $o_subtarget | grep -o 64)"
+ qemu_exe="qemu-system-riscv$is64"
+
+ [ -n "$kernel" ] || kernel="$o_bindir/openwrt-riscv64-${o_subtarget%-*}-vmlinux-initramfs.elf"
+
+ [ -z "$rootfs" ] || {
+ if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
+ gunzip "$rootfs.gz"
+ fi
+ o_qemu_extra+=( \
+ "-drive" "file=$rootfs,format=raw" \
+ "-append" "root=/dev/sda rootwait" \
+ )
+ }
+
+ [ -z "$o_network" ] || {
+ o_qemu_extra+=(
+ -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN"
+ -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN"
+ )
+ }
+
+ "$qemu_exe" -machine "$mach" -nographic \
+ -kernel "$kernel" \
+ "${o_qemu_extra[@]}"
+}
+
start_qemu_x86() {
local qemu_exe
local kernel="$o_kernel"
case "$o_target" in
armvirt) start_qemu_armvirt ;;
malta) start_qemu_malta ;;
+ riscv) start_qemu_riscv ;;
x86) start_qemu_x86 ;;
*)
__errmsg "target $o_target is not supported yet"