Building RHEL8.2 UEFI image for QEMU

Hi Team,

I was trying to deploy or build an image using packer for a libvirt environment , basically what i was trying to do is create a UEFI based RHEL8.2 image but when i run packer build rhel8.2.json it was not working. Any one has tried to build rhel8.2 uefi image using packer. Below is the code which i tried to build
{
“builders”: [
{
“qemuargs”: [
["-m", “2048M”],
["-global", “driver=cfi.pflash01,property=secure,value=on”],
["-drive", “file=/usr/share/OVMF/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,readonly=on”],
["-boot", “order=c,once=d,menu=on,strict=on”]
],
“boot_command”: [
" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"
],
“boot_wait”: “2s”,
“firmware”: “UEFI”,
“cpus”: 4,
“headless”: true,
“http_directory”: “http”,
“iso_checksum”: “sha256:7fdfed9c7cced4e526a362e64ed06bcdc6ce0394a98625a40e7d05db29bf7b86”,
“iso_target_path”: “iso”,
“iso_urls”: [
“rhel_8_2_x86_64_dvd.iso”
],
“memory”: 4096,
“disk_size”: 51200,
“output_directory”: “output-centos”,
“shutdown_command”: “echo ‘done’ | sudo -S /sbin/halt -h -p”,
“ssh_username”: “root”,
“ssh_password”: “password”,
“ssh_timeout”: “60m”,
“type”: “qemu”,
“vm_name”: “centos-packer.qcow2”
}
]
}

I tried this solution also but didnt work out well Building UEFI images with QEMU/KVM

Did you try this?

boot_command           = ["<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<leftCtrlOn>x<leftCtrlOff>"]