[grub] - When the EFI memory map is too large, copy the parts we can to e820 Resolves: rhbz#624806
Peter Jones
pjones at fedoraproject.org
Thu Aug 19 18:21:16 UTC 2010
commit a2aa6d5530945aee04e11402cf6f49bd7320b5b5
Author: Peter Jones <pjones at redhat.com>
Date: Thu Aug 19 14:21:44 2010 -0400
- When the EFI memory map is too large, copy the parts we can to e820
Resolves: rhbz#624806
grub-efi-large-memory-map.patch | 80 +++++++++++++++++++++++++++++++++++++++
grub.spec | 8 +++-
2 files changed, 87 insertions(+), 1 deletions(-)
---
diff --git a/grub-efi-large-memory-map.patch b/grub-efi-large-memory-map.patch
new file mode 100644
index 0000000..afb201e
--- /dev/null
+++ b/grub-efi-large-memory-map.patch
@@ -0,0 +1,80 @@
+From: Mike Travis <travis at sgi.com>
+Subject: [PATCH] Convert EFI memory map to E820 map for the operating system
+Date: Thu, 19 Aug 2010 14:08:00 -0400
+
+IT#1003573
+
+Convert EFI memory map to E820 map for the operating system
+This code is based on a Linux kernel patch submitted by Edgar Hucek
+
+diff --exclude='*.rej' --exclude='*.orig' --exclude='*~' -Naurp grub.a/efi/efimm.c grub.b/efi/efimm.c
+--- grub.a/efi/efimm.c 2010-08-17 11:04:54.000000000 -0400
++++ grub.b/efi/efimm.c 2010-08-17 11:09:07.176704838 -0400
+@@ -265,6 +265,9 @@ grub_efi_get_memory_map (grub_efi_uintn_
+
+ /*
+ * Add a memory region to the kernel e820 map.
++ *
++ * Convert EFI memory map to E820 map for the operating system
++ * This code is based on a Linux kernel patch submitted by Edgar Hucek
+ */
+ static void
+ add_memory_region (struct e820_entry *e820_map,
+@@ -274,25 +277,49 @@ add_memory_region (struct e820_entry *e8
+ unsigned int type)
+ {
+ int x = *e820_nr_map;
++ static unsigned long long estart = 0ULL;
++ static unsigned long esize = 0L;
++ static unsigned int etype = -1;
++ static int merge = 0;
+
+- if (x == E820_MAX)
+- {
+- grub_printf ("Too many entries in the memory map!\n");
+- return;
+- }
+-
+- if (e820_map[x-1].addr + e820_map[x-1].size == start
++ /* merge adjacent regions of same type */
++ if ((x > 0) && e820_map[x-1].addr + e820_map[x-1].size == start
+ && e820_map[x-1].type == type)
+ {
+ e820_map[x-1].size += size;
++ estart = e820_map[x-1].addr;
++ esize = e820_map[x-1].size;
++ etype = e820_map[x-1].type;
++ merge++;
++ return;
+ }
+- else
++
++ /* fill up to E820_MAX */
++ if ( x < E820_MAX )
+ {
+ e820_map[x].addr = start;
+ e820_map[x].size = size;
+ e820_map[x].type = type;
+ (*e820_nr_map)++;
++ merge=0;
++ return;
++ }
++
++ /* different type means another region didn't fit */
++ /* or same type, but there's a hole */
++ if (etype != type || (estart + esize) != start)
++ {
++ merge = 0;
++ estart = start;
++ esize = size;
++ etype = type;
++ return;
+ }
++
++ /* same type and no hole, merge it */
++ estart += esize;
++ esize += size;
++ merge++;
+ }
+
+ /*
diff --git a/grub.spec b/grub.spec
index 18bdc70..c085b30 100644
--- a/grub.spec
+++ b/grub.spec
@@ -1,6 +1,6 @@
Name: grub
Version: 0.97
-Release: 66%{?dist}
+Release: 67%{?dist}
Epoch: 1
Summary: Grand Unified Boot Loader.
Group: System Environment/Base
@@ -57,6 +57,7 @@ Patch27: grub-0.97-invert-highlighted-menu-line-rhbz613153.patch
Patch28: grub-0.97-better-get-memory-map-rhbz607213.patch
Patch29: grub-0.97-add-strnchr.patch
Patch30: grub-0.97-efimap.patch
+Patch31: grub-efi-large-memory-map.patch
%description
GRUB (Grand Unified Boot Loader) is an experimental boot loader
@@ -97,6 +98,7 @@ systems.
%patch28 -p1
%patch29 -p1
%patch30 -p1
+%patch31 -p1
%build
autoreconf
@@ -159,6 +161,10 @@ fi
%{_datadir}/grub
%changelog
+* Thu Aug 19 2010 Peter Jones <pjones at redhat.com> - 0.97-67
+- When the EFI memory map is too large, copy the parts we can to e820
+ Resolves: rhbz#624806
+
* Wed Aug 04 2010 Peter Jones <pjones at redhat.com> - 0.97-66
- Draw the inverted line correctly in the menu
Resolves: rhbz#613153
More information about the scm-commits
mailing list