image,flash: get sector size from deviceinfo
This commit is contained in:
parent
4f7cb8f516
commit
927fa352c5
2 changed files with 15 additions and 6 deletions
6
flash.py
6
flash.py
|
@ -27,8 +27,10 @@ def cmd_flash(what: str, location: str):
|
||||||
device_image_name = get_image_name(device, flavour)
|
device_image_name = get_image_name(device, flavour)
|
||||||
device_image_path = get_image_path(device, flavour)
|
device_image_path = get_image_path(device, flavour)
|
||||||
|
|
||||||
# TODO: PARSE DEVICE SECTOR SIZE
|
deviceinfo = device.parse_deviceinfo()
|
||||||
sector_size = 4096
|
sector_size = deviceinfo.flash_pagesize
|
||||||
|
if not sector_size:
|
||||||
|
raise Exception(f"Device {device.name} has no flash_pagesize specified")
|
||||||
|
|
||||||
if what not in FLASH_PARTS.values():
|
if what not in FLASH_PARTS.values():
|
||||||
raise Exception(f'Unknown what "{what}", must be one of {", ".join(FLASH_PARTS.values())}')
|
raise Exception(f'Unknown what "{what}", must be one of {", ".join(FLASH_PARTS.values())}')
|
||||||
|
|
15
image.py
15
image.py
|
@ -397,7 +397,11 @@ def cmd_build(profile_name: str = None,
|
||||||
flavour = get_flavour(profile_name)
|
flavour = get_flavour(profile_name)
|
||||||
size_extra_mb: int = int(profile["size_extra_mb"])
|
size_extra_mb: int = int(profile["size_extra_mb"])
|
||||||
|
|
||||||
sector_size = 4096
|
deviceinfo = device.parse_deviceinfo()
|
||||||
|
sector_size = deviceinfo.flash_pagesize
|
||||||
|
if not sector_size:
|
||||||
|
raise Exception(f"Device {device.name} has no flash_pagesize specified")
|
||||||
|
|
||||||
rootfs_size_mb = FLAVOURS[flavour].get('size', 2) * 1000
|
rootfs_size_mb = FLAVOURS[flavour].get('size', 2) * 1000
|
||||||
|
|
||||||
packages = BASE_PACKAGES + [device.package.name] + FLAVOURS[flavour]['packages'] + profile['pkgs_include']
|
packages = BASE_PACKAGES + [device.package.name] + FLAVOURS[flavour]['packages'] + profile['pkgs_include']
|
||||||
|
@ -466,9 +470,12 @@ def cmd_inspect(profile: str = None, shell: bool = False):
|
||||||
arch = device.arch
|
arch = device.arch
|
||||||
wrap_if_foreign_arch(arch)
|
wrap_if_foreign_arch(arch)
|
||||||
flavour = get_flavour(profile)
|
flavour = get_flavour(profile)
|
||||||
# TODO: PARSE DEVICE SECTOR SIZE
|
deviceinfo = device.parse_deviceinfo()
|
||||||
sector_size = 4096
|
sector_size = deviceinfo.flash_pagesize
|
||||||
chroot = get_device_chroot(device, flavour, arch)
|
if not sector_size:
|
||||||
|
raise Exception(f"Device {device.name} has no flash_pagesize specified")
|
||||||
|
|
||||||
|
chroot = get_device_chroot(device.name, flavour, arch)
|
||||||
image_path = get_image_path(device, flavour)
|
image_path = get_image_path(device, flavour)
|
||||||
loop_device = losetup_rootfs_image(image_path, sector_size)
|
loop_device = losetup_rootfs_image(image_path, sector_size)
|
||||||
partprobe(loop_device)
|
partprobe(loop_device)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue