I have a custom iso based on Ubuntu 16.04 that is designed to run on a USB that boots in both Legacy (CSM) and EFI (with CSM support) modes just fine. When booting in EFI mode with CSM support, it's using the menu as defined in isolinux.cfg instead of the menu defined in grub.cfg, which I expected. It won't boot in EFI mode without CSM support at all.
I mounted my custom iso's efi partition and all it contains is bootx64.efi as a text file and no grubx64.efi. When I mount the efi partition from Ubuntu 16.04's iso, it has both bootx64.efi and grubx64.efi as programs. I'm pretty sure that I screwed-up the formatting of grub-mkimage and would appreciate some help on this. After mounting the iso, my method of modifying it is:
BOOT_IMG_DATA="$PWD"
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/EFI/BOOT
grub-mkimage \
-C xz \
-d "$HOME"/foxbuild2/src/livecd/image/boot/grub/x86_64-efi \
-O x86_64-efi \
-o $BOOT_IMG_DATA/EFI/BOOT/bootx64.efi \
boot linux search normal configfile \
part_gpt btrfs fat iso9660 loopback \
test keystatus gfxmenu regexp probe \
efi_gop efi_uga all_video gfxterm font \
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/EFI ::
# Create the new ISO image
# The example names get mapped to their roles here
#orig_iso=../foxclone.iso
new_iso=../foxclone025-4.15UEFI.iso
new_files="$PWD"
mbr_template=/usr/lib/ISOLINUX/isohdpfx.bin
xorriso -as mkisofs "$new_files" \
-o "$new_iso" \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-c isolinux/boot.cat \
-b isolinux/isolinux.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-eltorito-alt-boot \
-e isolinux/efi.img \
-no-emul-boot \
-isohybrid-gpt-basdat \
-m grub.cfg
Thanks in advance, Larry