Skip to content

Conversation

@bjordiscollaku
Copy link
Contributor

@bjordiscollaku bjordiscollaku commented Dec 3, 2025

Summary

This change introduces support for specifying the FAT32 logical sector size when creating the EFI System Partition image (efiesp.bin) and adds logic to adjust the ESP size for compliance when using larger sectors.

Details

  • Added --sector-size <size> argument (default: 512 bytes).
  • Updated mkfs.vfat invocation to use the provided sector size.
  • Added conditional logic to increase ESP size to 300 MB when sector size is 4096 bytes to meet FAT32 cluster count requirements and avoid mkfs warnings.
  • Enhanced script header and usage instructions to reflect the new option.
  • Maintained existing workflow for GRUB installation and image creation.

Why

  • UFS-based platforms require a 4096-byte sector size, while NVMe-based platforms require 512 bytes.
  • FAT32 specification recommends a minimum cluster count; with 4096-byte sectors, a 200 MB ESP is too small, causing warnings and non-standard metadata.
  • This update ensures compliance and clean metadata without duplicating scripts.

Usage

# For NVMe (512-byte sectors, default size 200 MB)
./build-efi-esp.sh --sector-size 512

# For UFS (4096-byte sectors, adjusted size 300 MB)
./build-efi-esp.sh --sector-size 4096

- Introduced `--sector-size` argument to allow specifying FAT32 logical sector size (default: 512 bytes).
- Updated mkfs.vfat invocation to use the provided sector size.
- Enhanced script header and usage instructions to reflect new functionality.
- Maintained existing workflow and behavior for EFI System Partition creation.

Signed-off-by: Bjordis Collaku <[email protected]>
- Added conditional logic to increase EFI System Partition size to 300 MB when --sector-size is set to 4096.
- Ensures FAT32 cluster count meets specification and avoids mkfs.fat warnings.
- Maintains default 200 MB size for 512-byte sector case.

Signed-off-by: Bjordis Collaku <[email protected]>
@bjordiscollaku bjordiscollaku changed the title Add configurable sector size support to EFIESP build script Add configurable sector size support and ESP size adjustment for FAT32 compliance Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants