[Top][All Lists]

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

[PATCH v5 14/20] use fw_path prefix when fallback searching for grub con

From: Robbie Harwood
Subject: [PATCH v5 14/20] use fw_path prefix when fallback searching for grub config
Date: Tue, 25 Apr 2023 11:05:25 -0400

From: Mark Salter <>

When PXE booting via UEFI firmware, grub was searching for grub.cfg in
the fw_path directory where the grub application was found.  If that
didn't exist, a fallback search would look for config file names based
on MAC and IP address.  However, the search would look in the prefix
directory which may not be the same fw_path.  This patch changes that
behavior to use the fw_path directory for the fallback search.  Only if
fw_path is NULL will the prefix directory be searched.

Signed-off-by: Mark Salter <>
Signed-off-by: Robbie Harwood <>
 grub-core/normal/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index a557ba5c9c..dfdfd56e06 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -322,7 +322,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ 
       char *config;
       const char *prefix, *fw_path;
-      fw_path = grub_env_get ("fw_path");
+      prefix = fw_path = grub_env_get ("fw_path");
       if (fw_path)
          config = grub_xasprintf ("%s/grub.cfg", fw_path);
@@ -345,7 +345,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ 
-      prefix = grub_env_get ("prefix");
+      if (!prefix)
+        prefix = grub_env_get ("prefix");
       if (prefix)
           grub_size_t config_len;

reply via email to

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