Skip to content

Instantly share code, notes, and snippets.

@Ranjandas
Last active May 8, 2024 00:28
Show Gist options
  • Save Ranjandas/80685ae33539809e81e11ff6200ef641 to your computer and use it in GitHub Desktop.
Save Ranjandas/80685ae33539809e81e11ff6200ef641 to your computer and use it in GitHub Desktop.
packer {
required_plugins {
qemu = {
version = ">= 1.1.0"
source = "github.com/hashicorp/qemu"
}
}
}
source "qemu" "hashibox" {
iso_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/aarch64/images/Fedora-Cloud-Base-Generic.aarch64-40-1.14.qcow2"
iso_checksum = "sha256:ebdce26d861a9d15072affe1919ed753ec7015bd97b3a7d0d0df6a10834f7459"
headless = true
disk_compression = true
disk_size = "10G"
disk_interface = "virtio"
format = "qcow2"
disk_image = true
boot_command = []
net_device = "virtio-net"
output_directory = "artifacts/qemu/"
qemu_binary = "qemu-system-aarch64"
accelerator = "tcg"
cpu_model = "cortex-a57"
machine_type = "virt"
cpus = 2
memory = 2048
use_backing_file = true
efi_boot = true
efi_firmware_code = "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw"
#efi_firmware_vars = "/tmp/libguestfsuWGwcy/vars1.fd"
efi_firmware_vars = "/usr/share/edk2/aarch64/vars-template-pflash.raw"
qemuargs = [
["-cdrom", "cidata.iso"],
["-monitor", "none"],
["-no-user-config"]
]
communicator = "ssh"
shutdown_command = "echo fedora | sudo -S shutdown -P now"
ssh_password = "fedora"
ssh_username = "fedora"
ssh_timeout = "20m"
}
build {
sources = ["source.qemu.hashibox"]
}
#cloud-config
system_info:
default_user:
name: fedora
chpasswd:
list: |
fedora:fedora
expire: False
ssh_pwauth: True
resize_rootfs: True
@Ranjandas
Copy link
Author

Command to generate the cidata.iso

genisoimage -output cidata.iso -input-charset utf-8 -volid cidata -joliet -r user-data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment