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

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