From nobody Thu Dec 21 23:21:00 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sx5yw3Tyrz54Pqy for ; Thu, 21 Dec 2023 23:21:12 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Received: from www121.sakura.ne.jp (www121.sakura.ne.jp [153.125.133.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sx5yv64pvz4ZD3; Thu, 21 Dec 2023 23:21:11 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Authentication-Results: mx1.freebsd.org; none Received: from kalamity.joker.local (123-1-22-158.area1b.commufa.jp [123.1.22.158]) (authenticated bits=0) by www121.sakura.ne.jp (8.17.1/8.17.1/[SAKURA-WEB]/20201212) with ESMTPA id 3BLNL06T075539; Fri, 22 Dec 2023 08:21:01 +0900 (JST) (envelope-from junchoon@dec.sakura.ne.jp) Date: Fri, 22 Dec 2023 08:21:00 +0900 From: Tomoaki AOKI To: Dimitry Andric Cc: Nuno Teixeira , FreeBSD CURRENT Subject: Re: symlink to /boot/loader.efi Message-Id: <20231222082100.4c9b0220ef15180ad2ff36df@dec.sakura.ne.jp> In-Reply-To: <90AA5680-49A9-4630-80EF-0580E8F31EA2@FreeBSD.org> References: <631DF939-4E18-4319-BE94-335E63B27B09@FreeBSD.org> <90AA5680-49A9-4630-80EF-0580E8F31EA2@FreeBSD.org> Organization: Junchoon corps X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:7684, ipnet:153.125.128.0/18, country:JP] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4Sx5yv64pvz4ZD3 On Thu, 21 Dec 2023 14:22:14 +0100 Dimitry Andric wrote: > Yeah, my procedure is the same as yours: I first copy /boot/efi/efi/freebsd/loader.efi to /boot/efi/efi/freebsd/loader.old, then copy the freshly built and installed /boot/loader.efi to /boot/efi/efi/freebsd/loader.efi. I don't see a technical reason why this could not be just another step in the installworld procedure. > > That said, I am unsure if the pathname /boot/efi/efi is always the same, at least for all UEFI systems. It is the default layout when you do a regular install with recent installer onto a UEFI system, but some users may use completely different mount points. So you should still have some way of configuring the default location for loader installation. > > Also, on default installations a fallback entry named /boot/efi/efi/boot/bootx64.efi is made, essentially another copy of loader.efi but with a different name. Namely, the default name that UEFI (on x86_64 at least) searches for, if it doesn't know anything else. I.e. if it isn't configured via efibootmgr(8), or the EFI variables have been junked for some reason. It might make sense to also update that file. > > -Dimitry Just an idea. It would be nice if loader.efi (hopefully, boot1.efi,too) could pass "where am I placed?" info, maybe via kenv. Would need boot1.efi to pass something (ideally, "where am I booted from?", but "boot1_used=1" is sufficient). To do so, loader.efi can confirm whether it was loaded via boot1.efi or directly from UEFI firmware. If nothing is passed to it, it can probe "where it is?" using UEFI call and set it, otherwise, it should be /boot/loader.efi, so nothing is needed to do. If no related kenv is set and freebsd-boot partition exists, it should be booted with legacy (BIOS) boot. The easiest to be set by loader.efi and/or boot1.efi would be raw UEFI device path. So would need analyzing where actually is on booted FreeBBSD environment. > > > On 21 Dec 2023, at 13:59, Nuno Teixeira wrote: > > > > Hello Dimitry, > > > > For a moment I forgot that efiboot is a fat system... > > I am inspired on what installworld does to kernel and kernel.old. > > I was thinking in something like it but with efi boot, something automatic. > > > > Thanks! > > > > Dimitry Andric escreveu no dia quinta, 21/12/2023 à(s) 12:48: > > On 21 Dec 2023, at 13:22, Nuno Teixeira wrote: > > > > > > On every current upgrade I update efi/freebsd/loader.efi (amd64) and efi/boot/boota64 (aarch64) with new copies on /boot/loader.efi. > > > For safety reasons I always have a copy of last running loader by appending "-old.efi" to loader or boota64 and use beinstall to get BEs if needed. > > > > > > Is that possible to link, e.g., /boot/efi/efi/freebsd/loader.efi -> /boot/loader.efi ? > > > > Symlinks do not work on FAT file systems, so I assume you mean a symlink placed in /boot (assuming that is UFS or ZFS), which points to /boot/efi/efi/freebsd? > > > > At the moment I think installworld would not write 'through' such a symlink. In fact, it makes a hard link from /boot/loader_lua.efi to /boot/loader.efi, unlinking any previous /boot/loader.efi. > > > > That said, it would be nice to have some sort of semi-official way of upgrading the real EFI loader through installworld. It would probably require some top-level Makefile magic. > > > > -Dimitry > > > > > > > > -- > > Nuno Teixeira > > FreeBSD Committer (ports) -- Tomoaki AOKI