On Fri, Aug 8, 2008 at 2:50 PM, Viswesh S <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Thanks,let me have a look at the chainloader command in grub2 and in legacy
> grub.
>
> Could you let me know the issue which you faced in the chainloader command.

Hi,

The problem is in loader/i386/pc/chainloader.c (grub_chainloader_cmd):

  /* Obtain the partition table from the root device.  */
  dev = grub_device_open (0);
  if (dev)
    {
      grub_disk_t disk = dev->disk;

      if (disk)
        {
          grub_partition_t p = disk->partition;
        
          /* In i386-pc, the id is equal to the BIOS drive number.  */
          drive = (int) disk->id;

          if (p)
            {
              grub_disk_read (disk, p->offset, 446, 64,
                              (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
              part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
                                    + (p->index << 4));
            }
        }

      grub_device_close (dev);
    }

p->offset is the offset of the start of the partition, but actually,
we need to read the sector that contain the partition table, which is
the mbr for primary. But replace p->offset with 0 doesn't fix this, as
grub_disk_read is related to the beginning of partition, not the disk.
You need to use the low level api:

disk->dev->read (disk, 0, 1, (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);

But this fix only apply to primary partition, for logical partition,
the partition table is not in mbr, and this quick patch doesn't work.
But I remember someone send a patch to allow for loading of syslinux
in logical partition, you can search the list if you're interested.

BTW, if this doesn't work, you can try loadbin. It can be used to
chainload ntldr/bootmgr directly.

-- 
Bean


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to