Skip to content

Commit

Permalink
Use virtio-net network device
Browse files Browse the repository at this point in the history
This is to be compatible with the ARM64 UEFI firmware bundled with
QEMU. Previous firmware by Linaro worked with e1000 as well.
  • Loading branch information
jacob-carlborg committed Aug 8, 2022
1 parent a141b41 commit 051567a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions openbsd.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -142,7 +154,7 @@ source "qemu" "qemu" {

boot_command = [
"S<enter><wait>",
"ifconfig em0 10.0.2.15 255.255.255.0<enter><wait>",
"ifconfig ${var.network_interface} 10.0.2.15 255.255.255.0<enter><wait>",
"ftp -o install.conf http://{{ .HTTPIP }}:{{ .HTTPPort }}/resources/install.conf<enter><wait>",
"ftp -o install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/resources/install.sh<enter><wait>",
"SECONDARY_USER_USERNAME=${var.secondary_user_username} ",
Expand Down
2 changes: 2 additions & 0 deletions var_files/x86-64.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
architecture = "x86-64"
firmware = "resources/ovmf.fd"
net_device = "e1000"
network_interface = "em0"

0 comments on commit 051567a

Please sign in to comment.