On Mon, Feb 21, 2022 at 1:45 PM David Ventura <[email protected]> wrote: > > The machines I'll boot support this, so it's fine. (And they'll only > ever boot Linux, so no need for hybrid MBR). > > Using grub-install also expects to read the device.map from my disk > and write to /boot/grub/i386-pc on my disk. > I understand how this makes sense for the use-case grub-install is > intended for, and how I'm fairly outside of it. >
You could try grub-bios-setup which installs grub image onto the device. grub-install does it as one of the steps it executes. > I'm trying to generate thousands of disk images for various tests on > real systems, and for each I know specifically what disk layout > they'll have, the address of the bios boot partition, path to grub > files, etc. > > On Mon, 21 Feb 2022 at 11:17, Pascal Hambourg <[email protected]> wrote: > > > > Le 21/02/2022 à 10:11, David Ventura a écrit : > > > > > > I'm not sure how to do that; running grub-install with either a file > > > or a loop device as target gets ignored and instead targets my > > > primary disk: > > > > > > $ grub-install -vvv /dev/loop13 > > > grub-install: info: executing modprobe efivars 2>/dev/null. > > > grub-install: info: Looking for /sys/firmware/efi ... > > > grub-install: info: ...found. > > > Installing for x86_64-efi platform. > > > > The target device is ignored because grub-install detects an EFI > > platform and defaults to install for EFI boot. You must force BIOS > > platform with --target=i386-pc. > > > > > On top of that, I'm building a franken-disk that can boot both in > > > BIOS/GPT and UEFI/GPT with a bios boot partition and Grub in the ESP. > > > I'm not sure if grub-install would be confused by this, or just work. > > > Do you have any suggestions for this? > > > > I observed that some BIOS platforms won't boot if the boot flag is not > > set on a partition entry of the MBR ; conversely, some UEFI platforms > > won't boot if the boot flag is set on the GPT partition entry of the > > MBR. Workaround : create a hybrid/DOS MBR or set the boot flag on an > > empty partition entry of the MBR. > > > > -- > Stack is the new term for "I have no idea what I'm actually using". >
