From nobody Tue Nov 28 18:06:50 2023 X-Original-To: dev-commits-src-main@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 4Sfr534jc3z52KF1 for ; Tue, 28 Nov 2023 18:07:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sfr532dc6z4L7M for ; Tue, 28 Nov 2023 18:07:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-507a29c7eefso7601324e87.1 for ; Tue, 28 Nov 2023 10:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1701194822; x=1701799622; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rw5/WbipIHtpfXJmx1CbZK6wRdM8Oe8rEGpRhhYYoJU=; b=scUo2shJY0EKbYtjfaFNNy3Wd65Eet6rrXp0l7J2ySN9uVtWQNZ2vEgiWHOORC1GD/ UUZneJ6AgW2wDGRLSZljDLhD/NF5okCZKtUmoazo5DwP5txYEYoAim4xyN5v5uG/yXns yOdHteCPsa29VwZIXtWZ36sfHTDqy8E+sI5beK3oRryEDIqlxGgpMo/JXIxDM4/B3iho xlRsw62zOX0pbN+hk/frA8HMzdDMuCUOfhzR/aT97p/dy2FnX+wEQps97/QfvXv1ejSp d/MDVJkTQC9PSQAiNmzogilIwnR3X4NtAc78sJhZ8hNMhcqSkn/ldtRAyfAak37UO3vW DDAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701194822; x=1701799622; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rw5/WbipIHtpfXJmx1CbZK6wRdM8Oe8rEGpRhhYYoJU=; b=qAzTFvKCEE2NcxHk4uJGHrBIGF4DX8E9/PVS+eTiAPvbvnNLETMAypxCxOpejY3n4q kyKBPNwMcNICXNzJHOykoBJ1qw6NNxCBOZGHSOwFoK1PBTz14EgEflwSp3E7wYyt1U3Q MNxfXq153EqxaQux0RUwHNobRFRShF280KG7i+Gdk/bE+vUdGxiLtyQDXlK4Qgx3R1wQ /2Op+8Ya9s/ePQq8H1s9ObLKnJt+kwUUNGdyHSwz+LYg5KamOYlElss+yWdaS/nI0j0M B0LxACufeJyDbxWiDWXDGj6XQfBPuppVTDcSY6oL3C3xHnp9Apmd7WTvPugRy+DrBK+/ H+EA== X-Gm-Message-State: AOJu0YzemUYQvveS+fmLgpBhK0p3bCWFBa8bgr/S3KWCIW9OkidL719+ HA3zFkQS4Zp8H19ocdlbpNABcURIz1ceB47UU8XGXg== X-Google-Smtp-Source: AGHT+IGjCrjklZ0l3/uFSstGPLyyb3w3kX8bV7J6+sbAG3SaOv3FcnnkeqkjtZA9Pc8rz+my3JaJVvJOzeFlgiiUE2Q= X-Received: by 2002:a05:6512:284:b0:50b:bf57:7d6 with SMTP id j4-20020a056512028400b0050bbf5707d6mr1215339lfp.6.1701194821784; Tue, 28 Nov 2023 10:07:01 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202311272246.3ARMkNS1037267@gitrepo.freebsd.org> <8fa6ed4d-c26b-4dd6-86f2-c3751f86d426@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Tue, 28 Nov 2023 11:06:50 -0700 Message-ID: Subject: Re: git: c596126a5d3d - main - pmbr: Only load the first 545k rather than error out To: John Baldwin Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000000befe9060b3a496d" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Sfr532dc6z4L7M --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 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 = 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


=
On Tue, Nov 28, 2023 at 10:56=E2=80= =AFAM John Baldwin <jhb@freebsd.org> wrote:
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 leav= e room
>> for a future ESP?=C2=A0 It might not always be safe to load a full= 545k
>> depending on if the firmware has reserved some of memory just belo= w
>> 640k.=C2=A0 545k is an upper bound on how much can be loaded in te= rms of
>> 640k - the load address, but the practical limit might be lower.= =C2=A0 It is
>> probably safer as a general rule to keep the boot partition closer= to
>> the size of the=C2=A0 boot loader and leave a gap in place instead= .
>>
>
> Today we load 512k always.

Well, we load the partition size always.=C2=A0 The default size of the part= ition
has grown over time.=C2=A0 Arguably we should have been using padding inste= ad of
growing the partition, but that is harder to write in installer tools, etc.=
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
length from the payload due to the limited room in the MBR.=C2=A0 I think w= e
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 usual= ly 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--