In my experience, getting BIOS-mode and EFI-mode GRUBs to coexist on one medium can be tricky, since they may want to use the same configuration file, but have different needs for that. To be sure, it can be made to work, but unless you're very knowledgeable about GRUB, have very explicit instructions from somebody who has that knowledge, or are very lucky, you can end up with a tangled mess. I realize from your own answer, tourdetour, that you've worked past this hurdle, and that's great; but....
My general recommendation for this task is to rely on two different boot loaders, such as GRUB for BIOS-mode and rEFInd (caveat: I maintain rEFInd) for EFI-mode booting. They use different configuration files, so there's no chance of conflict on that score. Setting it up for BIOS-mode first, but with a FAT partition set aside to become the EFI System Partition (ESP), is a good start. The EFI boot loader must then be installed using the fallback filename (EFI/BOOT/bootx64.efi
, at least for x86-64 systems) on the ESP. In the case of rEFInd, this can be done with the refind-install
script:
refind-install --usedefault /dev/sdb1
This example sets up rEFInd on /dev/sdb1
, which should be the unmounted FAT partition on the USB drive -- adjust that value as necessary. If you want to use ELILO, gummiboot/systemd-boot, or something else instead, you'll need to consult its documentation to learn how to install and configure it.
One caveat: If you plan to boot on systems that support Secure Boot, it may be easier to use GRUB 2 as the EFI-mode boot loader, at least if the distribution supports Secure Boot. You'd then use something else (SYSLINUX, LILO, or GRUB Legacy) for BIOS-mode booting. The reason is that most distributions provide a complete path, from Shim to GRUB 2 to the kernel, with Secure Boot support. Swapping out GRUB 2 for something else is possible, but means you'll need to add at least one key to your MOK list when you boot. This isn't too great a challenge on a one-time basis, but if you move the installation from one machine to another or distribute it widely, it can be a pain.