[grub/f15/master] Support flat file installs (#681787)

Peter Jones pjones at fedoraproject.org
Mon Mar 14 14:14:43 UTC 2011


commit 8eed7ad7e0c14b6c0e4448a00d186cb44be8e1cd
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Fri Mar 11 17:44:54 2011 +0100

    Support flat file installs (#681787)

 grub-0.97-flat-file-install.patch |   72 +++++++++++++++++++++++++++++++++++++
 grub.spec                         |    8 ++++-
 2 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/grub-0.97-flat-file-install.patch b/grub-0.97-flat-file-install.patch
new file mode 100644
index 0000000..6b37fbc
--- /dev/null
+++ b/grub-0.97-flat-file-install.patch
@@ -0,0 +1,72 @@
+From c9a6d055d51a0ebe83b845de0bf1498e28b54988 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Sat, 26 Feb 2011 17:02:19 +0100
+Subject: [PATCH] If partition file is not present, use whole disk
+
+In that case, we don't need to worry about cache coherence between whole
+volume and partition anyway.
+---
+ lib/device.c     |    4 ++++
+ stage2/disk_io.c |   28 ++++++++++++++--------------
+ 2 files changed, 18 insertions(+), 14 deletions(-)
+
+diff --git a/lib/device.c b/lib/device.c
+index 45e4001..50540bc 100644
+--- a/lib/device.c
++++ b/lib/device.c
+@@ -1119,6 +1119,10 @@ write_to_partition (char **map, int drive, int partition,
+   fd = open (dev, O_RDWR);
+   if (fd < 0)
+     {
++      /* No partition file, pass thru and not worry about
++       * cache inconsistency. */
++      if (errno == ENOENT)
++        return -1;
+       errnum = ERR_NO_PART;
+       return 0;
+     }
+diff --git a/stage2/disk_io.c b/stage2/disk_io.c
+index 308b291..09a0b75 100644
+--- a/stage2/disk_io.c
++++ b/stage2/disk_io.c
+@@ -381,23 +381,23 @@ devwrite (int sector, int sector_count, char *buf)
+ 	 embed a Stage 1.5 into a partition instead of a MBR, use system
+ 	 calls directly instead of biosdisk, because of the bug in
+ 	 Linux. *sigh*  */
+-      return write_to_partition (device_map, current_drive, current_partition,
+-				 sector, sector_count, buf);
++      int ret;
++      ret = write_to_partition (device_map, current_drive, current_partition,
++				sector, sector_count, buf);
++      if (ret != -1)
++	return ret;
+     }
+-  else
+ #endif /* GRUB_UTIL && __linux__ */
+-    {
+-      int i;
+-      
+-      for (i = 0; i < sector_count; i++)
+-	{
+-	  if (! rawwrite (current_drive, part_start + sector + i, 
+-			  buf + (i << get_sector_bits(current_drive))))
+-	      return 0;
++    int i;
+ 
+-	}
+-      return 1;
+-    }
++    for (i = 0; i < sector_count; i++)
++      {
++	if (! rawwrite (current_drive, part_start + sector + i,
++			buf + (i << get_sector_bits(current_drive))))
++	    return 0;
++
++      }
++    return 1;
+ }
+ 
+ static int
+-- 
+1.7.1
+
diff --git a/grub.spec b/grub.spec
index 934e306..b7ed228 100644
--- a/grub.spec
+++ b/grub.spec
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 72%{?dist}
+Release: 73%{?dist}
 Epoch: 1
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
@@ -26,6 +26,9 @@ Source0: ftp://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
 Patch0: grub-fedora-14.patch
 Patch1: grub-0.97-support-4k-sector-size.patch
 
+# https://bugzilla.redhat.com/show_bug.cgi?id=681787
+Patch2: grub-0.97-flat-file-install.patch
+
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
 capable of booting into most free operating systems - Linux, FreeBSD,
@@ -105,6 +108,9 @@ fi
 %{_datadir}/grub
 
 %changelog
+* Fri Mar 11 2011 Lubomir Rintel <lkundrak at v3.sk> - 1:0.97-73
+- Support flat file installs (#681787)
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:0.97-72
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list