+run_qemu() +{
The below "case ... arch_option= esac" lines can be made a standalone function too.
- case "$qemu" in
qemu-system-aarch64)
arch_option=(
-machine virt-4.0,accel=kvm,gic-version=3
-cpu Kunpeng-920
-bios $bios
-nic $nic
)
;;
qemu-kvm)
[ "$(arch)" == "aarch64" ] && arch_option=(
-machine virt-4.0,accel=kvm,gic-version=3
-cpu Kunpeng-920
-bios $bios
-nic $nic
)
[ "$(arch)" == "x86_64" ] && arch_option=(
-bios $bios
-nic $nic
)
;;
qemu-system-x86_64)
arch_option=(
-bios $bios
-nic $nic
)
;;
qemu-system-riscv64)
arch_option=(
-machine virt
-device virtio-net-device,netdev=net0,mac=${mac}
-netdev bridge,br=br0,id=net0,helper=${helper}
)
;;
- esac
Then let run_qemu() only call the below line.
- "${kvm[@]}" "${arch_option[@]}" --append "${append}"
Thanks, Fengguang
}
check_logfile write_logfile
-qemu_command parse_ipxe_script check_option_value -get_initrd
+set_initrd +set_bios +set_helper +set_nic +set_device +set_netdev +set_qemu
print_message
+public_option run_qemu -- 2.23.0