+++ b/providers/qemu/kvm.sh @@ -7,6 +7,9 @@ : ${nr_cpu:=1} : ${memory:=1G}
+bios=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd
Current bios var is strongly correlated with aarch64, may be you need a function to prepare `BIOS` var for different arch, such as get_bios()
+individual_option() +{
- aarch64=(
-machine virt-4.0,accel=kvm,gic-version=3
-cpu Kunpeng-920
-bios $bios
-nic $nic
- )
+}
If you want your script support many arch, how about modify `aarch64` to `APPENDS`? it looks more general.
Btw, maybe you can unify the function naming. just as the follow: get_bios() get_helper() get_nic() get_qemu_command() get_public_option() get_individual_option() run_qemu() main() { step_1 step_2 step_3 }
-------- Thanks Yu Chuan
+run_qemu() +{
case $qemu in
qemu-system-aarch64)
kvm=("${kvm[@]}" "${aarch64[@]}")
;;
qemu-kvm)
[ "$(arch)" == "aarch64" ] && kvm=("${kvm[@]}" "${aarch64[@]}")
;;
esac
"${kvm[@]}" --append "${append}"
} @@ -112,7 +145,11 @@ qemu_command parse_ipxe_script check_option_value get_initrd +get_nic
print_message
+public_option +individual_option
run_qemu
2.23.0