On Thu, 2026-02-26 at 16:19 +0800, Xiangyu Chen via
lists.openembedded.org wrote:
> From: Xiangyu Chen <[email protected]>
> 
> Grub would report an error message in boot stage as below:
> 
>    "error: no such device: ((hd0,gpt1)/EFI/BOOT)/EFI/BOOT/grub.cfg"
> 
> Consequently, the root variable is not set, and the intended protection
> against cross-device configuration loading (the purpose of the original 2014 
> commit)
> is lost.
> 
> The most robust fix is to use the --hint parameter.
> This separates the search target from the device hint, avoiding
> fragile string concatenation and supporting both prefixed and
> non-prefixed $cmdpath formats.
> 
> Fixes: 5ce73b6055ac ("grub: add cmdpath to grub configuration file")
> Signed-off-by: Xiangyu Chen <[email protected]>
> ---
>  meta/recipes-bsp/grub/files/cfg | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-bsp/grub/files/cfg b/meta/recipes-bsp/grub/files/cfg
> index 8ca53d24d7..8fe1a8d0c7 100644
> --- a/meta/recipes-bsp/grub/files/cfg
> +++ b/meta/recipes-bsp/grub/files/cfg
> @@ -1,2 +1,2 @@
> -search.file ($cmdpath)/EFI/BOOT/grub.cfg root
> +search --file --set=root --hint-efi=$cmdpath /EFI/BOOT/grub.cfg

I'm not sure that this can work for all use cases. The grub
documentatation for hints says "First try the device HINT" (i.e. it's
explicitly a device), whereas the documentation for cmdpath says that it
is "an absolute directory name".

Best regards,

-- 
Paul Barker

Attachment: signature.asc
Description: This is a digitally signed message part

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#232483): 
https://lists.openembedded.org/g/openembedded-core/message/232483
Mute This Topic: https://lists.openembedded.org/mt/118009422/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to