Comment 17 for bug 1461126

Revision history for this message
Stanislaw Bogatkin (sbogatkin) wrote :

Just my 2 cents about how it all works.

If you need just a solution - they are written at the end of comment.

TL;DR

There are BIOS or UEFI boot shcemes and MBR or GPT disk schemes. You CANNOT use UEFI with MBR - it just will not work as long as GPT is mandatory UEFI part.
Also we have bootloader - in our case, grub (when I said 'grub', I do not mean grub legacy).
So, we can have next cases when user want to install operating system:

1. BIOS+MBR
In such case you cannot use (primarily) hard disks larger than 2TB - you can't address that with MBR partitioning scheme. Usually disk partitioning looks like:
- MBR
- MBR gap (your partitions will start from sector 63 due to old DOS restriction about partitioning on cylinder boundaries, so we have about 32 free unused kilobytes there)
- Your partitions (usually, /boot then /)

That thing - MBR gap is used by grub for store stage 1.5 bootloader (core.img in grub2, if I remember it right). So, your MBR point with grub stage 1 point to grub stage 1.5 and then grub stage 1.5 point to your /boot partition with grub stage 2.

2. BIOS+GPT
In this case you can use much larger disks - up to some insane numbers in PB. Usually disk partitioning looks like:
- Protected MBR
- GPT (mbr is part of it, actually)
- Special bios boot partition (usually about 1Mb in size)
- Your partitions (/boot and /)

As long as GPT doesn't have such requirement as partitioning by cylinder boundaries, we don't have 32 kilobytes space there - partitions start just after GPT itself. But we need to store out grub stage 1.5 loader somewhere. For such case we create SPECIAL partition with code ef02, named bios_boot. It replaces old MBR gap and grub stored it's stage 1.5 loader there. But it is an old good grub there, nothing actually new.

3. UEFI+GPT
As long as UEFI is absolutely new standard, old grub cannot be loaded by UEFI firmware. There are especial new one (actually, not - it just ported to meet UEFI specifications) grub-efi that should be installed. Usually disk partitioning looks like:
- Protected MBR (don't used in most of cases)
- GPT (mbr is part of it, actually)
- Analog of /boot partition for UEFI standard, code ef00 (EFI partition, some FAT-related fs with bootloader on it)
- Your partitions (/boot and /, you can place /boot in efi partition)

In this case there are no such thing as stage 1.5 for grub. GPT point right to your loader in EFI partition, nothing else. But it is new grub, incompatible with old one. Also you need to know that your /boot partition should be placed in first 2TB of your hard disk.

So, you can use next solutions there:
1. Don't support GPT and UEFI. No need to rewrite something, this bug will not closed.
2. Support GPT, don't support UEFI. You just need to rewrite your partition scheme, it's all. Fully compatible with old one.
3. Support GPT and UEFI. You will need to do some rather complex logic to understand what you need to do. Actually, we already have bug with UEFI support for 7.0, so I rather don't recommend do it now.