aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd-image/openbsd-arm64.pkr.hcl
blob: 3749486140f73c32910e2c9a916af43c94dd5be7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
source "qemu" "openbsd-arm64" {
  vm_name          = "openbsd-${var.version}-aarch64.qcow2"
  iso_url          = "${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/install${local.version_short}.iso"
  iso_checksum     = "file:${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/SHA256"
  output_directory = "build"
  qemu_binary      = "qemu-system-aarch64"
  machine_type     = "virt"
  cpu_model        = "host"
  accelerator      = "hvf"
  cpus             = var.cpus
  memory           = var.memory
  disk_interface   = "virtio"
  disk_size        = "${var.disk_size}G"
  disk_compression = true
  format           = "qcow2"
  ssh_username     = "root"
  ssh_password     = local.root_password
  ssh_timeout      = "10m"

  http_port_min = local.http_port
  http_port_max = local.http_port

  http_content = merge(
    {
      "/install.conf" = templatefile("${path.root}/templates/install.conf.pkrtpl.hcl", {
        hostname           = var.hostname
        user               = var.admin_user
        ssh_key            = var.ssh_key
        root_password      = local.root_password
        mirror             = var.mirror
        version            = var.version
        version_short      = local.version_short
        arch               = var.arch
        disklabel_template = var.disklabel_template
        http_port          = local.http_port
      })
    },
    var.disklabel_template != "" ? { "/disklabel" = var.disklabel_template } : {}
  )

  boot_command = [
    "<wait>S<enter><wait>",
    "autoinstall<enter><wait>",
    "http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.conf<enter>",
  ]
  boot_wait           = "20s"
  shutdown_command    = "shutdown -p now"
  use_default_display = true
  headless            = false
  qemuargs = [
    ["-device", "qemu-xhci,id=xhci"],
    ["-device", "usb-kbd,bus=xhci.0"],
    ["-device", "virtio-gpu-pci"],
    ["-display", "cocoa"],
  ]
  efi_firmware_code = "/opt/homebrew/share/qemu/edk2-aarch64-code.fd"
  efi_firmware_vars = "./edk2-arm-vars.fd"
}