From 051567ad22504b1c0ee415e2b3e9f8750c632e84 Mon Sep 17 00:00:00 2001 From: Jacob Carlborg Date: Fri, 5 Aug 2022 20:43:06 +0200 Subject: [PATCH] Use virtio-net network device This is to be compatible with the ARM64 UEFI firmware bundled with QEMU. Previous firmware by Linaro worked with e1000 as well. --- openbsd.pkr.hcl | 16 ++++++++++++++-- var_files/x86-64.pkrvars.hcl | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/openbsd.pkr.hcl b/openbsd.pkr.hcl index 4a1752c..23a0794 100644 --- a/openbsd.pkr.hcl +++ b/openbsd.pkr.hcl @@ -39,6 +39,18 @@ variable "disk_size" { description = "The size in bytes of the hard disk of the VM" } +variable "net_device" { + default = "virtio-net" + type = string + description = "The driver to use for the network interface" +} + +variable "network_interface" { + default = "vio0" + type = string + description = "The network interface as it's named in OpenBSD" +} + variable "checksum" { type = string description = "The checksum for the virtual hard drive file" @@ -124,7 +136,7 @@ source "qemu" "qemu" { machine_type = var.machine_type cpus = var.cpus memory = var.memory - net_device = "e1000" + net_device = var.net_device disk_compression = true disk_interface = "virtio" @@ -142,7 +154,7 @@ source "qemu" "qemu" { boot_command = [ "S", - "ifconfig em0 10.0.2.15 255.255.255.0", + "ifconfig ${var.network_interface} 10.0.2.15 255.255.255.0", "ftp -o install.conf http://{{ .HTTPIP }}:{{ .HTTPPort }}/resources/install.conf", "ftp -o install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/resources/install.sh", "SECONDARY_USER_USERNAME=${var.secondary_user_username} ", diff --git a/var_files/x86-64.pkrvars.hcl b/var_files/x86-64.pkrvars.hcl index 4c0a90f..302c629 100644 --- a/var_files/x86-64.pkrvars.hcl +++ b/var_files/x86-64.pkrvars.hcl @@ -1,2 +1,4 @@ architecture = "x86-64" firmware = "resources/ovmf.fd" +net_device = "e1000" +network_interface = "em0"