help-grub
[Top][All Lists]
Advanced

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

Re: Unexpected prefix value


From: Pascal Hambourg
Subject: Re: Unexpected prefix value
Date: Tue, 28 Nov 2023 20:04:40 +0100
User-agent: Mozilla Thunderbird

On 28/11/2023 at 08:11, Andrei Borzenkov wrote:
On Tue, Nov 28, 2023 at 9:45 AM Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:

On 28/11/2023 at 04:44, Andrei Borzenkov wrote:
On 27.11.2023 23:06, Pascal Hambourg wrote:

But if I build an EFI GRUB core image with

    grub-mkimage --prefix='(hd0,gpt4)' --format=x86_64-efi \
     --output=/boot/efi/EFI/azerty/core.efi part_gpt ext2

(no / at the end of prefix), then when booting it, the $prefix value
seems to be the combination of the --prefix device and the $cmdpath path:

    cmdpath=(hd0,gpt1)/EFI/azerty
    prefix=(hd0,gpt4)/EFI/azerty

Is this expected behaviour ?

Yes. $prefix consists of two parts - device and the directory path. If
one of them is missing during initialization, grub attempts to guess and
fill it in.

Guessing a missing or incomplete device makes sense, but what is the use
case for guessing a missing path when the device is present ? AFAICS if
the devices in $cmdpath and --prefix do not match, the resulting $prefix
is doomed to failure.

I do not think it is done on purpose, it is more - garbage in, garbage
out. The file name without the path component is invalid, grub cannot
use it anyway.

In my experience, when I set prefix=(device) either by config file or manually at the grub prompt, GRUB can use it just fine so it seems to be perfectly valid. It is a prefix, not a full path, and as far as I can see grub uses it by prepending it to some file path starting with /. So as long as the resulting path is valid it should be fine.

So it should either drop the value passed in --prefix
or do something to make it usable. I suppose, ignoring the value in
--prefix in this case would be more logical

Wouldn't it be more logical to do something like this:

if prefix is empty
  set prefix = cmdpath
else if device part is empty or incomplete
  set missing device part from cmdpath

and do not touch the path part ?



reply via email to

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