image: create new module from {image,boot,fastboot,flash}.py

This commit is contained in:
InsanePrawn 2022-10-16 23:25:47 +02:00
parent afca099ede
commit 50bcd0de63
9 changed files with 18 additions and 16 deletions

View file

@ -1,37 +0,0 @@
import logging
import subprocess
def fastboot_erase_dtbo():
logging.info("Fastboot: Erasing DTBO")
subprocess.run(
[
'fastboot',
'erase',
'dtbo',
],
capture_output=True,
)
def fastboot_flash(partition, file):
logging.info(f"Fastboot: Flashing {file} to {partition}")
result = subprocess.run([
'fastboot',
'flash',
partition,
file,
])
if result.returncode != 0:
raise Exception(f'Failed to flash {file}')
def fastboot_boot(file):
logging.info(f"Fastboot: booting {file}")
result = subprocess.run([
'fastboot',
'boot',
file,
])
if result.returncode != 0:
raise Exception(f'Failed to boot {file} using fastboot')