nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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