diff --git a/ubuntu/ubuntu-cloudimg.pkr.hcl b/ubuntu/ubuntu-cloudimg.pkr.hcl index be495b9..989d7f5 100644 --- a/ubuntu/ubuntu-cloudimg.pkr.hcl +++ b/ubuntu/ubuntu-cloudimg.pkr.hcl @@ -2,18 +2,27 @@ locals { qemu_arch = { "amd64" = "x86_64" "arm64" = "aarch64" + "riscv64" = "riscv64" + } + uefi_dir = { + "amd64" = "OVMF" + "arm64" = "AAVMF" + "riscv64" = "qemu-efi-riscv64" } uefi_imp = { "amd64" = "OVMF" "arm64" = "AAVMF" + "riscv64" = "RISCV_VIRT" } qemu_machine = { "amd64" = "ubuntu,accel=kvm" "arm64" = "virt" + "riscv64" = "virt,acpi=off" } qemu_cpu = { "amd64" = "host" "arm64" = "cortex-a57" + "riscv64" = "rv64" } proxy_env = [ @@ -46,7 +55,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_dir, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.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 +75,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_dir, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_VARS.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/ubuntu/ubuntu-cloudimg.variables.pkr.hcl b/ubuntu/ubuntu-cloudimg.variables.pkr.hcl index 8267e08..adf566b 100644 --- a/ubuntu/ubuntu-cloudimg.variables.pkr.hcl +++ b/ubuntu/ubuntu-cloudimg.variables.pkr.hcl @@ -25,5 +25,5 @@ variable "customize_script" { variable "architecture" { type = string default = "amd64" - description = "The architecture to build the image for (amd64 or arm64)" + description = "The architecture to build the image for (amd64, arm64, or riscv64)" }