summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-boot/grub/files/grub-1.97-hostdisk.patch')
-rw-r--r--sys-boot/grub/files/grub-1.97-hostdisk.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/sys-boot/grub/files/grub-1.97-hostdisk.patch b/sys-boot/grub/files/grub-1.97-hostdisk.patch
new file mode 100644
index 0000000..6eb7fe4
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.97-hostdisk.patch
@@ -0,0 +1,60 @@
+--- util/hostdisk.c 2010-01-25 17:04:22 +0000
++++ util/hostdisk.c 2010-01-31 11:52:27 +0000
+@@ -336,7 +336,8 @@
+ char dev[PATH_MAX];
+
+ strcpy (dev, map[disk->id].device);
+- if (disk->partition && strncmp (map[disk->id].device, "/dev/", 5) == 0)
++ if (disk->partition && sector >= disk->partition->start
++ && strncmp (map[disk->id].device, "/dev/", 5) == 0)
+ is_partition = linux_find_partition (dev, disk->partition->start);
+
+ /* Open the partition. */
+@@ -490,6 +491,23 @@
+ {
+ int fd;
+
++ /* Split pre-partition and partition reads. */
++ if (disk->partition && sector < disk->partition->start
++ && sector + size > disk->partition->start)
++ {
++ grub_err_t err;
++ err = grub_util_biosdisk_read (disk, sector,
++ disk->partition->start - sector,
++ buf);
++ if (err)
++ return err;
++
++ return grub_util_biosdisk_read (disk, disk->partition->start,
++ size - (disk->partition->start - sector),
++ buf + ((disk->partition->start - sector)
++ << GRUB_DISK_SECTOR_BITS));
++ }
++
+ fd = open_device (disk, sector, O_RDONLY);
+ if (fd < 0)
+ return grub_errno;
+@@ -527,6 +545,23 @@
+ {
+ int fd;
+
++ /* Split pre-partition and partition writes. */
++ if (disk->partition && sector < disk->partition->start
++ && sector + size > disk->partition->start)
++ {
++ grub_err_t err;
++ err = grub_util_biosdisk_write (disk, sector,
++ disk->partition->start - sector,
++ buf);
++ if (err)
++ return err;
++
++ return grub_util_biosdisk_write (disk, disk->partition->start,
++ size - (disk->partition->start - sector),
++ buf + ((disk->partition->start - sector)
++ << GRUB_DISK_SECTOR_BITS));
++ }
++
+ fd = open_device (disk, sector, O_WRONLY);
+ if (fd < 0)
+ return grub_errno;