From nobody Tue Nov 28 18:06:50 2023 X-Original-To: dev-commits-src-all@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 4Sfr536lzJz52KRr for ; Tue, 28 Nov 2023 18:07:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (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 4Sfr5354q3z4L9n 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-x12b.google.com with SMTP id 2adb3069b0e04-50bc21821a1so519381e87.0 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=GqANBFLlNHwyIGb9yjS5/C7HAz7mWcpCEg73u2xx8QVAD8dJHNxJIuAxiQO/Y/tMSg RZ7eYl49GfbI10c+OQ01rTnyagaMZrnd1qTicOAJo9Xt5WhQOat45kINV+wHuhbrgo0b hUryHd691pJYqwKoSngolGfAoumy5EqFKvw9itwxDol6FjGSZczoVYiHFi05Tfig6WiA WgsxLW35x+V1LOw9cBbsUNkwMg5ZDfRQuogcrMVvyb0OxjsF7XE1411ivaFoeooSteBj 3ibicDFg8YlHI74jGoE9fLo46JbWvpzBUhSr728267niLvpLEiQWxhJEyl9CTurf6GK6 wYgA== X-Gm-Message-State: AOJu0YwaENcu4Hyrv7vDXu5lbBt8hAzJYPt0nO/Dr/iJAkX5gi8is8Rr uSh0WVpJb64rCJ3v+H3+UpcBoFq81vhEINCWptnnhw== 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 all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 4Sfr5354q3z4L9n --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--