Bug#553613: grub2 chainloading fails

Joerg Dorchain joerg at dorchain.net
Sun Nov 1 13:43:14 UTC 2009


Package: grub-pc
Version: 1.97~beta3-1
Tags: upstream,patch

Hello,

without this patch chainloading certain other loaders, esp.
syslinux, does not work.

This situation occurs with grub installed on the mbr and the
other loader as a partition boot loader.

A smiliar patch appeared on the grub-devel mailing list. This one
is adapted to the mentioned debian version of grub.

Please consider.

Bye,

Joerg


diff -ru grub2-1.96+20090721/include/grub/msdos_partition.h grub2+patch/include/grub/msdos_partition.h
--- grub2-1.96+20090721/include/grub/msdos_partition.h	2009-05-09 13:04:08.000000000 +0200
+++ grub2+patch/include/grub/msdos_partition.h	2009-07-22 10:49:34.557536456 +0200
@@ -184,6 +184,9 @@
 
   /* The offset of the extended partition.  */
   unsigned long ext_offset;
+
+  /* Partition entry. */
+  struct grub_msdos_partition_entry msdos_part_entry;
 };
 
 static inline int
diff -ru grub2-1.96+20090721/loader/i386/pc/chainloader.c grub2+patch/loader/i386/pc/chainloader.c
--- grub2-1.96+20090721/loader/i386/pc/chainloader.c	2009-06-11 18:13:39.000000000 +0200
+++ grub2+patch/loader/i386/pc/chainloader.c	2009-07-22 10:51:36.170516258 +0200
@@ -32,6 +32,7 @@
 #include <grub/dl.h>
 #include <grub/command.h>
 #include <grub/machine/biosnum.h>
+#include <grub/msdos_partition.h>
 
 static grub_dl_t my_mod;
 static int boot_drive;
@@ -94,10 +95,11 @@
   dev = grub_device_open (0);
   if (dev && dev->disk && dev->disk->partition)
     {
-      grub_disk_read (dev->disk, dev->disk->partition->offset, 446, 64,
-		      (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
-      part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
-			    + (dev->disk->partition->index << 4));
+      struct grub_msdos_partition *pcdata = dev->disk->partition->data;
+      grub_memcpy((void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR,
+			  (void *) &pcdata->msdos_part_entry,
+			  sizeof(struct grub_msdos_partition_entry));
+      part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
     }
 
   if (dev)
diff -ru grub2-1.96+20090721/partmap/pc.c grub2+patch/partmap/pc.c
--- grub2-1.96+20090721/partmap/msdos.c	2009-06-10 23:04:23.000000000 +0200
+++ grub2+patch/partmap/msdos.c	2009-07-22 10:53:34.679495828 +0200
@@ -131,6 +131,8 @@
 	  pcdata.bsd_part = -1;
 	  pcdata.dos_type = e->type;
 	  pcdata.bsd_type = -1;
+	  grub_memcpy(&pcdata.msdos_part_entry, e, sizeof(struct grub_msdos_partition_entry));
+	  pcdata.msdos_part_entry.start = grub_cpu_to_le32(p.offset + grub_le_to_cpu32 (e->start));
 
 	  grub_dprintf ("partition",
 			"partition %d: flag 0x%x, type 0x%x, start 0x%llx, len 0x%llx\n",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 267 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20091101/c89100ed/attachment.pgp>


More information about the Pkg-grub-devel mailing list