add x86_64 and riscv64 qemu command and options.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- providers/qemu/kvm.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 0c98065..6a1807f 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -25,6 +25,7 @@ qemu_command() { qemu=( qemu-system-aarch64 + qemu-system-x86_64 qemu-kvm )
@@ -74,6 +75,11 @@ check_option_value() } [ -n "$initrds" ] || exit + + [ -n "$(echo $kernel | grep "riscv64")" ] && qemu=qemu-system-riscv64 + + ls $bios >/dev/null 2>&1 || bios=/usr/share/ovmf/OVMF.fd + ls $helper >/dev/null 2>&1 || helper=/usr/lib/qemu/qemu-bridge-helper }
get_initrd() @@ -122,6 +128,17 @@ individual_option() -bios $bios -nic $nic ) + + x86_64=( + -bios $bios + -nic $nic + ) + + riscv64=( + -machine virt + -device virtio-net-device,netdev=net0,mac=${mac} + -netdev bridge,br=br0,id=net0,helper=${helper} + ) }
run_qemu() @@ -132,6 +149,13 @@ run_qemu() ;; qemu-kvm) [ "$(arch)" == "aarch64" ] && kvm=("${kvm[@]}" "${aarch64[@]}") + [ "$(arch)" == "x86_64" ] && kvm=("${kvm[@]}" "${x86_64[@]}") + ;; + qemu-system-x86_64) + kvm=("${kvm[@]}" "${x86_64[@]}") + ;; + qemu-system-riscv64) + kvm=("${kvm[@]}" "${riscv64[@]}") ;; esac