From 14d870923b129f0988c554f05766f31c8d895eb1 Mon Sep 17 00:00:00 2001 From: Jeff McJunkin Date: Tue, 8 Jul 2025 15:08:22 -0700 Subject: [PATCH] feat: Initial arm64 support for VMware Fusion builds --- source.vmware-iso.pkr.hcl | 24 ++++++++++++++++++++++++ variables.pkr.hcl | 6 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/source.vmware-iso.pkr.hcl b/source.vmware-iso.pkr.hcl index 6f1b897..5828461 100644 --- a/source.vmware-iso.pkr.hcl +++ b/source.vmware-iso.pkr.hcl @@ -4,6 +4,16 @@ source "vmware-iso" "preflight" { headless = "${var.headless}" guest_os_type = "${local.guest_os_type}" + firmware = var.arch == "arm64" ? "efi" : "bios" + + vmx_data = var.arch == "arm64" ? { + "virtualHW.version" = "20" + "vhv.enable" = "TRUE" + "usb.present" = "TRUE" + "usb:1.present" = "TRUE" + "usb:1.deviceType" = "hub" + "usb:1.port" = "1" + } : {} output_directory = "${var.output_directory}/${var.name}-vmware-iso-preflight" @@ -23,6 +33,7 @@ source "vmware-iso" "preflight" { disk_size = var.disk_size disk_type_id = var.vmware_disk_type_id + disk_adapter_type = var.arch == "arm64" ? "nvme" : "lsilogic" cpus = var.cpus memory = var.memory @@ -35,6 +46,18 @@ source "vmware-iso" "preflight" { source "vmware-iso" "full" { vm_name = var.name headless = "${var.headless}" + + guest_os_type = "${local.guest_os_type}" + firmware = var.arch == "arm64" ? "efi" : "bios" + + vmx_data = var.arch == "arm64" ? { + "virtualHW.version" = "20" + "vhv.enable" = "TRUE" + "usb.present" = "TRUE" + "usb:1.present" = "TRUE" + "usb:1.deviceType" = "hub" + "usb:1.port" = "1" + } : {} output_directory = "${var.output_directory}/${var.name}-vmware-iso-full" @@ -53,6 +76,7 @@ source "vmware-iso" "full" { disk_size = var.disk_size disk_type_id = var.vmware_disk_type_id + disk_adapter_type = var.arch == "arm64" ? "nvme" : "lsilogic" cpus = var.cpus memory = var.memory diff --git a/variables.pkr.hcl b/variables.pkr.hcl index 1bb3c24..1b52868 100644 --- a/variables.pkr.hcl +++ b/variables.pkr.hcl @@ -237,7 +237,9 @@ locals { aws_instance_type = var.aws_instance_type != "" ? var.aws_instance_type : "${local.aws_instance_prefix}.xlarge" aws_ami_filter_name = var.aws_ami_source_filter_name != "" ? var.aws_ami_source_filter_name : "ubuntu/images/*ubuntu-${local.ubuntu_version_short}-${var.arch}-server-*" - ubuntu_images_url = var.ubuntu_images_url != "" ? var.ubuntu_images_url : "https://releases.ubuntu.com/${local.ubuntu_version_short}" + # Different base URLs for different architectures + ubuntu_base_url = var.arch == "arm64" ? "https://cdimage.ubuntu.com/releases/${local.ubuntu_version_short}/release" : "https://releases.ubuntu.com/${local.ubuntu_version_short}" + ubuntu_images_url = var.ubuntu_images_url != "" ? var.ubuntu_images_url : local.ubuntu_base_url ubuntu_images_iso_filename = var.ubuntu_images_iso_filename != "" ? var.ubuntu_images_iso_filename : "ubuntu-${var.ubuntu_version}-live-server-${var.arch}.iso" iso_checksum = "file:${local.ubuntu_images_url}/SHA256SUMS" @@ -255,5 +257,5 @@ locals { vmware_vmx_source = var.source_directory != "" ? var.source_directory : "${var.name}-vmware-iso" - guest_os_type = "ubuntu-64" + guest_os_type = var.arch == "arm64" ? "arm-ubuntu-64" : "ubuntu-64" } \ No newline at end of file