Re: following -current on rpi4 with zfs-on-root

From: Marek Zarychta <zarychtam_at_plan-b.pwste.edu.pl>
Date: Tue, 20 Sep 2022 16:28:59 UTC
W dniu 20.09.2022 o 14:33, void pisze:
> On Mon, Sep 19, 2022 at 09:48:42PM -0600, Warner Losh wrote:
> 
>> I've updated UPDATING in https://reviews.freebsd.org/D36629. Please 
>> review.
> 
>> For EFI, there are many choices. The default installation places
>> loader.efi into the ESP in EFI\FREEBSD\LOADER.EFI. The following
>> updates it (assuming the ESP is on p1, and isn't already mounted):
>> mount -t msdos /dev/ada0p1 /boot/efi
>> cp /boot/efi/loader.efi /boot/efi/efi/freebsd
>> If you have a non-standard setup, please see the EFI notes section.
> 
> My non-expert opinion:
> 
> 1. ideally there should be an indication in what circumstances
>     the above is required, because it might not be possible to infer
>     for the non-expert (with regards to the above) user 

While following CURRENT branch, updates of the ESP loader have to be 
done quite often. For STABLE branches, it might not be required at all 
for the whole lifecycle. Reading UPDATING and commit messages could help.

> 2. if it needs to happen, where in the buildworld/kernel/install/
>     etcupdate/reboot sequence is it required? I would guess after
>     etcupdate and before reboot, but guessing isn't the same as knowing.
>     It would be great if this was in the Source of Truth(tm).
> 

There is no official HOWTO upgrade for arm64 on ZFS. Upgrading from 
sources is a pretty straightforward and standard procedure described in 
the handbook[1]. Usually, such an upgrade is done not in-place, but by 
cross-building and cross-instaling on amd64 machine, so rebooting is not 
required.

To upgrade the loader, you need to copy _newly_ built file 
/boot/loader_lua.efi to EFI/BOOT/bootaa64.efi on ESP partition. So 
upgrading loader on ESP partition can be performed no earlier than after 
completing installworld, which is too late if you are going to strictly 
follow[1] and reboot between installkernel and installworld steps. If 
you are going to follow the handbook, you can find in the OBJDIR freshly 
built loader 
(/usr/obj/usr/src/arm64.aarch64/stand/efi/loader_lua/loader_lua.efi) and 
copy it to the ESP prior to rebooting as described in review D36629[2].


[1] https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld
[2] https://reviews.freebsd.org/D36629

-- 
Marek Zarychta