[grub2/f19] Fix booting from drives with 4k sectors on UEFI.
Peter Jones
pjones at fedoraproject.org
Wed Apr 3 20:10:49 UTC 2013
commit 3ad78fdcc98047e5548a4b28356c05967aa01611
Author: Peter Jones <pjones at redhat.com>
Date: Wed Apr 3 14:14:27 2013 -0400
Fix booting from drives with 4k sectors on UEFI.
grub-2.00-handle-4k-sectors.patch | 41 +++++++++++++++++++++++++++++++++++++
grub2.spec | 6 ++++-
2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/grub-2.00-handle-4k-sectors.patch b/grub-2.00-handle-4k-sectors.patch
new file mode 100644
index 0000000..64842ea
--- /dev/null
+++ b/grub-2.00-handle-4k-sectors.patch
@@ -0,0 +1,41 @@
+From f923381741b5a56115c5860a593e94539c5bbc8f Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones at redhat.com>
+Date: Wed, 3 Apr 2013 11:41:52 -0400
+Subject: [PATCH] Make grub_efidisk_get_device_name() work on 4K native disks.
+
+When we have 4kB sectors instead of 512b sectors, hd.partition_start and
+grub_partition_get_start() won't match - the latter assumes 512-byte
+sectors, and the former gives us the correct number based on the
+physical media's sector size. So when we have to compare them, we need
+to compensate.
+
+Signed-off-by: Peter Jones <grub2-owner at fedoraproject.org>
+---
+ grub-core/disk/efi/efidisk.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
+index 77ab5b0..a905b52 100644
+--- a/grub-core/disk/efi/efidisk.c
++++ b/grub-core/disk/efi/efidisk.c
+@@ -791,11 +791,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
+ auto int find_partition (grub_disk_t disk, const grub_partition_t part);
+
+ /* Find the identical partition. */
+- int find_partition (grub_disk_t disk __attribute__ ((unused)),
+- const grub_partition_t part)
++ int find_partition (grub_disk_t disk, const grub_partition_t part)
+ {
+- if (grub_partition_get_start (part) == hd.partition_start
+- && grub_partition_get_len (part) == hd.partition_size)
++ struct grub_efidisk_data *d = disk->data;
++ grub_efi_block_io_media_t *m = d->block_io->media;
++
++ if (grub_partition_get_start (part) / (m->block_size / 512) == hd.partition_start
++ && grub_partition_get_len (part) / (m->block_size / 512) == hd.partition_size)
+ {
+ partition_name = grub_partition_get_name (part);
+ return 1;
+--
+1.8.1.4
+
diff --git a/grub2.spec b/grub2.spec
index 0e93487..78f9010 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -41,7 +41,7 @@
Name: grub2
Epoch: 1
Version: 2.00
-Release: 16%{?dist}
+Release: 17%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
@@ -80,6 +80,7 @@ Patch36: grub-2.00-search-for-specific-config-file-for-netboot.patch
Patch37: grub2-add-bootpath-device-to-the-list.patch
Patch38: grub-2.00-add-GRUB-DISABLE-SUBMENU-option.patch
Patch39: grub-2.00-support-bls-config.patch
+Patch40: grub-2.00-handle-4k-sectors.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -433,6 +434,9 @@ fi
%doc grub-%{tarversion}/themes/starfield/COPYING.CC-BY-SA-3.0
%changelog
+* Wed Apr 03 2013 Peter Jones <pjones at redhat.com> - 2.00-17
+- Fix booting from drives with 4k sectors on UEFI.
+
* Thu Feb 14 2013 Peter Jones <pjones at redhat.com> - 2.00-16
- Allow the user to disable submenu generation
- (partially) support BLS-style configuration stanzas.
More information about the scm-commits
mailing list