Date: Tue, 28 Nov 2023 11:06:50 -0700 From: Warner Losh <imp@bsdimp.com> To: John Baldwin <jhb@freebsd.org> Cc: Warner Losh <imp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c596126a5d3d - main - pmbr: Only load the first 545k rather than error out Message-ID: <CANCZdfr9eVA7bwSvzQo2_Vi%2B8edzqramDVboKyWCrqR9fQrXWA@mail.gmail.com> In-Reply-To: <e5973b11-f84c-40c7-bda1-dc666263eb3f@FreeBSD.org> References: <202311272246.3ARMkNS1037267@gitrepo.freebsd.org> <8fa6ed4d-c26b-4dd6-86f2-c3751f86d426@FreeBSD.org> <CANCZdfqC_Y2%2Bj7Vi5rWbKagyByk7xrWBy6H0q8qw8hDpZc4WuQ@mail.gmail.com> <e5973b11-f84c-40c7-bda1-dc666263eb3f@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000000befe9060b3a496d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Nov 28, 2023 at 10:56=E2=80=AFAM John Baldwin <jhb@freebsd.org> wro= te: > On 11/28/23 9:07 AM, Warner Losh wrote: > > On Tue, Nov 28, 2023 at 9:06=E2=80=AFAM John Baldwin <jhb@freebsd.org> = wrote: > >> But also, can't you just leave a gap in the partitions to leave room > >> for a future ESP? It might not always be safe to load a full 545k > >> depending on if the firmware has reserved some of memory just below > >> 640k. 545k is an upper bound on how much can be loaded in terms of > >> 640k - the load address, but the practical limit might be lower. It i= s > >> probably safer as a general rule to keep the boot partition closer to > >> the size of the boot loader and leave a gap in place instead. > >> > > > > Today we load 512k always. > > Well, we load the partition size always. The default size of the partiti= on > has grown over time. Arguably we should have been using padding instead = of > growing the partition, but that is harder to write in installer tools, et= c. > When I wrote pmbr I on purpose used the partition size as the size to loa= d > rather than trying to assume information about the payload and parse > length from the payload due to the limited room in the MBR. I think we > started out creating freebsd-boot partitions that were 64k and later grew > them with a desire they could be replaced with an ESP partition, but ESPs > need a minimum size of 512k? > ESPs usually need at least a couple of megebytes since loader.efi is 660k right now and you really want a backup when you install a new one. It's better if it's tens of MB, though, since you may need it for other things... Warner --0000000000000befe9060b3a496d 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, Nov 28, 2023 at 10:56=E2=80= =AFAM John Baldwin <<a href=3D"mailto:jhb@freebsd.org">jhb@freebsd.org</= a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p= x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On= 11/28/23 9:07 AM, Warner Losh wrote:<br> > On Tue, Nov 28, 2023 at 9:06=E2=80=AFAM John Baldwin <<a href=3D"ma= ilto:jhb@freebsd.org" target=3D"_blank">jhb@freebsd.org</a>> wrote:<br> >> But also, can't you just leave a gap in the partitions to leav= e room<br> >> for a future ESP?=C2=A0 It might not always be safe to load a full= 545k<br> >> depending on if the firmware has reserved some of memory just belo= w<br> >> 640k.=C2=A0 545k is an upper bound on how much can be loaded in te= rms of<br> >> 640k - the load address, but the practical limit might be lower.= =C2=A0 It is<br> >> probably safer as a general rule to keep the boot partition closer= to<br> >> the size of the=C2=A0 boot loader and leave a gap in place instead= .<br> >><br> > <br> > Today we load 512k always.<br> <br> Well, we load the partition size always.=C2=A0 The default size of the part= ition<br> has grown over time.=C2=A0 Arguably we should have been using padding inste= ad of<br> growing the partition, but that is harder to write in installer tools, etc.= <br> When I wrote pmbr I on purpose used the partition size as the size to load<= br> rather than trying to assume information about the payload and parse<br> length from the payload due to the limited room in the MBR.=C2=A0 I think w= e<br> started out creating freebsd-boot partitions that were 64k and later grew<b= r> them with a desire they could be replaced with an ESP partition, but ESPs<b= r> need a minimum size of 512k?<br></blockquote><div><br></div><div>ESPs usual= ly need at least a couple of megebytes since loader.efi is 660k right now</= div><div>and you really want a backup when you install a new one. It's = better if it's tens of MB,</div><div>though, since you may need it for = other things...</div><div><br></div><div>Warner</div></div></div> --0000000000000befe9060b3a496d--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfr9eVA7bwSvzQo2_Vi%2B8edzqramDVboKyWCrqR9fQrXWA>