image/fastboot: flash_image(): add optional sparse_size parameter

This commit is contained in:
InsanePrawn 2023-01-06 04:22:46 +01:00
parent 08285a7931
commit 604f123067

View file

@ -1,6 +1,8 @@
import logging import logging
import subprocess import subprocess
from typing import Optional
def fastboot_erase_dtbo(): def fastboot_erase_dtbo():
logging.info("Fastboot: Erasing DTBO") logging.info("Fastboot: Erasing DTBO")
@ -14,10 +16,11 @@ def fastboot_erase_dtbo():
) )
def fastboot_flash(partition, file): def fastboot_flash(partition: str, file: str, sparse_size: Optional[str] = None):
logging.info(f"Fastboot: Flashing {file} to {partition}") logging.info(f"Fastboot: Flashing {file} to {partition}")
result = subprocess.run([ result = subprocess.run([
'fastboot', 'fastboot',
*(['-S', sparse_size] if sparse_size is not None else []),
'flash', 'flash',
partition, partition,
file, file,