dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Vladimir Serbinenko <phcoder@gmail.com>
f725e3
Date: Sat, 28 Dec 2013 17:25:14 +0100
f725e3
Subject: [PATCH] Don't abort() on unavailable coreboot tables if not running
f725e3
 on coreboot.
f725e3
f725e3
---
f725e3
 grub-core/kern/i386/coreboot/cbtable.c | 2 +-
f725e3
 grub-core/kern/i386/coreboot/init.c    | 5 +++++
f725e3
 ChangeLog                              | 4 ++++
f725e3
 3 files changed, 10 insertions(+), 1 deletion(-)
f725e3
f725e3
diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c
f725e3
index e3bb7b2e09d..1669bc0ca23 100644
f725e3
--- a/grub-core/kern/i386/coreboot/cbtable.c
f725e3
+++ b/grub-core/kern/i386/coreboot/cbtable.c
f725e3
@@ -55,7 +55,7 @@ grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t,
f725e3
     if (check_signature (table_header))
f725e3
       goto signature_found;
f725e3
 
f725e3
-  grub_fatal ("Could not find coreboot table\n");
f725e3
+  return 0;
f725e3
 
f725e3
 signature_found:
f725e3
 
f725e3
diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c
f725e3
index 6b150b47d88..3314f027fec 100644
f725e3
--- a/grub-core/kern/i386/coreboot/init.c
f725e3
+++ b/grub-core/kern/i386/coreboot/init.c
f725e3
@@ -51,6 +51,7 @@ grub_exit (void)
f725e3
 
f725e3
 grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR;
f725e3
 static grub_uint64_t modend;
f725e3
+static int have_memory = 0;
f725e3
 
f725e3
 /* Helper for grub_machine_init.  */
f725e3
 static int
f725e3
@@ -82,6 +83,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
f725e3
 
f725e3
   grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin));
f725e3
 
f725e3
+  have_memory = 1;
f725e3
+
f725e3
   return 0;
f725e3
 }
f725e3
 
f725e3
@@ -97,6 +100,8 @@ grub_machine_init (void)
f725e3
   grub_vga_text_init ();
f725e3
 
f725e3
   grub_machine_mmap_iterate (heap_init, NULL);
f725e3
+  if (!have_memory)
f725e3
+    grub_fatal ("No memory found");
f725e3
 
f725e3
   grub_video_coreboot_fb_late_init ();
f725e3
 
f725e3
diff --git a/ChangeLog b/ChangeLog
f725e3
index 0401f6154f8..ed6d77cc8ea 100644
f725e3
--- a/ChangeLog
f725e3
+++ b/ChangeLog
f725e3
@@ -1,3 +1,7 @@
f725e3
+2013-12-28  Vladimir Serbinenko  <phcoder@gmail.com>
f725e3
+
f725e3
+	Don't abort() on unavailable coreboot tables if not running on coreboot.
f725e3
+
f725e3
 2013-12-28  Andrey Borzenkov <arvidjaar@gmail.com>
f725e3
 
f725e3
 	* grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation