On Sat, Aug 30, 2008 at 4:29 AM, Viswesh S <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am back with my Windows boot up question using grub and grub2.Sorry for
> making the question a bit long.
>
> Some experiments and results which I did.
>
> Scenario: One hard disk,different partitions.
>
> Case 1:
>
> Partition 1 -> Windows Server 2003
> Partition 2 -> Swap
> Partition 3 -> Linux
>
> Boot loader : Grub2.
>
> Windows boots up successfully from grub2 using chainloading (hd0,1) +1
>
> Case 2:
>
> Installed server 2008 in the free space in between Server 2003 and swap.
>
> Partition 1 : Windows server 2003
> Partition 2: Windows server 2008
> Partition 3 :Swap
> Partition 4:Linux
>
> Grub2 doesnt boot up windows with the command chainloader (hd0,1) +1, with
> error
>
> A disk read error occurred
> Ctrl+Alt +del to restart.
>
> But Grub legacy boots up with no issues , with the same command, prefixed
> with rootnoverify hd0
>
> Case 3:
>
> Partition 1 :Boot
> Partition 2:Windows
> Partition 3: Linux
>
> Same behaviour : Grub2 doesnt boot Windows with chainloader command (hd0,2)
> +1
>
> Same error as before.
>
> Not surprisingly grub boots with the same command.
>
> I had a look at the boot sector code of Windows, which gets copied, by
> dumping the partition using dd.
>
> For me, it looked the same.
>
> Also another hunch is that,as the error ( A disk read error occurred ),,
> happened in Windows boot sector, find the areas in boot sector code of
> Windows where it calls this error and goes into an infinite loop.
>
> So in the different cases, I could see that it is something to do with the
> INT 13 call, with functions 41 and 42.
>
> Can anyone let me know the differences here, with respect to grub2 and grub.
>
> Also,on more thing is the way chainloader command is written in grub and
> grub2.I was finding it difficult to decode the assembly parts in both and
> find out the differences.
>
> Can anyone pour some advice and directions on these.

Hi,

I thinks it's caused by partition entry pointer %esi which isn't
correct in grub2, please see if this patch fixes the problem.

-- 
Bean
diff --git a/loader/i386/pc/chainloader.c b/loader/i386/pc/chainloader.c
index 825dbb3..ab3b203 100644
--- a/loader/i386/pc/chainloader.c
+++ b/loader/i386/pc/chainloader.c
@@ -101,12 +101,24 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
 	  /* In i386-pc, the id is equal to the BIOS drive number.  */
 	  drive = (int) disk->id;
 
-	  if (p)
+	  if ((p) && (p->index < 4))
 	    {
-	      grub_disk_read (disk, p->offset, 446, 64,
-			      (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
+              int i;
+
+	      disk->dev->read (disk, 0, 1,
+                               (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR);
+
+              grub_memcpy ((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR,
+                           (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR + 0x1be,
+                           64);
+
 	      part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
 				    + (p->index << 4));
+
+              for (i = 0; i < 4; i++)
+                *((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR + i * 16) = 0;
+
+              *((char *) part_addr) = 0x80;
 	    }
 	}
 
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to