My approach:
I initiate a usb drive with a new GPT table using fdisk.
A new ESP partition to house the GRUB.
sgdisk -n 0:0:+512M -t 0:EF00 -c 0:"GRUB_ESP" "/dev/sdc"
partprobe "$targetDisk"
mkfs.fat -F 32 -n "ESP" "/dev/sdc1"
I mount that partition and install grub onto it.
grub-install \
--target=x86_64-efi \
--efi-directory="/mnt/sdc1-part" \
--bootloader-id=GRUB \
--recheck
I boot it
qemu-system-x86_64 \
-m 1G \
-device qemu-xhci \
-drive if=none,id=usbstick,file=/dev/sdc,format=raw \
-device usb-storage,drive=usbstick \
-boot menu=on \
-display gtk,zoom-to-fit=on
near successful attempt
Before I restarted with a fresh GPT table, the usb was formatted with Etcher before it burned an iso onto it.
I don't know what it did, but it made usb bootable at least, the GRUB printed errors regarding unkown file system and it did not list all partitions on the usb when I did ls, but nonetheless, it was bootable.
my goal
I want to mimic Ventoy on my main drive while:
- not destroying previous data partitions
- having entries to other bootable drives and UEFI settings