Репозиторий Sisyphus
Последнее обновление: 16 июля 2019 | Пакетов: 17682 | Посещений: 14330140
en ru br
Репозитории ALT
S:2.02-alt17
D:0.97-alt2
5.1: 0.97-alt5
4.1: 0.97-alt4.M41.1
3.0: 0.95-alt1
www.altlinux.org/Changes

Группа :: Система/Ядро и оборудование
Пакет: grub

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: grub-2.02-add-fw_path-variable.patch
Скачать


From 88c7ba4163340b2652f9009b65d850625588b6a9 Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Date: Wed, 19 Sep 2012 21:22:55 -0300
Subject: [PATCH 18/89] Add fw_path variable (revised)
This patch makes grub look for its config file on efi where the app was
found. It was originally written by Matthew Garrett, and adapted to fix the
"No modules are loaded on grub2 network boot" issue:
https://bugzilla.redhat.com/show_bug.cgi?id=857936
---
 grub-core/kern/main.c   | 13 ++++++-------
 grub-core/normal/main.c | 25 ++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 9cad0c4..8ab7794 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -127,16 +127,15 @@ grub_set_prefix_and_root (void)
 
   grub_machine_get_bootlocation (&fwdevice, &fwpath);
 
-  if (fwdevice)
+  if (fwdevice && fwpath)
     {
-      char *cmdpath;
+      char *fw_path;
 
-      cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
-      if (cmdpath)
+      fw_path = grub_xasprintf ("(%s)/%s", fwdevice, fwpath);
+      if (fw_path)
 	{
-	  grub_env_set ("cmdpath", cmdpath);
-	  grub_env_export ("cmdpath");
-	  grub_free (cmdpath);
+	  grub_env_set ("fw_path", fw_path);
+	  grub_free (fw_path);
 	}
     }
 
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 249e19b..759c475 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -338,7 +338,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
       /* Guess the config filename. It is necessary to make CONFIG static,
 	 so that it won't get broken by longjmp.  */
       char *config;
-      const char *prefix;
+      const char *prefix, *fw_path;
+
+      fw_path = grub_env_get ("fw_path");
+      if (fw_path)
+	{
+	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
+	  if (config)
+	    {
+	      grub_file_t file;
+
+	      file = grub_file_open (config);
+	      if (file)
+		{
+		  grub_file_close (file);
+		  grub_enter_normal_mode (config);
+		}
+              else
+                {
+                  /*  Ignore all errors.  */
+                  grub_errno = 0;
+                }
+	      grub_free (config);
+	    }
+	}
 
       prefix = grub_env_get ("prefix");
       if (prefix)
-- 
2.5.5
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin