GPT boot has less features than legacy MBR-based one (Was: UEFI, loader.efi and /boot.config)

Tomoaki AOKI junchoon at dec.sakura.ne.jp
Sat Jan 19 02:32:32 UTC 2019


On Fri, 18 Jan 2019 22:44:28 +0300
Lev Serebryakov <lev at FreeBSD.org> wrote:

> On 18.01.2019 22:27, Warner Losh wrote:
> 
> >     > errm.. you press a key and enter device and or loader path. if it
> >     is not working - the code is there to be fixed.
> >     〓And loader looks to "bootme" attribute and try to boot from partition
> >     which has one, even if it is loaded from other partition itself.
> > Correct.
>  And system crashes, because "bootme" partition has broken installation.
> 
>  With MBR + boot0/boot0sio it is solved with one keypress.
> 
> >     > GPT does not have the concept of active partition.
> >     〓It has "bootme" / "bootonce" attributes. And [zfs]gptboot doesn't have
> >     any tools to set these attributes, AFAIK. Same for UEFI boot code.
> > 
> > gpart can set these.
>  You need live, booted system (at least single-user) to use gpart.
> 
> > UEFI completely ignores them, though, because getting to that data is
> > hard in the UEFI environment. But in UEFI, you're supposed to use
> > BootXXXX and BootOrder/BootNext as managed by efibootmgr.
>  Again, you need booted system to use efibootmgr.
> 
>   boot0/boot0sio works before system and could switch boot partition in
> case of MBR. It is why I write, that GPT/Legacy and GPT/UEFI miss
> important feature which is present for MBR boot for ages. Which is sad &
> funny at same time, as GPT/UEFI has much more code than 512 bytes of boot0.
> 
> -- 
> // Lev Serebryakov
> 

Hi.
I should note that 512-bytes boot0 doesn't have that feature.
What had it WAS larger boot0ext, which has already gone on stable/11
and later. IIRC, sysinstall let me select which to install on MBR.

It could be larger than 512 bytes as no partition could be mapped on
1st cylinder because USUAL partition editors aligns partition by
cylinder on ancient CHS days.
But IIUC, it was trivial, NOT assured by any spec.
So preparing 512-bytes (single sector) boot0 IS mandatory for MBR,
while boot0ext is not.

One good news is that boot1.efi having boot-time partition selection
by Naomichi Nonaka exists on bugzilla.[1]

The latest ones includes my quick and ugly hack to get back deleted
but needed functions, though.

"boot1.c patch rev4 for stable/11 after MFC of r332751" would be
applicable to stable/11 (not tested recently), and
"boot1.c patch rev4 for stable/12 and head after r332751" would be
applicable to stable/12 and head.

  *I've uploaded long-forgotton ones just before this mail.

They should be cleaned-up to use currently-available functions
instead of re-adding deleted functions but I have not enough time
to do, and Naomichi, the original auther of the patche, already
switched to use grub and would not maintain it further.

And a bad news is that [1] would never be committed, and non-UEFI
GPT-based installation doesn't have any alternatives.

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207940

-- 
Tomoaki AOKI    <junchoon at dec.sakura.ne.jp>


More information about the freebsd-current mailing list