From nobody Thu Aug 18 11:04:46 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 4M7hqZ42nWz4ZC6F for ; Thu, 18 Aug 2022 11:04:58 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4M7hqZ3b4zz3gvy for ; Thu, 18 Aug 2022 11:04:58 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660820698; 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=QvQ9nAx0LeWoXuW1VoLdVvUZ5l9f5TkDVz2vAPleCE0=; b=DaO2U/ksdRdTjYpA5HYiu2cbmmlfOYNs+6HXTWZUlicSIThxfQxNDMKUR7vUfN4Bpg4fVm x6e81DDbqXNuJtFTIZhC/lDbwTSL1TTHrvrBosleogJuD/51dVKRTTVMeLf3T4tvTGvWkp uha/gcEp1oQfJqBeltCLLPSzOXjdU2SYUW0H0VFqHe1PO//Yy8iEK7+oRqdLLhd1Qb3qI+ 0stZ/p4s77AeL60jKsXqnPinOgCMXm+JMOdgWDCC6IOqzr7C36goLc6gkhS4rvDT48Obca SrPmpKJfMnGjCh+n/wcjHkCQEV6cyPW2RzXt5o2bHDjgMOlR2DYt+jsUAveJUg== Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) (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 4M7hqZ2RMHzm3B for ; Thu, 18 Aug 2022 11:04:58 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-vk1-f180.google.com with SMTP id t64so578860vkb.12 for ; Thu, 18 Aug 2022 04:04:58 -0700 (PDT) X-Gm-Message-State: ACgBeo2ZNDLm5gQ5hRErYOlTvvHK0k32Vjuuf7er/JZrAUgETk+BEE1J r5tBDHAU60be/1+2hqABVUw4n9u77oArBkZeT80= X-Google-Smtp-Source: AA6agR6Bsng6mScbeXJ4nl9iQNsfBJV3uA47gqt87J+zTBaAkY781hW4krILBSfVvEZG7uenE31Cd5IKjRNmx+7eQn8= X-Received: by 2002:a1f:acd2:0:b0:37b:531:9988 with SMTP id v201-20020a1facd2000000b0037b05319988mr859412vke.19.1660820697842; Thu, 18 Aug 2022 04:04:57 -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: Thu, 18 Aug 2022 12:04:46 +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="000000000000bb0aa305e681f311" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660820698; 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=QvQ9nAx0LeWoXuW1VoLdVvUZ5l9f5TkDVz2vAPleCE0=; b=Mh9/Nz0lZxE7LvMbeqMqDztoz4CC5VRriO3LaNQ15FT5QunH/P0mmpYcdYRkCX57YByRsN Y++Uq+3SE7KBK4EU+cPwlAjOACc0TRovcSRQru5s3QWyJ5Dtr6yevq3bWrEDzW4i9FAxQ1 QwTFMLjgUGjeSOXUBUr5shPYxEnT7IQUOKxNTIxAxF2iE3TgyVNTiymkgsRSGvRKG/CMkz sqlxicRYd2fypXPnV8fB9s1o7Dy4+v09cibzWWowMr6yJa8mjLtOEpBovuf7IGafh7buBH 1zporJLtNXMEWImeXuPXaWm5CCYSGKW28f+bWGto6QmvmBtMcrqliluNw1NIBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660820698; a=rsa-sha256; cv=none; b=oGwmayLMxITlCIm+JStCbrmn3Ew7AlPUAQOumgCGV9kqPNNOvyvyI9azBxb68gf/FDHpem bgKfLZPuTEl19yYfUT8PEKjxNB5/IvJuAndX1vTaBBJ7aB7KMHSh+L9dRUPgn5psxMBDWs RbDGkzl+mhFDK7itegi59rBi5DGzHzREXjoRwgXWKnHGtY72s94wVhKNKzemyEpectWanj JtCzjY8TrD55il9aehqOsxlWIpqEhLiYyQ3qSVsEIt00vwt6hasS5ZPUXWZoc7fOC+ny2u aiiTNZ1Z7RReL7Oa6UightdhXu3VgiNzfh3KOl11EL3zLt5tDW47928MYFkk8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --000000000000bb0aa305e681f311 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Forgot to send a screenshot for loader.efi @ main-n257458-ef8b872301c5 ( +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 ) Someone talked about this warnings earlier: --- Attempted extraction of recovery data from stadard superblock: failed Attempt to find boot zone recovery data: failed (...) --- But it boots ok. Cheers, Nuno Teixeira escreveu no dia quarta, 17/08/2022 =C3= =A0(s) 19:18: > *** and "EFI Hard Drive"(legacy /efi/boot/bootx64.efi) from BIOS. > ^^^^ > > Nuno Teixeira escreveu no dia quarta, 17/08/2022 > =C3=A0(s) 19:14: > >> Hi, >> >> And it's done: >> --- >> Boot0007* FreeBSD-14 >> HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)/File(\efi\fr= eebsd\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\fr= eebsd\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\M= icrosoft\Boot\bootmgfw.efi) >> da1p1:/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) >> --- >> 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 b= e >>>>> configured (see efibootmgr(8)). >>>>> >>>>> Therefore, once you have set up OS specific setup, there is no use fo= r >>>>> default (/efi/boot/=E2=80=A6) and you need to update one or anot= her, 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= \Microsoft\Boot\bootmgfw.efi) >>>> >>>> da0p1:/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)/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 bac= kup >>>> 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 th= e >>> ESP on 'installworld'. >>> >>> Warner >>> >> >> >> -- >> Nuno Teixeira >> FreeBSD Committer (ports) >> > > > -- > Nuno Teixeira > FreeBSD Committer (ports) > --=20 Nuno Teixeira FreeBSD Committer (ports) --000000000000bb0aa305e681f311 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Forgot to send a screenshot for loader.efi @ main-n= 257458-ef8b872301c5
( +Boot0007* FreeBSD-14 HD(1,GPT,73acd1b2-de4= 1-11eb-8156-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.e= fi )

Someone talked about this warnings earlier:
---
Attempted extraction of recovery data from stadard s= uperblock: failed
Attempt to find boot zone recovery data: failed=
(...)
---
But it boots ok.

Cheers,

Nuno Teixeira <= eduardo@freebsd.org> escreveu no dia quarta, 17/08/2022 =C3=A0(s) 19= :18:
*** and "EFI Hard Drive"(legacy <ESP>/efi/boot/b= ootx64.efi) from BIOS.
=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=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 ^^^^
=
Nuno T= eixeira <eduard= o@freebsd.org> escreveu no dia quarta, 17/08/2022 =C3=A0(s) 19:14:
=
Hi,

And it's done:
---
=C2=A0Boot0007* FreeBSD-14 HD(1,GPT,73acd1b2-de41-11eb-8156-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/f= reebsd/loader.efi /boot/efi//efi/freebsd/loader.efi
+Boot0006* FreeBSD-1= 4_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/free= bsd/loader-old.efi /boot/efi//efi/freebsd/loader-old.efi
=C2=A0Boot0004*= Windows Boot Manager HD(1,GPT,8c497825-1db2-41f8-8924-85dfd0bb7283,0x800,0= x82000)/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/bootmgfw.efi (null)=C2=A0Boot0000* EFI Hard Drive (SAMSUNG MZVLB1T0HBLR-000L2) PciRoot(0x0)/P= ci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-00)/HD(1,GPT,73acd1= b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)
---
and I = can choose "FreeBSD-14"(<ESP>/efi/freebsd/loader.efi), &quo= t;FreeBSD-14_old"(<ESP>/efi/freebsd/loader-old.efi) and "EF= I Hard Drive"(legacy <ESP>/efi/bootx64.efi) from BIOS.

NOTE: efibootmgr(8) example is:
---
efi= bootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-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 "e= fi" 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
<= br>
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
(and make = it active)
efibootmgr -a -b NNNN
---
and crea= te other for loader.efi.old in case of problems.

Yes.
=C2=A0
In this case I will need only upd= ate <ESP>/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&= #39;s likely tied up behind issues of installing things automatically into = the ESP on 'installworld'.

Warner=C2=A0


--
Nuno Teixeira
FreeBSD Co= mmitter (ports)


--
Nuno Teixeira
FreeBSD Co= mmitter (ports)


--
Nun= o Teixeira
FreeBSD Committer (ports)
--000000000000bb0aa305e681f311--