add grub-2.00-linux-mbr.patch - fix upstream bug #36490

backport upstream rev 4405

bug #36490: grub-probe doesn't work with fat32 file systems
This commit is contained in:
Mads Kiilerich 2012-06-02 01:55:15 +02:00
parent 7045ce64ed
commit 7f44b9b444
2 changed files with 83 additions and 1 deletions

82
grub-2.00-linux-mbr.patch Normal file
View File

@ -0,0 +1,82 @@
From: Valdimir Serbinenko <phcoder@gmail.com>
Subject: Fix MBR remapping workaround.
upstream rev 4405
--- a/grub-core/kern/emu/hostdisk.c 2012-05-27 11:19:09 +0000
+++ b/grub-core/kern/emu/hostdisk.c 2012-06-02 11:48:44 +0000
@@ -1067,27 +1067,18 @@
if (fd < 0)
return grub_errno;
+#ifdef __linux__
+ if (sector == 0)
+ /* Work around a bug in Linux ez remapping. Linux remaps all
+ sectors that are read together with the MBR in one read. It
+ should only remap the MBR, so we split the read in two
+ parts. -jochen */
+ max = 1;
+#endif /* __linux__ */
+
if (max > size)
max = size;
-#ifdef __linux__
- if (sector == 0 && max > 1)
- {
- /* Work around a bug in Linux ez remapping. Linux remaps all
- sectors that are read together with the MBR in one read. It
- should only remap the MBR, so we split the read in two
- parts. -jochen */
- if (grub_util_fd_read (fd, buf, (1 << disk->log_sector_size))
- != (1 << disk->log_sector_size))
- return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
- map[disk->id].device, strerror (errno));
-
- buf += (1 << disk->log_sector_size);
- size--;
- max--;
- }
-#endif /* __linux__ */
-
if (grub_util_fd_read (fd, buf, max << disk->log_sector_size)
!= (ssize_t) (max << disk->log_sector_size))
return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
@@ -1111,28 +1102,18 @@
if (fd < 0)
return grub_errno;
+#ifdef __linux__
+ if (sector == 0)
+ /* Work around a bug in Linux ez remapping. Linux remaps all
+ sectors that are write together with the MBR in one write. It
+ should only remap the MBR, so we split the write in two
+ parts. -jochen */
+ max = 1;
+#endif /* __linux__ */
+
if (max > size)
max = size;
-#ifdef __linux__
- if (sector == 0 && max > 1)
- {
- /* Work around a bug in Linux ez remapping. Linux remaps all
- sectors that are write together with the MBR in one write. It
- should only remap the MBR, so we split the write in two
- parts. -jochen */
- if (grub_util_fd_write (fd, buf, (1 << disk->log_sector_size))
- != (1 << disk->log_sector_size))
- return grub_error (GRUB_ERR_WRITE_ERROR,
- N_("cannot write to `%s': %s"),
- map[disk->id].device, strerror (errno));
-
- buf += (1 << disk->log_sector_size);
- size--;
- max--;
- }
-#endif /* __linux__ */
-
if (grub_util_fd_write (fd, buf, max << disk->log_sector_size)
!= (ssize_t) (max << disk->log_sector_size))
return grub_error (GRUB_ERR_WRITE_ERROR, N_("cannot write to `%s': %s"),

View File

@ -58,7 +58,7 @@ Patch10: grub-2.00-add-fw_path-search.patch
Patch11: grub-2.00-Add-fwsetup.patch
Patch13: grub-2.00-Dont-set-boot-on-ppc.patch
Patch14: grub-2.00-ignore-gnulib-gets-stupidity.patch
Patch15: grub-2.00-linux-mbr.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)