I have a device with an AMD64 CPU but a UEFI bootloader that only supports i386.
I have made a custom Ubuntu 19.04 ISO installer using Cubic and have flashed it to a USB using usb-creator-gtk (Startup Disk Creator).
This creates two partitions on the USB:
The first partition formatted as ISO9660 and holds the ISO contents, the second is a FAT32 partition that contains only the .EFI boot files.
The second partition is what the tablet will boot from. Its contents come from an efi.img file stored inside /boot/grub on the ISO. This originally contained only AMD64 EFI files.:
I have created my own replacement img.efi file and input a bootia32.efi file using these commands:
dd if=/dev/zero of=efi.img bs=1M count=5
mkfs.fat efi.img
sudo mount -o loop,rw efi.img /media/efi
sudo cp -r <files> /media/efi
This successfully makes a bootable USB, however it doesn't load the installer Grub, it only loads a Grub command line.
I've used this bootia32.efi
file to successfully load grub before, if I instead manually format the USB as FAT32, copy over the ISO files and put the custom EFI file inside of /EFI/BOOT then the device will boot into Grub as I would expect.
But I'd like to make an ISO that can be flashed as normal and boot fine.
My question is, what is the point of creating a separate partition to hold the boot EFI files as usb-creator-gtk does? How do I make that partition load the installer's Grub config instead of just the Grub command line?
Thank you
Thanks to @oldfred for explaining that the seperated partitions is to overcome the 4GB file size limit for FAT32.
I've managed to create the bootable ISO by putting both the
boot
folder and theEFI
folders from the ISO into the FAT32 (efi.img) partition.I've modified the grub.cfg to launch from a different partition than the one it sits in.
This doesn't seem right to me because the original efi.img file only had three files:
But, it works so I'm happy.
The exact structure of my efi.img file is this:
Some of those probably aren't necessary, but I'm not concerned about the extra 10MB of space it uses.
This is my grub.cfg inside the img.efi file, note the
set root=(hd0)
:If anyone can shed further light on what should be inside of the efi.img file, please let me know.