> On 28. Nov 2023, at 19:56, John Baldwin <j...@freebsd.org> wrote:
> 
> On 11/28/23 9:07 AM, Warner Losh wrote:
>> On Tue, Nov 28, 2023 at 9:06 AM John Baldwin <j...@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 is
>>> 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 partition
> 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, etc.
> When I wrote pmbr I on purpose used the partition size as the size to load
> rather than trying to assume information about the payload and parse a
> 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?
> 

The size is not specified (from UEFI_Spec_2_10_Aug29):

"It is outside of the scope of this specifi- cation to attempt to coordinate 
the specification of size and location of an ESP that can be shared by multiple 
OS or Diagnostics installations, or to manage potential namespace collisions in 
directory naming in a single (central) ESP.”

and 

"The EFI firmware must support the FAT32, FAT16, and FAT12 variants of the EFI 
file system. What variant of EFI FAT to use is defined by the size of the 
media.”

In reality, there are systems which only support FAT32 on hard disks, and that 
will set minimum size ~34MB with 512B sector and a bit over 256MB with 4k 
sector. 

However, there are suggestions from vendors (notably Microsoft), to have at 
least ~100MB to make it possible to store auxiliary files such as diagnostics 
and other tools.

rgds,
toomas

Reply via email to