My standard advice to everyone is to avoid ever using grub-mkimage
directly. In your case, grub-mkrescue is designed to do exactly what you
want. It will make an iso file for you, with whatever contents you want,
and on top of that it will add whatever is needed to make that iso bootable
with whatever platforms of grub you have installed. You just need to ensure
that there is a an appropriate /boot/grub/grub.cfg among the files that you
include in the iso. The resulting iso will then be bootable either dd'd to
a flash drive / HD, burned to a CD/DVD, or even (with a lot of extra work
to make grub small enough) as a floppy disk.

When I say "bootable with whatever platforms of grub you have installed"
I'm referring to the what debian packages
as grub-efi-amd64-bin, grub-efi-ia32-bin, grub-pc-bin, etc. If you'd like
help with the syntax of grub-mkrescue feel free to reply and I can go into
more detail.

On Sat, Feb 8, 2020 at 11:13 AM larry <larry29...@hughes.net> wrote:

> 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
>
>

Reply via email to