[parted-devel] [PATCH] GPT & BIOS Boot partition

H. Peter Anvin hpa at zytor.com
Fri Feb 22 20:25:32 UTC 2008


Robert Millan wrote:
>>>
>> Yuck, this is a total mess.  It's not a "bootable" flag, then, it's a 
>> "I'm Grub" flag.
> 
> Not really.  For example, you can do:
> 
>   grub-install /dev/sda3	# this won't touch your MBR!
>   dd if=mbr-gpt of=/dev/sda
> 
> and it works.  There's nothing GRUB-specific in it;  the MBR just loads the
> first sector of /dev/sda3 at 0x7c00, sets appropiate %dl register and jumps
> to it.  As long as the code in /dev/sda3 knows what to do on GPT, everything
> should be fine.
> 

That's the problem - "it just".  There is another part of the MBR 
protocol which this doesn't seem to address; the DS:SI structure.

When an MBR chainloads a boot program, it sets DS:SI to point to the 
partition entry; to make it work for cases like logical partitions it 
needs to be synthesized since a logical partition entry has slightly 
different meaning.

For < 2 TB, we can simply synthesize a MBR-style partition entry in 
memory and point to it.  No problem.  For >= 2 TB, there are issues here.

One possible extension protocol would look like:

Point DS:SI to an MBR-style partition entry followed by the GPT 
partition entry.  The MBR partition entry has EE as its type (indicating 
GPT) and has the offset and length valid if possible, otherwise 
0FFFFFFFFh.  This should provide maximum compatibility while providing 
the program with the flexibility it needs.

Why bother with this stuff?  Well, for one thing, if partitions can be 
moved, it is not a very nice thing to stop being able to boot as a result.

However, using a specific UUID for this doesn't seem to be all that good 
of an idea; especially with Redmond OSes seemingly going a different way.

	-hpa



More information about the parted-devel mailing list