From nobody Wed Aug 17 18:14:38 2022 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 4M7GQ32ZTTz4Ys5x for ; Wed, 17 Aug 2022 18:14:51 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M7GQ327cfz449L for ; Wed, 17 Aug 2022 18:14:51 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660760091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ME2r25cGse3I7TJhMtBDDPqKB66INlvk1tnbvDThoow=; b=SiQU/NllOqEFH62KSsDOcE40XDrDPOy6z2rL55+jSXBj+yuF2rYA0iIepHpks1puhFQYxV fdTyEUk2Z4XnJz2Fcz45HNWLubHgn9InNUQjEk4vIxL9Rb+Pm0X1XD7MB4NoMXgyicyUKO se+kXNlO0HItqhYgWSAOYqBzhYtFV+agI4vGf8p+E+jg9lKxLCAGTnVwjsHx4UUEi9nqQX fqHUEBV7xKiZv8HLjhG2WYPgw1IZ6p9vG7DMnaosNcBIs/Ggi4IjBYHdgZitoiHJOkHJ5P F2ulWAxckTTGkrQ/jiHIB4Y5DvlPGjw9urjtW08lBZ7vuThsbao4LSH8Hq3r/Q== Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: eduardo) by smtp.freebsd.org (Postfix) with ESMTPSA id 4M7GQ315GZz1Rv3 for ; Wed, 17 Aug 2022 18:14:51 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-vs1-f48.google.com with SMTP id n125so7685186vsc.5 for ; Wed, 17 Aug 2022 11:14:51 -0700 (PDT) X-Gm-Message-State: ACgBeo0G6/mRTfX43GGjuUo31LnqP6iU3MejhrHnji3DCfvofqFZsBSX kDWLdcnriOC34i2ieLxIbPjGUP8TcYvLilnv7Gc= X-Google-Smtp-Source: AA6agR4C42z0ehMwWU7migLLreqYwysxNZ+RA5JsRr5c7I1dK5Y2ZNiNjDGi1vM1LbIa+dL9YGg9bUrlsBSYZnqRsss= X-Received: by 2002:a05:6102:2836:b0:386:91a5:a241 with SMTP id ba22-20020a056102283600b0038691a5a241mr10780239vsb.51.1660760090599; Wed, 17 Aug 2022 11:14:50 -0700 (PDT) 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 References: <62B26DE1-0E26-40BA-8647-E591E9ACEB7A@me.com> In-Reply-To: From: Nuno Teixeira Date: Wed, 17 Aug 2022 19:14:38 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: 24.3. Updating Bootcode To: Warner Losh Cc: Toomas Soome , FreeBSD CURRENT Content-Type: multipart/alternative; boundary="00000000000041e90905e673d76f" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660760091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ME2r25cGse3I7TJhMtBDDPqKB66INlvk1tnbvDThoow=; b=ZGzv8oWbWVH7aVD1dRyFhAqoLgJLr4i5Q6tOULAMkkTyIL0XW4BsalLgahEE68DD1HOTu1 QqgjFjGUNKfFzH4pCgt+bCXDS+9OwycGqSvZNvkhrhXg+m9lW51zuji96ca1gMmaqlZvdV SZUvhKrA71trf59wb1Cojm61/9do6rUCoQwGrRGWszEg0IWsLzYfeRpiBeedlEp8/XaeXA pBT0DF+wvnmMOwLWYBFx7fyXqB/x2IkbeMYQNlGOMrG8nTiejz5fBulZ0yPi56kGSCdAQC b5CLL5Kkow3EIZ+jj1+Hi4Dvw42jKXvSgKgeion5GAaRKUjERD4aEJmO1QxllQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660760091; a=rsa-sha256; cv=none; b=MaxSaEmasH39U6afTKEbi1ZV8QQwxm8dlPtOqK6oNxX01CZYbd3WT0pNvPROEx9V1CNdA7 7Fug+FMimGOuE1Kk/cl0xSdR3R9RI3baboKbmkNbvWC3diAvE3nUCaUAuBdSgpwFZKwX61 /7k3FwPOXIYPVznmX7n8754QIzpgnKRT3JqLaGhcLLKO2PEbCKX7j7rfw7eW8Rpk51SM0u P9ZvPKFoR00Mt+CzHJBhm/SwrtNfKfCNfkE8bLd5CuRV5WFf34V41zjNqg4r32Wl44lrJA KYRG3oMXb714jnLXuXs/nYtjgE1Bb0SOmBadxLf3F795l6OiFCGtXwQZY2RD9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --00000000000041e90905e673d76f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, And it's done: --- Boot0007* FreeBSD-14 HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)/File(\efi\freeb= sd\loader.efi) nvd0p1:/efi/freebsd/loader.efi /boot/efi//efi/freebsd/loader.efi +Boot0006* FreeBSD-14_old HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)/File(\efi\freeb= sd\loader-old.efi) nvd0p1:/efi/freebsd/loader-old.efi /boot/efi//efi/freebsd/loader-old.efi Boot0004* Windows Boot Manager HD(1,GPT,8c497825-1db2-41f8-8924-85dfd0bb7283,0x800,0x82000)/File(\EFI\Micr= osoft\Boot\bootmgfw.efi) da1p1:/EFI/Microsoft/Boot/bootmgfw.efi (null) Boot0000* EFI Hard Drive (SAMSUNG MZVLB1T0HBLR-000L2) PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-00)/H= D(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000) --- and I can choose "FreeBSD-14"(/efi/freebsd/loader.efi), "FreeBSD-14_old"(/efi/freebsd/loader-old.efi) and "EFI Hard Drive"(legacy /efi/bootx64.efi) from BIOS. NOTE: efibootmgr(8) example is: --- efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-11 ^^^ --- But I choosed "efi" instead of "EFI"... Thanks all for helping me understand it! Cheers, Warner Losh escreveu no dia ter=C3=A7a, 16/08/2022 =C3=A0(= s) 18:19: > > > On Tue, Aug 16, 2022 at 6:01 AM Nuno Teixeira wrote= : > >> Hi Toomas, >> >> For better OS support, the UEFI specification (UEFI 2.8A Feb 14, page >>> 499) is suggesting to use structure like: >>> >>> /efi//=E2=80=A6 >>> >>> And to use this suggestion, it means the UEFI Boot Manager needs to be >>> configured (see efibootmgr(8)). >>> >>> Therefore, once you have set up OS specific setup, there is no use for >>> default (/efi/boot/=E2=80=A6) and you need to update one or anothe= r, but not >>> both. >>> >> >> FreeBSD have /efi/freebsd/... but it's not configured in efibootmgr= : >> > > The current default installer will do this, but older upgraded systems > don't do this by default. Likely you are looking at an older > system and/or one of the 'bad actors' that reset this stuff between boots= . > > >> efibootmgr -v: >> --- >> BootOrder : 0004, 0000, 2002, 2003, 2001 >> Boot0004* Windows Boot Manager >> HD(1,GPT,8c497825-1db2-41f8-8924-85dfd0bb7283,0x800,0x82000)/File(\EFI\M= icrosoft\Boot\bootmgfw.efi) >> da0p1:/EFI/Microsoft/Boot/bootmgfw.ef= i >> (null) >> +Boot0000* EFI Hard Drive (SAMSUNG MZVLB1T0HBLR-000L2) >> PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-00= )/HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000) >> Boot2002* EFI DVD/CDROM >> Boot2003* EFI Network >> Boot2001* EFI USB Device >> --- >> so boot is definitely using /efi/boot/bootx64.efi @Boot0000 >> > > In your case, that's true. The "EFI Hard Drive" is a default entry the > UEFI BIOS created for you. > > >> I think I can create a new boot: >> --- >> efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-14 >> (and make it active) >> efibootmgr -a -b NNNN >> --- >> and create other for loader.efi.old in case of problems. >> > > Yes. > > >> In this case I will need only update /efi/freebsd/loader.efi. >> >> Q: for what has been said in mailing, boot is compiled in /usr/src/stand= , >> isn't a good idea that when it install new boot it backup old boot like >> /boot/kernel -> /boot/kernel.old? >> > > Yes. In fact that's what's done, but only for the BIOS version. We should > do the same for efi but don't seem to do so currently. But that's likely > tied up behind issues of installing things automatically into the ESP on > 'installworld'. > > Warner > --=20 Nuno Teixeira FreeBSD Committer (ports) --00000000000041e90905e673d76f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

