Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Dec 2023 23:49:38 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Tomoaki AOKI <junchoon@dec.sakura.ne.jp>, Toomas Soome <tsoome@me.com>, Mark Millard <marklmi@yahoo.com>, Current FreeBSD <freebsd-current@freebsd.org>
Subject:   Re: symlink to /boot/loader.efi
Message-ID:  <ZYYEcqZGEsaSVjsb@kib.kiev.ua>
In-Reply-To: <CANCZdfrwq%2BLS6vXcewruZBFo6RMZi-2q2vWkdYFeN4en7hK0QQ@mail.gmail.com>
References:  <AF65AD57-5D93-4FC2-84E8-58E1D7C0C3BC.ref@yahoo.com> <AF65AD57-5D93-4FC2-84E8-58E1D7C0C3BC@yahoo.com> <94C108FE-3D2F-4116-B071-810F64DECEC4@me.com> <5879A778-0522-4E0F-A569-731E5EC85C18@yahoo.com> <8711C4A5-6329-4FB2-9D7A-4C7215595110@me.com> <20231223000015.766b94fe0e3a3b742fd386c5@dec.sakura.ne.jp> <CANCZdfrwq%2BLS6vXcewruZBFo6RMZi-2q2vWkdYFeN4en7hK0QQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 22, 2023 at 02:03:56PM -0700, Warner Losh wrote:
> Yes. I'd prefer to make this more parameterized, maybe with sanity checks.
> 
> That is, there'd be a tool that would do the right thing, based on what you
> tell it to do. we'd set the defaults to be a default install. If you want
> something other than defaults, you'd need to set a make variable (or a
> command line arg if you ran the tool by hand.
> 
> You can know what type of system you are on: if arm, arm64 or riscv64, then
> it's UEFI. If i386 then it's BIOS (though you can confirm this by looking
> at machdep.bootmethod to see if it is BIOS, UEFI or something else), with
> amd64, it's the same check as i386. If it's powerpc, then you someone with
> powerpc skills will have to fill in the blanks here.
> 
> If it is BIOS, we can infer the boot disk from where / lives. This isn't
> always correct, so that needs to be overiden. kenv might be useful, but it
> exports loaddev/currdev in the Boot Loader's namespace (disk0, etc) which
> may or may not match up with anything on FreeBSD.
> 
> If it's UEFI, then we can use efibootmgr to find what was booted (or at
> least locate the ESP). Once we have the ESP, we can look at other bits of
> the boot variables to know if it's /efi/boot/bootx64.efi or if it's
> /etc/freebsd/loader.efi to update (and optionally, we could to both). Then
> you also have 'automount vs. fail' if the ESP isn't mounted.
> 
> I'd recommend against autodetecting boot1 vs loader, except maybe as a
> safety measure that can be overriden. It's another reason having boot1.efi
> around complicates things needlessly.
> 
> This is the sort of thing I was hoping to code up. I got bogged down by
> including 'also update the primary loader (aka the freebsd-boot partition,
> the u-boot stuff that needs to be dd', etc), so I think we shouldn't do
> that until phase 2.
> 
> So maybe we should write a man page for this tool, and maybe a paragraph
> for how it would hook into the build system if we wanted to have a 'make
> installboot' target that lives logically before installkernel.
> 
> Comments?

Can we remove boot1.efi from the picture of the updating tool at all?

Lets make the boot1 explicitly limited for very simple configuration
where it searches for first UFS GPT partition and loads loader.efi
from there.  The autoupdate tool would be not used at all in such
config, by administrator choice.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZYYEcqZGEsaSVjsb>