mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-27 10:45:37 -04:00
image: pass sector_size to partition_device()
This commit is contained in:
parent
3d3002114f
commit
f848474b08
2 changed files with 10 additions and 23 deletions
17
image/cli.py
17
image/cli.py
|
@ -17,7 +17,7 @@ from .boot import cmd_boot
|
|||
from .cryptsetup import encryption_option, get_cryptmapper_path, luks_close, luks_create, luks_open
|
||||
from .flash import cmd_flash
|
||||
from .image import (
|
||||
IMG_FILE_BOOT_DEFAULT_SIZE,
|
||||
IMG_DEFAULT_SIZE_BOOT_MB,
|
||||
create_boot_fs,
|
||||
create_img_file,
|
||||
create_root_fs,
|
||||
|
@ -114,16 +114,7 @@ def cmd_build(
|
|||
profile: Profile = config.get_profile(profile_name)
|
||||
flavour = get_profile_flavour(profile_name)
|
||||
rootfs_size_mb = flavour.parse_flavourinfo().rootfs_size * 1000 + int(profile.size_extra_mb)
|
||||
bootfs_size_str = IMG_FILE_BOOT_DEFAULT_SIZE
|
||||
bootfs_size_mb = -1
|
||||
if bootfs_size_str.endswith('M'):
|
||||
bootfs_size_mb = int(bootfs_size_str.rstrip('M'))
|
||||
elif bootfs_size_str.endswith('G'):
|
||||
bootfs_size_mb = int(bootfs_size_str.rstrip('G')) * 1024
|
||||
elif not bootfs_size_str.isdecimal():
|
||||
raise Exception(f"Couldn't part bootfs target size as megabytes: {bootfs_size_str}")
|
||||
else:
|
||||
bootfs_size_mb = int(bootfs_size_str)
|
||||
bootfs_size_mb = IMG_DEFAULT_SIZE_BOOT_MB
|
||||
|
||||
if encryption is None:
|
||||
encryption = profile.encryption
|
||||
|
@ -145,7 +136,7 @@ def cmd_build(
|
|||
pkgbuilds |= set(filter_pkgbuilds(packages_extra, arch=arch, allow_empty_results=True, use_paths=False))
|
||||
build_packages(pkgbuilds, arch, try_download=not no_download_pkgs)
|
||||
|
||||
sector_size = sector_size or device.get_image_sectorsize()
|
||||
sector_size = sector_size or device.get_image_sectorsize() or 512
|
||||
|
||||
image_path = block_target or get_image_path(device, flavour.name)
|
||||
|
||||
|
@ -156,7 +147,7 @@ def cmd_build(
|
|||
|
||||
loop_device = losetup_setup_image(image_path, sector_size or device.get_image_sectorsize_default())
|
||||
|
||||
partition_device(loop_device, boot_partition_size=bootfs_size_str)
|
||||
partition_device(loop_device, sector_size=sector_size, boot_partition_size_mb=bootfs_size_mb)
|
||||
partprobe(loop_device)
|
||||
|
||||
boot_dev: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue