From nobody Wed Aug 17 18:18:01 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 4M7GTy3nK3z4YsPN for ; Wed, 17 Aug 2022 18:18:14 +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 4M7GTy3JYBz45Ln for ; Wed, 17 Aug 2022 18:18:14 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660760294; 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=UX/UXYT80XGtnIr7SfnKED1diQ71NWQTBwrIx60dwCI=; b=ZRK8F1ifZr6xL3El6rLmmn4RnFP+RirxXOLHOoFgwcz8wAm9FRoUQcxUlit01HneisFetX UQQBXcfqCeurzt/FBcbhGwguB0hH59Pe/KvXtnAGfyoGnmn7+NbrEiBQixzrfAc51Ubdw1 3hypj+hbjNwNbQ+C/+n6MNy5QrHzoHMMB8ZYn7uVFHDmwkvQX4kwHgnbKItMNIxUVNRoRV AddSDdWs0INJ6aeV84/AlfobLP/201Nam794L2YzfG4sKm1iwF7N7BbqwCSOgHpNNjHz1g iTDnZjghJOhf7+tdDXUvJAiSmjO4eutcpYCvfSpADxLZos/yuN3EeX938WlzMQ== Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) (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 4M7GTy2B6TzTHH for ; Wed, 17 Aug 2022 18:18:14 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-ua1-f50.google.com with SMTP id s5so4585998uar.1 for ; Wed, 17 Aug 2022 11:18:14 -0700 (PDT) X-Gm-Message-State: ACgBeo12hc2KqMHuo7CGuXVVM/9CqU39oyZQCdrN5disYbBK6iqstuT5 45dT7aMzYD7YaPsLQDqqj3MYcaQkF62wuFbrBJg= X-Google-Smtp-Source: AA6agR4kNMyeS2p7DNhPS2c/XPvx+2phZQ1/8wj/PRYchkqwghqgs1gNttbx0RLhft//yQXKgyf04UmOAVdhgoAwia4= X-Received: by 2002:a9f:358c:0:b0:387:9de3:6c8a with SMTP id t12-20020a9f358c000000b003879de36c8amr11248819uad.94.1660760293772; Wed, 17 Aug 2022 11:18:13 -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:18:01 +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="0000000000005e16a705e673e39a" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660760294; 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=UX/UXYT80XGtnIr7SfnKED1diQ71NWQTBwrIx60dwCI=; b=JSveQZyY/LiHu01+0a196qjIMAwd30QZ6rV5vIDyQ+rBNx7M/MbcIG1LJc57NaY3XHckzp TNciJCYfXreBn7G7SqsiHjpryn57onUq/deaz98m0yavGqE2+3o8Sq6HHtlScmVQpVFB/y w739GDxRoGTp22aSJda7iiqdmPHqgdYLpOI8dKIBsxPJYbzZrmMIAxqLTU3R3jl/V4cdkX XTFDGyMv2xo1kwAqffEVDAe4JmR9Em4J/SA5TtQ1XeK8gOeqJMDX1HQxS+KYOgxqY+NhxD E+BBiwrzN9nd7B2kF76d95pnxOeYYGVuUGN617/pXBH1k1Ckj0gGRD+6sLx9HA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660760294; a=rsa-sha256; cv=none; b=eQ+xcuT48im96IKIZn8NTsbpaHw2/br4dNm2OL42nqGldsxhRnfIsu/V2RThPhQICrsIb+ tgZpTkgTvFIvGZOEXSl5wy+x8w99ar46XKTeFFimYC1agjPpLR0v9PENTdBy4MciOWO1y2 WWUh4aDnglcdRq/UnF3t10faUjHVNXlawgqfXq42//toz1Ub1qinoO0IExEnumCWZQRHIK KhTgT8r+fxLaeEP8v5KjoC1m3yKvig59rQfmGWCmjULkG4HGfMlYdw5DPXcZbY0MZ0VdRQ hPD+d/4/yzVsz9SJpfXbbQxA4DkAJQXfoWEv0poU50mxqo/JtP0O0ujtXKurSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --0000000000005e16a705e673e39a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable *** 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\fre= ebsd\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\fre= ebsd\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\Mi= crosoft\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)= /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 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 anoth= er, but not >>>> both. >>>> >>> >>> FreeBSD have /efi/freebsd/... but it's not configured in efibootmg= r: >>> >> >> 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 boot= s. >> >> >>> 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-0= 0)/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 back= up >>> old boot like /boot/kernel -> /boot/kernel.old? >>> >> >> Yes. In fact that's what's done, but only for the BIOS version. We shoul= d >> 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 >> > > > -- > Nuno Teixeira > FreeBSD Committer (ports) > --=20 Nuno Teixeira FreeBSD Committer (ports) --0000000000005e16a705e673e39a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
*** and "EFI Hard Drive"(legacy <ESP>= /efi/boot/bootx64.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 Teixeira <eduardo@free= bsd.org> escreveu no dia quarta, 17/08/2022 =C3=A0(s) 19:14:
H= i,

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/free= bsd/loader.efi /boot/efi//efi/freebsd/loader.efi
+Boot0006* FreeBSD-14_o= ld HD(1,GPT,73acd1b2-de41-11eb-8156-002b67dfc673,0x28,0x82000)/File(\efi\fr= eebsd\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* Win= dows Boot Manager HD(1,GPT,8c497825-1db2-41f8-8924-85dfd0bb7283,0x800,0x820= 00)/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)/Pc= i(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,39-f9-b8-01-81-38-25-00)/HD(1,GPT,73acd1b= 2-de41-11eb-8156-002b67dfc673,0x28,0x82000)
---
and I c= an 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) from BIOS.
=
NOTE: efibootmgr(8) example is:
---
efib= ootmgr -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

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

Yes.
=C2=A0
In this case I will need only update <ESP>/efi/freebsd= /loader.efi.

Q: for what has been said in mail= ing, 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.o= ld?

Yes. In fact that's wha= t'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 'installworl= d'.

Warner=C2=A0


--
Nuno Teixeira
FreeBSD Co= mmitter (ports)


--
Nun= o Teixeira
FreeBSD Committer (ports)
--0000000000005e16a705e673e39a--