Re: FreeBSD 14.1 and UEFI boot ignores bootme flag

From: Karl Denninger <karl_at_denninger.net>
Date: Tue, 13 Aug 2024 19:14:46 UTC
On 8/13/2024 09:30, Daniel Braniss wrote:
>
>
>> On 13 Aug 2024, at 15:38, Warner Losh <imp@bsdimp.com> wrote:
>>
>>
>>
>> On Tue, Aug 13, 2024, 12:11 AM Daniel Braniss <danny@cs.huji.ac.il> 
>> wrote:
>>
>>     hi,
>>     my disk has 2 root partitions, and once I switched to UEFI boot,
>>     can’t boot the second partition:
>>     (the hardware is a bit old, Dell PowerEdge R710 with bios from
>>     05/22/2018)
>>
>>     store-08# gpart show -l
>>     =>        40  5857345456  mfid0  GPT  (2.7T)
>>              40       81920      1  efi  (40M)
>>     81960    8388608      2  root  (4.0G)
>>     8470568    8388608      3  root0  [bootme]  (4.0G)
>>        16859176     8388608      4  d1  (4.0G)
>>        25247784     8388608      5  d2  (4.0G)
>>        33636392  5823709104      6  zfs  (2.7T)
>>
>>     it only boots from partition 2.
>>
>>     so is there any magic?
>>
>>
>> Use efibootmgr. Bootme flags are non-standard and have been ignored 
>> in UEFI since the start.
>
> I read the man for efibootmgr but it was way above my pay grade :-)
> I tried add/create but got nowhere.
>
> store-08# efibootmgr
> BootCurrent: 0000
> Timeout    : 0 seconds
> BootOrder  : 0002, 0000, 0001
> Boot0002* Broadcom NetXtreme II Gigabit Ethernet (BCM5709)
> +Boot0000* EFI Fixed Disk Boot Device 1
> Boot0001* TSSTcorp DVD+/-RW TS-L633C
>
> At some point I succeeded in deleting the dvd, but now I see its back.
>
> So how do I add a second boot partition?
>
> (If the sequence look fishy, it’s because I can change the boot 
> sequence via DHCP)
>
>
Try this:

root@TnHouse:/data/karl # gpart show
=>      63  62521281  mmcsd0  MBR  (30G)
         63    102375       1  fat32lba  [active]  (50M)
     102438  15522562       2  freebsd  (7.4G)
   15625000  46896344          - free -  (22G)

=>       0  15522562  mmcsd0s2  BSD  (7.4G)
          0   7168000         1  freebsd-ufs  (3.4G)
    7168000   7168000         2  freebsd-ufs  (3.4G)
   14336000     65536         4  freebsd-ufs  (32M)
   14401536   1121026         5  freebsd-ufs  (547M)

This is a Pi3/4 boot SD card, thus MBR ('cause it has to be) but the 
system actually BOOTS off the EFI partition.  In there we have....

root@TnHouse:/mnt # ls -laR EFI
total 12
drwxr-xr-x  1 root wheel  4096 Jul  4 15:11 .
drwxr-xr-x  1 root wheel 16384 Dec 31  1979 ..
drwxr-xr-x  1 root wheel  4096 Jul  4 15:11 BOOT
drwxr-xr-x  1 root wheel  4096 Jul  4 15:11 FreeBSD

EFI/BOOT:
total 840
drwxr-xr-x  1 root wheel   4096 Jul  4 15:11 .
drwxr-xr-x  1 root wheel   4096 Jul  4 15:11 ..
-rwxr-xr-x  1 root wheel 849444 Jul  4 15:13 bootaa64.efi

EFI/FreeBSD:
total 12
drwxr-xr-x  1 root wheel 4096 Jul  4 15:11 .
drwxr-xr-x  1 root wheel 4096 Jul  4 15:11 ..
-rwxr-xr-x  1 root wheel   17 Aug  8 19:17 loader.env

And loader.env contains...

root@TnHouse:/mnt/EFI/FreeBSD # cat loader.env
rootdev=disk0s2b

There you go.  Works great and is basically the same as "bootme"

Should work for any EFI bootable system.

-- 
Karl Denninger
karl@denninger.net
/The Market Ticker/
/[S/MIME encrypted email preferred]/