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

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