And it's done:
=
---
=C2=A0Boot0007* FreeBSD-14 HD(1,GPT,73acd1b2-de41-11eb-8= 156-002b67dfc673,0x28,0x82000)/File(\efi\freebsd\loader.efi)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0nvd0p1:/efi/freebsd/loader.efi /boot/efi//efi/freebsd/loader.efi
+= Boot0006* FreeBSD-14_old HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28= ,0x82000)/File(\efi\freebsd\loader-old.efi)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0nvd0p1:/efi/freebsd/loader-old.efi /boot/efi//efi/freebsd/loader-old.efi=
=C2=A0Boot0004* Windows Boot Manager HD(1,GPT,8c497825-1db2-41f8-8924-8= 5dfd0bb7283,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0da1p1:/EFI/Microsoft/Boot/boot= mgfw.efi (null)
=C2=A0Boot0000* EFI Hard Drive (SAMSUNG MZVLB1T0HBLR-000= L2) PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-0= 0)/HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)
--= -
and I can choose "FreeBSD-14"(<ESP>/efi/freebsd= /loader.efi), "FreeBSD-14_old"(<ESP>/efi/freebsd/loader-old= .efi) and "EFI Hard Drive"(legacy <ESP>/efi/bootx64.efi) fr= om BIOS.

NOTE: efibootmgr(8) example is:
---
efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L Free= BSD-11
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^^^
---
But= I choosed "efi" instead of "EFI"...

=
Thanks all for helping me understand it!

Cheers,


Warner Losh <imp@bsdimp.com> escreveu no dia ter=C3=A7a, 16/08/2022 =C3= =A0(s) 18:19:


On Tue, Aug 16, 2022 at 6:01 AM Nuno Te= ixeira <eduardo= @freebsd.org> wrote:
Hi Toomas,

For better OS support, the UEFI specification (UEFI 2.8A Feb 14, page 499) = is suggesting to use structure like:

<ESP>/efi/<OS>/=E2=80=A6

And to use this suggestion, it means the UEFI Boot Manager needs to be conf= igured (see efibootmgr(8)).

Therefore, once you have set up OS specific setup, there is no use for defa= ult (<ESP>/efi/boot/=E2=80=A6) and you need to update one or another,= but not both.

FreeBSD have <E= SP>/efi/freebsd/... but it's not configured in efibootmgr:

The current default installer will do th= is, but older upgraded systems don't do this by default. Likely you are= looking at an older
system and/or one of the 'bad actors'= ; that reset this stuff between boots.
=C2=A0
efibootmgr -v:
---
BootOrder =C2=A0: 0004, 0000, 2002, 2003, 2001
<= div>Boot0004* Windows Boot Manager HD(1,GPT,8c497825-1db2-41f8-8924-85dfd0b= b7283,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0da0p1:/EFI/Microsoft/Boot/bootmgfw= .efi (null)
+Boot0000* EFI Hard Drive (SAMSUNG MZVLB1T0HBLR-000L2) PciRo= ot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-00)/HD(1,G= PT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)
=C2=A0Boot2= 002* EFI DVD/CDROM
=C2=A0Boot2003* EFI Network
=C2=A0Boot2001* EFI US= B Device
---
so boot is definitely using <ESP>/ef= i/boot/bootx64.efi @Boot0000

In your case, that's true. The "= EFI Hard Drive" is a default entry the UEFI BIOS created for you.
=C2=A0
I think I can create a new boot:
---
efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-14<= /div>
(and make it active)
efibootmgr -a -b NNNN
--= -
and create other for loader.efi.old in case of problems.
<= /div>

Yes.
=C2=A0
In this case = I will need only update <ESP>/efi/freebsd/loader.efi.
<= br>
Q: for what has been said in mailing, boot is compiled in /us= r/src/stand, isn't a good idea that when it install new boot it backup = old boot like /boot/kernel -> /boot/kernel.old?
=

Yes. In fact that's what's done, but only for t= he BIOS version. We should do the same for efi but don't seem to do so = currently. But that's likely tied up behind issues of installing things= automatically into the ESP on 'installworld'.

=
Warner=C2=A0


--
Nun= o Teixeira
FreeBSD Committer (ports)
--00000000000041e90905e673d76f--