Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2022 11:15:19 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Nuno Teixeira <eduardo@freebsd.org>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: 24.3. Updating Bootcode
Message-ID:  <CANCZdfqskq8ecroKOU=2hWNGsPTxPY-R0vHa8o-QLCgZAKFEAA@mail.gmail.com>
In-Reply-To: <CAFDf7UJv9QCuD27XDs2ihLiN21Rn6PeZjbJtWVOAAfHb8HHnHw@mail.gmail.com>
References:  <CAFDf7UJv9QCuD27XDs2ihLiN21Rn6PeZjbJtWVOAAfHb8HHnHw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000002da73d05e65ee574
Content-Type: text/plain; charset="UTF-8"

On Tue, Aug 16, 2022 at 3:49 AM Nuno Teixeira <eduardo@freebsd.org> wrote:

> Hello all,
>
> With so much discussion about updating boot, I feel confused about the
> correct procedure of doing it.
>
> Like being said there are a "24.3. Updating Bootcode" in Handbook (WIP)
> that points to some important manuals.
>
> There are 3 places where boot loader are:
>
>  ESP (EFI System Partition):
> 1 - (/boot/efi)/efi/boot/bootXXX.efi (default location)
>

Default for the boot loader, that is. By default we don't install here
anymore (though as a workaround
for broken BIOSes or those that don't properly save EFI env vars or that
change help to be helpful,
we'll park a copy here, this usually isn't updated).


> 2 - (/boot/efi)/efi/freebsd/loader.efi (FreeBSD reserved area)
>

This is what the boot usually uses on working systems.


> Operating System:
> 3 - /boot/loader.efi
>

This is only used when chain loaded from a legacy system that installed
boot1.efi, or in some cases
from a 'special needs' system that loads it from gptboot.efi.


> For what I've read we should:
>  - backup: `cp /boot/efi/efi/boot/bootXXX.efi
> /boot/efi/efi/boot/bootXXX.efi.bkp`
>

I'd recommend bootXXX-old.efi (or bootXXX-bkp.efi) since you'll be able to
run it from the EFI shell
if you are lucky enough to have one. The shell won't run the .bkp file.


>  - update: `cp /boot/loader.efi /boot/efi/efi/boot/bootXXX.efi`
>

Yes and no. You should likely update both this one and the one in
efi/freebsd as well since the latter
is more typically used (though your system may be one of the
sadly-too-sizable number of systems
that ignore the env vars and use the default removable media file).


> In this example we have a /boot/efi mount by the system, "/dev/XXXpN on
> /boot/efi (msdosfs, local)".
>

Yes.


> What about (/boot/efi)/efi/freebsd/loader.efi (reserved area)? Is
> necessary to backup and update it too?
>

It's the primary thing that gets used most of the time. I'd certainly back
it up and update it.

Warner

--0000000000002da73d05e65ee574
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, Aug 16, 2022 at 3:49 AM Nuno =
Teixeira &lt;<a href=3D"mailto:eduardo@freebsd.org">eduardo@freebsd.org</a>=
&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div=
 dir=3D"ltr"><div>Hello all,</div><div><br></div><div>With so much discussi=
on about updating boot, I feel confused about the correct procedure of doin=
g it.</div><div><br></div><div>Like being said there are a &quot;24.3. Upda=
ting Bootcode&quot; in Handbook (WIP) that points to some important manuals=
.<br></div><div><br></div><div>There are 3 places where boot loader are:</d=
iv><br><div>=C2=A0ESP (EFI System Partition):</div><div>1 - (/boot/efi)/efi=
/boot/bootXXX.efi (default location)</div></div></blockquote><div><br></div=
><div>Default=C2=A0for the boot loader, that is. By default we don&#39;t in=
stall here anymore (though as a workaround</div><div>for broken BIOSes or t=
hose that don&#39;t properly save EFI env vars or that change help to be he=
lpful,</div><div>we&#39;ll park a copy here, this usually isn&#39;t updated=
).</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
<div dir=3D"ltr"><div>2 - (/boot/efi)/efi/freebsd/loader.efi (FreeBSD reser=
ved area)</div></div></blockquote><div><br></div><div>This is what the boot=
 usually uses on working systems.</div><div>=C2=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>Operating System:<br=
></div><div>3 - /boot/loader.efi</div></div></blockquote><div><br></div><di=
v>This is only used when chain loaded from a legacy system that installed b=
oot1.efi, or in some cases</div><div>from a &#39;special needs&#39; system =
that loads it from gptboot.efi.</div><div>=C2=A0</div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div dir=3D"ltr"><div>For what I&#39;ve read w=
e should:</div><div>=C2=A0- backup: `cp /boot/efi/efi/boot/bootXXX.efi /boo=
t/efi/efi/boot/bootXXX.efi.bkp`</div></div></blockquote><div><br></div><div=
>I&#39;d recommend bootXXX-old.efi (or bootXXX-bkp.efi) since you&#39;ll be=
 able to run it from the EFI shell</div><div>if you are lucky enough=C2=A0t=
o have one. The shell won&#39;t run the .bkp file.</div><div>=C2=A0</div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>=C2=
=A0- update: `cp /boot/loader.efi /boot/efi/efi/boot/bootXXX.efi`</div></di=
v></blockquote><div><br></div><div>Yes and no. You should likely update bot=
h this one and the one in efi/freebsd as well since the latter</div><div>is=
 more typically used (though your system may be one of the sadly-too-sizabl=
e number of systems</div><div>that ignore the env vars and use the default =
removable media file).</div><div>=C2=A0</div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex"><div dir=3D"ltr"><div>In this example we have a /boot/e=
fi mount by the system, &quot;/dev/XXXpN on /boot/efi (msdosfs, local)&quot=
;.</div></div></blockquote><div><br></div><div>Yes.</div><div>=C2=A0</div><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>What=
 about (/boot/efi)/efi/freebsd/loader.efi (reserved area)? Is necessary to =
backup and update it too?</div></div></blockquote><div><br></div><div>It&#3=
9;s the primary thing that gets used most of the time. I&#39;d certainly ba=
ck it up and update it.</div><div><br></div><div>Warner=C2=A0</div></div></=
div>

--0000000000002da73d05e65ee574--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqskq8ecroKOU=2hWNGsPTxPY-R0vHa8o-QLCgZAKFEAA>