2024-03-09 23:28:50 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -x
|
2024-01-21 22:41:00 +01:00
|
|
|
|
2024-03-11 15:11:17 +01:00
|
|
|
# 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
|
2024-03-11 15:11:17 +01:00
|
|
|
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 "$@"
|