Create bootable UEFI ISO image

Build UEFI ISO

sudo apt install -y grub-efi-amd64-bin mtools xorriso mkisofs
 
mkdir -p iso/boot/grub
mkdir -p iso/EFI/BOOT
 
cp /tmp/ironic-python-agent.initramfs iso/boot/initrd.img
cp /tmp/ironic-python-agent.kernel iso/boot/vmlinuz
 
cat <<EOF> iso/boot/grub/grub.cfg
set timeout=0
set root=(cd0)
set prefix=(memdisk)/boot/grub
 
menuentry 'Linux' {
   echo 'Loading kernel...'
   linux /boot/vmlinuz console=tty0 rw
   echo "Loading initrd..."
   initrd /boot/initrd.img
   echo "Booting..."
}
EOF
 
grub-mkstandalone -o iso/EFI/BOOT/BOOTX64.EFI -O x86_64-efi "boot/grub/grub.cfg=iso/boot/grub/grub.cfg"
dd if=/dev/zero of=iso/EFI/BOOT/efiboot.img bs=1M count=10
mkfs.msdos -F 12 -n 'EFIBOOTISO' iso/EFI/BOOT/efiboot.img
mmd -i iso/EFI/BOOT/efiboot.img ::EFI
mmd -i iso/EFI/BOOT/efiboot.img ::EFI/BOOT
mcopy -i iso/EFI/BOOT/efiboot.img iso/EFI/BOOT/BOOTX64.EFI ::EFI/BOOT/BOOTX64.EFI
 
xorriso -as mkisofs -V 'EFI_ISO_BOOT' -e EFI/BOOT/efiboot.img -no-emul-boot -o /tmp/efi-boot.iso iso/

Rebuild efi-boot.iso as Ironic esp.img UEFI image

cat <<EOF> iso/boot/grub/grub.cfg
set timeout=0
set root=(cd0)
set prefix=(memdisk)/boot/grub
 
configfile /EFI/ubuntu/grub.cfg
EOF
 
ls -l /httpboot/
total 973693
-rw-r--r-- 1 root   root    10485760 Feb 11 17:28 esp.img
-rw-r--r-- 1 root   root   531835089 Feb 11 14:20 ipa.initramfs
-rw-r--r-- 1 root   root    11662080 Feb 11 14:21 ipa.kernel

Links
https://forums.fogproject.org/topic/15465/getting-fos-on-a-bootable-iso-image/7
https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image/23
https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image/22
https://github.com/syzdek/efibootiso