image.py: make device paths work with cmd_flash() again, add dd debug output

This commit is contained in:
InsanePrawn 2022-05-08 17:27:58 +02:00
parent 232254948d
commit e288918e58
2 changed files with 7 additions and 5 deletions

View file

@ -18,9 +18,9 @@ ROOTFS = FLASH_PARTS['ROOTFS']
@click.command(name='flash') @click.command(name='flash')
@click.argument('what', type=click.Choice(list(FLASH_PARTS.values()))) @click.argument('what', type=click.Choice(list(FLASH_PARTS.values())))
@click.argument('location', required=False, type=click.Choice(LOCATIONS)) @click.argument('location', type=str, required=False)
def cmd_flash(what, location): def cmd_flash(what: str, location: str):
"""Flash a partition onto a device""" """Flash a partition onto a device. `location` takes either a path to a block device or one of emmc, sdcard"""
enforce_wrap() enforce_wrap()
device, flavour = get_device_and_flavour() device, flavour = get_device_and_flavour()
device_image_name = get_image_name(device, flavour) device_image_name = get_image_name(device, flavour)

View file

@ -23,7 +23,7 @@ IMG_FILE_BOOT_DEFAULT_SIZE = "90M"
def dd_image(input: str, output: str, blocksize='1M') -> CompletedProcess: def dd_image(input: str, output: str, blocksize='1M') -> CompletedProcess:
return subprocess.run([ cmd = [
'dd', 'dd',
f'if={input}', f'if={input}',
f'of={output}', f'of={output}',
@ -32,7 +32,9 @@ def dd_image(input: str, output: str, blocksize='1M') -> CompletedProcess:
'oflag=direct', 'oflag=direct',
'status=progress', 'status=progress',
'conv=sync,noerror', 'conv=sync,noerror',
]) ]
logging.debug(f'running dd cmd: {cmd}')
return subprocess.run(cmd)
def partprobe(device: str): def partprobe(device: str):