mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
build_library/qemu_template.sh: Simplify qemu execution
The final part of the script differed only the name of the qemu binary to execute and in network device driver (virtio-net-pci on amd64 vs virtio-net-device on arm64). virtio-net-pci seems to be working also on arm64, so simplify the code to avoid repetition.
This commit is contained in:
parent
b3dd088469
commit
36ee8ed43a
@ -291,25 +291,18 @@ fi
|
|||||||
|
|
||||||
case "${VM_BOARD}" in
|
case "${VM_BOARD}" in
|
||||||
amd64-usr)
|
amd64-usr)
|
||||||
# Default to KVM, fall back on full emulation
|
QEMU_BIN=qemu-system-x86_64 ;;
|
||||||
qemu-system-x86_64 \
|
arm64-usr)
|
||||||
|
QEMU_BIN=qemu-system-aarch64 ;;
|
||||||
|
*) die "Unsupported arch" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
"$QEMU_BIN" \
|
||||||
-name "$VM_NAME" \
|
-name "$VM_NAME" \
|
||||||
-m ${VM_MEMORY} \
|
-m ${VM_MEMORY} \
|
||||||
-netdev user,id=eth0${QEMU_FORWARDED_PORTS:+,}${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \
|
-netdev user,id=eth0${QEMU_FORWARDED_PORTS:+,}${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \
|
||||||
-device virtio-net-pci,netdev=eth0 \
|
-device virtio-net-pci,netdev=eth0 \
|
||||||
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
||||||
"$@"
|
"$@"
|
||||||
;;
|
|
||||||
arm64-usr)
|
|
||||||
qemu-system-aarch64 \
|
|
||||||
-name "$VM_NAME" \
|
|
||||||
-m ${VM_MEMORY} \
|
|
||||||
-netdev user,id=eth0${QEMU_FORWARDED_PORTS:+,}${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \
|
|
||||||
-device virtio-net-device,netdev=eth0 \
|
|
||||||
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
|
||||||
"$@"
|
|
||||||
;;
|
|
||||||
*) die "Unsupported arch" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
Loading…
Reference in New Issue
Block a user