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

From: Warner Losh <imp_at_bsdimp.com>
Date: Tue, 20 Sep 2022 20:36:02 UTC
On Tue, Sep 20, 2022 at 10:29 AM Marek Zarychta <
zarychtam@plan-b.pwste.edu.pl> wrote:

> 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.
>

They are only ever needed after 'zfs upgrade' on the zpool that you are
booting from.


> > 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).
>

Yes, the order should be:

buildworld, buildkernel, installkernel, reboot, installworld, install new
ESP
loader, zfs upgrade. You don't need to do the last two steps if you don't
do the last step.


> 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].
>

My order doesn't require copying from the objtree :).

Warner


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