----- Original Message ----
From: Bean <[EMAIL PROTECTED]>
To: The development of GRUB 2 <grub-devel@gnu.org>
Sent: Friday, 8 August, 2008 4:00:41 PM
Subject: Re: Windows boot

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.

Hi,
I tried the loadbin,according to the instructions which you had given in 
osdir.com
" 
linux loadbin.bin
initrd ntldr

This method is not limited to grub2, it can also be used in boot
loaders which support the linux kernel format, such as
syslinux/lilo/grub.

To compile loadbin.bin, use the following commands:

gcc -nostdlib -DLOADBIN -Wl,-N -o lnxhdr lnxhdr.S
objcopy -O binary lnxhdr lnxhdr.bin
"
Are you sure, this is the procedure ? Dont we need to generate loadbin ?
Could you please confirm ?
Regards,
Viswesh

-- 
Bean


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



      Add more friends to your messenger and enjoy! Go to 
http://in.messenger.yahoo.com/invite/
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to