qemush/qemu/launchers/kvm

26 lines
494 B
Text
Raw Normal View History

2024-03-09 23:28:50 +01:00
#!/usr/bin/env sh
set -x
# What processor architecture to use
arch=$QEMUSH_ARCH
[ -z "$arch" ] && arch=$(uname -m)
2024-03-09 23:28:50 +01:00
# How many CPU cores to use
nproc=$QEMUSH_NPROC
[ -z "$nproc" ] && nproc=$(($(nproc) / 2))
2023-12-13 12:41:28 +01:00
2024-03-09 23:28:50 +01:00
# How much RAM to use
ram=$QEMUSH_RAM
[ -z "$ram" ] && ram=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K
2023-12-13 12:41:28 +01:00
2024-03-09 23:28:50 +01:00
# Set the arguments
set -- "qemu-system-${arch}" \
2024-03-09 23:28:50 +01:00
-enable-kvm \
-M q35 \
-cpu host -smp "$nproc" \
-m "$ram" \
"$@"
2023-12-13 12:41:28 +01:00
2024-03-09 23:28:50 +01:00
# Start the machine
exec "$@"