[haiku-development] Re: GPT boot loader for Haiku (the start of)

  • From: André Braga <meianoite@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Wed, 10 Jun 2009 14:24:41 -0300

Em 10/06/2009, às 07:00, "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> escreveu:

Alright, I got it know, thanks! But then we'd also want to have the
boot manager boot code adapted for GPT, too, right?

It's not really necessary to modify the boot manager code at all, since it's based on partition offsets already. What *must* be modified, though, is the boot manager code /injector/, that is, Bootman. GPT uses 32 sectors, from LBA1 to LBA33, and bootman overwrites LBA0 to LBA3. On a machine with EFI this is mostly harmless as the firmware will detect that the first partition table got corrupted and will rewrite it with the backup table found on the last 33 sectors of the disk. Not so much on a BIOS machine, if there are no MBR partitions other than the EFI Protective you're pretty much toast :P

GPT gives us flexibility to create even ridiculously small partitions, so when we get the capability of writing GPTs we could define a 2kb 'Boot' UUID using the Haiku suffix and have Bootman place the code there, and have the protective MBR code load it instead of stage1 from a 'BFS1' UUID. This can all be done already, except for Bootman not having the ability to place the boot manager code in an arbitrary partition instead of the first 2kb of the disk.

By the way, there should be a fallback to reading the backup GPT in case the primary is corrupted.

All in all, we're in a surprisingly good shape to fully support GPT.


Cheers,
A.

Other related posts: