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

23d2ea
From 05a567228906c64062e4cbaa66245e15aea1b39d Mon Sep 17 00:00:00 2001
39700a
From: Vladimir Serbinenko <phcoder@gmail.com>
39700a
Date: Sat, 28 Dec 2013 17:25:14 +0100
27a4da
Subject: [PATCH 008/260] Don't abort() on unavailable coreboot tables if not
23d2ea
 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
27a4da
index 0401f6154..ed6d77cc8 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
27a4da
index e3bb7b2e0..1669bc0ca 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
27a4da
index 6b150b47d..3314f027f 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
-- 
27a4da
2.13.0
39700a