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>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 16, 2022 at 3:49 AM Nuno Teixeira &lt;<a href="mailto:eduardo@freebsd.org">eduardo@freebsd.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello all,</div><div><br></div><div>With so much discussion about updating boot, I feel confused about the correct procedure of doing it.</div><div><br></div><div>Like being said there are a &quot;24.3. Updating 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:</div><br><div> ESP (EFI System Partition):</div><div>1 - (/boot/efi)/efi/boot/bootXXX.efi (default location)</div></div></blockquote><div><br></div><div>Default for the boot loader, that is. By default we don&#39;t install here anymore (though as a workaround</div><div>for broken BIOSes or those that don&#39;t properly save EFI env vars or that change help to be helpful,</div><div>we&#39;ll park a copy here, this usually isn&#39;t updated).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>2 - (/boot/efi)/efi/freebsd/loader.efi (FreeBSD reserved area)</div></div></blockquote><div><br></div><div>This is what the boot usually uses on working systems.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Operating System:<br></div><div>3 - /boot/loader.efi</div></div></blockquote><div><br></div><div>This is only used when chain loaded from a legacy system that installed boot1.efi, or in some cases</div><div>from a &#39;special needs&#39; system that loads it from gptboot.efi.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>For what I&#39;ve read we should:</div><div> - backup: `cp /boot/efi/efi/boot/bootXXX.efi /boot/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 to have one. The shell won&#39;t run the .bkp file.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div> - update: `cp /boot/loader.efi /boot/efi/efi/boot/bootXXX.efi`</div></div></blockquote><div><br></div><div>Yes and no. You should likely update both 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-sizable number of systems</div><div>that ignore the env vars and use the default removable media file).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>In this example we have a /boot/efi mount by the system, &quot;/dev/XXXpN on /boot/efi (msdosfs, local)&quot;.</div></div></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="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&#39;s the primary thing that gets used most of the time. I&#39;d certainly back it up and update it.</div><div><br></div><div>Warner </div></div></div>
home | help

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