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

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
39700a
From: Vladimir Serbinenko <phcoder@gmail.com>
39700a
Date: Sat, 28 Dec 2013 17:25:14 +0100
28f7f8
Subject: [PATCH] Don't abort() on unavailable coreboot tables if not running
28f7f8
 on coreboot.
39700a
39700a
---
39700a
 grub-core/kern/i386/coreboot/cbtable.c | 2 +-
39700a
 grub-core/kern/i386/coreboot/init.c    | 5 +++++
28f7f8
 ChangeLog                              | 4 ++++
39700a
 3 files changed, 10 insertions(+), 1 deletion(-)
39700a
39700a
diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c
28f7f8
index e3bb7b2e09d..1669bc0ca23 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
28f7f8
index 6b150b47d88..3314f027fec 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
 
28f7f8
diff --git a/ChangeLog b/ChangeLog
28f7f8
index 0401f6154f8..ed6d77cc8ea 100644
28f7f8
--- a/ChangeLog
28f7f8
+++ b/ChangeLog
28f7f8
@@ -1,3 +1,7 @@
28f7f8
+2013-12-28  Vladimir Serbinenko  <phcoder@gmail.com>
28f7f8
+
28f7f8
+	Don't abort() on unavailable coreboot tables if not running on coreboot.
28f7f8
+
28f7f8
 2013-12-28  Andrey Borzenkov <arvidjaar@gmail.com>
28f7f8
 
28f7f8
 	* grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation