image/image.py: Fix off-by-one error when creating boot partition in full image

This commit is contained in:
Syboxez Blank 2023-12-14 21:00:06 -06:00
parent 4c5609423e
commit e783ec6632

View file

@ -356,7 +356,7 @@ def create_img_file(image_path: str, size_str: str):
def partition_device(device: str, sector_size: int, boot_partition_size_mb: int = IMG_DEFAULT_SIZE_BOOT_MB):
initial_offset = 1048576 // sector_size # 2048 for 512, 256 for 4096
boot_partition_size: int = align_bytes(boot_partition_size_mb * 1024 * 1024, 4096)
boot_partition_size: int = align_bytes((boot_partition_size_mb + 1) * 1024 * 1024, 4096)
create_partition_table = ['mklabel', 'msdos']
create_boot_partition = ['mkpart', 'primary', 'ext2', f'{initial_offset}s', f'{boot_partition_size}b']
create_root_partition = ['mkpart', 'primary', f'{bytes_to_sectors(boot_partition_size, sector_size) + initial_offset}s', '100%']