diff --git a/debian/Makefile b/debian/Makefile index 89bd345..4c03d36 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -26,6 +26,12 @@ ifeq ($(strip $(ARCH)),arm64) boot = uefi endif +ifeq ($(wildcard /usr/share/OVMF/OVMF_CODE.fd),) + OVMF_SFX ?= _4M +else + OVMF_SFX ?= +endif + .PHONY: all clean all: debian @@ -47,6 +53,7 @@ debian: check-deps clean -var debian_series=${SERIES} \ -var debian_version=${VERSION} \ -var architecture=${ARCH} \ + -var ovmf_suffix=${OVMF_SFX} \ -var boot_mode=${BOOT} \ -var timeout=${TIMEOUT} . diff --git a/debian/debian-cloudimg.pkr.hcl b/debian/debian-cloudimg.pkr.hcl index 9c9c8bd..5902e13 100644 --- a/debian/debian-cloudimg.pkr.hcl +++ b/debian/debian-cloudimg.pkr.hcl @@ -46,7 +46,7 @@ source "qemu" "cloudimg" { ["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"], ["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"], ["-device", "virtio-gpu-pci"], - ["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.fd"], + ["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE${var.ovmf_suffix}.fd"], ["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"], ["-drive", "file=output-cloudimg/packer-cloudimg,format=qcow2"], ["-drive", "file=seeds-cloudimg.iso,format=raw"] @@ -66,7 +66,7 @@ build { provisioner "shell-local" { inline = [ - "cp /usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd ${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd", + "cp /usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_VARS${var.ovmf_suffix}.fd ${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd", "cloud-localds seeds-cloudimg.iso user-data-cloudimg meta-data" ] inline_shebang = "/bin/bash -e" diff --git a/debian/debian-cloudimg.variables.pkr.hcl b/debian/debian-cloudimg.variables.pkr.hcl index 4f5a79f..80cf034 100644 --- a/debian/debian-cloudimg.variables.pkr.hcl +++ b/debian/debian-cloudimg.variables.pkr.hcl @@ -39,3 +39,9 @@ variable "architecture" { default = "amd64" description = "The architecture to build the image for (amd64 or arm64)" } + +variable "ovmf_suffix" { + type = string + default = "" + description = "Suffix for OVMF CODE and VARS files. Newer systems such as Noble use _4M." +}