37b39b7
From d60083bf794914c4f26f561adcdd107abe80cd7e Mon Sep 17 00:00:00 2001
37b39b7
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
37b39b7
Date: Wed, 19 Feb 2014 15:58:43 -0500
58fe9aa
Subject: [PATCH 131/152] use fw_path prefix when fallback searching for grub
37b39b7
 config
37b39b7
37b39b7
When PXE booting via UEFI firmware, grub was searching for grub.cfg
37b39b7
in the fw_path directory where the grub application was found. If
37b39b7
that didn't exist, a fallback search would look for config file names
37b39b7
based on MAC and IP address. However, the search would look in the
37b39b7
prefix directory which may not be the same fw_path. This patch
37b39b7
changes that behavior to use the fw_path directory for the fallback
37b39b7
search. Only if fw_path is NULL will the prefix directory be searched.
37b39b7
37b39b7
Signed-off-by: Mark Salter <msalter@redhat.com>
37b39b7
---
37b39b7
 grub-core/normal/main.c | 5 +++--
37b39b7
 1 file changed, 3 insertions(+), 2 deletions(-)
37b39b7
37b39b7
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
37b39b7
index f66c03c..5e2ac15 100644
37b39b7
--- a/grub-core/normal/main.c
37b39b7
+++ b/grub-core/normal/main.c
37b39b7
@@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
37b39b7
       char *config;
37b39b7
       const char *prefix, *fw_path;
37b39b7
 
37b39b7
-      fw_path = grub_env_get ("fw_path");
37b39b7
+      prefix = fw_path = grub_env_get ("fw_path");
37b39b7
       if (fw_path)
37b39b7
 	{
37b39b7
 	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
37b39b7
@@ -366,7 +366,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
37b39b7
 	    }
37b39b7
 	}
37b39b7
 
37b39b7
-      prefix = grub_env_get ("prefix");
37b39b7
+      if (! prefix)
37b39b7
+	      prefix = grub_env_get ("prefix");
37b39b7
       if (prefix)
37b39b7
         {
37b39b7
           grub_size_t config_len;
37b39b7
-- 
37b39b7
1.9.3
37b39b7