help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grub on BIOS/GPT


From: Andrei Borzenkov
Subject: Re: Grub on BIOS/GPT
Date: Mon, 21 Feb 2022 19:55:04 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 21.02.2022 15:49, David Ventura wrote:
> Hm, grub-bios-setup also seems to not want to apply on files/loop devices:
> 
> $ grub-bios-setup -s -d asd -b boot.img -c core.img hdd-grub.raw
> grub-bios-setup: warning: disk does not exist, so falling back to
> partition device /dev/vda2.
> grub-bios-setup: warning: disk does not exist, so falling back to
> partition device /dev/vda2.
> grub-bios-setup: error: guessing the root device failed, because of
> `disk `hostdisk//dev/vda2' not found'.
> 
> $ grub-bios-setup -s -d asd -b boot.img -c core.img /dev/loop13
> grub-bios-setup: error: disk `hostdisk//dev/loop13' not found.
> 
> Any suggestions?
> 

If you loop device is partitioned, create custom device.map pointing
to this loop device. It may work.

If you loop device refers to single partition, you cannot install into
MBR using this device.

> I'll try to hack on grub-bios-setup, to get it to not look at disks
> and instead read the input file. Doubt I'll be successful, but my
> initial plan of "just stomping the jump address of boot.img" did not
> pan out
> 
> 
> 
> On Mon, 21 Feb 2022 at 12:29, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>
>> On Mon, Feb 21, 2022 at 1:45 PM David Ventura <davidventura27@gmail.com> 
>> 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 <pascal@plouf.fr.eu.org> 
>>> 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".
>>>
> 
> 
> 
> --
> Stack is the new term for "I have no idea what I'm actually using".
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]