As already mentioned in this mailing list (
http://lists.gnu.org/archive/html/grub-devel/2008-07/msg00192.html)n<http://lists.gnu.org/archive/html/grub-devel/2008-07/msg00192.html%29n>I
can't chainload Syslinux from Grub2 on a disk with a pc partition
table
(Syslinux is installed on a primary partition).
I just get "Boot error" (from Syslinux i guess).
However it does work from Grub Legacy.
I also couldn't chainload Syslinux from Grub2 if the disk used a GPT
partition table.
The patch provided in the previous thread and adapted to current Debian
unstable Grub2 package (1.96+20090721-3, patch attached) fixes the problem.
Have any decision been made to include that patch in a future release (or a
"better" one just providing enough information for Syslinux to boot as it
was mentioned that this one copies more than necessary) ?

Thanks.

-- 
Jean-Pierre Flori
diff -ru grub2-1.96+20090721/include/grub/pc_partition.h grub2+patch/include/grub/pc_partition.h
--- grub2-1.96+20090721/include/grub/pc_partition.h	2009-05-09 13:04:08.000000000 +0200
+++ grub2+patch/include/grub/pc_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_pc_partition_entry pc_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/pc_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_pc_partition *pcdata = dev->disk->partition->data;
+      grub_memcpy((void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR,
+			  (void *) &pcdata->pc_part_entry,
+			  sizeof(struct grub_pc_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/pc.c	2009-06-10 23:04:23.000000000 +0200
+++ grub2+patch/partmap/pc.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.pc_part_entry, e, sizeof(struct grub_pc_partition_entry));
+	  pcdata.pc_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",
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to