[syslinux] Is it possible to chainload EXTLINUX from GRUB?

H. Peter Anvin hpa at zytor.com
Tue Oct 24 16:22:04 PDT 2006


Gavin D. Smith wrote:
> 
> Here we go. The following is chainloading extlinux on a primary 
> partition, which succeeds.
> 

[DS:SI points to a proper partition table entry]

xp /16b ds:si [bochs]: 0x000007ce <bogus+ 0>: 0x80 0x00 0x01
0x20 0x83 0x03 0x20 0x3f 0x000007d6 <bogus+ 8>: 0x00 0x10 0x00 0x00 0x00
0x10 0x00 0x00

This refers to a partition starting at sector 0x1000 (4096), which is 
4096 sectors long.  This is your c.img2 partition.

> 
> The following is where the problem is, chainloading extlinux on a 
> logical partition.
> 

[DS:SI points to a bogus partition table entry]

<bochs:5> xp /16b ds:si [bochs]: 0x000007be <bogus+ 0>: 0x80 0x01 0x01
0x60 0x83 0x03 0x20 0x7e 0x000007c6 <bogus+ 8>: 0x20 0x00 0x00 0x00 0x60
0x0f 0x00 0x00

This refers to a partition starting at sector 0x20 (32), and which is 
0x0f60 (3936) sectors long.  It has the correct length, but the wrong 
start address.

This is the raw binary copy of the meta-partition table entry, in your 
case sector 12288.  The problem is that that doesn't give the boot 
loader the information it wants, because the start field is *relative* 
to the beginning of the partition.  In order to chainload a logical 
partition, the chainloader needs to adjust the start field with the 
position of the boot field, so that it ends up with 12288+32 = 12320 
(0x3020), which is the start of your logical partition.

> Disk c.img: 0 cylinders, 0 heads, 0 sectors/track
> Warning: The partition table looks like it was made
>  for C/H/S=*/4/32 (instead of 0/0/0).
> For this listing I'll assume that geometry.
> Units = sectors of 512 bytes, counting from 0
> 
>   Device Boot    Start       End   #sectors  Id  System
>   c.img1            32      4095       4064  83  Linux
>   c.img2          4096      8191       4096  83  Linux
>   c.img3          8192     12287       4096  83  Linux
>   c.img4         12288     16383       4096   5  Extended
>   c.img5         12320     16255       3936  83  Linux

For additional information, see:

http://www.win.tue.nl/~aeb/partitions/partition_tables.html

... as well as com32/modules/chain.c in the syslinux distribution.

	-hpa




More information about the Syslinux mailing list