[PATCH 00/26] block: add support for non-512 byte sectors
Ahmad Fatoum
a.fatoum at barebox.org
Fri Jun 26 01:42:11 PDT 2026
barebox code is currently a mixture of code that reads as if it supports
runtime-determined block sizes and code that hardcodes assumption of
512 byte sectors. End result is that use of a 4K sector will likely
crash as e.g. partition table parser is hardcoded to 512 bytes.
This series fixes most of that. Apparently there are MMCs (but not SDs)
that have 4K sectors, which this series doesn't add support for.
The parted command also doesn't yet support anything but 512 byte
sectors for now, so an erorr is printed, but most everything else should
now function correctly with either sector size.
Tested both on QEMU with USB/EFI/NVMe as well as real hardware (RK3588 +
NVMe).
Ahmad Fatoum (26):
nvme: use barebox-appropriate 64-bit type for timeouts
nvme: fix buffer advancement when chunking due to max_hw_sectors
nvme: allow flush opcode
nvme: honor namespace block size for I/O
bootscan: fix detection of GPT
block: clarify that writebuffer_io_len returns sector counts
block: fix wrong type for discard_start/size byte ranges
block: fix discard zeroing too little memory
block: use logical block size for reparse checks
block: require lower bound of sector size to be 512 bytes
filetype: don't hardcode sector size in file_detect_partition_table
block: define helpers for non-512-byte sector support
bootscan: use block size for partition table probe
ramdisk: validate exported sector size
efi: block: fix sector size mismatch in block device registration and
ops
efi: loader: disk: report block device size in Block I/O
efi: loader: file: report cdev block size in file info
partitions: use byte offset for first partition policy
partitions: dos: allocate correctly sized buffer for
dos_partition_desc
partition: support non-512 byte sectors
fs: fat: fix garbage read when writing with bigger block size
fs: fat: support larger block device sectors
usb-storage: preserve READ CAPACITY sector size
fuzz: add 4K-sector partition ramdisk target
commands: parted: prepare use of non-512-byte sectors
commands: parted: exit if block size if not 512
Documentation/devel/fuzzing.rst | 1 +
.../migration-guides/migration-master.rst | 11 +++
commands/createnv.c | 18 +++-
commands/parted.c | 21 +++--
common/block.c | 29 ++++--
common/bootscan.c | 19 +++-
common/filetype.c | 16 ++--
common/partitions.c | 93 +++++++++++--------
common/partitions/dos.c | 6 +-
common/partitions/efi.c | 28 +++---
drivers/block/efi-block-io.c | 21 +++--
drivers/block/ramdisk.c | 36 +++++--
drivers/nvme/host/core.c | 6 +-
drivers/nvme/host/nvme.h | 9 +-
drivers/nvme/host/pci.c | 5 +-
drivers/usb/storage/usb.c | 44 +++++----
efi/loader/protocols/disk.c | 9 +-
efi/loader/protocols/file.c | 3 +-
fs/fat/diskio.h | 9 ++
fs/fat/fat-diskio.c | 10 +-
fs/fat/fat.c | 51 +++++++---
fs/fat/ff.c | 2 +-
fs/fat/ffconf.h | 6 +-
images/Makefile.sandbox | 1 +
include/block.h | 38 +++++++-
include/disks.h | 7 ++
include/filetype.h | 3 +-
include/fuzz.h | 9 +-
include/partitions.h | 4 +-
29 files changed, 351 insertions(+), 164 deletions(-)
--
2.47.3
More information about the barebox
mailing list