Skip to content

Commit

Permalink
Set CPU model as "max"
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorm committed Jul 21, 2024
1 parent ba5a153 commit 987b39e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packer/qemu/start-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ case "${QEMU_SYSTEM_BINARY#*qemu-system-}" in
x86_64)
: "${EFI_FIRMWARE_CODE:=/usr/share/edk2/x64/OVMF_CODE.4m.fd}"
: "${EFI_FIRMWARE_VARS:=/usr/share/edk2/x64/OVMF_VARS.4m.fd}"
set -- "$@" -machine q35 -smp 2 -m 1024
set -- "$@" -machine q35 -smp 2 -m 1024 -cpu max
;;
aarch64)
: "${EFI_FIRMWARE_CODE:=/usr/share/AAVMF/AAVMF_CODE.fd}"
: "${EFI_FIRMWARE_VARS:=/usr/share/AAVMF/AAVMF_VARS.fd}"
set -- "$@" -machine virt,gic-version=3 -cpu cortex-a76 -smp 2 -m 1024
set -- "$@" -machine virt,gic-version=max -cpu cortex-a76 -smp 2 -m 1024
;;
esac
set -- "$@" -nographic -serial mon:stdio
Expand All @@ -53,7 +53,7 @@ set -- "$@" -drive file="${EFI_FIRMWARE_VARS:?}",if=pflash,unit=1,format=raw,sna

# Use KVM if available
if [ -w /dev/kvm ] && [ "${QEMU_SYSTEM_BINARY#*qemu-system-}" = "$(uname -m)" ]; then
set -- "$@" -accel kvm -cpu host
set -- "$@" -accel kvm
fi

# Create a snapshot image to preserve the original image
Expand Down
8 changes: 4 additions & 4 deletions packer/sources.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ source "qemu" "main" {

headless = true
accelerator = var.qemu_binary == "qemu-system-aarch64" ? "none" : null
machine_type = var.qemu_binary == "qemu-system-aarch64" ? "virt,gic-version=3" : "q35"
cpu_model = var.qemu_binary == "qemu-system-aarch64" ? "cortex-a76" : null
machine_type = var.qemu_binary == "qemu-system-aarch64" ? "virt,gic-version=max" : "q35"
cpu_model = var.qemu_binary == "qemu-system-aarch64" ? "cortex-a76" : "max"
cpus = 2
memory = 1024
qemu_binary = var.qemu_binary
Expand Down Expand Up @@ -93,8 +93,8 @@ source "qemu" "baremetal" {

headless = true
accelerator = var.qemu_binary == "qemu-system-aarch64" ? "none" : null
machine_type = var.qemu_binary == "qemu-system-aarch64" ? "virt,gic-version=3" : "q35"
cpu_model = var.qemu_binary == "qemu-system-aarch64" ? "cortex-a76" : null
machine_type = var.qemu_binary == "qemu-system-aarch64" ? "virt,gic-version=max" : "q35"
cpu_model = var.qemu_binary == "qemu-system-aarch64" ? "cortex-a76" : "max"
cpus = 2
memory = 1024
qemu_binary = var.qemu_binary
Expand Down

0 comments on commit 987b39e

Please sign in to comment.