Skip to content

Conversation

learmj
Copy link
Collaborator

@learmj learmj commented Sep 26, 2025

Improves handling of the config variable that defines the target device storage sector size (basically now enforces 512 or 4096)
Encourages mkfs.ext4 to use a minimum block size of 4K if that variable indicates a 4Kn device.

@learmj
Copy link
Collaborator Author

learmj commented Sep 26, 2025

Hi @martamomotko @timg236 @roliver-rpi

The only functional difference here is if IGconf_device_sector_size is 4096, -b -4096 is added to the mkfs.ext4 args to ensure a minimum block size of 4K for all ext4 filesystems.

IGconf_device_sector_size is already being passed to mkfs.vfat via -S.

@learmj learmj force-pushed the sector_validation branch from 7f1c442 to 64619f8 Compare October 10, 2025 11:28
@learmj
Copy link
Collaborator Author

learmj commented Oct 10, 2025

Hi @martamomotko @timg236
From raspberrypi/rpi-eeprom#577, I assume there are no issues if I merge this now?

@timg236
Copy link

timg236 commented Oct 10, 2025

@martamomotko Did you manage to get the rpi-image-gen image to boot on NVMe, it sounded like there was a problem with the MBR / offset of the FAT

@martamomotko
Copy link

Hi @learmj
From what I can tell, the 4Kn image generation seems to have incorrect partition alignment. The GPT header offset is at 0x200(512) instead of 0x1000(4096), which means it assumes 512-byte sectors.

The capacity validator allowed suffixed values (e.g. "4K"), but
mkfs.vfat -S accepts only plain digits, causing failures.

Restrict sector_size to numeric values (512 or 4096) and update the
description to define it as the target device's logical sector size,
with context on 512n/512e/4Kn.
mkfs.vfat already uses IGconf_device_sector_size, but try to encourage
mkfs.ext4 to use a minimum block size of 4K if this variable specifies a
4K sector size.
No change to BTFS filesystem creation.
It's not currently possible to create an image compatible with a 4Kn
device using genimage, so restrict device sector size to 512 only.

Refs:
pengutronix/genimage#313
@learmj learmj force-pushed the sector_validation branch from 64619f8 to bdc905f Compare October 14, 2025 13:57
@learmj
Copy link
Collaborator Author

learmj commented Oct 14, 2025

Hi @martamomotko
As discussed, we cannot currently use rpi-image-gen to generate 4Kn compatible device images. Therefore setting IGconf_device_sector_size to anything other than 512 must result in a configuration validation error.
The other changes on this branch are valid for setting filesystem attributes.
The genimage templates can be revisited once 4Kn support is implemented in upstream genimage.

@martamomotko
Copy link

Yes, thank you @learmj

@learmj learmj merged commit fcc2396 into raspberrypi:master Oct 14, 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.

3 participants